* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overscroll-behavior: none;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    padding: 16px;
    padding-top: calc(
        16px + var(--tg-content-safe-area-inset-top, 0px) +
            var(--tg-safe-area-inset-top, 0px)
    );
    padding-bottom: calc(16px + var(--tg-safe-area-inset-bottom, 0px));
    padding-left: calc(16px + var(--tg-safe-area-inset-left, 0px));
    padding-right: calc(16px + var(--tg-safe-area-inset-right, 0px));
    min-height: 100vh;
}

.screen {
    max-width: 540px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

.banner {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 14px;
}

.header {
    text-align: center;
    margin-bottom: 16px;
}

h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.subtitle {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #888888);
}

button {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    opacity: 0.5;
}

button.secondary {
    margin-top: 8px;
    background: var(--tg-theme-secondary-bg-color, #e8e8e8);
    color: var(--tg-theme-text-color, #000000);
}

.location-tools {
    margin-bottom: 10px;
}

.geo-status {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    color: var(--tg-theme-hint-color, #777777);
    word-break: break-word;
}

#location-screen {
    position: relative;
}

#location-screen::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='3' fill='%23888888' fill-opacity='1'/%3E%3C/svg%3E");
}

#location-screen > * {
    position: relative;
    z-index: 1;
}

#location-status,
#status {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    font-size: 14px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 15px;
    pointer-events: none;
    opacity: 0.45;
}

.location-search {
    width: 100%;
    padding: 10px 38px 10px 36px;
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 10px;
    font-size: 14px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    color: var(--tg-theme-text-color, #000000);
    outline: none;
    transition: border-color 0.2s;
}

.location-search:focus {
    border-color: var(--tg-theme-button-color, #3390ec);
}

.location-search::placeholder {
    color: var(--tg-theme-hint-color, #888888);
}

.search-clear {
    position: absolute;
    right: 4px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--tg-theme-hint-color, #aaaaaa);
    color: var(--tg-theme-bg-color, #ffffff);
    font-size: 13px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    opacity: 0.6;
}

.location-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.location-card {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 12px;
}

.location-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.location-meta {
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--tg-theme-hint-color, #888888);
}

.location-meta.ok {
    color: #1b8f4b;
}

.location-meta.warning {
    color: #c53929;
}

.selected-location {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #777777);
    word-break: break-word;
}

.instruction-card {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 12px 12px 12px 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--tg-theme-button-color, #3390ec);
}

.instruction-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.instruction-list {
    padding-left: 22px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #000000);
}

.instruction-list li {
    margin-bottom: 6px;
}

.instruction-list li:last-child {
    margin-bottom: 0;
}

.instruction-footer {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-theme-hint-color, #888888);
}

.question-card {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.question-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
}

.send-btn {
    margin-top: 4px;
    margin-bottom: 12px;
    padding: 14px;
}

.file-input {
    display: none;
}

.question-hint {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #888888);
    margin-bottom: 8px;
}

.previews-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.preview-item {
    position: relative;
}

.preview {
    width: 100%;
    border-radius: 10px;
    max-height: 280px;
    object-fit: contain;
    background: #ffffff;
}

.btn-remove-photo {
    width: auto;
    margin-top: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    background: #c53929;
    color: #ffffff;
    border-radius: 8px;
}

.photo-state {
    margin-top: 8px;
    font-size: 13px;
    color: var(--tg-theme-hint-color, #888888);
}

.photo-state.ok {
    color: #1b8f4b;
}

textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
    resize: vertical;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    caret-color: var(--tg-theme-text-color, #000000);
}

textarea::placeholder {
    color: var(--tg-theme-hint-color, #888888);
}

.comment-counter {
    margin-top: 6px;
    font-size: 12px;
    text-align: right;
    color: var(--tg-theme-hint-color, #888888);
}

#result {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    font-size: 14px;
    word-break: break-word;
}

#result .label {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1b8f4b;
}

#result .row {
    margin-bottom: 6px;
}

#result .warning {
    color: #c53929;
}

#error-screen {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#error-screen p {
    color: #c53929;
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
}
