:root {
    --bg: #f3efe6;
    --bg-2: #e7e0d4;
    --card: #fffaf4;
    --ink: #241c16;
    --muted: #5c534b;
    --line: #e0d5c8;
    --home: #b85c38;
    --home-ink: #fff8f4;
    --away: #1d6a5c;
    --away-ink: #f4fbf8;
    --accent: var(--home);
    --accent-ink: var(--home-ink);
    --shadow: 0 16px 40px rgba(70, 46, 24, 0.1);
    --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
    --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
    --radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.05rem;
    line-height: 1.45;
}

body[data-path="vacation"] {
    --accent: var(--away);
    --accent-ink: var(--away-ink);
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--accent); }

.bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.logo, h1, h2, .eyebrow {
    font-family: var(--serif);
    font-weight: 560;
    letter-spacing: -0.03em;
}

.logo { color: var(--ink); text-decoration: none; font-size: 1.35rem; }


main {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 4rem;
}

h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); line-height: 1.05; margin: 0.2rem 0 0.6rem; }

h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0.4rem 0; }

.eyebrow, .lead, .fade, .hint, .weight { color: var(--muted); }

.lead { max-width: 38rem; }

.choices, .segment {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.choices { margin: 1rem 0; }

.choices button, .segment button, .go, .text, .chip, summary {
    min-height: 44px;
}

.choices button, .segment button {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    text-align: left;
}

.choices button { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }

.choices button span, .fade { color: var(--muted); font-size: 0.95rem; }

.choices button[aria-pressed="true"], .segment button[aria-pressed="true"] {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}

.choices button[aria-pressed="true"] span { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }

.cats button { min-width: min(100%, 220px); }

.aim, fieldset {
    border: 0;
    margin: 0.8rem 0 0;
    padding: 0;
}

fieldset {
    border-top: 1px solid var(--line);
    padding-top: 0.8rem;
}

legend { padding: 0; margin-bottom: 0.45rem; }

.aim { background: var(--card); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }

.segment.wraps button, .segment button { border-radius: 999px; }

.age-at, label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.7rem;
}

input, select {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--bg);
    padding: 0 0.75rem;
}

.weight { font-size: 1.05rem; }

.hint { color: var(--accent); }

.go {
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.75rem 1.2rem;
    min-height: 48px;
}

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

.go.slim { min-height: 44px; }

.text {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

details { margin-top: 0.8rem; }

summary {
    cursor: pointer;
    color: var(--ink);
}

.result-tools, .chips, .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.result-head { margin-bottom: 1rem; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    padding: 0 0.4rem 0 0.85rem;
}

.chip button {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--muted);
}

.layout { display: grid; gap: 1.25rem; }

.map-wrap { position: relative; }

#map {
    width: 100%;
    height: 280px;
    background: var(--bg-2);
    border-radius: var(--radius);
    display: block;
    touch-action: manipulation;
}

.map-reset {
    position: absolute;
    left: 0.7rem;
    bottom: 2.2rem;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    padding: 0 0.9rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1rem 1rem;
    margin-bottom: 0.8rem;
}

.card.is-selected { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }

.card-main {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0;
    min-height: 44px;
}

.place-name { font-family: var(--serif); font-size: 1.45rem; display: block; }

.badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.8rem;
    height: 1.8rem;
    margin-right: 0.4rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.95rem;
}

.facts { margin: 0.35rem 0 0; padding: 0; list-style: none; color: var(--muted); }

.facts li + li { margin-top: 0.15rem; }

.score { color: var(--ink); }

.note { color: var(--muted); font-size: 0.95rem; }

.empty { background: var(--card); border-radius: var(--radius); padding: 1rem; }

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(36, 28, 22, 0.38);
    z-index: 20;
}

.drawer, .sheet {
    background: var(--card);
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.panel-head, .panel-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
}

.panel-body { overflow: auto; padding: 0 1rem 1rem; }

.panel-foot { border-top: 1px solid var(--line); padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)); }

.filter-block { border-top: 1px solid var(--line); padding: 0.3rem 0 0.8rem; }

.filter-block h3 { font-family: var(--serif); font-weight: 560; font-size: 1.2rem; margin: 0.6rem 0; }

.check { flex-direction: row; align-items: center; min-height: 44px; }

.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }

.figure { padding: 0.7rem 0; border-top: 1px solid var(--line); }

.figure strong { display: block; }

.figure p { margin: 0.2rem 0 0; color: var(--muted); }

#results { scroll-margin-top: 5rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (min-width: 860px) {
    .layout { grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr); align-items: start; }
    .map-wrap { position: sticky; top: 5rem; }
    #map { height: min(70vh, 640px); }
    .drawer {
        position: fixed;
        top: 4.4rem;
        right: 0;
        bottom: 0;
        width: min(460px, 100%);
        border-left: 1px solid var(--line);
    }
    .sheet {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: min(560px, calc(100% - 2rem));
        max-height: min(78dvh, 740px);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }
}

@media (max-width: 859px) {
    .drawer, .sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 86dvh;
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: var(--shadow);
    }
}

.drawer-intro { margin: 0 0 0.4rem; }

.cat-weight {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
    margin: 0.35rem 0 0.15rem;
}

.cat-weight span { color: var(--muted); font-size: 0.92rem; }

.drawer .segment { margin-top: 0.45rem; }

.drawer .segment button {
    min-height: 36px;
    padding: 0.35rem 0.7rem;
}

.tune {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.35rem 0.5rem;
    margin-top: 0.55rem;
}

.tune-main {
    display: flex;
    flex: 1 1 12rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    min-width: 0;
}

.tune-main .segment { margin-top: 0; }

.tune-name { font-size: 0.98rem; }

.tune-stack { flex: 1 1 100%; display: flex; flex-direction: column; gap: 0.15rem; }

.tune-stack .fade { margin: 0.2rem 0 0; }

.tune-open {
    width: 36px;
    height: 36px;
    min-height: 36px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    line-height: 1;
}

.tune-open::before {
    content: "";
    width: 14px;
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) left top / 14px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left 5px / 9px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left 10px / 5px 2px no-repeat;
}

.tune-open.is-set {
    background: color-mix(in srgb, var(--accent) 14%, var(--card));
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    color: var(--accent);
    font-weight: 650;
    font-size: 0.95rem;
}

.tune-open.is-set::before { content: none; }

.tune-weight {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0 0.2rem;
}

.tune-caption { color: var(--muted); font-size: 0.85rem; }

.weight-pick, .drawer .pill {
    min-height: 36px;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
}

.weight-pick[aria-pressed="true"], .drawer .pill[aria-pressed="true"] {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}

.limits-label {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.limits-note { margin: 0.2rem 0 0.15rem; color: var(--muted); font-size: 0.88rem; }

.ask-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.back-arrow {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    font-size: 1.3rem;
    line-height: 1;
}

.ask-actions { margin-top: 1rem; }

#step-next, .ask-actions .go { width: min(100%, 28rem); }

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: 0.35rem 0 0.2rem;
}

.pager .fade { margin: 0; }

.limit { margin: 0.85rem 0 0.15rem; }

.limit-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.limit-name { font-size: 0.98rem; }

.limit-read {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.limit-read.is-open { color: var(--muted); font-weight: 500; }

.limit-track {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
}

.limit-rail {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 999px;
    background: #e4d9cc;
    z-index: 0;
}

.notch {
    position: absolute;
    top: 50%;
    left: calc(11px + (100% - 22px) * var(--p));
    width: 2px;
    height: 12px;
    margin-left: -1px;
    background: #9a9086;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

input.limit-range {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    z-index: 2;
    width: 100%;
    height: 28px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

input.limit-range::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

input.limit-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -9px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fffaf4;
    box-shadow: 0 1px 3px rgba(36, 28, 22, 0.25);
}

input.limit-range::-moz-range-track {
    height: 4px;
    background: transparent;
    border: 0;
}

input.limit-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px #fffaf4;
}

.drawer[hidden], .sheet[hidden], .backdrop[hidden], [hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
}
