:root {
    color-scheme: light;
    --bg: #ece7df;
    --bg-grid: rgba(35, 50, 78, 0.045);
    --panel: #f8f5ee;
    --panel-strong: #fcfbf7;
    --panel-border: rgba(18, 31, 59, 0.12);
    --text: #16253c;
    --text-muted: #5b677b;
    --text-soft: #78839a;
    --accent: #2d5bd1;
    --accent-strong: #2147aa;
    --map-bg: #d8e0e8;
    --map-neutral: #dfe4ea;
    --map-selectable: #c0cad7;
    --shadow: 0 10px 30px rgba(22, 37, 60, 0.055);
    --visa-free: #12a87d;
    --pre-travel-auth: #5e6ad2;
    --e-visa: #f0b44c;
    --visa-required: #e45d5d;
    --no-data: #8c96a9;
    --self: #1fa8ff;
    --leaflet-control: rgba(255, 255, 255, 0.96);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101720;
    --bg-grid: rgba(173, 188, 214, 0.06);
    --panel: #151e2b;
    --panel-strong: #1a2534;
    --panel-border: rgba(148, 166, 204, 0.18);
    --text: #eef3fb;
    --text-muted: #a2b0c6;
    --text-soft: #7f90aa;
    --accent: #7c92ea;
    --accent-strong: #98abf8;
    --map-bg: #1a2738;
    --map-neutral: #2a3546;
    --map-selectable: #44526a;
    --shadow: 0 14px 36px rgba(3, 7, 14, 0.28);
    --visa-free: #2ec79a;
    --pre-travel-auth: #8b96f7;
    --e-visa: #f2c15b;
    --visa-required: #f07474;
    --no-data: #60708c;
    --self: #5bc2ff;
    --leaflet-control: rgba(9, 20, 39, 0.96);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    position: relative;
    min-height: 100svh;
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 95px,
            var(--bg-grid) 96px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 95px,
            var(--bg-grid) 96px
        ),
        var(--bg);
    overflow-x: hidden;
}

body::before,
body::after {
    display: none;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.45rem;
}

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

.hero {
    position: relative;
    padding: clamp(1.35rem, 2vw, 1.75rem);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 1.15rem 1.7rem;
    animation: reveal-up 0.45s ease;
}

.hero::after {
    display: none;
}

.hero-copy,
.hero-actions,
.control-card,
.hero-stats {
    position: relative;
    z-index: 1;
}

.eyebrow,
.panel-eyebrow {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.hero-title,
.panel-title,
.summary-country {
    margin: 0;
    font-family: "Sora", sans-serif;
    letter-spacing: -0.04em;
}

.hero-title {
    margin-top: 0.55rem;
    font-size: clamp(1.95rem, 4vw, 3rem);
    line-height: 1.04;
    max-width: 11ch;
}

.hero-description {
    margin: 0.8rem 0 0;
    max-width: 48rem;
    font-size: 0.96rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.theme-toggle,
.form-button {
    border: 0;
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.theme-toggle {
    padding: 0.8rem 1rem;
    border-radius: 999px;
    color: var(--text);
    background: var(--panel-strong);
    border: 1px solid var(--panel-border);
    box-shadow: none;
    font-weight: 700;
}

.theme-toggle:hover,
.form-button:hover {
    transform: translateY(-2px);
}

.control-card {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) auto;
    gap: 1rem;
    align-items: end;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
}

.control-stack {
    display: grid;
    gap: 0.7rem;
}

.form-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
}

.select-shell {
    position: relative;
}

.select-shell::after {
    content: "";
    position: absolute;
    right: 1.25rem;
    top: 50%;
    width: 0.65rem;
    height: 0.65rem;
    margin-top: -0.35rem;
    border-right: 2px solid var(--text-soft);
    border-bottom: 2px solid var(--text-soft);
    transform: rotate(45deg);
    pointer-events: none;
}

.form-select {
    width: 100%;
    appearance: none;
    border: 1px solid var(--panel-border);
    border-radius: 0.95rem;
    background: var(--panel-strong);
    color: var(--text);
    padding: 0.95rem 3.2rem 0.95rem 1rem;
    font: inherit;
    font-weight: 700;
}

.form-select:focus,
.theme-toggle:focus-visible,
.form-button:focus-visible,
.visa-list-item:focus-visible {
    outline: 3px solid rgba(79, 110, 255, 0.28);
    outline-offset: 3px;
}

.form-button {
    min-width: 12rem;
    padding: 0.95rem 1.25rem;
    border-radius: 0.95rem;
    background: var(--accent);
    color: #ffffff;
    box-shadow: none;
    font-weight: 800;
}

.form-button:disabled {
    opacity: 0.72;
    cursor: progress;
    transform: none;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.95rem;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
}

.stat-tile {
    position: relative;
    padding: 0.7rem 0 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.stat-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 2.4rem;
    height: 2px;
    background: var(--accent);
}

.stat-label {
    display: block;
    margin-bottom: 0.55rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.stat-value {
    display: block;
    min-height: 2.3rem;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.15;
}

.stat-value-small {
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    line-height: 1.3;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(20rem, 0.95fr);
    gap: 1.25rem;
    align-items: stretch;
    height: clamp(44rem, 78svh, 58rem);
}

.map-card,
.summary-panel,
.list-panel {
    animation: reveal-up 0.55s ease;
}

.map-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    height: 100%;
}

.panel-header,
.list-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid var(--panel-border);
}

.panel-title {
    margin-top: 0.25rem;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    line-height: 1.15;
}

.panel-subtle,
.list-count,
.summary-copy,
.country-hint,
.metric-note {
    color: var(--text-muted);
}

.panel-subtle {
    max-width: 17rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.15rem;
    padding-bottom: 0.1rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    font-size: 0.8rem;
    font-weight: 750;
    color: var(--text-muted);
}

.legend-swatch,
.metric-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
    flex: none;
}

.legend-self,
.metric-dot.self {
    background: var(--self);
}

.legend-visa-free,
.metric-dot.visa-free {
    background: var(--visa-free);
}

.legend-pre-travel-auth,
.metric-dot.pre-travel-auth {
    background: var(--pre-travel-auth);
}

.legend-e-visa,
.metric-dot.e-visa {
    background: var(--e-visa);
}

.legend-visa-required,
.metric-dot.visa-required {
    background: var(--visa-required);
}

.legend-no-data,
.metric-dot.no-data {
    background: var(--no-data);
}

.map-frame {
    flex: 1;
    min-height: 0;
    padding: 0.75rem;
    border-radius: 0.9rem;
    background: #e7ecef;
    border: 1px solid var(--panel-border);
}

:root[data-theme="dark"] .map-frame {
    background: #111b28;
}

.map-container {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0.75rem;
    background: var(--map-bg);
    overflow: hidden;
}

.insight-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1.5rem;
    min-height: 0;
    height: 100%;
}

.summary-panel,
.list-panel {
    padding: 1.25rem;
}

.summary-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.summary-placeholder,
.list-empty {
    display: grid;
    align-items: center;
    min-height: 10rem;
    border-radius: 0.95rem;
    background: var(--panel-strong);
    border: 1px solid var(--panel-border);
    padding: 1.2rem;
}

.summary-placeholder .panel-title,
.list-empty p {
    margin-top: 0.35rem;
}

.country-summary-head {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.flag-frame {
    width: 4.6rem;
    height: 4.6rem;
    padding: 0.75rem;
    border-radius: 0.9rem;
    background: var(--panel-strong);
    border: 1px solid var(--panel-border);
    box-shadow: none;
    display: grid;
    place-items: center;
    flex: none;
}

.flag-frame img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.8rem;
}

.flag-fallback,
.country-flag-fallback {
    display: grid;
    place-items: center;
    font-family: "Sora", sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.flag-fallback {
    width: 100%;
    height: 100%;
}

.summary-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.45rem;
}

.summary-country {
    font-size: clamp(1.7rem, 2vw, 2rem);
    line-height: 1.1;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: transparent;
    border: 1px solid rgba(45, 91, 209, 0.18);
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 800;
}

.summary-copy {
    margin: 0.8rem 0 0;
    line-height: 1.7;
    font-size: 0.98rem;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.85rem;
    margin-top: 1.35rem;
}

.metric-card {
    padding: 0.95rem;
    border-radius: 0.85rem;
    background: transparent;
    border: 1px solid var(--panel-border);
}

.metric-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.83rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.metric-value {
    display: block;
    margin-top: 0.65rem;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.45rem, 1.8vw, 1.7rem);
    line-height: 1.1;
}

.metric-note {
    margin-top: 0.35rem;
    font-size: 0.88rem;
}

.list-count {
    margin: 0.2rem 0 0;
    font-size: 0.94rem;
    font-weight: 800;
}

.list-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.visa-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow: auto;
    min-height: 0;
    padding-right: 0.25rem;
}

.visa-list-item {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid var(--panel-border);
    background: var(--panel-strong);
    color: var(--text);
    box-shadow: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
    animation: reveal-up 0.35s ease;
}

.visa-list-item:not(:disabled):hover {
    transform: none;
    border-color: rgba(45, 91, 209, 0.28);
    background: rgba(45, 91, 209, 0.035);
}

.visa-list-item:disabled {
    cursor: default;
    opacity: 0.78;
}

.destination-meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.country-flag {
    width: 2.35rem;
    height: 2.35rem;
    object-fit: cover;
    border-radius: 0.8rem;
    box-shadow: 0 12px 22px rgba(17, 28, 49, 0.14);
    flex: none;
}

.country-flag-fallback {
    background: rgba(125, 138, 160, 0.14);
}

.country-copy {
    min-width: 0;
}

.country-name {
    display: block;
    font-size: 0.98rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-hint {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.86rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 0.82rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: currentColor;
}

.status-pill.visa-free {
    color: var(--visa-free);
    background: rgba(18, 168, 125, 0.12);
}

.status-pill.pre-travel-auth {
    color: var(--pre-travel-auth);
    background: rgba(94, 106, 210, 0.14);
}

.status-pill.e-visa {
    color: #9f6700;
    background: rgba(240, 180, 76, 0.16);
}

:root[data-theme="dark"] .status-pill.e-visa {
    color: #ffd278;
}

.status-pill.visa-required {
    color: var(--visa-required);
    background: rgba(228, 93, 93, 0.14);
}

.status-pill.no-data {
    color: var(--no-data);
    background: rgba(140, 150, 169, 0.16);
}

.leaflet-container {
    font-family: "Manrope", sans-serif;
    background: var(--map-bg);
}

.leaflet-bar,
.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 8px 16px rgba(17, 28, 49, 0.08) !important;
}

.leaflet-control-zoom a {
    width: 2.35rem;
    height: 2.35rem;
    line-height: 2.35rem;
    border: 0 !important;
    background: var(--leaflet-control) !important;
    color: var(--text) !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.72) !important;
    color: var(--text-muted) !important;
    border-radius: 0.5rem 0 0 0 !important;
    padding: 0.3rem 0.45rem !important;
}

:root[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(9, 20, 39, 0.84) !important;
}

.leaflet-tooltip {
    border: 0;
    border-radius: 0.7rem;
    padding: 0.55rem 0.8rem;
    background: rgba(8, 18, 33, 0.9);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(8, 18, 33, 0.34);
}

.leaflet-tooltip::before {
    display: none;
}

.leaflet-interactive {
    transition: fill-opacity 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease;
}

.leaflet-container path.leaflet-interactive {
    cursor: pointer;
}

.visa-list::-webkit-scrollbar {
    width: 0.55rem;
}

.visa-list::-webkit-scrollbar-thumb {
    background: rgba(125, 138, 160, 0.45);
    border-radius: 999px;
}

.noscript-banner {
    position: relative;
    z-index: 1;
    width: min(32rem, calc(100% - 2rem));
    margin: 0 auto 2rem;
    padding: 1rem 1.2rem;
    text-align: center;
}

@keyframes reveal-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .dashboard {
        grid-template-columns: 1fr;
        height: auto;
    }

    .map-card,
    .insight-panel {
        height: auto;
        min-height: unset;
    }
}

@media (max-width: 780px) {
    .page-shell {
        padding-top: 1.15rem;
    }

    .control-card,
    .hero-stats,
    .summary-metrics {
        grid-template-columns: 1fr;
    }

    .form-button {
        width: 100%;
        min-width: 0;
    }

    .panel-header,
    .list-header,
    .country-summary-head {
        flex-direction: column;
    }

    .panel-subtle {
        max-width: none;
    }

    .map-frame,
    .map-container {
        min-height: 25rem;
    }
}

@media (max-width: 560px) {
    .page-shell {
        gap: 1rem;
        padding-inline: 0.85rem;
    }

    .panel,
    .map-frame,
    .stat-tile,
    .metric-card,
    .visa-list-item {
        border-radius: 0.95rem;
    }

    .hero-title {
        max-width: none;
        font-size: clamp(2.15rem, 12vw, 3rem);
    }

    .legend {
        gap: 0.55rem;
    }

    .legend-item {
        width: 100%;
        justify-content: flex-start;
    }

    .visa-list-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
