:root { --ink: #2b1d14; --cream: #fff6e6; --tomato: #e8402e; --mint: #2f6f66; --gold: #ffc233;
  --font: "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, "Noto Color Emoji";
  --gs-bg: #fff6e6; --gs-fg: #2b1d14; --gs-hi: #ffc233; --gs-accent: #e8402e; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2f6f66; color: var(--ink); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: var(--ink); background: var(--cream); border: 3px solid var(--ink); border-radius: 14px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); font-weight: 700; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button.primary { background: var(--tomato); color: #fff; }
button.big { font-size: 26px; padding: 14px 38px; }
button:focus-visible, button.sel { outline: 4px solid var(--gold); outline-offset: 2px; }
kbd { font: 12px/1 ui-monospace, monospace; border: 1.5px solid currentColor; border-radius: 5px; padding: 2px 5px; margin-left: 6px; opacity: .75; vertical-align: 2px; }
.touch-only, .pad-only { display: none; }
body.touch .touch-only { display: inline; } body.touch .mouse-only { display: none; }
body.pad .pad-only { display: inline; } body.pad .mouse-only, body.pad .touch-only { display: none; }
.dim { opacity: .7; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }

/* screens */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20;
  background: rgba(20, 40, 36, .45); overflow-y: auto; }
.screen[hidden], .how[hidden], #hud[hidden] { display: none; }
.card { background: var(--cream); border: 4px solid var(--ink); border-radius: 24px; padding: 22px 20px; text-align: center;
  box-shadow: 0 8px 0 var(--ink); max-width: 360px; width: 100%; margin: auto; }
.card.wide { max-width: 440px; }
#title { background: linear-gradient(rgba(20,40,36,.15), rgba(20,40,36,.55)); }
#title h1 { font-size: 52px; line-height: .95; margin: 4px 0 10px; color: var(--tomato); letter-spacing: -1px;
  text-shadow: 3px 3px 0 var(--ink); -webkit-text-stroke: 1.5px var(--ink); }
.tag { margin: 0 0 18px; font-size: 16px; }
h2 { margin: 0 0 6px; font-size: 28px; }
.sub { margin: 0 0 12px; }

/* HUD */
#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 5; pointer-events: none; padding: max(6px, env(safe-area-inset-top)) 8px 0; }
#topbar { display: flex; align-items: center; gap: 8px; }
#score { background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; padding: 2px 10px; font-weight: 800; font-size: 22px; min-width: 96px; }
#score small { font-size: 11px; margin-left: 4px; opacity: .6; font-weight: 700; }
#score.bump { animation: pop .25s; }
#balls { flex: 1; display: flex; gap: 4px; justify-content: center; }
#balls i { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #b86a45, #6b341c); border: 2.5px solid var(--ink); }
#balls i.used { opacity: .25; }
#pauseBtn { pointer-events: auto; min-width: 44px; padding: 6px 10px; font-size: 16px; letter-spacing: -2px; }
#boardBox { margin: 6px auto 0; max-width: 360px; background: #c98b4a; border: 3px solid var(--ink); border-radius: 14px; padding: 5px 6px 4px;
  box-shadow: 0 4px 0 rgba(0,0,0,.35); }
#board { display: flex; gap: 5px; justify-content: center; }
#board i { flex: 1; max-width: 56px; aspect-ratio: 1; border-radius: 10px; background: rgba(255,246,230,.35); border: 2px dashed rgba(43,29,20,.35);
  display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 30px; }
#board i.f { background: var(--cream); border: 2px solid var(--ink); animation: pop .22s; }
#board i.ghost { opacity: .45; border-style: dotted; }
#board.cooking i { transition: transform .45s cubic-bezier(.5,-0.4,.8,.5), opacity .45s; transform: translateY(60px) scale(.3) rotate(25deg); opacity: 0; }
#ghost { font-size: 14px; font-weight: 700; text-align: center; padding: 3px 2px 0; color: var(--ink); min-height: 20px; }
#ghost b { color: #fff; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); }
@keyframes toastPop { 0% { transform: translateX(-50%) scale(.6); } 60% { transform: translateX(-50%) scale(1.15); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

#launchHint, #flipHint { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22%; z-index: 6; background: var(--cream); border: 3px solid var(--ink);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; pointer-events: none; white-space: nowrap; animation: bob 1.2s ease-in-out infinite; }
#flipHint { bottom: 30%; }
@keyframes bob { 50% { transform: translate(-50%, -6px); } }

/* the cooked dish */
/* Round 3: the card sits over the HUD (the board it was cooked from), not over the top bumpers */
#dish { position: fixed; left: 50%; top: calc(max(6px, env(safe-area-inset-top)) + 30px); transform: translate(-50%, 0); z-index: 8; text-align: center; pointer-events: none; width: 92%; max-width: 380px; }
#dish.show { animation: dishIn .35s cubic-bezier(.2,1.6,.4,1); }
#dish.out { transition: opacity .35s, transform .35s; opacity: 0; transform: translate(-50%, -30px); }
@keyframes dishIn { 0% { transform: translate(-50%, 0) scale(.3); opacity: 0; } 100% { transform: translate(-50%, 0) scale(1); opacity: 1; } }
.pan { position: relative; margin: 0 auto 4px; width: 130px; height: 46px; background: radial-gradient(ellipse at 50% 40%, #555 0 55%, #222 70%); border: 4px solid var(--ink);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pan::after { content: ''; position: absolute; right: -58px; top: 15px; width: 62px; height: 14px; background: #3a2a20; border: 3px solid var(--ink); border-radius: 8px; }
#dishIngs { font-size: 21px; letter-spacing: -4px; }
.steam { position: absolute; left: 0; right: 0; top: -30px; height: 34px; }
.steam i { position: absolute; bottom: 0; width: 18px; height: 18px; background: rgba(255,255,255,.85); border-radius: 50%; animation: steam 1.1s ease-out infinite; }
.steam i:nth-child(1) { left: 34%; } .steam i:nth-child(2) { left: 48%; animation-delay: .3s; } .steam i:nth-child(3) { left: 62%; animation-delay: .6s; }
@keyframes steam { 0% { transform: translateY(10px) scale(.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-34px) scale(1.6); opacity: 0; } }
#dishName { display: inline-block; font-size: 25px; font-weight: 900; color: #fff; background: var(--tomato); border: 4px solid var(--ink); border-radius: 14px;
  padding: 4px 14px; box-shadow: 0 5px 0 var(--ink); line-height: 1.1; }
#dish.recipe #dishName { background: #2f9e57; font-size: 28px; }
#dish.kiss #dishName { background: linear-gradient(90deg, #ff5f6d, #ffc233); }
#dish.small #dishName { font-size: 19px; background: var(--cream); color: var(--ink); }
#dishSub { margin-top: 6px; font-weight: 800; font-size: 17px; color: #fff; text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
#toast { position: fixed; left: 50%; top: 52%; transform: translateX(-50%); z-index: 9; background: var(--gold); border: 3px solid var(--ink); border-radius: 12px;
  padding: 6px 14px; font-weight: 800; pointer-events: none; animation: toastPop .25s; width: max-content; max-width: 90vw; text-align: center; }
.fly { position: fixed; z-index: 7; font-size: 34px; pointer-events: none; transition: transform .42s cubic-bezier(.4,.1,.6,1), opacity .42s; will-change: transform; }

/* pick cards */
#cards { display: flex; gap: 8px; margin: 6px 0 12px; }
.icard { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; font-weight: 600; font-size: 12.5px; line-height: 1.25; min-width: 0; }
.icard .em { font-size: 40px; line-height: 1; }
.icard .nm { font-size: 16px; font-weight: 900; }
.icard .rc { color: #2f6f66; }
.icard .sw { opacity: .75; }
.icard .od { background: #fff; border: 1.5px solid var(--ink); border-radius: 8px; padding: 2px 5px; }
#skipBtn { font-size: 14px; }

/* result */
#stars { font-size: 40px; letter-spacing: 4px; margin: 2px 0; }
#stars .off { filter: grayscale(1); opacity: .3; }
#resScore { font-size: 30px; font-weight: 900; margin: 0; }
#resDishes { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 8px 0; max-height: 96px; overflow-y: auto; }
#resDishes span { background: #fff; border: 2px solid var(--ink); border-radius: 9px; padding: 2px 7px; font-size: 13px; font-weight: 700; }
#resDishes span.r { background: #c9f0d6; }
#vote .q { margin: 12px 0 6px; font-weight: 800; }
#vote .opts { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; }
#vote .opts button { flex: 0 0 auto; font-size: 13px; padding: 6px 10px; min-height: 40px; }
.door { font-size: 14px; margin-top: 8px; background: #eee3cf; }
#doorThanks, #voteThanks { margin: 8px 0; font-weight: 700; }
#doorThanks a { color: var(--mint); }
[data-wefav-row] { margin-top: 12px; }

/* cookbook */
#bookList { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 14px; text-align: left; max-height: 52vh; overflow-y: auto; }
#bookList div { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 5px 8px; font-size: 13px; font-weight: 700; }
#bookList div.no { background: #eee3cf; color: #8a7a66; }
#bookList .e { display: block; font-size: 17px; letter-spacing: -2px; }
#bookList h3 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 16px; }

/* how to play */
.how { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 520px); max-height: 86vh; overflow-y: auto;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 20px; padding: 18px 20px; box-shadow: 0 8px 0 var(--ink); line-height: 1.4; font-size: 15px; user-select: text; -webkit-user-select: text; }
.how h2 { font-size: 22px; padding-right: 40px; } .how h3 { margin: 12px 0 4px; font-size: 17px; }
.how ul { padding-left: 20px; margin: 4px 0; } .how dt { font-weight: 800; margin-top: 6px; } .how dd { margin: 0 0 4px; }
.how a { color: var(--mint); }
.how-close { position: sticky; float: right; top: 0; font-size: 22px; padding: 0 12px; }

/* desktop: the board sits in the left margin */
@media (min-aspect-ratio: 1/1) and (min-width: 800px) {
  #hud { padding: 20px; }
  #topbar { position: fixed; left: 20px; top: 20px; width: 300px; }
  #boardBox { position: fixed; left: 20px; top: 84px; width: 300px; margin: 0; }
  #board i { font-size: 34px; }
  #ghost { font-size: 15px; }
  #pauseBtn { position: fixed; right: 20px; top: 20px; }
  #dish { left: 170px; top: 250px; width: 320px; }
}

button.daily { display: block; margin: 10px auto 0; background: var(--gold); font-size: 18px; }
#endlessBox { margin: 6px 0; }
#endlessBox .gs-panel { margin: 0 auto; max-width: 320px; }
#nameBtn { margin-top: 6px; font-size: 14px; background: var(--gold); }
button.link { background: none; border: none; box-shadow: none; text-decoration: underline; font-size: 14px; min-height: 36px; padding: 4px 8px; }
button .new { font-size: 11px; font-weight: 900; background: var(--tomato); color: #fff; border-radius: 6px; padding: 1px 5px; vertical-align: 3px; }
body[data-table="sushi"] { background: #1e2a44; }
body[data-table="tacos"] { background: #7a2e1f; }

/* round 4: the critic */
#order { margin: 6px auto 0; max-width: 360px; display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 3px 8px; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
#order[hidden] { display: none; }
#order .who { background: #ff4f9a; color: #fff; border-radius: 7px; padding: 0 6px; font-size: 12px; }
#order .tk { display: inline-flex; gap: 3px; }
#order .tk i { font-style: normal; font-size: 18px; opacity: .35; filter: grayscale(.8); transition: opacity .2s, transform .2s; }
#order .tk i.on { opacity: 1; filter: none; transform: scale(1.15); }
#order.done { background: #c9f0d6; }
#order .ok { color: #2f9e57; }
#dish.critic #dishName { background: #ff4f9a; }
.order-line { background: #ffe1ee; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 8px; font-weight: 700; font-size: 14px; margin: 6px 0; }
#review { margin: 6px 0; }
#review .forks { font-size: 30px; }
#review .forks .off { opacity: .2; filter: grayscale(1); }
#review .quote { font-style: italic; font-weight: 700; margin: 2px 0 6px; }
#review ul { list-style: none; padding: 0; margin: 0 0 4px; font-size: 13px; font-weight: 700; text-align: left; display: inline-block; }
#review li.no { opacity: .55; }
#review li.ok { color: #2f7a46; }
@media (min-aspect-ratio: 1/1) and (min-width: 800px) {
  #order { position: fixed; left: 20px; top: 214px; width: 300px; margin: 0; box-sizing: border-box; font-size: 15px; }
  body:has(#order:not([hidden])) #dish { top: 290px; }
}

/* round 6: one path, the chef rank, mastery medals, endless */
.best { margin: -8px 0 12px; font-size: 18px; font-weight: 800; min-height: 1px; }
.best b { font-size: 24px; color: var(--tomato); }
#playSub { font-size: 13px; margin: 6px 0 0; min-height: 0; }
#playSub:empty { display: none; }
button.endless { background: #b9a4ff; }
#endlessLine { font-size: 13px; margin: 6px 0 0; }
#path { margin: 14px 0 4px; }
.rank { text-align: left; }
.rank .rk { display: flex; justify-content: space-between; font-size: 14px; }
.rank .rk span { opacity: .55; font-weight: 700; }
.rank .bar { height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; margin: 3px 0; }
.rank .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--tomato)); border-radius: 999px; transition: width .6s; }
.rank small { display: block; font-size: 12.5px; font-weight: 700; }
#pathSteps { list-style: none; display: flex; justify-content: space-between; gap: 4px; padding: 0; margin: 8px 0 0; }
#pathSteps li { flex: 1; font-size: 11px; font-weight: 700; opacity: .4; line-height: 1.15; }
#pathSteps li span { display: block; font-size: 20px; }
#pathSteps li.on { opacity: 1; }
#pathSteps li.next { opacity: .9; color: var(--tomato); }
#pathSteps li.next span { animation: pop 1.4s ease-in-out infinite; }
#resRank { margin: 8px 0 0; }
#resRank .gain { font-size: 12.5px; margin: 2px 0 0; font-weight: 700; text-align: left; }
#rankUp { background: var(--gold); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 8px; margin: 8px 0 0; animation: pop .4s; }
#rankUp[hidden] { display: none; }
#rankUp b { display: block; font-size: 18px; }
#rankUp span { display: block; font-size: 13.5px; font-weight: 700; }
#goal { font-weight: 800; font-size: 15px; margin: 10px 0 4px; color: var(--mint); }
#hudBest { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 10px; padding: 1px 7px; font-weight: 800; font-size: 13px; }
#hudBest:empty { display: none; }
#balls b { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 10px; padding: 1px 8px; font-size: 14px; }
#bookList div { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#bookList div .e { flex-basis: 100%; }
#bookList .n { flex: 1; text-align: left; }
#bookList .md i { font-style: normal; opacity: .15; filter: grayscale(1); }
#bookList .md i.on { opacity: 1; filter: none; }
button[hidden], p[hidden] { display: none !important; }
