:root {
  --bg: #FBF7F1;
  --card: #FFFFFF;
  --ink: #1B1712;
  --soft: #6F655A;
  --line: #EAE2D6;
  --accent: #E4572E;
  --good: #2E8B57;
  --shadow: 0 1px 2px rgba(40, 25, 10, .06), 0 8px 28px rgba(40, 25, 10, .08);
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, -apple-system, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141110; --card: #1F1B19; --ink: #F5EFE8; --soft: #A69B90; --line: #2E2825;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141110; --card: #1F1B19; --ink: #F5EFE8; --soft: #A69B90; --line: #2E2825;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body.swiping { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.screen { max-width: 560px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- start ---------- */
.start { min-height: 100dvh; display: flex; flex-direction: column; padding-top: max(20px, env(safe-area-inset-top)); }
.brand { font: 800 19px/1 var(--display); letter-spacing: -.02em; text-decoration: none; color: var(--accent); }
.start-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-bottom: 12vh; }
h1 { font: 800 clamp(44px, 13vw, 68px)/.95 var(--display); letter-spacing: -.035em; margin: 0 0 18px; }
.big-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 60px; border: 0; border-radius: 18px; background: var(--accent); color: #fff;
  font-weight: 650; font-size: 18px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .15s ease;
}
.big-btn:active { transform: scale(.98); }
.big-btn.small { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.address { display: flex; height: 60px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.address input { flex: 1; min-width: 0; border: 0; background: none; padding: 0 18px; font: inherit; font-size: 17px; color: var(--ink); outline: none; }
.address input::placeholder { color: var(--soft); }
.address button { width: 60px; border: 0; background: none; color: var(--accent); }
.address:focus-within { border-color: var(--accent); }
.msg { min-height: 1.5em; color: var(--soft); margin: 4px 0 0; }

/* ---------- quiz ---------- */
.quiz { min-height: 100dvh; display: flex; flex-direction: column; padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.quiz-top { display: flex; align-items: center; gap: 12px; height: 44px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; margin-left: -10px; }
.steps { flex: 1; display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; }
.steps li { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps li.done, .steps li.now { background: var(--ink); }
.steps li.now { background: var(--accent); }
.quiz h2 { font: 800 clamp(34px, 9vw, 48px)/1 var(--display); letter-spacing: -.03em; margin: 28px 0 22px; }
.options { flex: 1; display: grid; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 340px; }
.option {
  position: relative; border: 0; border-radius: 26px; background: var(--c); color: #fff;
  display: flex; align-items: flex-end; padding: 22px; text-align: left; overflow: hidden;
  font: 800 clamp(30px, 9vw, 44px)/1 var(--display); letter-spacing: -.03em;
  box-shadow: var(--shadow); transition: transform .18s ease, filter .18s ease;
}
.option::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.28), transparent 55%),
              radial-gradient(80% 60% at 0% 100%, rgba(0,0,0,.18), transparent 60%);
}
.option span { position: relative; }
.option-key {
  position: absolute !important; top: 18px; right: 20px; font: 700 13px/1 var(--body); letter-spacing: 0;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.22);
}
.option:hover { filter: brightness(1.05); }
.option:active { transform: scale(.97); }
.options.in .option { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.options.in .option + .option { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.either { align-self: center; margin-top: 14px; border: 0; background: none; color: var(--soft); font-weight: 600; padding: 10px 20px; border-radius: 12px; }

/* ---------- results ---------- */
.results { padding-bottom: 40px; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px; margin: 0 -16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.where { display: flex; align-items: center; gap: 6px; min-width: 0; border: 0; background: none; padding: 8px 0; font-weight: 650; }
.where span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where svg { color: var(--accent); width: 20px; height: 20px; }
.picks-btn { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 20px; border: 0;
  background: var(--card); box-shadow: var(--shadow); font-weight: 700; }
.picks-btn svg { color: var(--accent); fill: var(--accent); width: 18px; height: 18px; }
.picks-btn.bump { animation: bump .4s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

.controls { display: grid; gap: 10px; padding: 4px 0 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--line); }
.seg button { height: 38px; border: 0; border-radius: 10px; background: none; font-weight: 650; color: var(--soft); }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.cuisine-chips { display: contents; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-sep { flex: none; width: 1px; background: var(--line); margin: 6px 2px; }

/* feed */
.feed { display: grid; gap: 16px; }
.place { background: var(--card); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); scroll-margin-top: 140px; }
.place-head { padding: 20px 20px 14px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, var(--card)), var(--card) 70%); border-top: 5px solid var(--c); }
.place h3 { font: 800 26px/1.05 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.meta { margin: 0; color: var(--soft); font-size: 14px; white-space: pre-wrap; }
.hours { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0 0; font-size: 14px; font-weight: 650; color: var(--soft); }
.hours.is-open { color: var(--good); }
.hours.is-closed { color: var(--accent); }
.walk { color: var(--soft); font-weight: 500; }
.menu-peek { padding: 0 20px; }
.loading { color: var(--soft); margin: 6px 0 14px; font-size: 15px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.no-menu { margin: 6px 0 14px; color: var(--soft); font-size: 15px; }
.no-menu a { color: var(--ink); font-weight: 650; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dishes li { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.dishes li:last-child { border-bottom: 0; }
.d-name { font-weight: 600; }
.d-price { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.d-desc { margin: 3px 0 0; color: var(--soft); font-size: 14px; }
.full-menu { width: 100%; height: 46px; margin: 6px 0 14px; border: 0; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, var(--card)); font-weight: 700; white-space: pre; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 20px; }
.act { height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); text-decoration: none; font-size: 14px; font-weight: 650; }
.act.app { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { text-align: center; padding: 60px 10px; color: var(--soft); }

/* deck */
.deck-wrap { display: flex; flex-direction: column; height: calc(100dvh - 190px); min-height: 440px; }
.deck { position: relative; flex: 1; }
.deck-msg { position: absolute; inset: 0; display: grid; place-content: center; gap: 16px; text-align: center; color: var(--soft); margin: 0; padding: 20px; }
.deck-msg p { margin: 0; }
.dish {
  position: absolute; inset: 0; border-radius: 30px; background: var(--c); color: #fff; padding: 24px;
  display: flex; flex-direction: column; overflow: hidden; touch-action: none; user-select: none;
  box-shadow: 0 18px 50px rgba(30, 15, 5, .22); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  --keep: 0; --pass: 0;
}
.dish::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(110% 70% at 100% 0%, rgba(255,255,255,.3), transparent 55%),
              radial-gradient(90% 70% at 0% 100%, rgba(0,0,0,.28), transparent 60%);
}
.dish > * { position: relative; }
.dish:not(.top) { transform: scale(.95) translateY(14px); }
.dish:not(.top):nth-last-child(3) { transform: scale(.9) translateY(28px); }
.dish.top { cursor: grab; }
.dish-place { margin: 0; font-weight: 700; font-size: 16px; display: flex; flex-direction: column; gap: 2px; }
.dish-place span { font-weight: 500; opacity: .85; font-size: 14px; }
.dish-main { margin-top: auto; }
.dish h3 { font: 800 clamp(36px, 10vw, 52px)/.98 var(--display); letter-spacing: -.03em; margin: 0; text-wrap: balance; }
.dish-desc { margin: 12px 0 0; font-size: 16px; opacity: .92; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.dish-price { margin: 18px 0 0; font: 800 28px/1 var(--display); }
.stamp { position: absolute; top: 26px; padding: 6px 14px; border: 3px solid #fff; border-radius: 12px; font: 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.keep-stamp { right: 22px; transform: rotate(10deg); opacity: var(--keep); }
.pass-stamp { right: 22px; transform: rotate(-10deg); opacity: var(--pass); }
.deck-actions { display: flex; justify-content: center; gap: 28px; padding: 18px 0 max(6px, env(safe-area-inset-bottom)); }
.round { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .15s; }
.round svg { width: 30px; height: 30px; stroke-width: 2.6; }
.round:active { transform: scale(.92); }
.pass svg { color: var(--soft); }
.keep { background: var(--accent); }
.keep svg { color: #fff; fill: #fff; }

/* sheet */
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 26px 26px 0 0; background: var(--card); color: var(--ink); }
.sheet[open] { animation: up .32s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet::backdrop { background: rgba(20, 12, 6, .45); backdrop-filter: blur(3px); }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 26px; } }
.sheet-inner { display: flex; flex-direction: column; max-height: 88dvh; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.sheet-head h2 { font: 800 26px/1.05 var(--display); letter-spacing: -.02em; margin: 0; }
.sheet-head .icon-btn { margin: 0 -10px 0 0; }
.sheet-body { overflow-y: auto; padding: 0 20px 24px; overscroll-behavior: contain; }
.sheet-body .acts { padding: 6px 0 0; }
.menu-sec h3 { font: 700 13px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--soft); margin: 22px 0 4px; display: flex; justify-content: space-between; }
.sec-dist { text-transform: none; letter-spacing: 0; font-weight: 500; }
.src { color: var(--soft); font-size: 13px; margin: 18px 0 10px; }
.remove { border: 0; background: none; color: var(--soft); font-size: 22px; line-height: 1; padding: 0 4px; }
.clear { margin-top: 22px; border: 0; background: none; color: var(--soft); text-decoration: underline; padding: 0; }
.empty-picks { color: var(--soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
