:root {
    color-scheme: dark;
    --bg: #070d1f;
    --panel: rgba(25, 31, 49, 0.76);
    --panel-strong: rgba(35, 41, 60, 0.92);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(137, 206, 255, 0.45);
    --text: #dce1fb;
    --muted: #a9b4c0;
    --primary: #89ceff;
    --primary-strong: #0ea5e9;
    --secondary: #c0c1ff;
    --tertiary: #ffb86e;
    --danger: #ffb4ab;
    --ok: #7dd3a8;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
    font-family: Geist, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 10% 5%, rgba(14, 165, 233, 0.18), transparent 30rem),
        radial-gradient(circle at 88% 18%, rgba(255, 184, 110, 0.12), transparent 26rem),
        linear-gradient(135deg, #070d1f 0%, #121726 48%, #151313 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    line-height: 1;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 4rem);
    background: rgba(7, 13, 31, 0.74);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(22px);
}

.brand,
.nav-actions,
.nav-button,
.nav-link {
    display: inline-flex;
    align-items: center;
}

.brand {
    gap: 0.55rem;
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 800;
}

.nav-actions {
    gap: 0.75rem;
}

.nav-link,
.nav-button {
    min-height: 2.5rem;
    border-radius: 999px;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.nav-link {
    color: var(--muted);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-button {
    background: rgba(14, 165, 233, 0.18);
    border: 1px solid rgba(137, 206, 255, 0.28);
    color: var(--primary);
}

.page-shell {
    width: min(1400px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 5rem) 0 5rem;
}

.hero {
    display: grid;
    gap: clamp(2rem, 5vw, 4rem);
}

.hero-copy {
    max-width: 820px;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--tertiary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 1.25rem;
    color: #f7fbff;
    font-size: clamp(2.45rem, 6vw, 5.4rem);
    line-height: 1.03;
    letter-spacing: 0;
}

.hero-subtitle,
.content-header p {
    max-width: 720px;
    color: rgba(220, 225, 251, 0.72);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.7;
}

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
}

.upload-panel,
.settings-panel,
.content-header,
.empty-state,
.map-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.upload-panel {
    border-radius: 1.5rem;
    padding: 0.55rem;
}

.drop-zone {
    position: relative;
    display: grid;
    min-height: 420px;
    place-items: center;
    align-content: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 2px dashed rgba(137, 206, 255, 0.34);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    text-align: center;
    transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    border-color: rgba(137, 206, 255, 0.78);
    background: rgba(14, 165, 233, 0.08);
}

.drop-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    display: grid;
    width: 4.6rem;
    height: 4.6rem;
    place-items: center;
    border-radius: 1.25rem;
    background: rgba(137, 206, 255, 0.12);
    color: var(--primary);
    font-size: 2.4rem;
}

.drop-zone strong {
    color: #f7fbff;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.drop-zone span:not(.material-symbols-outlined) {
    color: var(--muted);
}

.settings-panel {
    border-radius: 1.5rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.settings-panel.is-disabled {
    opacity: 0.46;
    filter: grayscale(0.7);
    pointer-events: none;
}

.panel-head,
.toggle-row,
.map-card-head,
.filter-head,
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-head h2,
.content-header h1 {
    margin: 0;
}

.pill {
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.field {
    display: grid;
    gap: 0.7rem;
    margin-top: 1.35rem;
}

.field > span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.field input[type="text"] {
    width: 100%;
    min-height: 3.2rem;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: rgba(0, 0, 0, 0.24);
    color: var(--text);
    padding: 0 1rem;
    outline: none;
}

.field input[type="text"]:focus {
    border-color: var(--line-strong);
}

.layer-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.layer-card {
    display: grid;
    gap: 0.55rem;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.layer-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.layer-card.is-selected {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.1);
}

.layer-card strong {
    color: var(--text);
    font-size: 0.72rem;
    line-height: 1.2;
}

.layer-preview {
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 0.55rem;
    overflow: hidden;
}

.layer-osm {
    background:
        linear-gradient(90deg, rgba(137, 206, 255, 0.1) 1px, transparent 1px),
        linear-gradient(rgba(137, 206, 255, 0.1) 1px, transparent 1px),
        #202a39;
    background-size: 14px 14px;
}

.layer-otm {
    background:
        repeating-radial-gradient(circle at 30% 40%, rgba(255, 184, 110, 0.35), rgba(255, 184, 110, 0.35) 1px, transparent 2px, transparent 11px),
        #252b32;
}

.layer-satellite {
    background:
        radial-gradient(circle at 35% 45%, rgba(125, 211, 168, 0.28), transparent 30%),
        radial-gradient(circle at 70% 20%, rgba(137, 206, 255, 0.18), transparent 24%),
        #151817;
}

.layer-google {
    background:
        linear-gradient(45deg, transparent 42%, rgba(242, 202, 112, 0.8) 43%, rgba(242, 202, 112, 0.8) 49%, transparent 50%),
        linear-gradient(-20deg, transparent 45%, rgba(255, 255, 255, 0.75) 46%, rgba(255, 255, 255, 0.75) 52%, transparent 53%),
        radial-gradient(circle at 30% 28%, rgba(114, 181, 103, 0.55), transparent 25%),
        radial-gradient(circle at 78% 70%, rgba(97, 164, 219, 0.55), transparent 24%),
        #263241;
}

.color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.color-choice {
    cursor: pointer;
}

.color-choice input {
    position: absolute;
    opacity: 0;
}

.color-choice span {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid transparent;
    border-radius: 0.9rem;
    background: var(--swatch);
}

.color-choice input:checked + span {
    border-color: #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.toggle-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.6rem;
}

.toggle-row strong,
.toggle-row small {
    display: block;
}

.toggle-row strong {
    color: #f7fbff;
    font-size: 0.88rem;
}

.toggle-row small {
    margin-top: 0.2rem;
    color: var(--muted);
}

.toggle-row input {
    appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 2.9rem;
    height: 1.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.toggle-row input::after {
    content: "";
    position: absolute;
    top: 0.18rem;
    left: 0.18rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 999px;
    background: #fff;
    transition: transform 160ms ease;
}

.toggle-row input:checked {
    background: var(--primary-strong);
}

.toggle-row input:checked::after {
    transform: translateX(1.32rem);
}

.primary-action,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 3.4rem;
    border: 0;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary-strong), #2c42c7);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.primary-action {
    width: 100%;
    margin-top: 1.5rem;
}

.primary-action:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.notice {
    margin-top: 1.2rem;
    border-radius: 0.85rem;
    padding: 0.85rem;
    font-weight: 700;
}

.notice.error {
    background: rgba(255, 180, 171, 0.12);
    border: 1px solid rgba(255, 180, 171, 0.28);
    color: var(--danger);
}

.content-header {
    border-radius: 1.5rem;
    padding: clamp(1.4rem, 4vw, 2.2rem);
    margin-bottom: 1.5rem;
}

.map-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.map-card {
    display: grid;
    gap: 1rem;
    border-radius: 1.1rem;
    padding: 1.2rem;
    transition: border-color 160ms ease, transform 160ms ease;
}

.map-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
}

.map-card h2 {
    margin: 0;
    overflow: hidden;
    color: #fff;
    font-size: 1.1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.empty-state {
    grid-column: 1 / -1;
    border-radius: 1.25rem;
    padding: 2rem;
    text-align: center;
}

.map-body {
    overflow: hidden;
    background: #070d1f;
}

.map-shell,
.map-view,
.map-canvas {
    width: 100%;
    height: 100vh;
}

.map-view {
    position: relative;
}

.map-canvas {
    background: #111827;
}

.map-error {
    display: grid;
    height: 100%;
    place-items: center;
    padding: 2rem;
    color: var(--danger);
    text-align: center;
}

.leaflet-container {
    font-family: Geist, system-ui, sans-serif;
}

.map-title,
.map-actions,
.download-button,
.filter-panel,
.modal,
.leaflet-control-layers,
.leaflet-control-zoom a {
    background: rgba(12, 19, 36, 0.88);
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

.map-title {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 600;
    display: grid;
    gap: 0.2rem;
    max-width: min(34rem, calc(100vw - 2rem));
    border-radius: 0.9rem;
    padding: 0.8rem 1rem;
    pointer-events: none;
}

.map-title strong {
    overflow: hidden;
    color: #fff;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-title span {
    color: var(--muted);
    font-size: 0.78rem;
}

.map-actions {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 650;
    display: flex;
    gap: 0.55rem;
    border-radius: 999px;
    padding: 0.45rem;
}

.icon-button {
    display: grid;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.icon-button:hover,
.icon-button.is-active {
    background: rgba(137, 206, 255, 0.16);
    color: var(--primary);
}

.download-button {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    z-index: 650;
    min-height: 2.7rem;
    padding: 0 1rem;
    background: rgba(12, 19, 36, 0.88);
}

.filter-panel {
    position: absolute;
    right: 1rem;
    bottom: 5rem;
    z-index: 700;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(34rem, calc(100vh - 7rem));
    overflow: auto;
    border-radius: 1rem;
    padding: 1rem;
}

.filter-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2rem;
    color: var(--text);
    cursor: pointer;
}

.filter-row input {
    accent-color: var(--tag-color, var(--primary));
}

.tag-dot {
    width: 0.78rem;
    height: 0.78rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--tag-color, #334155);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.modal {
    width: min(32rem, 100%);
    border-radius: 1.25rem;
    padding: 1.2rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 1rem 0;
}

.share-buttons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    padding: 0 0.9rem;
    cursor: pointer;
}

.share-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
}

.share-field input {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    padding: 0 0.8rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.82rem;
}

.share-field button,
.close-button {
    border: 0;
    border-radius: 0.8rem;
    background: rgba(137, 206, 255, 0.16);
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
    padding: 0.8rem 1rem;
}

.cluster-marker {
    display: grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.86);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 900;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.leaflet-tooltip.mapdrop-tooltip {
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: rgba(12, 19, 36, 0.92);
    color: var(--text);
    box-shadow: var(--shadow);
}

.tooltip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 14rem;
}

.tooltip-tag {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
}

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

    .drop-zone {
        min-height: 300px;
    }
}

@media (max-width: 640px) {
    .top-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-actions,
    .nav-link,
    .nav-button {
        width: 100%;
    }

    .nav-link,
    .nav-button {
        justify-content: center;
    }

    .layer-options {
        grid-template-columns: 1fr;
    }

    .map-title {
        right: 1rem;
    }

    .download-button {
        bottom: 4.6rem;
    }
}
