:root {
    --bg: #030712;
    --bg-soft: #071426;
    --panel: rgba(8, 19, 36, 0.82);
    --panel-strong: rgba(7, 17, 33, 0.96);
    --glass: rgba(9, 23, 43, 0.62);
    --line: rgba(126, 184, 255, 0.16);
    --line-strong: rgba(126, 184, 255, 0.3);
    --text: #e9f2ff;
    --muted: #91a8c6;
    --muted-2: #6f86a4;
    --accent: #5cc8ff;
    --accent-soft: rgba(92, 200, 255, 0.14);
    --accent-2: #ffc857;
    --danger: #ff7d7d;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    --radius: 18px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1100px 760px at 68% 18%, rgba(22, 66, 122, 0.5) 0%, rgba(8, 24, 48, 0.28) 42%, transparent 70%),
        radial-gradient(900px 700px at 18% 82%, rgba(30, 40, 92, 0.32) 0%, transparent 65%),
        linear-gradient(160deg, #050a14 0%, #03060d 50%, #010308 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
}

:focus-visible {
    outline: 2px solid rgba(92, 200, 255, 0.72);
    outline-offset: 2px;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.42) 100%);
}

::selection {
    background: rgba(92, 200, 255, 0.3);
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    touch-action: none;
    cursor: grab;
}

#stage:active {
    cursor: grabbing;
}

#stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

#labels {
    position: fixed;
    inset: 0;
    z-index: 15;
    overflow: hidden;
    pointer-events: none;
}

#labels > div {
    position: absolute !important;
    inset: 0;
}

/* ---------- Top bar ---------- */

.topbar {
    position: fixed;
    z-index: 50;
    top: 16px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px 8px 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(16, 34, 60, 0.78), rgba(6, 15, 30, 0.82));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 5px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    flex: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #04121f;
    background: linear-gradient(150deg, #a9ecff, #4ab8ff 55%, #2a7de0);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 18px rgba(44, 148, 255, 0.4);
}

.brand-mark .icon {
    width: 21px;
    height: 21px;
    stroke-width: 1.6;
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1;
    white-space: nowrap;
}

.brand-text em {
    font-style: normal;
    color: var(--accent);
    margin-left: 3px;
    letter-spacing: 0.04em;
}

/* ---------- Search ---------- */

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 300px;
    max-width: 620px;
    height: 42px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(4, 12, 25, 0.62);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-wrap:focus-within {
    border-color: rgba(92, 200, 255, 0.55);
    background: rgba(4, 12, 25, 0.82);
    box-shadow: 0 0 0 3px rgba(92, 200, 255, 0.12), 0 0 26px rgba(44, 148, 255, 0.12);
}

.search-icon {
    color: var(--muted-2);
}

.search-wrap input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
}

.search-wrap input::placeholder {
    color: var(--muted-2);
}

.search-wrap input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.search-kbd {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--muted-2);
    font-family: var(--font);
    font-size: 11px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.03);
}

.search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    max-height: min(60vh, 480px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: pop 0.16s ease-out;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.99);
    }
}

.search-group-title {
    padding: 8px 10px 4px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.search-item:hover,
.search-item.is-active {
    background: var(--accent-soft);
}

.search-flag {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.055);
    font-size: 17px;
    line-height: 1;
}

.search-flag .icon {
    width: 15px;
    height: 15px;
    color: var(--muted);
}

.search-meta {
    min-width: 0;
    flex: 1;
}

.search-name {
    display: block;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.search-sub {
    display: block;
    overflow: hidden;
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.search-type {
    flex: none;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 99px;
    color: var(--muted-2);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-empty {
    padding: 16px 10px;
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}

.search-hint {
    padding: 6px 10px 8px;
    color: var(--muted-2);
    font-size: 11px;
}

/* ---------- Toolbar ---------- */

.toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex: none;
}

.tool-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.tool-btn.is-active {
    border-color: rgba(92, 200, 255, 0.22);
    background: var(--accent-soft);
    color: var(--accent);
}

.tool-btn.is-active svg {
    filter: drop-shadow(0 0 6px rgba(92, 200, 255, 0.55));
}

.tool-btn-fav {
    padding-right: 8px;
}

.badge {
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--accent);
    color: #04101d;
    font-size: 10px;
    font-weight: 700;
}

.badge:empty,
.badge[data-zero="1"] {
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted);
}

.fav-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 350px;
    max-height: min(62vh, 480px);
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: pop 0.16s ease-out;
}

.fav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 10px;
}

.fav-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.fav-head span {
    color: var(--muted-2);
    font-size: 11px;
}

.fav-empty {
    padding: 20px 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.fav-item {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    border-radius: 11px;
}

.fav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.fav-open {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    padding: 8px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.fav-open:focus-visible {
    outline-offset: -2px;
}

.fav-item .search-flag {
    width: 30px;
    height: 30px;
}

.fav-item .search-name {
    font-size: 13px;
}

.fav-remove {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    margin-left: 4px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted-2);
    cursor: pointer;
}

.fav-remove:hover {
    background: rgba(255, 125, 125, 0.12);
    color: var(--danger);
}

.fav-remove .icon {
    width: 15px;
    height: 15px;
}

/* ---------- Layers ---------- */

.layers-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 330px;
    max-height: min(68vh, 540px);
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: pop 0.16s ease-out;
}

.layer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 10px;
}

.layer-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.layer-head span {
    color: var(--muted-2);
    font-size: 11px;
}

.layer-group + .layer-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.layer-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 8px 3px;
}

.layer-group-title {
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.layer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease;
}

.layer-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.layer-row.is-busy {
    cursor: progress;
}

.layer-swatch {
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: var(--layer-color, var(--accent));
    box-shadow: 0 0 8px var(--layer-color, var(--accent));
    opacity: 0.85;
}

.layer-meta {
    flex: 1;
    min-width: 0;
}

.layer-title {
    display: block;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.layer-hint {
    display: block;
    overflow: hidden;
    margin-top: 1px;
    color: var(--muted-2);
    font-size: 10.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 17px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.18s ease;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #9fb6d4;
    transition: transform 0.18s ease, background 0.18s ease;
}

.layer-row.is-on .switch,
.switch.is-on {
    background: rgba(92, 200, 255, 0.32);
}

.layer-row.is-on .switch::after,
.switch.is-on::after {
    transform: translateX(13px);
    background: var(--accent);
    box-shadow: 0 0 8px rgba(92, 200, 255, 0.75);
}

.switch.is-mixed {
    background: rgba(92, 200, 255, 0.2);
}

.switch.is-mixed::after {
    transform: translateX(6px);
    background: var(--accent);
}

.switch-sm {
    width: 26px;
    height: 15px;
}

.switch-sm::after {
    width: 11px;
    height: 11px;
}

.switch-sm.is-on::after {
    transform: translateX(11px);
}

.switch-sm.is-mixed::after {
    transform: translateX(4px);
}

.layer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 6px 2px;
    border-top: 1px solid var(--line);
}

.layer-foot span {
    color: var(--muted-2);
    font-size: 10.5px;
}

.layer-reset {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.layer-reset:hover {
    text-decoration: underline;
}

/* ---------- Info panel ---------- */

.panel {
    position: fixed;
    z-index: 42;
    top: 90px;
    right: 18px;
    bottom: 18px;
    width: 392px;
    max-width: calc(100vw - 36px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(13, 30, 54, 0.9), rgba(5, 13, 26, 0.93));
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px) saturate(1.15);
    -webkit-backdrop-filter: blur(22px) saturate(1.15);
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.36s cubic-bezier(0.22, 0.9, 0.25, 1), opacity 0.3s ease, visibility 0.3s;
}

.panel.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(4, 12, 24, 0.6);
    color: var(--muted);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.16s ease, color 0.16s ease;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 26px 24px 26px;
    scrollbar-width: thin;
    scrollbar-color: rgba(126, 184, 255, 0.24) transparent;
}

.panel-content::-webkit-scrollbar,
.search-results::-webkit-scrollbar,
.fav-popover::-webkit-scrollbar,
.layers-popover::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb,
.fav-popover::-webkit-scrollbar-thumb,
.layers-popover::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 99px;
    background: rgba(126, 184, 255, 0.24);
    background-clip: padding-box;
}

.panel-eyebrow {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 40px 10px 0;
    color: var(--accent);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.panel-eyebrow::before {
    content: "";
    width: 16px;
    height: 1px;
    background: var(--accent);
    opacity: 0.7;
}

.panel-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.panel-title .flag {
    flex: none;
    font-size: 30px;
    line-height: 1.15;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

.panel-sub {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.02em;
}

.panel-summary {
    margin: 18px 0 18px;
    color: #c7d8ee;
    font-size: 13.5px;
    line-height: 1.62;
}

.facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 18px;
}

.fact {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.028);
}

.fact.wide {
    grid-column: 1 / -1;
}

.fact-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.fact-value {
    display: block;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-actions {
    display: flex;
    gap: 8px;
    margin: 0 0 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--line-strong);
}

.btn:active {
    transform: translateY(1px);
}

.btn .icon {
    width: 15px;
    height: 15px;
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #8ee1ff, #45b3ff 60%, #2a86e8);
    color: #04121f;
    box-shadow: 0 6px 20px rgba(58, 160, 255, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a5e8ff, #59bdff 60%, #3392ef);
}

.btn-star.is-fav {
    border-color: rgba(255, 200, 87, 0.36);
    background: rgba(255, 200, 87, 0.12);
    color: var(--accent-2);
}

.btn-star.is-fav .icon {
    fill: currentColor;
}

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 9px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-title span {
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.city-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.city-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}

.city-link:hover {
    background: rgba(92, 200, 255, 0.09);
}

.city-link .dot {
    width: 5px;
    height: 5px;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(92, 200, 255, 0.8);
}

.city-link .city-link-name {
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.city-link .city-link-pop {
    color: var(--muted-2);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

.city-link .icon {
    width: 13px;
    height: 13px;
    color: var(--muted-2);
}

.country-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.country-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.country-link .icon {
    width: 13px;
    height: 13px;
}

.panel-note {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted-2);
    font-size: 10.5px;
    line-height: 1.5;
}

.panel-skeleton {
    padding-top: 8px;
}

.sk {
    height: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}

.sk-title {
    width: 64%;
    height: 30px;
    margin-bottom: 16px;
}

.sk-line {
    width: 100%;
}

.sk-line.short {
    width: 72%;
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

/* ---------- Zoom ---------- */

.zoom-controls {
    position: fixed;
    z-index: 26;
    top: 50%;
    left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--glass);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transform: translateY(-50%);
    transition: opacity 0.2s ease, visibility 0.2s;
}

.zoom-controls button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.zoom-controls button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.zoom-controls button + button {
    border-top: 1px solid var(--line);
    border-radius: 0 0 9px 9px;
}

.zoom-controls button + button:hover {
    border-radius: 9px;
}

.zoom-controls .icon {
    width: 17px;
    height: 17px;
}

/* ---------- HUD ---------- */

.coords {
    position: fixed;
    z-index: 22;
    left: 18px;
    bottom: 18px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(3, 10, 20, 0.58);
    color: var(--muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
}

.coords.is-active {
    color: var(--text);
    border-color: rgba(92, 200, 255, 0.3);
}

.hints {
    position: fixed;
    z-index: 22;
    left: 50%;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: rgba(3, 10, 20, 0.5);
    color: var(--muted-2);
    font-size: 10.5px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateX(-50%);
    pointer-events: none;
}

.hints span + span::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    margin-right: 16px;
    border-radius: 50%;
    background: var(--muted-2);
    vertical-align: middle;
    opacity: 0.6;
}

.stats {
    position: fixed;
    z-index: 22;
    right: 18px;
    bottom: 18px;
    color: var(--muted-2);
    font-size: 10.5px;
    letter-spacing: 0.02em;
    text-align: right;
    pointer-events: none;
}

.measure-card {
    position: fixed;
    z-index: 30;
    left: 18px;
    bottom: 64px;
    width: 300px;
    padding: 14px 15px;
    border: 1px solid rgba(255, 200, 87, 0.28);
    border-radius: 14px;
    background: rgba(12, 20, 30, 0.88);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.measure-label {
    color: var(--accent-2);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.measure-value {
    margin: 5px 0 3px;
    font-size: 23px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.measure-sub {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.measure-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.measure-actions .btn {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
}

/* ---------- City labels ---------- */

.city-label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #dceeff;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.8);
    transition: opacity 0.15s ease;
}

.city-dot {
    width: 5px;
    height: 5px;
    flex: none;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: #8fe3ff;
    box-shadow: 0 0 6px rgba(79, 195, 255, 0.9), 0 0 12px rgba(79, 195, 255, 0.5);
}

.city-name {
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(2, 8, 16, 0.18);
}

.city-label:hover {
    color: #fff;
    z-index: 2;
}

.city-label:hover .city-name,
.city-label.is-selected .city-name {
    background: rgba(92, 200, 255, 0.18);
    color: #fff;
}

.city-label.name-hidden .city-name {
    display: none;
}

.city-label.is-selected .city-dot {
    width: 7px;
    height: 7px;
    border-color: #fff3cf;
    background: var(--accent-2);
    box-shadow: 0 0 10px rgba(255, 200, 87, 0.95), 0 0 20px rgba(255, 200, 87, 0.55);
}

.city-label.is-capital .city-dot {
    background: #ffe6a3;
    border-color: rgba(255, 255, 255, 0.8);
}

body.deep-zoom .city-label {
    font-size: 12px;
}

body.deep-zoom .city-dot {
    width: 6px;
    height: 6px;
}

body.deep-zoom .city-name {
    background: rgba(2, 8, 16, 0.42);
}

/* ---------- Water labels ---------- */

.water-label {
    display: block;
    padding: 0;
    color: #a9dcff;
    font-family: var(--font);
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.8);
}

.water-label.is-ocean {
    color: #9ed6ff;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.water-label.is-sea {
    color: #b6e1ff;
    font-size: 10.5px;
    font-style: italic;
    letter-spacing: 0.05em;
}

.water-label.is-lake {
    color: #a6dcff;
    font-size: 10px;
}

.water-label.is-river {
    color: #8fd0ff;
    font-size: 9.5px;
    font-style: italic;
}

body.deep-zoom .water-label {
    font-size: 11px;
    color: #c6e9ff;
}

body.deep-zoom .water-label.is-river,
body.deep-zoom .water-label.is-lake {
    font-size: 10.5px;
    color: #b9e6ff;
}

/* ---------- Tooltip, toast, loader ---------- */

.hover-tip {
    position: fixed;
    z-index: 34;
    top: 0;
    left: 0;
    max-width: 260px;
    padding: 6px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: rgba(4, 12, 24, 0.9);
    color: var(--text);
    font-size: 11.5px;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(14px, 14px);
    transition: opacity 0.12s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hover-tip.show {
    opacity: 1;
}

.hover-tip small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.toast {
    position: fixed;
    z-index: 90;
    left: 50%;
    bottom: 86px;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: rgba(8, 20, 38, 0.95);
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background:
        radial-gradient(700px 500px at 50% 42%, rgba(20, 58, 108, 0.42), transparent 70%),
        #030712;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader.is-done {
    opacity: 0;
    visibility: hidden;
}

.loader p {
    margin: 15px 0 2px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.loader small {
    color: var(--muted-2);
    font-size: 11px;
}

.loader-globe {
    position: relative;
    width: 54px;
    height: 54px;
    border: 1px solid rgba(92, 200, 255, 0.28);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(165, 232, 255, 0.9), rgba(54, 153, 255, 0.45) 45%, rgba(6, 22, 44, 0.9) 75%);
    box-shadow: 0 0 40px rgba(44, 148, 255, 0.35), inset -6px -8px 18px rgba(0, 0, 0, 0.5);
    animation: float 2.4s ease-in-out infinite;
}

.loader-globe::before,
.loader-globe::after {
    content: "";
    position: absolute;
    inset: -7px;
    border: 1px solid rgba(92, 200, 255, 0.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1.4s linear infinite;
}

.loader-globe::after {
    inset: -14px;
    border-color: rgba(92, 200, 255, 0.1);
    border-bottom-color: rgba(92, 200, 255, 0.6);
    animation-duration: 2.2s;
    animation-direction: reverse;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {
    50% {
        transform: translateY(-4px);
    }
}

.fatal {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: grid;
    place-content: center;
    padding: 30px;
    background: rgba(3, 7, 18, 0.96);
    text-align: center;
}

.fatal h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.fatal p {
    max-width: 460px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

body.panel-open .zoom-controls {
    opacity: 0.35;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .tool-btn span {
        display: none;
    }

    .tool-btn {
        width: 40px;
        justify-content: center;
        padding: 0;
    }

    .tool-btn-fav {
        width: auto;
        padding: 0 8px 0 10px;
        gap: 5px;
    }
}

@media (max-width: 860px) {
    .brand-text {
        display: none;
    }

    .brand {
        padding: 5px;
    }

    .topbar {
        gap: 8px;
    }

    .search-wrap {
        flex-basis: 220px;
    }
}

@media (max-width: 760px) {
    .topbar {
        top: 8px;
        left: 8px;
        right: 8px;
        flex-wrap: wrap;
        gap: 6px;
        padding: 7px;
        border-radius: 15px;
    }

    .brand {
        order: 0;
    }

    .toolbar {
        order: 1;
        gap: 1px;
    }

    .search-wrap {
        order: 2;
        flex: 1 1 100%;
        max-width: none;
        height: 40px;
    }

    .search-kbd {
        display: none;
    }

    .search-wrap input {
        font-size: 16px;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
    }

    .tool-btn-fav {
        width: auto;
        padding: 0 6px 0 8px;
    }

    .search-results {
        max-height: 44vh;
    }

    .fav-popover,
    .layers-popover {
        position: fixed;
        top: 108px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 56vh;
    }

    .panel {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-width: none;
        height: 66vh;
        max-height: 66vh;
        border-radius: 20px;
        transform: translateY(calc(100% + 30px));
    }

    .panel.open {
        transform: translateY(0);
    }

    .panel-content {
        padding: 22px 18px 20px;
    }

    .panel-title {
        font-size: 23px;
    }

    .panel-title .flag {
        font-size: 26px;
    }

    .facts {
        gap: 6px;
    }

    .zoom-controls {
        top: auto;
        left: 8px;
        bottom: 58px;
        flex-direction: row;
        transform: none;
    }

    .zoom-controls button + button {
        border-top: 0;
        border-left: 1px solid var(--line);
        border-radius: 0;
    }

    .coords {
        left: 8px;
        bottom: 8px;
        font-size: 10.5px;
        padding: 7px 10px;
    }

    .hints,
    .stats {
        display: none;
    }

    .measure-card {
        left: 8px;
        right: 8px;
        bottom: 104px;
        width: auto;
    }

    .toast {
        bottom: 100px;
        max-width: calc(100vw - 32px);
        text-align: center;
    }

    .city-label {
        font-size: 10px;
    }

    .city-name {
        padding: 1px 3px;
    }

    body.panel-open .zoom-controls {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    body.panel-open .measure-card {
        bottom: calc(66vh + 18px);
    }
}

@media (max-width: 420px) {
    .brand {
        padding: 4px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
    }

    .tool-btn {
        width: 34px;
        height: 34px;
    }

    .tool-btn-fav {
        padding: 0 5px 0 7px;
    }

    .badge {
        display: none;
    }

    .panel-actions {
        flex-wrap: wrap;
    }

    .panel-actions .btn {
        flex: 1 1 auto;
    }
}

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

.tool-btn:disabled {
    opacity: 0.45;
    cursor: wait;
}
