:root {
    color-scheme: dark;

    --background: #07111f;
    --background-secondary: #0b1727;
    --panel: rgba(15, 31, 50, 0.94);
    --panel-secondary: #101f32;
    --panel-border: rgba(143, 180, 214, 0.18);

    --text-primary: #f2f7fb;
    --text-secondary: #a9bacb;
    --text-muted: #7f94a8;

    --accent: #57b8ff;
    --accent-strong: #2993df;
    --accent-soft: rgba(87, 184, 255, 0.13);

    --success: #45d19b;
    --warning: #f3bd54;
    --danger: #ff6f78;

    --shadow:
        0 20px 45px rgba(0, 0, 0, 0.22),
        0 2px 8px rgba(0, 0, 0, 0.16);

    --radius-large: 20px;
    --radius-medium: 14px;
    --radius-small: 9px;

    --content-width: 1440px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(39, 107, 160, 0.20),
            transparent 34rem
        ),
        linear-gradient(
            180deg,
            var(--background-secondary),
            var(--background)
        );
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
}

button,
textarea,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.site-header {
    border-bottom: 1px solid var(--panel-border);
    background: rgba(7, 17, 31, 0.80);
    backdrop-filter: blur(16px);
}

.header-content {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
    padding: 30px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

h2 {
    margin: 0;
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
    letter-spacing: -0.02em;
}

h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.header-description {
    max-width: 760px;
    margin: 12px 0 0;
    color: var(--text-secondary);
}

.source-badge {
    min-width: 245px;
    padding: 14px 16px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.source-badge__label {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 28px auto;
    display: grid;
    gap: 20px;
}

.panel {
    padding: 24px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-large);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel-header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.input-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 0.8fr);
    gap: 20px;
}

.form-group {
    min-width: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

textarea {
    width: 100%;
    min-height: 360px;
    resize: vertical;
    padding: 16px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    outline: none;
    color: #dbeeff;
    background: #071321;
    font-family:
        "Cascadia Code",
        "SFMono-Regular",
        Consolas,
        monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    tab-size: 2;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.help-text,
.selected-file,
.metadata-note {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.help-text {
    margin: 8px 0 0;
}

.upload-card,
.metadata-card {
    padding: 20px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: var(--panel-secondary);
}

.upload-card p {
    color: var(--text-secondary);
}

#geojson-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.file-button,
.primary-button,
.secondary-button {
    min-height: 44px;
    padding: 10px 17px;
    border-radius: var(--radius-small);
    font-weight: 700;
    transition:
        transform 120ms ease,
        border-color 120ms ease,
        background 120ms ease;
}

.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    color: var(--text-primary);
    background: var(--accent-soft);
    cursor: pointer;
}

.primary-button {
    border: 1px solid var(--accent);
    color: #03111c;
    background: var(--accent);
}

.secondary-button {
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.035);
}

.file-button:hover,
.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.primary-button:hover {
    background: #75c5ff;
}

.secondary-button:hover {
    border-color: rgba(143, 180, 214, 0.42);
    background: rgba(255, 255, 255, 0.065);
}

.upload-card .secondary-button {
    width: 100%;
    margin-top: 8px;
}

.action-row {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.status-panel {
    min-height: 86px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: rgba(10, 24, 40, 0.92);
}

.status-panel p {
    margin: 3px 0 0;
    color: var(--text-secondary);
}

.status-indicator {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.04);
}

.status-idle {
    background: var(--text-muted);
}

.status-loading {
    background: var(--warning);
    animation: pulse 1.25s infinite;
}

.status-success {
    background: var(--success);
}

.status-error {
    background: var(--danger);
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.45;
        transform: scale(0.82);
    }
}

.result-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 0.72fr);
    gap: 20px;
}

.image-card {
    min-height: 400px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background:
        linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.025) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.025) 25%,
            transparent 25%
        ),
        #050d17;
    background-size: 24px 24px;
}

.image-card img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
}

.metadata-list {
    margin: 0;
}

.metadata-list div {
    padding: 12px 0;
    border-bottom: 1px solid var(--panel-border);
}

.metadata-list div:last-child {
    border-bottom: 0;
}

.metadata-list dt {
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.metadata-list dd {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.metadata-note {
    margin: 18px 0 0;
}

.date-badge {
    padding: 7px 11px;
    border: 1px solid rgba(69, 209, 155, 0.25);
    border-radius: 999px;
    color: var(--success);
    background: rgba(69, 209, 155, 0.08);
    font-size: 0.84rem;
    font-weight: 700;
}

.is-hidden {
    display: none;
}

.site-footer {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
    padding: 0 0 32px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.site-footer p {
    margin: 0;
}

code {
    color: #bce2ff;
}

@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
    }

    .source-badge {
        width: 100%;
        min-width: 0;
    }

    .input-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    textarea {
        min-height: 310px;
    }

    .metadata-card {
        order: -1;
    }
}

@media (max-width: 560px) {
    .header-content,
    .dashboard,
    .site-footer {
        width: min(calc(100% - 20px), var(--content-width));
    }

    .header-content {
        padding: 22px 0;
    }

    .dashboard {
        margin-top: 18px;
    }

    .panel {
        padding: 17px;
        border-radius: 15px;
    }

    .panel-header {
        flex-direction: column;
        margin-bottom: 16px;
    }

    .action-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    textarea {
        min-height: 270px;
        padding: 13px;
        font-size: 0.82rem;
    }

    .status-panel {
        align-items: flex-start;
    }

    .image-card {
        min-height: 240px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}