:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --raised: #ffffff;
    --line: #e1e5ee;
    --text: #0d1322;
    --muted: #5b647d;
    --faint: #8e97ad;
    --red: #e11d2e;
    --on-red: #ffffff;
    --open: #0e9f63;
    --warn: #b26a00;
    --shadow: 0 1px 2px rgba(13, 19, 34, 0.06), 0 8px 24px rgba(13, 19, 34, 0.06);
    --bar: 56px;
    --top: calc(var(--bar) + env(safe-area-inset-top));
    --map-h: max(36vh, 220px);
    --cap: 22px;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b647d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: light;
}

@supports (height: 1svh) {
    :root {
        --map-h: max(36svh, 220px);
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --bg: #0b1020;
        --surface: #131a2c;
        --raised: #1b2339;
        --line: #253050;
        --text: #f2f4fa;
        --muted: #8c96b3;
        --faint: #6a7495;
        --red: #ff4655;
        --open: #3bd995;
        --warn: #ffb547;
        --shadow: none;
        --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c96b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
        color-scheme: dark;
    }
}

:root[data-theme='dark'] {
    --bg: #0b1020;
    --surface: #131a2c;
    --raised: #1b2339;
    --line: #253050;
    --text: #f2f4fa;
    --muted: #8c96b3;
    --faint: #6a7495;
    --red: #ff4655;
    --open: #3bd995;
    --warn: #ffb547;
    --shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c96b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    background: var(--bg);
    color: var(--text);
    font-family:
        Figtree,
        system-ui,
        -apple-system,
        'Segoe UI',
        Roboto,
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 2px;
    border-radius: 8px;
}

.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--top);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.prefs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.langs {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.langs a {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.langs a:hover {
    color: var(--text);
}

.langs a[aria-current='true'] {
    background: var(--text);
    color: var(--bg);
}

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

.theme {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
}

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

.theme button:hover {
    color: var(--text);
}

.theme button[aria-pressed='true'] {
    background: var(--text);
    color: var(--bg);
}

.theme svg {
    width: 18px;
    height: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.brand .mark,
.pin {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--red);
    color: var(--on-red);
    font-weight: 800;
    font-size: 17px;
    line-height: 1;
}

.split {
    display: flex;
    flex-direction: column;
}

.mapwrap {
    order: -1;
    position: sticky;
    top: var(--top);
    z-index: 12;
    height: var(--map-h);
}

.mapwrap > .map {
    position: absolute;
    inset: 0;
}

.mapwrap::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    z-index: 6;
    height: var(--cap);
    border-radius: var(--cap) var(--cap) 0 0;
    background: var(--bg);
    box-shadow: 0 -6px 18px -8px rgba(13, 19, 34, 0.35);
    pointer-events: none;
}

.mapwrap .maplibregl-ctrl-bottom-left,
.mapwrap .maplibregl-ctrl-bottom-right {
    bottom: var(--cap);
}

.panel {
    position: relative;
    z-index: 11;
    padding: 4px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background: var(--bg);
}

@media (min-width: 960px) {
    .split {
        display: grid;
        grid-template-columns: minmax(380px, 460px) 1fr;
        height: calc(100vh - var(--top));
        height: calc(100dvh - var(--top));
    }

    .mapwrap {
        order: 0;
        position: relative;
        top: 0;
        height: auto;
    }

    .mapwrap::after {
        display: none;
    }

    .mapwrap .maplibregl-ctrl-bottom-left,
    .mapwrap .maplibregl-ctrl-bottom-right {
        bottom: 0;
    }

    .panel {
        border-right: 1px solid var(--line);
        overflow-y: auto;
        padding: 28px 24px 48px;
    }
}

.crumbs {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 12px;
}

.crumbs a {
    text-decoration: none;
}

.crumbs a:hover {
    text-decoration: underline;
}

.summary {
    position: sticky;
    top: calc(var(--top) + var(--map-h));
    z-index: 1;
    display: grid;
    gap: 6px;
    margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 6px calc(-1 * max(16px, env(safe-area-inset-left)));
    padding: 8px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: var(--bg);
}

.summary::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 18px;
    background: linear-gradient(var(--bg), transparent);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.scrolled .summary::after {
    opacity: 1;
}

.summary + .hint {
    margin-bottom: 16px;
}

.kicker {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.kicker[data-tone='open'] {
    color: var(--open);
}

.kicker[data-tone='warn'] {
    color: var(--warn);
}

h1 {
    margin: 0;
    font-size: clamp(24px, 5vw, 32px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.hint {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 60ch;
}

.tools {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.located #locate {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

.search {
    position: relative;
}

.search input {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
}

.search input::placeholder {
    color: var(--faint);
    font-weight: 500;
}

.results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(13, 19, 34, 0.25);
}

.results li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.results li span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.results li.active {
    background: var(--surface);
    outline: 1px solid var(--line);
}

.results li.empty {
    color: var(--muted);
    font-weight: 500;
    cursor: default;
}

.pick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
}

.pick label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.pick select {
    width: 100%;
    min-height: 46px;
    padding: 0 40px 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface) var(--chevron) no-repeat right 14px center / 16px;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
}

.pick select:disabled {
    opacity: 0.5;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary,
.btn.call {
    background: var(--red);
    border-color: var(--red);
    color: var(--on-red);
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.card {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 18px;
    background: var(--raised);
    border: 1.5px solid var(--line);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.card.active {
    border-color: var(--red);
}

.head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.name {
    flex: 1;
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.chip i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.chip.open {
    color: var(--open);
}

.chip.closing {
    color: var(--warn);
}

.meta {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.addr,
.landmark {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--muted);
}

.landmark {
    font-size: 13px;
    color: var(--faint);
}

.acts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.foot {
    margin-top: 24px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--faint);
}

.foot p {
    margin: 0 0 4px;
}

.pin-wrap {
    line-height: 0;
}

.pin {
    border: 2px solid #ffffff;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

.pin.soon {
    opacity: 0.7;
}

.pin.active {
    transform: scale(1.3);
    opacity: 1;
}

.me {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2f7bff;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 6px rgba(47, 123, 255, 0.25);
}

.maplibregl-ctrl-attrib {
    font-size: 11px;
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .pin,
    .theme button {
        transition: none;
    }
}

@media (min-width: 960px) {
    .card {
        scroll-margin-top: 16px;
    }

    .summary {
        position: static;
        margin: 0 0 6px;
        padding: 0;
    }
}

.ad {
    height: 50px;
    margin: 4px 0 12px;
    overflow: hidden;
}

@media (min-width: 960px) {
    .ad {
        height: 90px;
        margin: 0 0 16px;
    }
}

.ad-placeholder {
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.split.info {
    display: block;
    height: auto;
}

.split.info .panel {
    max-width: 760px;
    margin: 0 auto;
    padding-top: 20px;
    border-right: 0;
    overflow: visible;
}

.split.info .summary {
    position: static;
    margin: 0 0 6px;
    padding: 0;
}

.sources {
    display: grid;
    gap: 12px;
    margin: 8px 0 24px;
    padding: 0;
    list-style: none;
}

.sources li {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--raised);
    border: 1px solid var(--line);
    font-size: 15px;
    line-height: 1.5;
}

.sources a {
    font-weight: 600;
}

.meta-links {
    margin: 20px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.meta-links a {
    color: inherit;
}

.maperr {
    margin: 0;
    padding: 24px 16px;
    color: var(--muted);
    font-size: 14px;
}
