:root {
  color-scheme: light;
  --paper: #f8f4e9;
  --paper-deep: #eee7d5;
  --ink: #1c211d;
  --olive: #596d2f;
  --olive-dark: #35451e;
  --orange: #ca541d;
  --mustard: #dda516;
  --line: #d8cfba;
  --muted: #686b63;
  --card: #fffdf7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.filter-panel { border-right: 1px solid var(--line); padding: 34px 34px 34px 42px; background: rgba(255, 253, 247, .46); }
.brand-block { padding-bottom: 24px; margin-bottom: 25px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--olive-dark); font-family: Georgia, serif; font-size: 2.9rem; font-weight: 800; line-height: 1; text-decoration: none; letter-spacing: -.05em; }
.brand-mascot { width: 54px; height: 54px; flex: 0 0 auto; border-radius: 13px; object-fit: cover; }
.brand-block p { margin: 12px 0 0; font-size: .92rem; line-height: 1.45; }
.search-form { display: grid; gap: 23px; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { margin-bottom: 9px; padding: 0; text-transform: uppercase; font-size: .71rem; font-weight: 800; letter-spacing: .035em; }
input, select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; background: rgba(255,255,255,.55); color: var(--ink); outline: none; }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(89,109,47,.2); outline-offset: 2px; border-color: var(--olive); }
.location-field { display: grid; grid-template-columns: 22px minmax(0,1fr) 35px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding-left: 10px; background: rgba(255,255,255,.55); }
.location-field input { border: 0; background: transparent; padding-left: 5px; min-width: 0; }
.location-field input:focus { outline: 0; }
svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { position: relative; width: 35px; height: 35px; border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; display: grid; place-items: center; }
.icon-button.is-loading { cursor: wait; }
.icon-button.is-loading svg { opacity: 0; }
.icon-button.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(89,109,47,.25); border-top-color: var(--olive); border-radius: 50%; animation: location-spin .7s linear infinite; }
@keyframes location-spin { to { transform: rotate(360deg); } }
.location-alternative { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .65rem; margin: 4px 0; }
.location-alternative::before, .location-alternative::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.field-row { display: grid; grid-template-columns: 1fr 68px; gap: 8px; }
.segmented-control { display: grid; grid-template-columns: repeat(5, 1fr); }
.segmented-control label span { display: grid; place-items: center; min-height: 43px; border: 1px solid var(--line); border-right: 0; background: rgba(255,255,255,.55); cursor: pointer; font-size: .8rem; }
.segmented-control label:first-child span { border-radius: 7px 0 0 7px; }
.segmented-control label:last-child span { border-right: 1px solid var(--line); border-radius: 0 7px 7px 0; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control input:checked + span { background: var(--olive); color: white; border-color: var(--olive); }
.switch-row { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: .9rem; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 45px; height: 26px; border-radius: 20px; background: #b8b8ae; padding: 3px; transition: .2s; }
.switch::after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch-row input:checked + .switch { background: var(--olive); }
.switch-row input:checked + .switch::after { transform: translateX(19px); }
.primary-button { min-height: 50px; border: 0; border-radius: 6px; background: var(--olive); color: white; font-weight: 750; cursor: pointer; display: flex; gap: 10px; align-items: center; justify-content: center; transition: transform .15s, background .15s; }
.primary-button:hover { background: var(--olive-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.clear-button { border: 0; background: transparent; color: var(--olive-dark); text-decoration: underline; font-size: .78rem; cursor: pointer; }

.results-panel { padding: 45px 50px 55px; min-width: 0; }
.results-header { width: 100%; max-width: 1040px; border-bottom: 1px solid var(--line); padding-bottom: 25px; container-type: inline-size; }
.eyebrow { margin: 0 0 10px; color: var(--olive); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { width: 100%; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 9cqi, 6.25rem); font-weight: 700; line-height: .86; letter-spacing: -.045em; white-space: pre-line; }
.results-location { margin: 21px 0 0; font-size: 1.1rem; font-weight: 750; color: var(--olive-dark); }
.results-body { display: grid; grid-template-columns: minmax(390px, 1.25fr) minmax(300px, .85fr); gap: clamp(30px, 4vw, 65px); padding-top: 24px; align-items: start; }
.list-header { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: 1rem; font-weight: 800; }
.match-count { color: var(--olive); font-size: .85rem; font-weight: 800; }
.status-message { margin: 8px 0 20px; color: var(--muted); line-height: 1.55; }
.restaurant-list { display: grid; }
.restaurant-card { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 15px; padding: 20px 0; border-top: 1px solid var(--line); animation: card-in .38s both; }
.restaurant-card:first-child { border-top: 0; padding-top: 10px; }
.restaurant-card.is-spinner-excluded { opacity: .48; filter: grayscale(.75); }
.restaurant-card.is-spinner-excluded .rank-badge { background: var(--muted); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.rank-badge { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--option-color, var(--olive)); color: white; font-family: Georgia, serif; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.card-heading { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.spinner-toggle { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; padding: 0; background: transparent; color: var(--muted); cursor: pointer; }
.spinner-toggle svg { width: 18px; height: 18px; }
.spinner-toggle:hover, .spinner-toggle[aria-pressed="true"] { border-color: var(--olive); color: var(--olive-dark); background: #eef1e5; }
.restaurant-photo-wrap { width: min(100%, 460px); margin: 5px 0 10px; }
.restaurant-photo { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 7px; object-fit: cover; background: var(--paper-deep); }
.restaurant-photo-wrap figcaption { margin-top: 4px; color: var(--muted); font-size: .65rem; }
.restaurant-photo-wrap figcaption a { color: inherit; }
.restaurant-card h3 { margin: 0 0 7px; font-family: Georgia, serif; font-size: clamp(1.55rem, 2.2vw, 2.2rem); line-height: 1; }
.restaurant-stats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: .82rem; }
.restaurant-stats span + span::before { content: "·"; padding-right: 8px; color: #aaa28d; }
.rating { color: #ad7b00; font-weight: 800; }
.open-status { display: inline-flex; padding: 3px 8px; border-radius: 4px; background: #e5ecd8; color: var(--olive-dark); font-weight: 700; }
.open-status.closed { background: #eee9df; color: var(--muted); }
.restaurant-address, .fit-reason { margin: 0; font-size: .83rem; color: var(--muted); line-height: 1.45; }
.fit-reason { margin-top: 9px; color: var(--ink); }
.fit-reason strong { color: var(--orange); }
.maps-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 9px; color: var(--olive-dark); font-size: .78rem; font-weight: 800; text-underline-offset: 3px; }
.add-more-button { width: 100%; min-height: 46px; margin-top: 12px; border: 1px solid var(--olive); border-radius: 6px; background: transparent; color: var(--olive-dark); font-weight: 800; cursor: pointer; transition: background .15s, color .15s; }
.add-more-button:hover { background: var(--olive); color: white; }
.loading-placeholder { height: 126px; border-top: 1px solid var(--line); background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); background-size: 220% 100%; animation: shimmer 1.15s infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

.wheel-column { position: sticky; top: 35px; text-align: center; }
.wheel-wrap { --wheel-size: min(31vw, 430px); position: relative; width: var(--wheel-size); height: var(--wheel-size); margin: 8px auto 22px; filter: drop-shadow(0 10px 12px rgba(70,60,38,.14)); }
.wheel { width: 100%; height: 100%; position: relative; border: 10px solid #fffdf4; border-radius: 50%; background: conic-gradient(var(--olive) 0 33.333%, var(--orange) 33.333% 66.666%, var(--mustard) 66.666% 100%); transition: transform 4.8s cubic-bezier(.12,.78,.16,1); overflow: hidden; }
.wheel::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(28,33,29,.12); pointer-events: none; }
.wheel-pointer { position: absolute; z-index: 4; top: -17px; left: 50%; width: 36px; height: 55px; transform: translateX(-50%); background: var(--orange); clip-path: polygon(50% 100%, 0 0, 100% 0); filter: drop-shadow(0 2px 1px rgba(0,0,0,.2)); }
.wheel-labels { position: absolute; inset: 0; pointer-events: none; }
.wheel-label { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: rotate(var(--placement-angle)) translateX(var(--wheel-label-radius, calc(var(--wheel-size) * .34))); color: white; }
.wheel-label span { position: absolute; left: 0; top: 0; display: -webkit-box; width: var(--wheel-label-width, calc(var(--wheel-size) * .19)); overflow: hidden; transform: translate(-50%, -50%) rotate(90deg); overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-family: Georgia, serif; font-weight: 700; font-size: var(--wheel-label-size, .7rem); line-height: 1.05; text-align: center; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.spin-button { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 100px; height: 100px; border: 8px solid white; border-radius: 50%; background: var(--ink); color: white; text-transform: uppercase; font-size: 1rem; font-weight: 900; letter-spacing: .04em; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,.28); }
.spin-button:disabled { cursor: wait; color: transparent; }
.spin-button:disabled::after { content: "•••"; color: white; position: absolute; inset: 30px 0 0; letter-spacing: 4px; }
.wheel-help { display: flex; justify-content: center; align-items: center; gap: 12px; max-width: 340px; margin: 0 auto; font-size: .83rem; line-height: 1.4; }
.wheel-help span { color: var(--olive); font-size: 2rem; }
.winner-card { margin: 20px auto 0; max-width: 340px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); text-align: left; animation: winner-in .45s both; }
@keyframes winner-in { from { opacity: 0; transform: scale(.96); } }
.winner-kicker { display: block; color: var(--orange); font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.winner-card strong { display: block; margin: 3px 0; font-family: Georgia, serif; font-size: 1.4rem; }
.winner-card [data-winner-meta] { color: var(--muted); font-size: .78rem; }
.winner-maps-link { margin-top: 11px; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 290px minmax(0,1fr); }
  .filter-panel { padding: 28px 26px 28px 34px; }
  .results-panel { padding: 35px 30px; }
  .results-body { grid-template-columns: 1fr; }
  .wheel-column { position: static; order: -1; }
  .wheel-wrap { --wheel-size: min(62vw, 390px); }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .filter-panel { border: 0; border-bottom: 1px solid var(--line); padding: 24px; }
  .brand-block { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; margin-bottom: 18px; }
  .brand-block p { margin: 0; text-align: right; font-size: .75rem; }
  .search-form { gap: 17px; }
  .results-panel { padding: 30px 20px 45px; }
  h1 { font-size: clamp(2.7rem, 10cqi, 4.5rem); }
  .results-body { display: flex; flex-direction: column-reverse; }
  .recommendations-column, .wheel-column { width: 100%; }
  .wheel-wrap { --wheel-size: min(84vw, 360px); }
  .restaurant-card { grid-template-columns: 35px minmax(0,1fr); gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .wheel { transition-duration: .01ms; }
}
