:root {
  --night: #0e1730;
  --night-up: #19264b;
  --line: rgba(255, 243, 226, .14);
  --soft: rgba(255, 243, 226, .08);
  --flour: #fff3e2;
  --muted: #aab5d6;
  --ember: #ff5b1f;
  --ember-deep: #c93d0a;
  --crust: #ffb454;
  --basil: #1f9d5c;
  --serif: 'Young Serif', Georgia, serif;
  --sans: 'Figtree', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { background: var(--night); color-scheme: dark; }
body {
  font: 500 16px/1.45 var(--sans);
  color: var(--flour);
  background: radial-gradient(900px 520px at 50% -120px, #26397a 0%, rgba(38, 57, 122, 0) 70%), var(--night);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--crust); outline-offset: 2px; }
.screen:focus { outline: none; }

.app { max-width: 540px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* top bar */
.top { display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 6px; }
.slot { display: flex; gap: 4px; }
.slot.end { justify-content: flex-end; }
.brand { font-family: var(--serif); font-size: 1.2rem; color: var(--crust); text-align: center; white-space: nowrap; }
.round { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.round:hover { background: var(--soft); }

.badge {
  position: absolute; top: 1px; right: 1px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--ember); color: #fff; font: 700 .72rem/20px var(--sans);
  text-align: center; pointer-events: none;
}
.badge svg { width: 14px; height: 14px; margin: 3px auto 0; stroke-width: 3; }

.screen { flex: 1; padding: 6px 16px 24px; }
.loading { color: var(--muted); padding: 60px 0; text-align: center; }

/* buttons */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px; padding: 0 24px; border-radius: 999px;
  background: var(--ember); color: #fff; font-weight: 700; font-size: 1.02rem;
  box-shadow: 0 10px 26px -10px rgba(255, 91, 31, .75);
  transition: background .25s, box-shadow .25s, transform .12s;
}
.cta:active { transform: scale(.98); }
.cta.quiet { background: var(--night-up); box-shadow: inset 0 0 0 1px var(--line); }
.cta.done { background: var(--basil); box-shadow: 0 10px 26px -10px rgba(31, 157, 92, .8); }
.cta.center { justify-content: center; text-align: center; }
.cta:disabled { opacity: .75; }
.cta.busy::after { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.amount { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.amount em { font-style: normal; font-weight: 500; font-size: .86rem; opacity: 0; }
.amount em.flash { animation: flash 1.4s ease-out; }
.pill-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; margin-right: 6px; border-radius: 13px; background: rgba(255, 255, 255, .25); font-size: .86rem; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); background: var(--soft); font-weight: 600; font-size: .94rem;
}
.pill:hover { box-shadow: inset 0 0 0 1px var(--crust); }
.pill.wide { width: 100%; margin-top: 18px; }
.link { display: inline-block; color: var(--crust); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
.link.center { display: block; margin: 8px auto 0; }

.actions { position: sticky; bottom: 0; z-index: 30; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(14, 23, 48, 0), var(--night) 34%); }

.tabs { position: sticky; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); background: #111c3b; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; font-size: .8rem; color: var(--muted); }
.tabs a[aria-current] { color: var(--crust); }
.tabs .badge { top: 4px; right: calc(50% - 26px); }

/* home */
.intro { padding: 14px 0 20px; }
.intro h1 { font-size: 2.15rem; max-width: 13ch; }
.intro p { color: var(--muted); margin-top: 8px; max-width: 34ch; }
.choices { display: grid; gap: 14px; }
.choice { position: relative; display: flex; align-items: flex-end; min-height: 168px; padding: 20px; border-radius: 28px; overflow: hidden; isolation: isolate; transition: transform .15s; }
.choice:active { transform: scale(.98); }
.pizza-choice { background: linear-gradient(115deg, #a92a14, #6d1409); }
.burger-choice { background: linear-gradient(115deg, #a35a07, #603003); }
.choice img { position: absolute; z-index: -1; width: 200px; right: -22px; top: 50%; translate: 0 -50%; transition: rotate .5s; }
.burger-choice img { right: -8px; }
.pizza-choice:hover img { rotate: 24deg; }
.burger-choice:hover img { rotate: -6deg; }
.choice strong { display: block; font: 400 1.45rem/1.2 var(--serif); max-width: 8ch; }
.choice small { display: block; margin-top: 6px; font-size: .92rem; color: rgba(255, 243, 226, .85); }
.sides { margin-top: 28px; }
.sides li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sides li:last-child { border-bottom: 0; }
.sides img { width: 62px; height: 62px; }
.sides li span { flex: 1; }
.sides small { display: block; color: var(--crust); }

/* builder */
.screen.builder { display: flex; flex-direction: column; padding-bottom: 0; }
.screen.locked .toppings, .screen.locked .segment { opacity: .45; pointer-events: none; }
.build-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.build-head h1 { font-size: clamp(1.3rem, 6.2vw, 1.6rem); }
.is-pizza .segment button { min-width: 34px; padding: 0 8px; }
.segment { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--soft); }
.segment button, .segment span { display: grid; place-items: center; min-width: 44px; min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.segment button[aria-checked="true"] { background: var(--flour); color: var(--night); }

.stage { position: relative; flex: 1; display: grid; place-items: center; min-height: 250px; padding: 12px 0; }
.pizza { position: relative; width: min(88vw, 40dvh, 400px); min-width: 230px; aspect-ratio: 1; scale: var(--scale, 1); transition: scale .35s cubic-bezier(.3, 1.4, .5, 1), rotate 2s ease-in-out; }
.pizza::before { content: ''; position: absolute; inset: -5%; border-radius: 50%; background: radial-gradient(circle, #1f2c52 60%, #121c3a 70%, rgba(18, 28, 58, 0) 71%); }
.pizza .base, .pizza .bake, #pieces { position: absolute; inset: 0; width: 100%; height: 100%; }
.pizza .piece { position: absolute; height: auto; max-width: none; pointer-events: none; }
.pizza .bake { opacity: 0; z-index: 200; pointer-events: none; transition: opacity 1.7s ease-in; }
.baking .bake, .baked .bake { opacity: 1; }
.baking .pizza { rotate: 30deg; }
.baked .pizza { rotate: 30deg; }
.baking #pieces, .baked #pieces { filter: saturate(1.15) brightness(.94); transition: filter 1.7s; }
.oven { position: absolute; inset: -8% -10%; border-radius: 50%; opacity: 0; pointer-events: none; background: radial-gradient(closest-side, rgba(255, 190, 60, .85), rgba(255, 91, 31, .55) 55%, rgba(255, 60, 0, 0)); transition: opacity .5s; }
.baking .oven { opacity: 1; animation: flicker .45s ease-in-out infinite alternate; }

.burger-view { position: relative; width: min(86vw, 40dvh, 440px); min-width: 230px; aspect-ratio: 1; }
.burger-view img { position: absolute; max-width: none; transition: bottom .32s cubic-bezier(.3, 1.4, .5, 1), left .32s, width .32s, height .32s; }
.plate { position: absolute; left: 50%; bottom: calc(50% - min(43vw, 20dvh, 220px)); translate: -50% 0; width: min(88vw, 41dvh, 450px); aspect-ratio: 4.4; border-radius: 50%; background: radial-gradient(closest-side, #3a4a7c, #233361 70%, #1a274d 71%, #131e3f); box-shadow: 0 14px 24px rgba(0, 0, 0, .35); }
.is-burger .stage { min-height: 280px; }

.hint { text-align: center; color: var(--muted); font-size: .9rem; min-height: 28px; }
.hint .link { padding: 0; }
.toppings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 4px; padding-top: 6px; }
.toppings li { position: relative; display: flex; justify-content: center; }
.topping { display: flex; flex-direction: column; align-items: center; width: 100%; }
.disc { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--soft); box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s, scale .12s; }
.topping:active .disc { scale: .9; }
.disc img { width: 52px; height: 52px; }
.label { margin-top: 5px; font-size: .8rem; font-weight: 600; line-height: 1.2; text-align: center; }
.price { font-size: .72rem; color: var(--muted); }
.on .disc { box-shadow: inset 0 0 0 2px var(--ember); background: rgba(255, 91, 31, .16); }
.toppings .badge { top: -4px; right: calc(50% - 38px); }
.minus { position: absolute; top: -4px; left: calc(50% - 38px); width: 24px; height: 24px; border-radius: 50%; background: #55638f; box-shadow: 0 0 0 2px var(--night); }
.minus::before { content: ''; position: absolute; left: 7px; right: 7px; top: 11px; height: 2px; background: #fff; }
.minus::after { content: ''; position: absolute; inset: -8px; }

/* cart */
.cart h1 { margin: 4px 0 12px; }
.lines li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lines img { width: 64px; height: 64px; }
.what { min-width: 0; }
.what strong { display: block; line-height: 1.25; }
.what p { color: var(--muted); font-size: .84rem; margin: 2px 0; }
.cost { color: var(--crust); font-weight: 700; margin-right: 14px; }
.stepper { display: flex; align-items: center; border-radius: 999px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { width: 38px; height: 40px; font-size: 1.25rem; border-radius: 50%; }
.stepper output { min-width: 20px; text-align: center; font-weight: 700; }
.extra { padding: 18px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
fieldset { border: 0; margin: 18px 0 6px; }
legend { font-weight: 700; margin-bottom: 8px; }
.segment.wide { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.segment label { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; width: 100%; cursor: pointer; }
.segment input:checked + span { background: var(--flour); color: var(--night); }
.segment input:focus-visible + span { outline: 3px solid var(--crust); }
.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--soft); font-size: 16px; }
.field input::placeholder { color: #7f8bb3; }
.field input[aria-invalid="true"] { border-color: #ff8a72; }
.totals { margin-top: 20px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totals .grand { color: var(--flour); font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.error { color: #ffab98; font-weight: 600; margin-top: 10px; }
.error:empty { margin: 0; }
.small { color: var(--muted); font-size: .84rem; margin-top: 10px; }
.empty { text-align: center; padding: 56px 0; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.empty .cta { display: inline-flex; width: auto; justify-content: center; }

/* payment sheet */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(5, 9, 22, .72); animation: fade .2s; }
.sheet-open { overflow: hidden; }
.pay-card { width: 100%; max-width: 440px; max-height: 92dvh; overflow: auto; padding: 24px 20px calc(18px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--night-up); animation: rise .3s cubic-bezier(.2, .9, .3, 1); }
.pay-card h2 { font-size: 1.7rem; }
.test { display: inline-block; margin-top: 8px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 180, 84, .16); color: var(--crust); font-size: .84rem; font-weight: 600; }
.methods label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; margin-bottom: 8px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.methods label:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ember); background: rgba(255, 91, 31, .12); }
.methods input { accent-color: var(--ember); width: 18px; height: 18px; }
.pay-card .cta { margin-top: 14px; }

/* tracking */
.track .number { font: 400 3.6rem/1 var(--serif); color: var(--crust); margin: 12px 0 14px; }
.track h1 { font-size: 1.75rem; }
.lead { color: var(--muted); margin-top: 6px; }
.track.is-ready h1 { color: var(--crust); }
.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; }
.progress li { padding-top: 12px; border-top: 5px solid var(--soft); font-size: .86rem; color: var(--muted); }
.progress li.on { border-color: var(--ember); color: var(--flour); font-weight: 700; }
.progress li.now { animation: pulse 1.2s ease-in-out infinite alternate; }
.is-ready .progress li { border-color: var(--basil); }
.receipt { margin: 22px 0; padding: 6px 18px; border-radius: 20px; background: var(--soft); }
.receipt li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.receipt li:last-child { border: 0; }
.receipt small { display: block; color: var(--muted); }
.receipt .grand { font-size: 1.08rem; font-weight: 700; }
.orders h1 { margin: 6px 0 14px; }
.history li a { display: grid; grid-template-columns: 1fr auto 80px; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.history b { text-align: right; }
.state { padding: 3px 12px; border-radius: 999px; background: var(--soft); font-size: .82rem; font-weight: 600; }
.state.ready { background: var(--basil); }
.state.cooking, .state.new { background: var(--ember-deep); }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); translate: -50% 12px; z-index: 70; max-width: calc(100% - 32px); width: max-content; padding: 12px 20px; border-radius: 999px; background: var(--flour); color: var(--night); font-weight: 600; font-size: .92rem; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s; }
.toast.show { opacity: 1; translate: -50% 0; }
.noscript { padding: 40px; text-align: center; }

@keyframes spin { to { rotate: 360deg; } }
@keyframes flash { 0% { opacity: 0; translate: 0 8px; } 12%, 70% { opacity: .95; translate: 0 0; } 100% { opacity: 0; } }
@keyframes flicker { from { scale: .96; filter: brightness(.9); } to { scale: 1.06; filter: brightness(1.2); } }
@keyframes pulse { from { border-top-color: var(--ember); } to { border-top-color: rgba(255, 91, 31, .35); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { translate: 0 100%; } }

/* short phones: keep the builder usable without much scrolling */
@media (max-height: 700px) and (max-width: 899px) {
  .disc { width: 52px; height: 52px; }
  .disc img { width: 44px; height: 44px; }
  .price { display: none; }
  .stage, .is-burger .stage { min-height: 224px; padding: 4px 0; }
  .pizza { width: min(76vw, 34dvh); min-width: 200px; }
  .burger-view { width: min(76vw, 34dvh); min-width: 210px; }
  .plate { width: min(78vw, 35dvh); bottom: calc(50% - min(38vw, 17dvh)); }
  .build-head h1 { font-size: 1.35rem; }
}

@media (min-width: 900px) {
  .app { max-width: 1120px; padding: 0 24px; }
  .intro { text-align: center; padding: 28px 0; }
  .intro h1 { font-size: 3rem; max-width: none; }
  .intro p { margin-inline: auto; max-width: none; }
  .choices { grid-template-columns: 1fr 1fr; gap: 22px; }
  .choice { min-height: 300px; padding: 32px; }
  .choice img { width: 320px; right: -30px; }
  .burger-choice img { right: -10px; }
  .choice strong { font-size: 2.1rem; }
  .sides ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .sides li { border-bottom: 0; }
  .screen.builder { display: grid; grid-template-columns: 1fr 440px; grid-template-rows: auto 1fr; column-gap: 40px; align-content: start; }
  .build-head { grid-column: 2; grid-row: 1; flex-direction: column; align-items: flex-start; padding-top: 24px; }
  .build-head h1 { font-size: 2.4rem; }
  .stage, .is-burger .stage { grid-column: 1; grid-row: 1 / 3; min-height: 560px; }
  .panel { grid-column: 2; grid-row: 2; padding-top: 22px; }
  .hint { text-align: left; margin-bottom: 8px; }
  .toppings { gap: 20px 6px; }
  .disc { width: 78px; height: 78px; }
  .disc img { width: 66px; height: 66px; }
  .toppings .badge { right: calc(50% - 46px); }
  .minus { left: calc(50% - 46px); }
  .pizza { width: min(100%, 62vh, 560px); }
  .burger-view { width: min(100%, 62vh, 560px); }
  .plate { width: min(100%, 63vh, 570px); bottom: calc(50% - min(31vh, 280px)); }
  .app:has(.screen.builder) .actions { align-self: flex-end; width: 440px; padding-inline: 0; margin-right: 16px; }
  .app:has(.screen.cart) .actions { align-self: flex-end; width: calc(50% - 20px); padding-inline: 0; margin-right: 16px; }
  .cart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
  .cart-grid fieldset { margin-top: 0; padding-top: 12px; }
  .screen.track, .screen.orders { width: 100%; max-width: 560px; margin: 0 auto; }
  .tabs { align-self: center; width: 420px; bottom: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
  .sheet { align-items: center; }
  .pay-card { border-radius: 28px; }
}

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