:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --paper: #f5f3e9;
    --card: #fffdf7;
    --ink: #20291f;
    --muted: #556052;
    --line: #d8dbce;
    --forest: #20382c;
    --sage: #e4ebdf;
    --yellow: #f2cb55;
    --rust: #873e2d;
    --outer: clamp(14px, 4.3vw, 30px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.45; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .65; cursor: wait; }
a { color: var(--forest); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--forest); outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 2.9rem); line-height: 1.07; letter-spacing: -.05em; overflow-wrap: anywhere; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; line-height: 1.25; }
.small { font-size: .82rem; }
.muted { color: var(--muted); }

.top-bar { background: var(--paper); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-inner, .shell { width: min(720px, 100%); margin-inline: auto; padding-inline: var(--outer); }
.top-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 1.46rem; letter-spacing: -.065em; font-weight: 780; }
.brand img { border-radius: 9px; }
.shell { padding-top: 14px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.hero {
    isolation: isolate; position: relative; overflow: hidden; min-height: 168px;
    background: var(--forest); color: #fffdf2; border-radius: 22px; padding: 17px 18px 19px;
}
.hero-text { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.5rem, 10vw, 4rem); line-height: .9; letter-spacing: -.074em; margin-block: 9px 12px; }
.hero p { font-size: .92rem; color: #f5f2db; }
.beta { display: inline-flex; padding: 2px 8px 3px; border: 1px solid #b6bfab; border-radius: 50px; font-weight: 620; font-size: .7rem; }
.hero-map {
    position: absolute; right: -18px; top: 2px; width: clamp(155px, 46vw, 273px); height: 105%;
    background: repeating-radial-gradient(ellipse at 66% 48%, transparent 0 12px, #d7e4be33 13px 14px, transparent 15px 24px);
    transform: rotate(-22deg); mask-image: linear-gradient(to right, transparent, black 36%);
}
.hero-map i, .hero-map b, .hero-map span { display: block; position: absolute; border-radius: 50%; }
.hero-map i { width: 39px; height: 39px; top: 37%; left: 54%; border: 2px solid var(--yellow); }
.hero-map b { width: 16px; height: 16px; top: calc(37% + 11.5px); left: calc(54% + 11.5px); background: var(--yellow); }
.hero-map span { width: 7px; height: 7px; top: 72%; left: 41%; background: #d1d9ba; }

#search-form { display: grid; gap: 13px; padding: 15px 0 18px; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 680; font-size: .92rem; }
.field input[type="text"] {
    background: var(--card); border: 1px solid #aeb8a8; border-radius: 13px; min-height: 49px;
    padding: 10px 12px; width: 100%; min-width: 0; color: var(--ink); font-size: 1rem;
}
.field input::placeholder { color: #677263; }
.location-field { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 6px; }
.location-button {
    width: 62px; min-height: 49px; border-radius: 13px; border: 1px solid #aeb8a8;
    background: var(--sage); font-size: 1.38rem; line-height: 1;
    display: grid; justify-items: center; align-content: center; gap: 3px;
}
.location-button small { font-size: .63rem; font-weight: 680; }
.suggestions { border: 1px solid var(--line); background: var(--card); border-radius: 14px; overflow: hidden; }
.suggestions button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 10px 12px; min-height: 46px; }
.suggestions button + button { border-top: 1px solid var(--line); }
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px;
    border: 1px solid #aeb8a8; border-radius: 13px; padding: 8px 12px; background: var(--card);
    color: var(--ink); text-decoration: none; font-weight: 670; line-height: 1.2; text-align: center;
}
.button-small { border-radius: 24px; font-size: .82rem; padding-inline: 12px; }
.primary { background: var(--yellow); border-color: var(--yellow); font-size: 1rem; min-height: 52px; }
#search-form .primary { justify-content: space-between; padding-inline: 16px; }
.notice { background: #f4e6dc; color: #633021; border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.shortcuts { border-top: 1px solid var(--line); padding: 15px 0 14px; }
.shortcuts h2 { margin-bottom: 10px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.shortcut {
    display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line);
    border-radius: 12px; padding: 6px 8px; min-height: 50px; background: var(--card); font-weight: 610; font-size: .9rem;
}
.shortcut[aria-pressed="true"] { border-color: var(--forest); background: var(--sage); }
.glyph { display: grid; place-items: center; border-radius: 8px; width: 32px; height: 33px; flex: 0 0 32px; background: var(--sage); color: var(--forest); font-weight: 730; font-size: 1.15rem; }
.shortcut:active, .row-open:active, .suggestions button:active { background: var(--sage); }
.shortcuts summary { min-height: 44px; padding-block: 11px; font-size: .88rem; font-weight: 620; color: var(--forest); cursor: pointer; }

.back, .text-button { min-height: 44px; border: 0; background: transparent; padding: 4px 4px 4px 0; color: var(--forest); font-weight: 650; font-size: .87rem; }
.back { display: flex; gap: 8px; align-items: center; }
.result-header { display: grid; gap: 5px; margin: 3px 0 14px; }
.place-label { color: var(--forest); font-weight: 670; overflow-wrap: anywhere; }
.counts { font-size: .88rem; font-weight: 610; }
#online-status { min-height: 1.2em; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); border-radius: 14px; background: #e2e7dc; padding: 3px; margin-bottom: 13px; }
.segmented button { min-height: 43px; background: transparent; border-radius: 11px; border: 1px solid transparent; font-weight: 680; }
.segmented button[aria-pressed="true"] { background: var(--card); border-color: #c8cfc1; }
.result-section { display: grid; gap: 8px; margin-bottom: 17px; }
.result-section header { display: flex; justify-content: space-between; align-items: baseline; column-gap: 8px; }
.result-section header span { color: var(--muted); flex: 0 0 auto; }
.result-row { background: var(--card); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.row-open {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; align-items: start; text-align: left;
    border: 0; width: 100%; background: transparent; padding: 11px 12px 8px; min-height: 67px;
}
.row-title { font-weight: 730; line-height: 1.24; overflow-wrap: anywhere; }
.row-subtitle { color: var(--muted); line-height: 1.3; grid-column: span 2; font-size: .83rem; overflow-wrap: anywhere; }
.distance { border-radius: 8px; background: var(--sage); padding: 3px 7px; font-size: .75rem; font-weight: 660; white-space: nowrap; }
.row-actions { display: flex; gap: 5px; align-items: center; padding: 0 10px 5px; }
.row-actions a, .row-actions button { color: var(--forest); background: transparent; border: 0; min-height: 44px; min-width: 44px; display: inline-grid; place-items: center; text-decoration: none; padding: 6px 7px; font-size: .82rem; font-weight: 660; }
.empty { display: grid; gap: 7px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }

.map-toggle { min-height: 44px; display: flex; gap: 8px; align-items: center; padding: 0 1px 6px; font-size: .88rem; font-weight: 620; }
.map-toggle input { width: 21px; height: 21px; accent-color: var(--forest); }
.map { height: clamp(275px, 51vh, 560px); margin: 0; border: 1px solid #b5c0ac; border-radius: 16px; overflow: hidden; position: relative; background: #e6e9da; }
.map canvas, .map-markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.map canvas { touch-action: none; cursor: grab; }
.map canvas:active { cursor: grabbing; }
.map-markers { pointer-events: none; }
.map-pin { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border: 0; background: transparent; pointer-events: auto; display: grid; place-items: center; }
.map-pin::after { content: ''; width: 15px; height: 15px; border-radius: 50%; background: var(--rust); border: 2px solid var(--card); box-shadow: 0 1px 2px #20382c66; }
.map-pin[aria-pressed="true"] { z-index: 1; }
.map-pin[aria-pressed="true"]::after { width: 20px; height: 20px; background: var(--yellow); border-color: var(--ink); }
.map-toolbar { position: absolute; right: 8px; bottom: 8px; display: grid; border: 1px solid #aeb8a8; border-radius: 11px; overflow: hidden; z-index: 2; }
.map-toolbar button { width: 44px; height: 44px; border: 0; background: var(--card); color: var(--forest); font-size: 1.36rem; line-height: 1; }
.map-toolbar button + button { border-top: 1px solid var(--line); }
.map-scale, .map-north { position: absolute; background: var(--card); color: var(--forest); padding: 3px 7px; border-radius: 6px; font-size: .7rem; font-weight: 650; pointer-events: none; }
.map-scale { bottom: 8px; left: 8px; }
.map-scale::after { content: ''; display: block; border-bottom: 2px solid var(--forest); width: var(--scale-width, 24px); }
.map-north { top: 8px; right: 8px; }
.map-credit { color: var(--muted); font-size: .71rem; margin-block: 5px 8px; }
#map-unlocated { margin-top: 7px; }
.map-preview { padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); display: grid; gap: 5px; }
.map-preview strong { overflow-wrap: anywhere; }

.detail-card { border: 1px solid var(--line); border-radius: 18px; padding: 15px; background: var(--card); display: grid; gap: 10px; }
.detail-card h1 { font-size: clamp(1.7rem, 6.4vw, 2.5rem); }
.detail-card dl { margin: 5px 0; display: grid; gap: 4px; }
.detail-card dt { font-weight: 700; }
.detail-card dd { margin: 0 0 8px; color: var(--muted); overflow-wrap: anywhere; }
.action-row { display: flex; flex-wrap: wrap; gap: 7px; }
.action-row > * { flex: 1 1 110px; }
.detail-sources { border-top: 1px solid var(--line); padding-top: 11px; }
.detail-sources ul { padding-left: 18px; margin: 7px 0 0; font-size: .85rem; color: var(--muted); }
.detail-sources a { display: inline-block; min-height: 33px; padding-top: 4px; }

.footer { border-top: 1px solid var(--line); margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .76rem; }
dialog { max-width: min(430px, calc(100% - 30px)); width: 100%; color: var(--ink); padding: 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
dialog::backdrop { background: #20291f72; }
dialog h2 { margin-bottom: 11px; }
dialog ol { display: grid; gap: 7px; margin: 0; padding-left: 21px; }
dialog p { margin: 10px 0; }
dialog form button { width: 100%; }
@media (min-width: 560px) {
    .hero { padding: 21px 25px 24px; }
    .shortcut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
