:root {
  --soot: #1B1715;
  --stone: #24211F;
  --ember: #FF7A2F;
  --ember-deep: #C44A16;
  --glow: #FFC27A;
  --chalk: #EDE6D8;
  --chalk-dim: rgba(237, 230, 216, 0.62);
  --chalk-faint: rgba(237, 230, 216, 0.28);
  --slate: #2C3033;
  --walnut: #4A2E1C;
  --brass: #C9A15A;

  --menu-w: clamp(210px, 17vw, 260px);
  --order-w: clamp(250px, 21vw, 320px);
  --prep-h: 236px;

  --sign: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --text: 'Big Shoulders Text', 'Arial Narrow', sans-serif;
  --chalkfont: 'Cabin Sketch', 'Big Shoulders Text', cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--soot);
  color: var(--chalk);
  font-family: var(--text);
  font-size: 17px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }

/* ---------------- Entrance ---------------- */
.entry {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #0E0D0F;
  will-change: opacity;
  transition: opacity 0.75s ease, visibility 0s linear 0.8s;
}
.entry canvas {
  position: absolute;
  inset: 0;
  cursor: default;
}
.way-in {
  position: absolute;
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
}
.way-in:focus-visible { outline: 3px solid var(--glow); outline-offset: 6px; }

body.inside .entry { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------------- Kitchen ---------------- */
.kitchen {
  position: fixed;
  inset: 0;
  opacity: 0;
  transform: scale(1.12);
  will-change: opacity, transform;
  transition: opacity 0.75s ease, transform 1.3s cubic-bezier(0.16, 0.84, 0.3, 1);
}
body.inside .kitchen { opacity: 1; transform: none; }

#bg, #scene, #fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#bg { z-index: 0; }
#scene { z-index: 1; }
#fx { z-index: 20; }

.app {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: grid;
  grid-template-columns: var(--menu-w) minmax(0, 1fr) var(--order-w);
  grid-template-rows: minmax(0, 1fr) var(--prep-h);
  grid-template-areas:
    'menu stage order'
    'prep prep prep';
}

.menu-slate, .order-slate, .prep { transition: filter 0.7s ease, opacity 0.7s ease; }
body.baking .menu-slate,
body.baking .order-slate,
body.baking .prep { filter: brightness(0.45) saturate(0.7); }

/* chalkboards in a walnut frame */
.slate {
  position: relative;
  align-self: start;
  margin: 26px;
  padding: 22px 22px 20px;
  border-radius: 6px;
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(90% 60% at 80% 90%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--slate);
  box-shadow:
    inset 0 0 0 9px var(--walnut),
    inset 0 0 0 10px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    0 18px 40px rgba(0, 0, 0, 0.5);
}
.slate::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 2px;
  pointer-events: none;
  background-image: repeating-linear-gradient(-12deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 7px);
}

.menu-slate { grid-area: menu; padding-left: 26px; padding-right: 22px; }
.slate-brand {
  margin: 4px 0 14px;
  font-family: var(--sign);
  font-weight: 900;
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--chalk);
}
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.step {
  appearance: none;
  border: 0;
  background: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
  cursor: pointer;
  font-family: var(--text);
  font-weight: 600;
  font-size: 21px;
  color: var(--chalk-faint);
  text-align: left;
}
.step .n {
  font-family: var(--chalkfont);
  font-size: 22px;
  width: 22px;
  text-align: center;
}
.step.done { color: var(--chalk-dim); }
.step.done .lbl { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(237, 230, 216, 0.45); }
.step.current { color: var(--chalk); }
.step.current .n { color: var(--ember); }
.step.current::after {
  content: '';
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
}
.step:disabled { cursor: default; }
.step:focus-visible { outline: 2px dashed var(--chalk); outline-offset: 2px; }

.stage { grid-area: stage; position: relative; min-height: 0; }

/* order slate */
.order-slate { grid-area: order; max-height: calc(100% - 52px); display: flex; flex-direction: column; }
#order { display: flex; flex-direction: column; min-height: 0; }
.o-title {
  margin: 2px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--chalkfont);
  font-size: 30px;
  font-weight: 700;
}
.o-title small { font-family: var(--text); font-size: 15px; font-weight: 500; color: var(--chalk-dim); }
.o-lines { list-style: none; margin: 0; padding: 0; overflow-y: auto; scrollbar-width: none; min-height: 30px; }
.o-lines::-webkit-scrollbar { display: none; }
.o-lines li {
  display: grid;
  grid-template-columns: 1fr auto 20px;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  font-size: 19px;
  font-weight: 500;
  border-bottom: 1px dashed rgba(237, 230, 216, 0.14);
}
.o-lines li.new { animation: chalk-in 0.6s ease-out both; }
@keyframes chalk-in {
  from { clip-path: inset(0 100% 0 0); opacity: 0.4; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
.o-lines .qty { color: var(--glow); font-weight: 600; }
.o-lines .rm {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: var(--chalk-faint);
}
.o-lines .rm:hover { color: var(--ember); }
.o-lines .rm:focus-visible { outline: 2px dashed var(--chalk); }
.o-lines .rm[hidden] { display: inline-block; visibility: hidden; }
.o-empty { margin: 4px 0 6px; font-size: 18px; color: var(--chalk-dim); }
.o-total {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid rgba(237, 230, 216, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.o-total span:first-child { font-size: 16px; color: var(--chalk-dim); }
.o-sum {
  font-family: var(--chalkfont);
  font-weight: 700;
  font-size: 46px;
  line-height: 1;
  color: var(--chalk);
  text-shadow: 0 0 18px rgba(255, 194, 122, 0.25);
}
.o-sum.bump { animation: bump 0.4s ease; }
@keyframes bump { 40% { transform: scale(1.12); color: var(--glow); } }
.o-note { margin-top: 8px; font-size: 15px; color: var(--chalk-dim); }

/* ---------------- Prep line (bottom) ---------------- */
.prep {
  grid-area: prep;
  position: relative;
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 18px 34px 22px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.35)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 140px),
    linear-gradient(180deg, #4E301D, #3A2215 60%, #2A180F);
  box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.06), 0 -18px 40px rgba(0, 0, 0, 0.45);
}
.prep::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: linear-gradient(180deg, rgba(255, 210, 160, 0.18), transparent);
}
.p-head h2 {
  margin: 0;
  font-family: var(--sign);
  font-weight: 900;
  font-size: 46px;
  line-height: 0.95;
  color: var(--chalk);
}
.p-head p { margin: 8px 0 0; font-size: 17px; line-height: 1.35; color: var(--chalk-dim); max-width: 32ch; }

.bowls {
  display: flex;
  justify-content: safe center;
  gap: clamp(12px, 1.3vw, 22px);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 14px 6px 6px;
}
.bowls::-webkit-scrollbar { display: none; }
.bowl-slot { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.bowl {
  position: relative;
  appearance: none;
  border: 0;
  padding: 9px;
  width: clamp(86px, 6.3vw, 124px);
  height: clamp(86px, 6.3vw, 124px);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  background: radial-gradient(circle at 35% 30%, #F7F1E6 0%, #E9DFCE 55%, #BFB3A0 100%);
  box-shadow:
    inset 0 -4px 8px rgba(0, 0, 0, 0.25),
    0 10px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.bowl::after {
  /* dark enamel rim line */
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px #1E2A3A;
  pointer-events: none;
}
.bowl canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
.bowl:hover { transform: translateY(-4px); }
.bowl:active { cursor: grabbing; }
.bowl:focus-visible { outline: 3px solid var(--glow); outline-offset: 4px; }
.bowl.picked { box-shadow: 0 0 0 4px var(--ember), 0 0 26px rgba(255, 122, 47, 0.6), 0 10px 18px rgba(0, 0, 0, 0.45); }
.bowl.full { opacity: 0.7; }
.bowl.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.b-label { display: flex; gap: 8px; align-items: baseline; font-size: 18px; font-weight: 600; color: var(--chalk); white-space: nowrap; }
.b-label .price { font-size: 15px; font-weight: 600; color: var(--glow); }
.pips { position: absolute; top: 2px; right: 6px; display: flex; gap: 3px; pointer-events: none; }
.pips i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ember);
  border: 2px solid #2A180F;
  box-shadow: 0 0 10px rgba(255, 122, 47, 0.7);
  animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes pop { from { transform: scale(0); } }
.minus {
  position: absolute;
  top: 0;
  left: 2px;
  z-index: 2;
  appearance: none;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--chalk);
  background: #15100D;
  box-shadow: 0 0 0 2px rgba(237, 230, 216, 0.4), 0 6px 12px rgba(0, 0, 0, 0.5);
  animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.minus:hover { background: var(--ember-deep); }
.minus:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }
.minus[hidden] { display: none; }

.p-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hint { font-size: 15px; color: var(--chalk-dim); max-width: 24ch; text-align: right; }
.go {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 16px 26px 17px;
  border-radius: 14px;
  font-family: var(--sign);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.01em;
  color: #1A0E08;
  background: var(--ember);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 10px 30px rgba(255, 122, 47, 0.3);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.go:hover:not(:disabled) { background: #FF8C47; }
.go:active:not(:disabled) { transform: translateY(1px); }
.go:disabled { opacity: 0.35; cursor: not-allowed; }
.go:focus-visible { outline: 3px solid var(--glow); outline-offset: 4px; }
.go.fire { background: linear-gradient(180deg, #FFB347, #FF6A1F); font-size: 28px; padding: 18px 32px 19px; }

.oven-facts { display: flex; gap: 30px; margin: 0; justify-content: center; }
.oven-facts div { display: flex; flex-direction: column; align-items: center; }
.oven-facts dt { font-family: var(--sign); font-weight: 900; font-size: 54px; line-height: 1; color: var(--glow); }
.oven-facts dd { margin: 4px 0 0; font-size: 16px; color: var(--chalk-dim); }

/* step change: prep content slides */
.prep.enter .p-head, .prep.enter .bowl-slot, .prep.enter .p-actions, .prep.enter .oven-facts {
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.prep.enter .bowl-slot:nth-child(2) { animation-delay: 0.04s; }
.prep.enter .bowl-slot:nth-child(3) { animation-delay: 0.08s; }
.prep.enter .bowl-slot:nth-child(4) { animation-delay: 0.12s; }
.prep.enter .bowl-slot:nth-child(5) { animation-delay: 0.16s; }
.prep.enter .bowl-slot:nth-child(6) { animation-delay: 0.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* ---------------- Now serving board ---------------- */
.serving {
  position: fixed;
  z-index: 15;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  padding: 34px 34px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #121010;
  border-radius: 0 0 14px 14px;
  box-shadow: inset 0 0 0 2px rgba(201, 161, 90, 0.5), 0 24px 50px rgba(0, 0, 0, 0.6);
  transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.4, 1);
}
.serving.show { transform: translate(-50%, 0); }
.serving::before, .serving::after {
  content: '';
  position: absolute;
  top: -40px;
  width: 2px;
  height: 56px;
  background: repeating-linear-gradient(180deg, var(--brass) 0 6px, transparent 6px 9px);
}
.serving::before { left: 28px; }
.serving::after { right: 28px; }
.serving-label { font-family: var(--sign); font-weight: 700; font-size: 18px; letter-spacing: 0.18em; color: var(--brass); }
.flip { display: flex; gap: 6px; perspective: 400px; }
.tile {
  position: relative;
  width: 64px;
  height: 88px;
  border-radius: 7px;
  background: linear-gradient(180deg, #2A2624 0 49.5%, #1A1716 50.5% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 12px rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  font-family: var(--sign);
  font-weight: 900;
  font-size: 72px;
  line-height: 1;
  color: var(--chalk);
}
.tile::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.7); }
.tile.flipping { animation: flip 0.32s ease-in-out; }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }

.credit {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease 1.2s;
  right: 16px;
  bottom: calc(var(--prep-h) + 12px);
  z-index: 3;
  font-size: 13px;
  color: var(--chalk-faint);
  text-decoration: none;
}
.credit strong { color: var(--chalk-dim); }
body.inside .credit { opacity: 1; pointer-events: auto; }
.credit:hover { color: var(--chalk); }

.order-chip { display: none; }

/* ---------------- Phones and small tablets ---------------- */
@media (max-width: 960px) {
  :root { --prep-h: auto; }
  body { position: fixed; inset: 0; overscroll-behavior: none; }
  .app {
    height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: 'stage' 'prep';
  }
  .menu-slate { display: none; }
  .order-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    right: 14px;
    z-index: 6;
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 8px 8px 8px 14px;
    border-radius: 999px;
    background: var(--slate);
    color: var(--chalk);
    font-size: 15px;
    font-weight: 600;
    box-shadow: inset 0 0 0 2px var(--walnut), 0 8px 20px rgba(0, 0, 0, 0.5);
  }
  .order-chip strong { font-family: var(--chalkfont); font-weight: 700; font-size: 18px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 122, 47, 0.2); color: var(--glow); }
  .order-chip strong.bump { animation: bump 0.4s ease; }
  .order-slate {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    right: 12px;
    z-index: 8;
    margin: 0;
    width: min(320px, calc(100vw - 24px));
    max-height: 60dvh;
    display: none;
  }
  body.order-open .order-slate { display: flex; animation: drop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
  @keyframes drop { from { opacity: 0; transform: translateY(-10px); } }
  .prep {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 30px);
    border-radius: 22px 22px 0 0;
  }
  .p-head { padding: 0 18px; }
  .p-head h2 { font-size: 32px; }
  .p-head p { font-size: 15px; margin-top: 4px; max-width: none; }
  .p-dots { display: flex; gap: 6px; margin-bottom: 8px; }
  .bowls { justify-content: flex-start; gap: 16px; padding: 12px 18px 6px; touch-action: pan-x; }
  .bowl { width: 96px; height: 96px; padding: 7px; touch-action: pan-x; }
  .bowl:hover { transform: none; }
  .b-label { font-size: 15px; }
  .b-label .price { font-size: 13px; }
  .minus { width: 26px; height: 26px; font-size: 18px; }
  .p-actions { align-items: stretch; padding: 0 18px; }
  .hint { display: none; }
  .go { text-align: center; font-size: 21px; padding: 14px 20px 15px; }
  .go.fire { font-size: 23px; }
  .oven-facts { gap: 18px; }
  .oven-facts dt { font-size: 34px; }
  .oven-facts dd { font-size: 13px; }
  .credit { bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); right: 50%; transform: translateX(50%); white-space: nowrap; font-size: 11px; }
  .tile { width: 48px; height: 66px; font-size: 54px; }
}
.p-dots { display: none; }
@media (max-width: 960px) { .p-dots { display: flex; } }
.p-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--chalk-faint); }
.p-dots i.on { background: var(--ember); box-shadow: 0 0 8px var(--ember); width: 22px; border-radius: 4px; }
.p-dots i.done { background: var(--chalk-dim); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
