/* Hallmark · macrostructure: bespoke, the page is a playable world with a HUD layer, panels below · tone: warm, busy, proud · anchor hue: arches gold on red
 * genre: playful-game · theme: custom (field #da291c, accent #ffc72c, cream #ede6d6, Instrument Serif italic + Work Sans) · studied: yes, DNA-source The Tie-break (Merci-Michel)
 * nav: top bar for the coin and three section links · footer: one line · enrichment: real-time three.js kitchen
 * contrast: pass (40-41) · honest: pass (46) · chrome: pass (47) · responsive: pass (49) · mobile: pass (34, 49-57)
 */
@font-face { font-family: "Instrument Serif"; src: url(/assets/fonts/InstrumentSerif-italic-400.woff2) format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url(/assets/fonts/WorkSans-normal-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url(/assets/fonts/WorkSans-normal-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --red: #da291c; --deep: #8a1a12; --gold: #ffc72c; --bevel: #e8a800; --cream: #ede6d6; --steel: #b9b4ac; --ink: #231a16;
  --serif: "Instrument Serif", Georgia, serif; --sans: "Work Sans", system-ui, sans-serif;
  --bar: 64px; --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--red); color: var(--cream); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { overflow-wrap: anywhere; min-width: 0; }
h1 em, h2 em { overflow-wrap: normal; }
button, .buy, .buy-it, .actions > * { white-space: nowrap; }
button:disabled { cursor: not-allowed; }
a:active, button:not(:disabled):active { transform: translateY(1px); }
.tag:active { transform: none; filter: brightness(.94); }

/* ---- header ---- */
.bar { position: fixed; inset: 0 0 auto; z-index: 30; height: var(--bar); display: flex; align-items: center; gap: 20px; padding: 0 clamp(12px, 2.4vw, 32px); background: linear-gradient(var(--red) 55%, rgba(218,41,28,0)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 8px; display: block; }
.brand em { font-size: 34px; line-height: 1; }
.jump { display: flex; gap: 22px; margin-right: auto; }
.jump a { text-decoration: none; font-size: 14px; opacity: 1; border-bottom: 1px solid transparent; transition: border-color .2s, opacity .2s; }
.jump a:hover { opacity: 1; border-color: currentColor; }
.coin { display: flex; align-items: center; gap: 8px; }
.ca, .buy, .ico, .phantom { height: 36px; border: 1px solid rgba(237,230,214,.55); background: transparent; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 14px; border-radius: 3px; transition: background .2s, color .2s, border-color .2s; }
.ca { padding: 0 12px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca:disabled { cursor: default; }
.buy { padding: 0 16px; background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 500; }
.buy[aria-disabled="true"] { background: transparent; color: var(--gold); }
.ico { width: 36px; }
.phantom { padding: 0 14px; background: var(--cream); color: var(--ink); border-color: var(--cream); font-weight: 500; }
.ca:not(:disabled):hover, .ico:hover { background: rgba(237,230,214,.14); }

/* ---- stage ---- */
.stage { position: relative; height: 100vh; height: 100svh; min-height: 520px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 6px 10px 7px; border: 0; border-radius: 4px; background: var(--cream); color: var(--ink); box-shadow: 0 3px 0 var(--deep); font-size: 13px; line-height: 1.15; touch-action: manipulation; will-change: transform; transition: background .15s, box-shadow .15s; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); z-index: -1; }
.tag b { font-weight: 500; font-size: 14px; }
.tag span { font-size: 12px; opacity: .72; white-space: nowrap; }
.tag span:empty { display: none; }
.tag[data-mood="go"] { background: var(--gold); }
.tag[data-mood="bad"] { background: var(--ink); color: var(--cream); box-shadow: 0 3px 0 #000; }
.tag[data-mood="bad"] span { opacity: .9; }
.tag.hit { animation: hit .22s var(--ease); }
.tag[hidden] { display: none; }
@keyframes hit { 40% { scale: .88; } }
.buyer { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; padding: 4px 8px; background: var(--gold); color: var(--ink); border-radius: 4px; font-size: 11px; line-height: 1.2; white-space: nowrap; box-shadow: 0 2px 0 var(--bevel); }
.buyer b { font-weight: 500; font-size: 12px; }

.hud { position: absolute; inset: var(--bar) 0 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.rail { position: absolute; left: clamp(10px, 2.4vw, 32px); right: 300px; top: 4px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 10px; }
.rail::-webkit-scrollbar { display: none; }
.ticket { flex: 0 0 auto; width: 128px; text-align: left; background: var(--cream); color: var(--ink); border: 0; border-radius: 2px; padding: 8px 10px 12px; position: relative; box-shadow: 0 3px 0 rgba(0,0,0,.18); animation: drop .35s var(--ease); }
.ticket header { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.ticket header b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket header i { font-style: normal; font-size: 11px; opacity: .6; white-space: nowrap; }
.ticket ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
.ticket li { display: flex; align-items: center; gap: 6px; }
.ticket li::before { content: ""; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 50%; flex: none; }
.ticket li[data-ok="1"]::before { background: var(--red); border-color: var(--red); }
.ticket .pat { position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--f, 1) * 100%); background: var(--ink); transition: width .1s linear; }
.ticket[data-mood="warn"] .pat { background: var(--bevel); }
.ticket[data-mood="bad"] { animation: drop .35s var(--ease), shake .5s infinite; }
.ticket[data-mood="bad"] .pat { background: var(--red); }
.ticket[data-buyer] { background: var(--gold); }
.ticket[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: -4px; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
@keyframes shake { 50% { transform: rotate(-1.2deg); } }
.rail-empty { position: absolute; left: clamp(10px, 2.4vw, 32px); top: 10px; margin: 0; font-size: 14px; }
.dash { position: absolute; right: clamp(10px, 2.4vw, 32px); top: 6px; display: flex; gap: 18px; align-items: flex-start; }
.clock { font-family: var(--serif); font-style: italic; font-size: 30px; line-height: 1; position: relative; padding-bottom: 8px; }
.clock .left { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 1) * 100%); background: var(--gold); }
.num { display: flex; flex-direction: column; line-height: 1; }
.num small { font-size: 12px; }
.num b { font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; }
.num[data-mood="bad"] b { color: var(--gold); }
.mute { background: none; border: 1px solid rgba(237,230,214,.4); border-radius: 3px; padding: 4px 8px; font-size: 12px; }
.stock { position: absolute; left: clamp(10px, 2.4vw, 32px); bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; pointer-events: none; }
.stock span[data-zero="1"] { text-decoration: line-through; text-decoration-thickness: 1px; }

.board { position: absolute; right: clamp(10px, 2.4vw, 32px); bottom: 14px; width: 260px; background: var(--ink); color: var(--cream); border-radius: 4px; padding: 10px 12px; font-size: 13px; z-index: 2; }
.board-head { margin: 0 0 6px; font-size: 20px; line-height: 1; color: var(--gold); }
.board ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.board li { display: flex; justify-content: space-between; gap: 10px; }
.board li a { text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board li span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.quiet { opacity: 1; }

.toast { position: absolute; left: 50%; bottom: 64px; transform: translate(-50%, 16px); margin: 0; padding: 8px 14px; background: var(--ink); color: var(--cream); border-radius: 3px; font-size: 14px; opacity: 0; transition: opacity .2s, transform .25s var(--ease); pointer-events: none; white-space: nowrap; z-index: 3; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast[data-mood="bad"] { background: var(--gold); color: var(--ink); }

/* ---- intro: the blurred kitchen under one line and one framed button ---- */
.intro { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; backdrop-filter: blur(9px) saturate(1.05); -webkit-backdrop-filter: blur(9px); background: rgba(138,26,18,.18); transition: opacity .6s var(--ease), backdrop-filter .6s; }
.intro::before, .intro::after { content: ""; position: absolute; background: rgba(237,230,214,.55); pointer-events: none; }
.intro::before { left: 0; right: 0; top: 50%; height: 1px; transform: scaleX(var(--line, 1)); }
.intro::after { top: 0; bottom: 0; left: 50%; width: 1px; transform: scaleY(var(--line, 1)); }
.intro.out { opacity: 0; pointer-events: none; --line: 0; }
.frame { position: relative; z-index: 1; text-align: center; max-width: 560px; padding: 40px 28px 30px; background: var(--red); border: 1px solid rgba(237,230,214,.7); outline: 1px solid rgba(237,230,214,.35); outline-offset: 7px; }
.frame h1 { margin: 0; font-size: clamp(64px, 9vw, 128px); line-height: .9; font-weight: 400; animation: rise .9s var(--ease) both; }
.frame p { margin: 18px auto 0; max-width: 42ch; font-size: 16px; animation: rise .9s .1s var(--ease) both; }
.frame .keys { font-size: 13px; opacity: 1; margin-top: 16px; }
.start { margin-top: 26px; display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; background: var(--cream); color: var(--ink); border: 0; border-radius: 2px; font-weight: 500; font-size: 17px; box-shadow: 0 0 0 1px var(--cream), 0 0 0 6px var(--red), 0 0 0 7px rgba(237,230,214,.7); transition: transform .2s var(--ease), background .2s; animation: rise .9s .2s var(--ease) both; }
.start:hover { background: var(--gold); transform: translateY(-2px); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.down { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 13px; text-decoration: none; z-index: 1; white-space: nowrap; }
.stage.playing .down { display: none; }

/* ---- receipt ---- */
.receipt { border: 0; padding: 0; background: transparent; max-width: 92vw; }
.receipt::backdrop { background: rgba(35,26,22,.55); backdrop-filter: blur(4px); }
.paper { width: 360px; max-width: 92vw; background: var(--cream); color: var(--ink); padding: 26px 26px 22px; text-align: center; position: relative; animation: print .7s var(--ease); --zig: radial-gradient(circle at 8px 0, transparent 7px, var(--cream) 7.5px); }
.paper::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; background: var(--zig); background-size: 16px 10px; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-20px); } to { clip-path: inset(0 0 -20px 0); } }
.paper img { border-radius: 8px; }
.paper h2 { margin: 6px 0 0; font-size: 46px; line-height: 1; color: var(--red); font-weight: 400; }
.when { margin: 4px 0 14px; font-size: 13px; opacity: .65; }
.paper dl { margin: 0; border-top: 1px dashed rgba(35,26,22,.4); border-bottom: 1px dashed rgba(35,26,22,.4); padding: 10px 0; }
.paper dl div { display: flex; justify-content: space-between; font-size: 15px; padding: 2px 0; }
.paper dt, .paper dd { margin: 0; }
.paper dd { font-variant-numeric: tabular-nums; font-weight: 500; }
.paper .total { font-size: 20px; padding-top: 8px; }
.paper .total dd { color: var(--red); }
.thanks { font-family: var(--serif); font-style: italic; font-size: 19px; margin: 12px 0; }
.actions { display: grid; gap: 8px; }
.actions > * { height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 2px; text-decoration: none; font-weight: 500; border: 1px solid var(--ink); background: transparent; }
.actions .share { background: var(--ink); color: var(--cream); }
.actions .save { background: var(--red); color: var(--cream); border-color: var(--red); }
.note { margin: 10px 0 0; font-size: 12px; opacity: .7; }

/* ---- panels below the kitchen ---- */
.panel { padding: clamp(70px, 10vw, 140px) clamp(16px, 4vw, 56px); position: relative; }
.panel.cream { background: var(--cream); color: var(--ink); }
.wrap { max-width: 1180px; margin: 0 auto; }
.wrap.two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 80px); align-items: start; }
.panel h2 { margin: 0; font-size: clamp(48px, 6.5vw, 96px); line-height: .95; font-weight: 400; }
.lede { font-size: 18px; max-width: 46ch; margin: 18px 0 0; }
.fine { font-size: 14px; max-width: 46ch; opacity: .75; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.menu-list { list-style: none; margin: 40px 0 0; padding: 0; border-top: 1px solid rgba(237,230,214,.5); }
.menu-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto auto; gap: 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(237,230,214,.3); }
.menu-list li.quiet { display: block; padding: 22px 0; font-size: 17px; }
.menu-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; background: var(--deep); }
.menu-list .nm em { font-size: 28px; line-height: 1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-list .nm small { font-size: 13px; }
.menu-list .px { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.menu-list .px small { display: block; font-size: 12px; }
.menu-list .buy-it { padding: 8px 16px; background: var(--gold); color: var(--ink); text-decoration: none; border-radius: 2px; font-weight: 500; }

.launch { display: grid; gap: 14px; }
.launch label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; }
.launch input, .launch textarea { font: 400 16px/1.4 var(--sans); color: var(--ink); background: #f7f2e7; border: 1px solid rgba(35,26,22,.35); border-radius: 2px; padding: 10px 12px; width: 100%; }
.launch input:focus, .launch textarea:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
.launch .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.launch .file input { padding: 8px; }
.go { height: 52px; background: var(--red); color: var(--cream); border: 0; border-radius: 2px; font-weight: 500; font-size: 17px; transition: background .2s; }
.go:hover { background: var(--deep); }
.go:disabled { opacity: .6; cursor: wait; }
.status { margin: 0; min-height: 1.5em; font-size: 14px; }
.status a { font-weight: 500; }

.crew { list-style: none; margin: 0; padding: 0; counter-reset: c; border-top: 1px solid rgba(237,230,214,.5); }
.crew li { counter-increment: c; display: grid; grid-template-columns: 44px 1fr auto auto; gap: 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid rgba(237,230,214,.3); font-variant-numeric: tabular-nums; }
.crew li::before { content: counter(c); font-family: var(--serif); font-style: italic; font-size: 26px; line-height: 1; }
.crew li.quiet { display: block; }
.crew li.quiet::before { content: none; }
.crew b { font-weight: 500; }

#faq details { border-top: 1px solid rgba(35,26,22,.3); padding: 16px 0; max-width: 760px; }
#faq details:last-of-type { border-bottom: 1px solid rgba(35,26,22,.3); }
#faq summary { cursor: pointer; font-family: var(--serif); font-style: italic; font-size: 28px; list-style: none; }
#faq summary::-webkit-details-marker { display: none; }
#faq details p { margin: 10px 0 0; max-width: 62ch; }
#faq h2 { margin-bottom: 30px; }

.foot { display: flex; align-items: center; gap: 12px; padding: 26px clamp(16px, 4vw, 56px) 40px; font-size: 14px; }
.foot img { border-radius: 6px; }
.foot p { margin: 0 auto 0 0; }
.foot em { font-size: 20px; }

/* ---- small screens ---- */
@media (max-width: 1080px) { .jump { display: none; } .coin { margin-left: auto; } }
@media (max-width: 720px) {
  :root { --bar: 56px; }
  .bar { gap: 8px; }
  .brand em { display: none; }
  .brand img { width: 32px; height: 32px; }
  .coin { gap: 6px; }
  .ca { max-width: 112px; font-size: 12px; padding: 0 8px; height: 32px; }
  .buy, .phantom { height: 32px; padding: 0 10px; font-size: 13px; }
  .ico { width: 32px; height: 32px; }
  .rail { right: 10px; top: 46px; }
  .rail-empty { top: 52px; font-size: 13px; right: 10px; }
  .ticket { width: 112px; padding: 6px 8px 10px; }
  .ticket header b { font-size: 16px; }
  .ticket ul { font-size: 12px; }
  .dash { left: 10px; right: 10px; top: 4px; justify-content: space-between; gap: 10px; }
  .clock { font-size: 24px; }
  .num b { font-size: 18px; }
  .board { display: none; }
  .stage.playing .board { display: none; }
  .stock { right: 10px; bottom: 10px; gap: 2px 10px; font-size: 12px; }
  .tag { min-width: 52px; padding: 5px 7px 6px; }
  .tag b { font-size: 12.5px; }
  .tag span { font-size: 10.5px; }
  .frame { margin: 0 14px; padding: 30px 18px 22px; }
  .frame p { font-size: 15px; }
  .frame .keys { display: none; }
  .wrap.two { grid-template-columns: 1fr; }
  .menu-list li { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .menu-list li .px:nth-of-type(2) { display: none; }
  .menu-list img { width: 44px; height: 44px; }
  .menu-list .buy-it { grid-column: 2 / -1; justify-self: start; }
  .launch .row { grid-template-columns: 1fr; }
  .toast { bottom: 44px; white-space: normal; text-align: center; max-width: 86vw; }
  .foot { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .reveal { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .tag { min-width: 0; padding: 4px 7px 5px; box-shadow: 0 2px 0 var(--deep); }
  .tag span { display: none; }
  .tag[data-station="spill"] span, .tag[data-station="bin"] span { display: block; }
}
