/* Kitchanna — styles
   Warm kitchen palette: cocoa, cream, tomato, butter, basil. Mobile-first,
   portrait, one column. Containers are drawn in CSS and themed per restaurant;
   the art sheets supply ingredients, dishes, characters, décor and VFX. */

:root {
  --cocoa: #2b1a12; --cocoa-2: #3a2419; --cocoa-3: #4d3223;
  --cream: #fff3e0; --cream-dim: #d9c3a5; --cream-2: #f7e6cc;
  --tomato: #e0322e; --tomato-dark: #9c1f1c; --tomato-light: #ff6b5e;
  --butter: #ffcf4d; --butter-dark: #c9962a; --butter-light: #ffe58a;
  --basil: #4caf50; --basil-dark: #2e7d32;
  --sky: #8fd3ff;
  --shadow: rgba(0,0,0,.35);
  --radius: 16px;
  --font-head: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --cw: 64px;   /* container width, set by JS */
  --ih: 44px;   /* item slot height */
  --cols: 5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: var(--font-body); color: var(--cream);
  background: var(--cocoa);
  background-image:
    radial-gradient(ellipse at 50% -10%, #6b3f2a 0%, transparent 55%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 6px, transparent 6px 12px);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
img { -webkit-user-drag: none; user-select: none; pointer-events: none; }
button { font-family: inherit; }
b { font-weight: 800; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; overflow: hidden; }
.screen.active { display: flex; }
[hidden] { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--font-head); font-weight: 700; letter-spacing: .02em;
  padding: 12px 22px; font-size: 17px; color: var(--cream);
  background: var(--cocoa-3); box-shadow: 0 4px 0 rgba(0,0,0,.35);
  transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }
.btn-primary { background: linear-gradient(180deg, var(--tomato-light), var(--tomato)); box-shadow: 0 5px 0 var(--tomato-dark); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn-primary:active { box-shadow: 0 1px 0 var(--tomato-dark); }
.btn-secondary { background: var(--cocoa-3); color: var(--cream); }
.btn-big { font-size: 21px; padding: 15px 28px; width: 100%; max-width: 360px; }
.btn-icon { width: 26px; height: 26px; }
.btn .cost { font-size: 12px; font-family: var(--font-body); font-weight: 700; opacity: .85; margin-left: 4px; }
.row-2 { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.row-2 .btn { flex: 1; }

/* ── Top bar / pills ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 6px;
}
.back-btn {
  color: var(--cream-dim); font-size: 13px; font-weight: 800; letter-spacing: .05em;
  padding: 6px 12px; border: 2px solid var(--cocoa-3); border-radius: 999px; text-decoration: none;
}
.wallet { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--cocoa-2); border: 2px solid var(--cocoa-3); border-radius: 999px;
  padding: 4px 10px 4px 6px; font-size: 14px; color: var(--cream);
}
.pill img { width: 22px; height: 22px; }
.pill .star { color: var(--butter); font-size: 16px; }
.pill.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }
.sound-toggle {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--cocoa-3);
  background: var(--cocoa-2); font-size: 16px; cursor: pointer; color: var(--cream);
}
.sound-toggle.off { opacity: .6; }

/* ── Home ────────────────────────────────────────────────────────────────── */
.home-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; width: 100%; max-width: 480px; margin: 0 auto;
}
.brand { text-align: center; line-height: 1; }
.brand-title {
  font-family: var(--font-head); font-weight: 700; font-size: 44px; margin: 0;
  color: var(--butter); text-shadow: 0 3px 0 var(--butter-dark), 0 6px 14px rgba(0,0,0,.45);
  letter-spacing: .01em;
}
.brand-tag { margin: 6px 0 0; color: var(--cream-dim); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }

.scene-wrap { width: 100%; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.45); border: 3px solid var(--cocoa-3); background: #000; position: relative; }
.scene {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  --wall: #f4c9a4; --wall-dark: #d9a077; --floor: #b97a4a; --floor-dark: #8f5a33; --sky: #8fd3ff;
  background:
    linear-gradient(180deg, var(--wall) 0%, var(--wall-dark) 62%, var(--floor) 62%, var(--floor-dark) 100%);
  overflow: hidden;
}
.scene::before { /* wainscot line */
  content: ''; position: absolute; left: 0; right: 0; top: 62%; height: 3px; background: rgba(0,0,0,.18);
}
.scene::after { /* floor sheen */
  content: ''; position: absolute; inset: 62% 0 0 0; background: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 28px); pointer-events: none;
}
.scene .deco { position: absolute; transform: translate(-50%, -100%); filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.scene .deco.tile { left: 0; right: 0; top: 62%; bottom: 0; transform: none; background-size: 25% auto; background-repeat: repeat; opacity: .9; filter: none; }
.scene .deco.pop { animation: popIn .5s cubic-bezier(.2,1.4,.4,1) both; }
.scene .who { position: absolute; transform: translate(-50%, -100%); filter: drop-shadow(0 6px 6px rgba(0,0,0,.3)); }
.scene .who.waitress { animation: sway 3.2s ease-in-out infinite; }
.scene .who.customer { animation: sway 4.1s ease-in-out infinite reverse; }
@keyframes sway { 50% { transform: translate(-50%, -100%) translateY(-3px); } }
.scene .counter { position: absolute; left: 50%; bottom: 3%; width: 46%; transform: translateX(-50%); filter: drop-shadow(0 8px 8px rgba(0,0,0,.35)); }
.scene-plate { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.65)); display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.rest-name { font-family: var(--font-head); font-size: 18px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.rest-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--cream-2); }
.bar { width: 90px; height: 10px; background: rgba(0,0,0,.45); border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,.2); }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--butter), var(--butter-light)); border-radius: 999px; transition: width .6s ease; }

.home-row { display: flex; gap: 8px; width: 100%; }
.chip {
  flex: 1; border: 2px solid var(--cocoa-3); background: var(--cocoa-2); color: var(--cream);
  border-radius: 999px; padding: 10px 12px; font-size: 13px; font-weight: 800; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.chip .badge-2x { position: absolute; top: -8px; right: 10px; background: var(--butter); color: var(--cocoa); font-style: normal; font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 999px; }
.chip .dot { width: 10px; height: 10px; background: var(--tomato-light); border-radius: 50%; box-shadow: 0 0 0 3px var(--cocoa-2); position: absolute; top: -3px; right: 10px; }
.chip.done { border-color: var(--basil); }
.home-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.home-nav button {
  border: 2px solid var(--cocoa-3); background: var(--cocoa-2); border-radius: 14px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--cream); cursor: pointer; font-size: 11px; font-weight: 800;
}
.home-nav button img { width: 40px; height: 40px; object-fit: contain; }
.home-nav button:active { transform: translateY(2px); }

/* ── Game HUD ────────────────────────────────────────────────────────────── */
#game { background: var(--cocoa); }
#game[data-theme="cart"]   { --counter: #b97a4a; --counter-dark: #8f5a33; --edge: #d9a077; }
#game[data-theme="cafe"]   { --counter: #6d8a6c; --counter-dark: #4c6b4c; --edge: #c9a06a; }
#game[data-theme="pizza"]  { --counter: #b9463a; --counter-dark: #85302a; --edge: #f1d3a5; }
#game[data-theme="sushi"]  { --counter: #2f5079; --counter-dark: #1f3a5f; --edge: #e2d3b3; }
#game[data-theme="bakery"] { --counter: #d98ea3; --counter-dark: #b56b83; --edge: #fbe6ee; }
#game[data-theme="fine"]   { --counter: #4a3a5d; --counter-dark: #2e2340; --edge: #c9b8e0; }
#game[data-theme="endless"]{ --counter: #4d3223; --counter-dark: #2b1a12; --edge: #d9c3a5; }
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 4px;
}
.hud-btn { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--cocoa-3); background: var(--cocoa-2); color: var(--cream); font-size: 13px; cursor: pointer; }
.hud-mid { text-align: center; }
.hud-level { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.hud-moves { font-size: 12px; color: var(--cream-dim); font-weight: 800; }
.hud-moves.over { color: var(--tomato-light); }
.hud-right { min-width: 38px; display: flex; justify-content: flex-end; }
.hud-timer { display: flex; align-items: center; gap: 4px; background: var(--cocoa-2); border: 2px solid var(--cocoa-3); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 15px; }
.hud-timer img { width: 24px; height: 24px; }
.hud-timer.low { border-color: var(--tomato); animation: pulse .6s infinite; }
.hud-fuse { background: #4a1d10; border: 2px solid var(--tomato-dark); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 800; color: var(--butter-light); }
.hud-fuse.low { animation: pulse .5s infinite; border-color: var(--tomato-light); }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ── Order strip ─────────────────────────────────────────────────────────── */
.order {
  display: flex; align-items: center; gap: 8px; margin: 4px 12px 0; padding: 6px 10px;
  background: var(--cream); color: var(--cocoa); border-radius: 18px; box-shadow: 0 4px 0 rgba(0,0,0,.25);
  position: relative;
}
.customer { position: relative; width: 74px; height: 74px; flex: none; }
.customer img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; transition: transform .2s; }
.customer.swap img { animation: swapIn .35s ease; }
@keyframes swapIn { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.bubble { position: absolute; left: 60px; top: -6px; background: #fff; border-radius: 12px; padding: 4px 8px; font-size: 11px; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.2); z-index: 2; }
.bubble::after { content: ''; position: absolute; left: -6px; bottom: 6px; border: 6px solid transparent; border-right-color: #fff; border-left: 0; }
.order-card { flex: 1; min-width: 0; }
.order-kicker { font-size: 10px; letter-spacing: .14em; font-weight: 900; color: var(--tomato); }
.order-name { font-family: var(--font-head); font-size: 19px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-ings { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.order-ings .oi { width: 26px; height: 26px; position: relative; opacity: .55; transition: opacity .3s, transform .3s; }
.order-ings .oi img { width: 100%; height: 100%; object-fit: contain; }
.order-ings .oi.done { opacity: 1; transform: scale(1.1); }
.order-ings .oi.done::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; background: var(--basil); color: #fff; border-radius: 50%; width: 13px; height: 13px; font-size: 9px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.order-dish { width: 58px; height: 58px; flex: none; }
.order-dish img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }

/* ── Board / containers ──────────────────────────────────────────────────── */
.board {
  flex: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 22px 10px; padding: 14px 10px 10px; position: relative;
  min-height: 0;
}
.board::before { /* the counter surface */
  content: ''; position: absolute; left: 8px; right: 8px; bottom: 6px; top: 8px;
  background: linear-gradient(180deg, var(--counter, #6a4530) 0%, var(--counter-dark, #4a2f20) 100%);
  border-radius: 22px; border: 3px solid var(--edge, #d9a077); opacity: .55; z-index: 0;
}
.cont {
  position: relative; width: var(--cw); height: calc(var(--ih) * 4 + 22px);
  display: flex; flex-direction: column-reverse; align-items: center; padding: 0 0 10px;
  cursor: pointer; z-index: 1; transition: transform .15s;
  border-radius: 8px 8px 20px 20px;
}
.cont .vessel {
  position: absolute; inset: 0; border-radius: 8px 8px 20px 20px; z-index: 0;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,.25), inset 0 4px 6px rgba(255,255,255,.18), 0 6px 0 rgba(0,0,0,.35);
  border: 3px solid rgba(0,0,0,.25);
}
.cont .rim {
  position: absolute; left: -6px; right: -6px; top: -5px; height: 12px; border-radius: 6px; z-index: 3;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.cont.t-tray .vessel { background: linear-gradient(180deg, #d9a26a, #a86f3d); }
.cont.t-tray .rim { background: linear-gradient(180deg, #e7b77f, #b8804d); }
.cont.t-jar .vessel { background: linear-gradient(180deg, rgba(220,240,255,.55), rgba(180,210,240,.5)); border-color: rgba(255,255,255,.55); }
.cont.t-jar .rim { background: linear-gradient(180deg, #d7a86e, #a3743f); }
.cont.t-pot .vessel { background: linear-gradient(180deg, #e04a3f, #9e2820); }
.cont.t-pot .rim { background: linear-gradient(180deg, #4a4a4a, #222); }
.cont.t-bamboo .vessel { background: repeating-linear-gradient(90deg, #d9b36e 0 8px, #c29a55 8px 10px); }
.cont.t-bamboo .rim { background: linear-gradient(180deg, #8a6a3a, #5f4525); }
.cont.t-canister .vessel { background: linear-gradient(180deg, #fff7ea, #e3d3b8); }
.cont.t-canister .rim { background: linear-gradient(180deg, #d7a86e, #a3743f); }
.cont.t-silver .vessel { background: linear-gradient(180deg, #e9e9ec, #9a9aa3); }
.cont.t-silver .rim { background: linear-gradient(180deg, #f5f5f7, #b0b0b8); }
.cont .items { position: relative; z-index: 2; display: flex; flex-direction: column-reverse; align-items: center; width: 100%; }
.item {
  width: calc(var(--cw) - 12px); height: var(--ih); display: flex; align-items: center; justify-content: center;
  flex: none; position: relative;
}
.item img { width: calc(var(--ih) + 4px); height: calc(var(--ih) + 4px); object-fit: contain; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.item.hidden-item img { filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)) saturate(.6); }
.item.ghost { visibility: hidden; }
.item.landed img { animation: land .28s cubic-bezier(.2,1.6,.4,1); }
@keyframes land { 0% { transform: scale(1.25, .8); } 60% { transform: scale(.92, 1.1); } 100% { transform: scale(1); } }
.cont.selected { transform: translateY(-6px); }
.cont.selected .lift { transform: translateY(-34px) scale(1.06); }
.cont .lift { transition: transform .16s cubic-bezier(.2,1.2,.4,1); }
.cont.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px) rotate(-2deg); } 75% { transform: translateX(5px) rotate(2deg); } }
.cont.complete .vessel { box-shadow: 0 0 0 3px var(--butter), 0 0 24px var(--butter), 0 6px 0 rgba(0,0,0,.35); }
.cont.complete { cursor: default; }
.cont .check { position: absolute; top: -18px; right: -12px; width: 34px; height: 34px; z-index: 5; animation: popIn .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.cont .hint-ring { position: absolute; left: 50%; top: 50%; width: 130%; height: 130%; transform: translate(-50%, -50%); z-index: 6; animation: ringPulse .7s ease-in-out infinite alternate; pointer-events: none; }
@keyframes ringPulse { from { transform: translate(-50%, -50%) scale(.95); opacity: .7; } to { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } }

/* twists */
.cont.frozen .ice { position: absolute; inset: -4px; z-index: 4; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(190,235,255,.55), rgba(120,190,240,.65)); border-radius: 10px 10px 22px 22px; border: 2px solid rgba(255,255,255,.7); }
.cont.frozen .ice img { width: 70%; }
.cont.frozen .ice .ice-n { position: absolute; bottom: 6px; right: 6px; background: #1b6fa8; color: #fff; font-weight: 900; font-size: 12px; border-radius: 999px; padding: 1px 7px; }
.cont.thaw .ice { animation: crack .35s ease both; }
@keyframes crack { 30% { transform: scale(1.06) rotate(-2deg); } 100% { opacity: 0; transform: scale(1.2); } }
.cont.locked .lock { position: absolute; inset: -4px; z-index: 4; display: flex; align-items: center; justify-content: center; background: rgba(40,20,10,.7); border-radius: 10px 10px 22px 22px; }
.cont.locked .lock img { width: 78%; }
.cont.unlocking .lock { animation: crack .45s ease both; }
.cont.stacked .plates { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); width: 110%; z-index: 3; }
.cont.stacked .vessel { border-style: dashed; border-color: rgba(255,255,255,.55); }
.cont.burning { transform: translateY(-4px); }
.cont.burning .stove { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); width: 120%; z-index: 0; }
.cont.burning .flames { position: absolute; left: 0; right: 0; bottom: -8px; height: 26px; z-index: 3; pointer-events: none; }
.cont.burning .flames i { position: absolute; bottom: 0; width: 14px; height: 22px; background: radial-gradient(ellipse at 50% 100%, #fff3a0 0%, #ff9d2e 45%, rgba(224,50,46,0) 75%); border-radius: 50% 50% 40% 40%; animation: flame .35s ease-in-out infinite alternate; }
.cont.burning .flames i:nth-child(1) { left: 10%; animation-delay: .1s; }
.cont.burning .flames i:nth-child(2) { left: 40%; height: 28px; }
.cont.burning .flames i:nth-child(3) { left: 68%; animation-delay: .2s; }
@keyframes flame { from { transform: scaleY(.8) translateY(2px); opacity: .8; } to { transform: scaleY(1.15); opacity: 1; } }
.cont.burning.low .flames i { animation-duration: .18s; background: radial-gradient(ellipse at 50% 100%, #fff 0%, #ff5d2e 45%, rgba(224,50,46,0) 75%); }
.cont.extra .vessel { border-style: dashed; }

/* ── Boosters bar ────────────────────────────────────────────────────────── */
.boosters {
  display: flex; justify-content: center; gap: 12px; padding: 6px 12px calc(12px + env(safe-area-inset-bottom));
}
.booster {
  position: relative; width: 70px; border: none; background: var(--cocoa-2); border-radius: 16px; padding: 6px 4px 5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--cream-dim);
  box-shadow: 0 4px 0 rgba(0,0,0,.35); border: 2px solid var(--cocoa-3);
}
.booster:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.booster img { width: 40px; height: 40px; object-fit: contain; }
.bst-label { font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.bst-count { position: absolute; top: -8px; right: -6px; background: var(--basil); color: #fff; font-style: normal; font-weight: 900; font-size: 11px; min-width: 20px; height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--cocoa); }
.bst-count.zero { background: var(--butter); color: var(--cocoa); }
.booster.busy { animation: pulse .6s infinite; }
.booster:disabled { opacity: .5; }

/* ── FX layer ────────────────────────────────────────────────────────────── */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 400; overflow: hidden; }
.fx-layer .fly { position: absolute; width: calc(var(--ih) + 4px); height: calc(var(--ih) + 4px); object-fit: contain; filter: drop-shadow(0 6px 5px rgba(0,0,0,.4)); will-change: transform; }
.fx-layer .spark { position: absolute; width: 60px; height: 60px; object-fit: contain; animation: sparkOut .7s ease-out both; }
@keyframes sparkOut { 0% { transform: scale(.4) rotate(0deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.4) rotate(25deg); opacity: 0; } }
.fx-layer .float-text { position: absolute; font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--butter-light); text-shadow: 0 2px 0 var(--cocoa), 0 0 12px rgba(0,0,0,.5); animation: floatUp 1s ease-out both; white-space: nowrap; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.8); opacity: 0; } 20% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { transform: translateY(-60px) scale(1); opacity: 0; } }
.fx-layer .coin { position: absolute; width: 30px; height: 30px; object-fit: contain; will-change: transform; }

/* coach marks */
.coach { position: absolute; z-index: 40; pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.coach-hand { font-size: 40px; animation: tapTap .9s ease-in-out infinite; filter: drop-shadow(0 4px 4px rgba(0,0,0,.5)); }
@keyframes tapTap { 50% { transform: translateY(-12px) scale(.92); } }
.coach-text { background: var(--cream); color: var(--cocoa); font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 12px; max-width: 220px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,.4); }

/* ── Overlays / cards / panels ───────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(20,10,6,.78); backdrop-filter: blur(3px); padding: 16px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.card { background: var(--cream); color: var(--cocoa); border-radius: 24px; padding: 22px 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: cardIn .3s cubic-bezier(.2,1.3,.4,1); }
@keyframes cardIn { from { transform: translateY(30px) scale(.95); opacity: 0; } }
.card-title { font-family: var(--font-head); font-size: 30px; font-weight: 700; }
.card-text { margin: 0; text-align: center; color: #6b4a3a; font-weight: 700; line-height: 1.4; }
.results-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.fail-img { width: 120px; height: 120px; object-fit: contain; animation: wobble 1.2s ease-in-out infinite; }
@keyframes wobble { 50% { transform: rotate(3deg) translateY(-3px); } }

.panel { align-items: flex-end; padding: 0; }
.panel-card { background: var(--cream); color: var(--cocoa); width: 100%; max-width: 520px; max-height: 92vh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: slideUp .3s cubic-bezier(.2,1.1,.4,1); margin: 0 auto; }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; }
.panel-head h2 { flex: 1; margin: 0; font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.panel-close { width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.08); font-size: 16px; cursor: pointer; color: var(--cocoa); }
.panel-head .pill { background: #fff; border-color: #e8d7bf; color: var(--cocoa); }
.panel-body { overflow-y: auto; padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.tabs { display: flex; gap: 6px; padding: 0 18px 8px; }
.tabs button { flex: 1; border: 2px solid #e8d7bf; background: #fff; border-radius: 999px; padding: 8px; font-weight: 900; color: #8a6a55; cursor: pointer; }
.tabs button.on { background: var(--cocoa); color: var(--cream); border-color: var(--cocoa); }

/* how to */
.howto-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.howto-step img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.howto-step h3, .howto-h { margin: 0 0 2px; font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.howto-step p { margin: 0; font-size: 14px; line-height: 1.45; color: #5a3f30; font-weight: 600; }
.howto-h { margin: 16px 0 8px; }
.howto-twists { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.howto-twists li { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 14px; padding: 8px 10px; font-size: 13px; color: #5a3f30; font-weight: 600; }
.howto-twists img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.howto-foot { font-size: 12px; color: #8a6a55; margin: 16px 0 0; font-weight: 700; }
.howto-foot a { color: var(--tomato); }

/* shop */
.shop-group { margin-bottom: 14px; }
.shop-group h3 { margin: 6px 0 8px; font-family: var(--font-head); font-size: 17px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.shop-group h3 small { font-size: 11px; color: #8a6a55; font-family: var(--font-body); font-weight: 800; }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-item { background: #fff; border-radius: 16px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 2px solid #eadbc4; }
.shop-item img { width: 56px; height: 56px; object-fit: contain; }
.shop-item .si-name { font-size: 11px; font-weight: 900; line-height: 1.15; min-height: 26px; display: flex; align-items: center; }
.shop-item .si-charm { font-size: 10px; color: #8a6a55; font-weight: 800; }
.shop-item button { border: none; border-radius: 999px; background: var(--butter); color: var(--cocoa); font-weight: 900; font-size: 12px; padding: 5px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.shop-item button img { width: 16px; height: 16px; }
.shop-item button:disabled { background: #e8d7bf; color: #a08a76; cursor: default; }
.shop-item.owned { border-color: var(--basil); }
.shop-item.owned button { background: var(--basil); color: #fff; }
.shop-item.locked { opacity: .55; }
.shop-item .si-desc { font-size: 10px; color: #8a6a55; font-weight: 700; }
.shop-item .si-own { font-size: 10px; color: var(--basil-dark); font-weight: 900; }

/* map */
.map-item { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 18px; padding: 10px 12px; margin-bottom: 10px; border: 2px solid #eadbc4; }
.map-item img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.map-item.current { border-color: var(--butter); box-shadow: 0 0 0 3px rgba(255,207,77,.35); }
.map-item.lockedr { opacity: .6; filter: grayscale(.5); }
.map-item .mi-name { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.map-item .mi-tag { font-size: 12px; color: #8a6a55; font-weight: 700; }
.map-item .mi-bar { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 900; color: #5a3f30; }
.map-item .bar { background: #eadbc4; }
.map-item .mi-stars { font-size: 12px; color: var(--butter-dark); font-weight: 900; }
.map-item button { margin-left: auto; }

/* events */
.event-card { background: #fff; border-radius: 18px; padding: 12px 14px; margin-bottom: 10px; border: 2px solid #eadbc4; }
.event-card .ev-head { display: flex; align-items: center; gap: 8px; }
.event-card .ev-name { font-family: var(--font-head); font-size: 19px; font-weight: 700; flex: 1; }
.event-card .ev-days { font-size: 11px; font-weight: 900; color: var(--tomato); }
.event-card p { margin: 6px 0 8px; font-size: 13px; color: #5a3f30; font-weight: 600; line-height: 1.4; }
.event-card .ev-levels { display: flex; gap: 6px; margin-bottom: 8px; }
.event-card .ev-levels i { flex: 1; height: 10px; border-radius: 999px; background: #eadbc4; }
.event-card .ev-levels i.done { background: var(--basil); }
.event-card .ev-reward { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #5a3f30; }
.event-card .ev-reward img { width: 40px; height: 40px; object-fit: contain; }
.event-card.past { opacity: .6; }
.event-card .ev-actions { margin-top: 8px; }
.event-empty { text-align: center; color: #8a6a55; font-weight: 700; padding: 20px 0; }

/* leaderboard */
.lb-blurb { margin: 0 0 8px; font-size: 13px; color: #8a6a55; font-weight: 700; }
.leaderboard { background: #fff; border-radius: 18px; padding: 10px 12px; border: 2px solid #eadbc4; }
.lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lb-title { font-weight: 900; font-size: 13px; letter-spacing: .08em; }
.lb-rank { font-size: 12px; font-weight: 900; color: var(--tomato); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #f2e6d3; font-size: 14px; font-weight: 700; }
.lb-list li.me { background: #fff6dc; border-radius: 8px; }
.lb-pos { width: 24px; color: #8a6a55; font-weight: 900; }
.lb-name { flex: 1; }
.lb-score { font-weight: 900; color: var(--butter-dark); }
.lb-loading, .lb-empty { color: #8a6a55; justify-content: center; }
.lb-footer { font-size: 12px; margin-top: 8px; color: #5a3f30; font-weight: 700; text-align: center; }
.lb-footer a { color: var(--tomato); }
.lb-edit { border: none; background: none; cursor: pointer; font-size: 12px; color: #8a6a55; }
.lb-nick-form { display: flex; gap: 6px; justify-content: center; }
.lb-nick-input { border: 2px solid #eadbc4; border-radius: 999px; padding: 6px 10px; font-family: inherit; font-weight: 800; width: 140px; }
.lb-nick-save { border: none; background: var(--cocoa); color: var(--cream); border-radius: 999px; padding: 6px 12px; font-weight: 900; cursor: pointer; }

/* ── Cook → plate → serve ────────────────────────────────────────────────── */
.cook { background: rgba(20,10,6,.86); flex-direction: column; justify-content: flex-start; padding: 0; }
.cook-stage { position: relative; width: 100%; max-width: 480px; height: 46vh; min-height: 300px; overflow: hidden; }
.cook-title { position: absolute; top: 22px; left: 0; right: 0; text-align: center; font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--butter-light); text-shadow: 0 3px 0 var(--butter-dark); opacity: 0; transition: opacity .3s; }
.cook-title.show { opacity: 1; }
.cook-vessel { position: absolute; left: 50%; top: 50%; width: 180px; height: 180px; object-fit: contain; transform: translate(-50%, -40%) scale(0); filter: drop-shadow(0 10px 10px rgba(0,0,0,.5)); }
.cook-vessel.in { animation: vesselIn .5s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes vesselIn { to { transform: translate(-50%, -40%) scale(1); } }
.cook-vessel.cooking { animation: cookShake .12s ease-in-out infinite; transform: translate(-50%, -40%) scale(1); }
@keyframes cookShake { 0%, 100% { transform: translate(-50%, -40%) scale(1) rotate(-1.5deg); } 50% { transform: translate(-50%, -40%) scale(1.02) rotate(1.5deg); } }
.cook-vessel.out { animation: vesselOut .4s ease-in forwards; }
@keyframes vesselOut { to { transform: translate(-50%, -40%) scale(0); opacity: 0; } }
.cook-steam { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.cook-steam img { position: absolute; width: 70px; height: 70px; left: -35px; top: -110px; opacity: 0; animation: steamUp 1.4s ease-out infinite; }
.cook-steam img:nth-child(2) { animation-delay: .45s; left: -60px; }
.cook-steam img:nth-child(3) { animation-delay: .9s; left: -10px; }
@keyframes steamUp { 0% { transform: translateY(20px) scale(.5); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(-90px) scale(1.3); opacity: 0; } }
.cook-burst { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; object-fit: contain; transform: translate(-50%, -50%) scale(0); opacity: 0; }
.cook-burst.go { animation: burst .7s ease-out forwards; }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
.cook-ring { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; object-fit: contain; transform: translate(-50%, -50%) scale(.6); opacity: 0; }
.cook-ring.go { animation: ringIn .9s ease-out forwards; }
@keyframes ringIn { 0% { transform: translate(-50%, -50%) scale(.4) rotate(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.3) rotate(30deg); opacity: 0; } }
.cook-plate { position: absolute; left: 50%; top: 50%; width: 150px; height: 150px; transform: translate(-50%, -50%) scale(0); }
.cook-plate::before { content: ''; position: absolute; left: 5%; right: 5%; top: 40%; bottom: 5%; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #fff 0%, #e6e0d6 60%, #c9c0b2 100%); box-shadow: 0 10px 14px rgba(0,0,0,.45); }
.cook-plate img { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; object-fit: contain; transform: translate(-50%, -55%); filter: drop-shadow(0 6px 6px rgba(0,0,0,.4)); }
.cook-plate.in { animation: plateIn .55s cubic-bezier(.2,1.5,.4,1) forwards; }
@keyframes plateIn { to { transform: translate(-50%, -50%) scale(1); } }
.cook-plate.serve { transition: transform .9s cubic-bezier(.4,0,.2,1); }
.cook-waitress { position: absolute; left: -110%; bottom: 0; height: 88%; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(0,0,0,.5)); transition: left .9s cubic-bezier(.4,0,.2,1); }
.cook-waitress.walk { animation: bob .35s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.cook-customer { position: absolute; right: -110%; bottom: 0; height: 72%; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(0,0,0,.5)); transition: right .6s cubic-bezier(.2,1.2,.4,1); }
.cook-customer.bounce { animation: bounceIn .6s cubic-bezier(.2,1.5,.4,1); }
@keyframes bounceIn { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
.cook-sparkles img { position: absolute; width: 70px; height: 70px; object-fit: contain; animation: sparkOut .9s ease-out both; }

.results { width: 100%; max-width: 420px; background: var(--cream); color: var(--cocoa); border-radius: 26px 26px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: slideUp .4s cubic-bezier(.2,1.2,.4,1); }
.results-kicker { font-family: var(--font-head); font-size: 28px; font-weight: 700; letter-spacing: .04em; color: var(--tomato); }
.results-stars { display: flex; gap: 10px; font-size: 46px; line-height: 1; }
.rstar { color: #d9cbb5; transition: none; }
.rstar.on { color: var(--butter); text-shadow: 0 3px 0 var(--butter-dark), 0 0 18px rgba(255,207,77,.6); animation: starPop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes starPop { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
.results-rows { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 4px; font-weight: 800; color: #5a3f30; }
.rrow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.rrow span { display: flex; align-items: center; gap: 5px; }
.rrow img { width: 20px; height: 20px; }
.rrow.total { border-top: 2px dashed #e0cfb5; padding-top: 6px; margin-top: 2px; font-size: 18px; color: var(--cocoa); }
.results-note { font-size: 12px; font-weight: 800; color: var(--basil-dark); min-height: 14px; text-align: center; }

/* splash */
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 360px; animation: cardIn .4s cubic-bezier(.2,1.3,.4,1); }
.splash-inner img { width: 200px; height: 200px; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.splash-kicker { font-size: 12px; letter-spacing: .18em; font-weight: 900; color: var(--butter); }
.splash-title { font-family: var(--font-head); font-size: 34px; font-weight: 700; }
.splash-text { margin: 0 0 8px; color: var(--cream-dim); font-weight: 700; line-height: 1.4; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--cream); color: var(--cocoa); font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.5); z-index: 300; animation: toastIn .25s ease; max-width: 90vw; text-align: center; }
@keyframes toastIn { from { transform: translateX(-50%) translateY(10px); opacity: 0; } }

/* auth badge (shared auth-ui.js) */
.auth-badge { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 60px; z-index: 200; }
#game.active ~ .auth-badge { display: none; }
.auth-icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--cocoa-3); background: var(--cocoa-2); color: var(--cream); font-size: 13px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.auth-dropdown { position: absolute; top: 40px; right: 0; min-width: 180px; background: var(--cocoa-2); border: 2px solid var(--cocoa-3); border-radius: 14px; box-shadow: 0 4px 16px var(--shadow); padding: 6px 0; z-index: 201; }
.auth-dropdown-email { padding: 8px 14px; font-size: 11px; color: var(--cream-dim); border-bottom: 1px solid var(--cocoa-3); word-break: break-all; }
.auth-dropdown-item { display: block; width: 100%; padding: 8px 14px; font-size: 12px; color: var(--cream); font-family: inherit; background: none; border: none; text-decoration: none; text-align: left; cursor: pointer; }
.auth-dropdown-item:hover { background: var(--cocoa-3); }

/* ── Small / large screens ───────────────────────────────────────────────── */
@media (max-height: 680px) {
  .brand-title { font-size: 34px; }
  .home-body { gap: 8px; }
  .customer { width: 60px; height: 60px; }
  .order-dish { width: 46px; height: 46px; }
  .booster img { width: 32px; height: 32px; }
}
@media (min-width: 600px) {
  #game { left: 50%; right: auto; width: 520px; margin-left: -260px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
