:root {
  --stage-scale: 1;
  --bg: #fbfbf8;
  --ink: #0b276f;
  --body-ink: #17284e;
  --sketch: #151515;
  --muted: #69728a;
  --gold: #c58b21;
  --gold-soft: #f0d79a;
  --panel: rgba(255, 255, 255, 0.94);
  --shadow: rgba(11, 39, 111, 0.12);
  --tomato: #d64b3f;
  --leaf: #4f8b52;
  --wheat: #d6a84b;
  --sauce: #8f3f52;
  --spice: #bc7a2d;
  --blue: #4e7fae;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--body-ink);
  background: #e8e9ec;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.theme-evening {
  --bg: #f5f6f4;
  --ink: #0a225d;
  --body-ink: #102147;
  --gold: #b9821e;
  background: #111827;
}

body.theme-kitchen {
  --bg: #fffdf6;
  --ink: #0d2b68;
  --body-ink: #25314f;
  --gold: #c18424;
  --gold-soft: #f5dfa6;
  background: #eee7d7;
}

.stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: var(--bg);
  transform: scale(var(--stage-scale));
  transform-origin: center center;
}

.recipe-board {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
}

.sketch-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.board-stroke,
.flow-line,
.table-line {
  fill: none;
  stroke: var(--sketch);
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#roughen);
}

.board-stroke {
  stroke-width: 5;
}

.rail-stroke {
  stroke-width: 3;
  opacity: 0.7;
}

.flow-line {
  stroke-width: 4;
  opacity: 0;
  transition: opacity 350ms ease;
}

.table-line {
  stroke-width: 4;
  opacity: 0;
}

.arrow-fill {
  fill: var(--sketch);
}

.flow-active {
  opacity: 0.82;
}

.zone-grid {
  position: absolute;
  left: 154px;
  top: 292px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  width: 1596px;
  height: 500px;
  pointer-events: none;
}

.zone {
  position: relative;
  display: block;
  border: 2px dashed rgba(11, 39, 111, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  opacity: 0.62;
  transition: opacity 260ms ease, background 260ms ease, border-color 260ms ease, transform 260ms ease;
}

.zone.is-active {
  border-color: rgba(197, 139, 33, 0.58);
  background: rgba(255, 255, 255, 0.78);
  opacity: 1;
  transform: translateY(-2px);
}

.stage-copy {
  position: absolute;
  left: 126px;
  top: 54px;
  width: 1260px;
  z-index: 8;
  transition: opacity 250ms ease, transform 250ms ease;
}

.stage-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
}

.stage-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}

.stage-copy p:last-child {
  margin: 14px 0 0;
  color: var(--body-ink);
  font-size: 29px;
  line-height: 1.22;
  font-weight: 400;
  max-width: 980px;
}

.stage.labels-off .stage-copy h2,
.stage.labels-off .stage-kicker {
  opacity: 0;
}

.stage.captions-off .stage-copy p:last-child {
  opacity: 0;
}

.station {
  position: absolute;
  z-index: 4;
  color: #111;
  transition: opacity 300ms ease, transform 300ms ease;
}

.station-title {
  position: absolute;
  left: 50%;
  top: -66px;
  z-index: 12;
  min-width: max-content;
  padding: 9px 16px 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid var(--ink);
  border-bottom: 6px solid var(--gold);
  border-radius: 7px;
  box-shadow: 0 7px 0 rgba(11, 39, 111, 0.08);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.station-market {
  left: 190px;
  top: 414px;
  width: 250px;
  height: 260px;
}

.source-stack {
  position: absolute;
  inset: 0;
}

.source-stack span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 118px;
  height: 54px;
  color: #111;
  background: #fff;
  border: 4px solid #111;
  border-radius: 4px;
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  font-size: 20px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.04);
}

.source-stack span:nth-child(1) {
  left: 6px;
  top: 4px;
  transform: rotate(-2deg);
}

.source-stack span:nth-child(2) {
  right: 4px;
  top: 42px;
  transform: rotate(1deg);
}

.source-stack span:nth-child(3) {
  left: 34px;
  top: 126px;
  transform: rotate(2deg);
}

.source-stack span:nth-child(4) {
  right: 22px;
  bottom: 0;
  transform: rotate(-1deg);
}

.station-storage {
  left: 506px;
  top: 390px;
  width: 272px;
  height: 286px;
  border: 5px solid #111;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.88);
  filter: url(#roughen);
}

.shelf {
  position: absolute;
  left: 28px;
  right: 28px;
  height: 4px;
  background: #111;
  border-radius: 2px;
}

.shelf-top {
  top: 82px;
}

.shelf-mid {
  top: 150px;
}

.shelf-bottom {
  top: 220px;
}

.jar {
  position: absolute;
  width: 54px;
  height: 70px;
  border: 4px solid #111;
  border-radius: 6px 6px 14px 14px;
  background: rgba(240, 215, 154, 0.4);
}

.jar:before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -13px;
  height: 14px;
  border: 4px solid #111;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #fff;
}

.jar-one {
  left: 54px;
  top: 94px;
}

.jar-two {
  left: 142px;
  top: 164px;
  background: rgba(79, 139, 82, 0.18);
}

.jar-three {
  right: 54px;
  top: 92px;
  background: rgba(214, 75, 63, 0.14);
}

.station-prep {
  left: 836px;
  top: 400px;
  width: 288px;
  height: 250px;
}

.cutting-board {
  position: absolute;
  left: 18px;
  top: 42px;
  width: 252px;
  height: 160px;
  border: 5px solid #111;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  filter: url(#roughen);
}

.cutting-board:after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 30px;
  height: 30px;
  border: 4px solid #111;
  border-radius: 50%;
}

.bowl {
  position: absolute;
  width: 94px;
  height: 48px;
  border: 5px solid #111;
  border-top: 0;
  border-radius: 0 0 50px 50px;
  background: rgba(255, 255, 255, 0.92);
  filter: url(#roughen);
}

.bowl:before {
  content: "";
  position: absolute;
  left: -4px;
  top: -12px;
  width: 95px;
  height: 24px;
  border: 5px solid #111;
  border-radius: 50%;
  background: #fff;
}

.bowl-one {
  left: 34px;
  top: 160px;
}

.bowl-two {
  left: 122px;
  top: 150px;
}

.bowl-three {
  right: 0;
  top: 164px;
}

.knife {
  position: absolute;
  left: 46px;
  top: 96px;
  width: 132px;
  height: 12px;
  background: #111;
  border-radius: 8px;
  transform: rotate(-18deg);
}

.knife:after {
  content: "";
  position: absolute;
  right: -58px;
  top: -10px;
  width: 72px;
  height: 28px;
  border: 4px solid #111;
  border-radius: 3px 12px 12px 3px;
  background: #f7f7f3;
}

.station-cook {
  left: 1190px;
  top: 420px;
  width: 282px;
  height: 250px;
}

.pot {
  position: absolute;
  left: 52px;
  top: 60px;
  width: 174px;
  height: 124px;
  border: 5px solid #111;
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(255, 255, 255, 0.92);
  filter: url(#roughen);
}

.pot:before {
  content: "";
  position: absolute;
  left: -6px;
  top: -34px;
  width: 177px;
  height: 56px;
  border: 5px solid #111;
  border-radius: 50%;
  background: #fff;
}

.pot:after {
  content: "";
  position: absolute;
  left: -28px;
  top: 26px;
  width: 226px;
  height: 18px;
  border-left: 5px solid #111;
  border-right: 5px solid #111;
}

.steam {
  position: absolute;
  top: -92px;
  width: 26px;
  height: 78px;
  border-left: 4px solid rgba(17, 17, 17, 0.72);
  border-radius: 50%;
  opacity: 0;
  animation: steam-rise 2.7s ease-in-out infinite;
}

.steam-one {
  left: 56px;
}

.steam-two {
  left: 92px;
  animation-delay: 0.4s;
}

.steam-three {
  left: 130px;
  animation-delay: 0.8s;
}

.pan {
  position: absolute;
  right: 24px;
  bottom: 18px;
  width: 136px;
  height: 36px;
  border: 5px solid #111;
  border-radius: 50%;
  transform: rotate(-10deg);
}

.pan:after {
  content: "";
  position: absolute;
  right: -78px;
  top: 10px;
  width: 86px;
  height: 12px;
  background: #111;
  border-radius: 8px;
}

.station-serve {
  left: 1512px;
  top: 430px;
  width: 240px;
  height: 280px;
}

.plate {
  position: absolute;
  display: grid;
  place-items: center;
  width: 120px;
  height: 68px;
  border: 5px solid #111;
  border-radius: 50%;
  background: #fff;
  filter: url(#roughen);
}

.plate span {
  width: 70px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 45%, var(--tomato) 0 8px, transparent 9px),
    radial-gradient(circle at 62% 56%, var(--leaf) 0 8px, transparent 9px),
    radial-gradient(circle at 48% 42%, var(--wheat) 0 11px, transparent 12px);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 300ms ease, transform 300ms ease;
}

.plate-one {
  left: 0;
  top: 58px;
  transform: rotate(-4deg);
}

.plate-two {
  right: 0;
  top: 92px;
  transform: rotate(3deg);
}

.plate-three {
  left: 56px;
  bottom: 34px;
  transform: rotate(1deg);
}

.ingredient {
  position: absolute;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 132px;
  height: 50px;
  padding: 0 13px;
  color: #111;
  background: rgba(255, 255, 255, 0.96);
  border: 4px solid #111;
  border-radius: 5px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.035);
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  font-size: 20px;
  filter: url(#roughen);
  will-change: transform, opacity;
}

.ingredient .swatch {
  width: 19px;
  height: 19px;
  border: 3px solid #111;
  border-radius: 50%;
  background: var(--item-color);
}

.ingredient-produce {
  --item-color: var(--tomato);
}

.ingredient-grains {
  --item-color: var(--wheat);
}

.ingredient-herbs {
  --item-color: var(--leaf);
}

.ingredient-sauce {
  --item-color: var(--sauce);
}

.ingredient-spice {
  --item-color: var(--spice);
}

.ingredient-requests {
  --item-color: var(--blue);
  min-width: 168px;
}

.merge-card {
  position: absolute;
  z-index: 6;
  width: 178px;
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 8px 14px;
  color: #111;
  background: rgba(255, 255, 255, 0.94);
  border: 4px dashed #111;
  border-radius: 6px;
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  font-size: 19px;
  text-align: center;
  opacity: 0;
  filter: url(#roughen);
  transform: translate(0, 0) rotate(-1deg) scale(0.96);
}

.merge-card-one {
  left: 1182px;
  top: 694px;
}

.merge-card-two {
  left: 1288px;
  top: 746px;
}

.technical-overlay {
  position: absolute;
  left: 170px;
  top: 802px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 1570px;
  min-height: 70px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.technical-overlay span {
  display: grid;
  place-items: center;
  margin-right: 14px;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(11, 39, 111, 0.22);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.stage.show-technical .technical-overlay {
  opacity: 1;
}

.deck-footer {
  position: absolute;
  left: 126px;
  right: 126px;
  bottom: 56px;
  z-index: 10;
}

.deck-footer p {
  margin: 0;
  color: var(--body-ink);
  font-size: 36px;
  font-style: italic;
  line-height: 1.25;
  transition: opacity 280ms ease, transform 280ms ease;
}

.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  width: min(420px, calc(100vw - 40px));
  padding: 18px;
  color: #15203a;
  background: var(--panel);
  border: 1px solid rgba(11, 39, 111, 0.18);
  border-radius: 8px;
  box-shadow: 0 24px 80px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 14px;
}

.controls.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.controls-header strong {
  color: var(--ink);
  font-size: 16px;
}

.controls button,
.controls input,
.controls select {
  font: inherit;
}

.controls button {
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

#closeControls {
  width: 34px;
  padding: 0;
}

.controls > label {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.controls input[type="text"],
.controls select {
  grid-column: 2 / 4;
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(21, 32, 58, 0.22);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
}

.controls input[type="range"] {
  width: 100%;
}

.check-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 16px 0;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

body.reduced-motion .ingredient,
body.reduced-motion .stage-copy,
body.reduced-motion .deck-footer p,
body.reduced-motion .station,
body.reduced-motion .flow-line,
body.reduced-motion .plate span {
  transition-duration: 0ms;
}

body.reduced-motion .steam {
  animation: none;
}

@keyframes steam-rise {
  0% {
    opacity: 0;
    transform: translateY(24px) scaleY(0.7);
  }
  30% {
    opacity: 0.64;
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scaleY(1.08);
  }
}

@media (max-width: 900px) {
  .controls {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }
}
