:root {
  --red: #e8563a;
  --red-d: #b8381f;
  --cream: #fff7ea;
  --paper: #fffdf8;
  --ink: #3a2a20;
  --ink-soft: #7a6555;
  --yellow: #ffc83a;
  --green: #4cc76b;
  --blue: #3d8bf0;
  --shadow: 0 6px 0 rgba(58, 42, 32, 0.25), 0 14px 30px rgba(0, 0, 0, 0.25);
  --font: "Nunito", "Baloo 2", ui-rounded, "Segoe UI Rounded", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1c14; font-family: var(--font); color: var(--ink); -webkit-tap-highlight-color: transparent; }
body { user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
kbd { display: inline-block; min-width: 1.6em; padding: 0.05em 0.45em; border-radius: 6px; background: #fff; border: 2px solid #d9c9b4; border-bottom-width: 4px; font: 800 0.85em var(--font); color: var(--ink); text-align: center; line-height: 1.4; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.error { color: #c0392b; font-weight: 700; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #f7b267, #e8563a 60%, #8c2f1d); z-index: 50; transition: opacity 0.5s; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-card { text-align: center; color: #fff; font-weight: 800; font-size: 1.2rem; text-shadow: 0 2px 0 rgba(0,0,0,0.2); }
.loading-pan { font-size: 4rem; animation: flip 1.2s ease-in-out infinite; }
@keyframes flip { 0%, 100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(12deg) translateY(-14px); } }
.load-track { width: 240px; height: 14px; border-radius: 10px; background: rgba(0,0,0,0.25); margin: 12px auto 0; overflow: hidden; }
#load-bar { height: 100%; width: 0; background: var(--yellow); border-radius: 10px; transition: width 0.2s; }

/* ---------- screens ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.screen { position: absolute; inset: 0; display: none; pointer-events: none; }
.screen.open { display: flex; }
.screen > * { pointer-events: auto; }
#screen-play { pointer-events: none; }
#screen-play > * { pointer-events: none; }
#screen-play .modal.open { pointer-events: auto; }

.panel { background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); border: 3px solid #f0dcc0; padding: 22px 26px; }
h1, h2, h3 { margin: 0 0 10px; }
h2 { font-size: 1.6rem; }

.btn { pointer-events: auto; font: 800 1rem var(--font); color: #fff; background: var(--red); border: none; border-radius: 14px; padding: 12px 20px; cursor: pointer; box-shadow: 0 5px 0 var(--red-d), 0 8px 18px rgba(0,0,0,0.2); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; text-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-d); }
.btn:disabled { filter: grayscale(0.7); opacity: 0.6; cursor: default; }
.btn.big { font-size: 1.45rem; padding: 16px 34px; border-radius: 18px; }
.btn.small { font-size: 0.85rem; padding: 7px 12px; border-radius: 10px; box-shadow: 0 3px 0 var(--red-d); }
.btn.secondary { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #d9c9b4, 0 8px 18px rgba(0,0,0,0.12); text-shadow: none; border: 2px solid #ecdcc6; }
.btn.secondary.small { box-shadow: 0 3px 0 #d9c9b4; }
.btn.on { background: var(--green); color: #fff; }

/* ---------- title ---------- */
#screen-title { align-items: center; justify-content: flex-start; padding-left: 6vw; }
.title-card { text-align: left; max-width: 460px; }
.logo { font-size: clamp(3rem, 8vw, 6rem); line-height: 0.88; letter-spacing: -0.02em; margin-bottom: 14px; display: flex; flex-direction: column; }
.logo span { color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink), 0 14px 22px rgba(0,0,0,0.35); display: inline-block; animation: bob 3s ease-in-out infinite; }
.logo span:nth-child(1) { color: var(--yellow); transform: rotate(-4deg); }
.logo span:nth-child(2) { color: #fff; animation-delay: 0.3s; margin-left: 0.4em; }
.logo span:nth-child(3) { color: var(--red); animation-delay: 0.6s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.tagline { font-weight: 800; color: #fff; font-size: 1.2rem; text-shadow: 0 2px 0 rgba(0,0,0,0.45), 0 0 18px rgba(0,0,0,0.4); margin: 0 0 22px; }
.menu { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.menu-row { display: flex; gap: 12px; }
.home-link { display: inline-block; margin-top: 26px; color: #fff; font-weight: 800; text-decoration: none; text-shadow: 0 2px 0 rgba(0,0,0,0.5); opacity: 0.85; }

/* ---------- lobby ---------- */
#screen-lobby { align-items: center; justify-content: center; padding: 16px; background: rgba(30, 18, 10, 0.35); backdrop-filter: blur(3px); }
.lobby { width: min(1100px, 100%); max-height: 100%; overflow: auto; }
.lobby-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lobby-head h2 { flex: 1; margin: 0; }
.online-box { background: #fff4e3; border-radius: 14px; padding: 8px 12px; min-width: 260px; }
.online-box p { margin: 4px 0; }
.code { font-size: 1.5rem; letter-spacing: 0.15em; color: var(--red); background: #fff; padding: 2px 10px; border-radius: 8px; border: 2px dashed var(--red); }
.share { display: flex; gap: 6px; }
.share input { flex: 1; min-width: 0; font: 600 0.8rem var(--font); border: 2px solid #ecdcc6; border-radius: 8px; padding: 4px 8px; }
.slots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin: 16px 0 10px; }
.slot { position: relative; background: #fff; border: 3px solid var(--c, #ecdcc6); border-radius: 16px; padding: 8px 6px 10px; text-align: center; min-height: 168px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 4px 0 color-mix(in srgb, var(--c, #ecdcc6) 70%, #000 0%); animation: pop-in 0.3s cubic-bezier(.3,1.6,.6,1); }
.slot.mine { background: color-mix(in srgb, var(--c) 12%, #fff); }
.slot.empty { border-style: dashed; border-color: #e6d4bb; box-shadow: none; justify-content: center; color: #b9a58c; animation: none; }
.slot-plus { font-size: 2.2rem; font-weight: 900; }
.slot small { font-size: 0.7rem; line-height: 1.5; }
.portrait { width: 86px; height: 86px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.15)); }
.slot-name { font-weight: 800; font-size: 0.9rem; width: 100%; text-align: center; border: none; background: transparent; font-family: var(--font); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input.slot-name { border-bottom: 2px dashed #d9c9b4; outline: none; user-select: text; }
.slot-tag { font-size: 0.7rem; font-weight: 700; color: var(--ink-soft); }
.slot-controls { display: flex; gap: 4px; }
.slot-controls button { border: none; background: #f3e8d8; border-radius: 8px; font-size: 0.9rem; padding: 3px 6px; cursor: pointer; }
.slot-controls button:hover { background: #ffe0b8; }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lobby-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lobby-row p { margin: 0; }
.lobby-buttons { display: flex; gap: 8px; }
#lobby-bots { display: flex; gap: 8px; }
.pick { margin-top: 16px; }
.levels { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.level { position: relative; font-family: var(--font); color: #fff; border: none; border-radius: 16px; padding: 10px 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 128px; background: linear-gradient(160deg, var(--a), color-mix(in srgb, var(--a) 55%, #000)); box-shadow: 0 4px 0 color-mix(in srgb, var(--a) 50%, #000); transition: transform 0.12s; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.level:hover:not(:disabled) { transform: translateY(-3px); }
.level.selected { outline: 4px solid var(--yellow); outline-offset: 2px; }
.level.locked { filter: grayscale(0.85) brightness(0.8); cursor: default; }
.level b { font-size: 0.95rem; line-height: 1.1; }
.lv-num { font-size: 0.7rem; opacity: 0.85; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.lv-dishes { display: flex; flex-wrap: wrap; gap: 2px; margin-top: auto; }
.lv-dishes img { width: 30px; height: 30px; background: rgba(255,255,255,0.85); border-radius: 50%; }
.lv-stars i { font-style: normal; color: rgba(0,0,0,0.3); font-size: 1.1rem; }
.lv-stars i.on { color: var(--yellow); text-shadow: 0 0 6px rgba(255,200,58,0.8); }
.lock { position: absolute; right: 8px; top: 8px; }
.level-info { margin: 10px 0 0; }
.lobby-start { display: flex; justify-content: center; margin-top: 14px; }
.lobby-start p { margin: 0; }

/* ---------- HUD ---------- */
#hud-root { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud { position: absolute; inset: 0; }
.hud-world { position: absolute; inset: 0; overflow: hidden; }
.orders { position: absolute; top: 12px; left: 12px; display: flex; gap: 10px; align-items: flex-start; max-width: calc(100% - 330px); flex-wrap: wrap; }
.ticket { width: 118px; background: var(--paper); border-radius: 12px; box-shadow: 0 4px 0 rgba(58,42,32,0.2), 0 6px 14px rgba(0,0,0,0.25); padding: 0 6px 6px; text-align: center; transform-origin: top center; transition: transform 0.35s cubic-bezier(.3,1.5,.6,1), opacity 0.35s; overflow: hidden; border-top: 0; }
.ticket.enter { transform: translateY(-120%) rotate(-6deg); opacity: 0; }
.ticket.urgent { animation: shake 0.5s infinite; }
.ticket.gone { transform: scale(1.25); opacity: 0; }
.ticket.gone-fail, .ticket.fail { transform: translateY(60px) rotate(12deg); opacity: 0; filter: sepia(1) hue-rotate(-40deg) saturate(3); }
@keyframes shake { 0%, 100% { rotate: 0deg; } 25% { rotate: -2deg; } 75% { rotate: 2deg; } }
.ticket-bar { height: 8px; margin: 0 -6px 4px; background: #eadfce; }
.ticket-bar span { display: block; height: 100%; transition: width 0.25s linear, background 0.4s; }
.ticket .dish { width: 70px; height: 70px; display: block; margin: -2px auto -4px; }
.ticket-name { font-weight: 900; font-size: 0.78rem; line-height: 1.1; margin-bottom: 4px; }
.parts { display: flex; justify-content: center; gap: 3px; flex-wrap: wrap; }
.part { position: relative; background: #f6ecdc; border-radius: 8px; width: 30px; height: 30px; }
.part img { width: 30px; height: 30px; }
.part i { position: absolute; right: -4px; bottom: -4px; font-size: 0.65rem; font-style: normal; }
.hud-right { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.score { display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 16px; padding: 6px 16px 6px 8px; box-shadow: var(--shadow); font-weight: 900; font-size: 1.9rem; min-width: 140px; justify-content: flex-end; }
.coin, .res-score .coin { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2a8, #ffc83a 45%, #d8921c); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); display: inline-block; flex-shrink: 0; }
.combo { font-weight: 900; color: #fff; font-size: 1.1rem; text-shadow: 0 2px 0 var(--red-d), 0 0 10px rgba(255,120,60,0.8); }
.combo.flash { animation: combo 0.6s; }
@keyframes combo { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
.clock { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 16px; padding: 6px 16px 6px 8px; box-shadow: var(--shadow); font-weight: 900; font-size: 1.7rem; }
.clock-face { --k: 1; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--k) * 360deg), #eadfce 0); border: 3px solid var(--ink); }
.clock.hurry { animation: hurry 0.5s infinite alternate; color: #d32f1a; }
.clock.hurry .clock-face { background: conic-gradient(#ff4f3a calc(var(--k) * 360deg), #eadfce 0); }
@keyframes hurry { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.08); } }
.countdown { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.4); font-size: clamp(4rem, 14vw, 9rem); font-weight: 900; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); opacity: 0; transition: transform 0.25s cubic-bezier(.3,1.7,.6,1), opacity 0.2s; white-space: nowrap; }
.countdown.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.countdown.go { color: var(--yellow); }
.countdown.over { color: var(--red); }
.tutorial-card { position: absolute; left: 50%; bottom: 22px; transform: translate(-50%, 240%); width: min(560px, calc(100% - 24px)); background: var(--paper); border-radius: 18px; padding: 12px 18px; box-shadow: var(--shadow); border: 3px solid var(--yellow); transition: transform 0.45s cubic-bezier(.3,1.4,.6,1); }
.tutorial-card.show { transform: translate(-50%, 0); }
.tutorial-card h3 { margin: 0 0 4px; font-size: 1.2rem; }
.tutorial-card p { margin: 0; font-weight: 700; line-height: 1.45; }
.tut-step { font-size: 0.75rem; font-weight: 900; color: var(--red); text-transform: uppercase; letter-spacing: 0.08em; }

/* banners */
.banner { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 900; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); white-space: nowrap; animation: banner 2.6s cubic-bezier(.3,1.6,.6,1) forwards; pointer-events: none; }
.banner.rush { color: #ff8a3a; }
.banner.hurry { color: #ffd24a; }
@keyframes banner { 0% { transform: translateX(-50%) scale(0.3); opacity: 0; } 12% { transform: translateX(-50%) scale(1.1); opacity: 1; } 20% { transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { transform: translateX(-50%) translateY(-30px); opacity: 0; } }

/* in-world labels */
.wbar, .wbubble, .wwarn, .nametag, .emote, .pop { position: absolute; left: 0; top: 0; will-change: transform; }
.wbar { width: 52px; height: 9px; margin: -4px 0 0 -26px; background: rgba(30,20,10,0.55); border-radius: 6px; border: 2px solid #fff; overflow: hidden; }
.wbar span { display: block; height: 100%; }
.wbubble { display: flex; gap: 1px; margin-left: -10px; translate: -50% -50%; background: rgba(255,253,248,0.94); border-radius: 14px; padding: 2px 4px; box-shadow: 0 3px 6px rgba(0,0,0,0.25); }
.wbubble img { width: 26px; height: 26px; }
.wbubble.done { background: #e9ffe6; border: 2px solid var(--green); }
.wbubble.plate img { width: 22px; height: 22px; }
.wwarn { translate: -50% -50%; width: 30px; height: 30px; border-radius: 50%; background: #ff4f3a; color: #fff; font-weight: 900; font-size: 1.2rem; display: grid; place-items: center; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0,0,0,0.3); }
.wwarn.blink { background: #ffd23a; color: var(--ink); scale: 1.2; }
.wwarn.burnt { background: #3a2a20; }
.wwarn.fire { background: transparent; box-shadow: none; font-size: 1.6rem; animation: bob 0.6s infinite; }
.nametag { translate: -50% -100%; font-size: 0.72rem; font-weight: 900; color: #fff; background: var(--c); padding: 1px 8px; border-radius: 10px; box-shadow: 0 2px 0 rgba(0,0,0,0.25); white-space: nowrap; opacity: 0.92; }
.emote { translate: -50% -100%; font-size: 2rem; animation: pop-in 0.25s cubic-bezier(.3,1.8,.6,1); filter: drop-shadow(0 3px 2px rgba(0,0,0,0.3)); }
.pop { translate: -50% -50%; text-align: center; animation: rise 1.4s ease-out forwards; }
.pop b { display: block; font-size: 2rem; font-weight: 900; color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.pop small { display: block; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.pop.bad b { color: #ff6a50; font-size: 1.6rem; }
@keyframes rise { 0% { transform: translateY(10px) scale(0.5); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-70px) scale(1); opacity: 0; } }

.level-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.7); opacity: 0; background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); padding: 18px 26px; text-align: center; transition: transform 0.35s cubic-bezier(.3,1.5,.6,1), opacity 0.3s; max-width: min(520px, calc(100% - 24px)); }
.level-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.level-card p { margin: 4px 0; font-weight: 700; }
.level-card .tip { font-size: 0.9rem; color: var(--ink-soft); }
.card-dishes { display: flex; gap: 12px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.card-dishes span { display: flex; flex-direction: column; align-items: center; font-size: 0.75rem; font-weight: 800; }
.card-dishes img { width: 64px; height: 64px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(30, 18, 10, 0.55); backdrop-filter: blur(3px); pointer-events: auto; z-index: 20; padding: 16px; }
.modal.open { display: flex; }
.modal .panel { width: min(460px, 100%); max-height: 100%; overflow: auto; }
.modal label { display: block; font-weight: 800; margin: 10px 0; }
.modal input:not([type=range]), .modal select { display: block; width: 100%; margin-top: 4px; font: 700 1.1rem var(--font); padding: 10px 12px; border-radius: 12px; border: 2px solid #ecdcc6; background: #fff; color: var(--ink); user-select: text; }
.modal input[type=range] { display: block; width: 100%; accent-color: var(--red); }
#join-code { text-transform: uppercase; letter-spacing: 0.3em; font-size: 1.6rem; text-align: center; }
.row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.pause .panel { display: flex; flex-direction: column; gap: 12px; text-align: center; width: min(320px, 100%); }
.how { width: min(720px, 100%) !important; }
.keys { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.9rem; }
.keys th, .keys td { padding: 5px 6px; border-bottom: 1px solid #f0e2cf; text-align: left; }
.how-dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.how-dish { display: flex; flex-direction: column; align-items: center; background: #fff4e3; border-radius: 12px; padding: 6px; font-size: 0.85rem; }
.how-dish > img { width: 60px; height: 60px; }
.how-dish span { display: flex; align-items: center; gap: 2px; font-weight: 900; color: var(--ink-soft); }
.how-dish span img { width: 26px; height: 26px; }

/* ---------- results ---------- */
#screen-results { align-items: center; justify-content: center; background: rgba(30, 18, 10, 0.45); backdrop-filter: blur(3px); overflow: hidden; }
.results { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; text-align: center; animation: pop-in 0.4s cubic-bezier(.3,1.5,.6,1); }
.res-stars { font-size: 4rem; letter-spacing: 0.08em; }
.res-stars i { font-style: normal; color: #e6d8c4; display: inline-block; }
.res-stars i.on { color: var(--yellow); animation: star-in 0.5s cubic-bezier(.3,1.8,.6,1) backwards; text-shadow: 0 4px 0 #d8921c, 0 0 20px rgba(255,200,58,0.9); }
.res-stars i:nth-child(2) { font-size: 1.25em; }
@keyframes star-in { from { transform: scale(3) rotate(-90deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.res-verdict { font-weight: 900; font-size: 1.2rem; color: var(--red); }
.res-score { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 3rem; font-weight: 900; margin: 6px 0; }
.res-score em { font-size: 0.9rem; font-style: normal; background: var(--green); color: #fff; padding: 2px 10px; border-radius: 10px; }
.res-thresholds { display: flex; justify-content: center; gap: 14px; font-weight: 800; color: #b9a58c; font-size: 0.9rem; }
.res-thresholds .hit { color: #d8921c; }
.res-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 12px 0; text-align: left; }
.res-lines div { display: flex; justify-content: space-between; border-bottom: 2px dotted #ecdcc6; padding: 2px 0; }
.res-served { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; font-weight: 900; }
.res-served span { display: flex; align-items: center; }
.res-served img { width: 42px; height: 42px; }
.res-awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 150px)); justify-content: center; gap: 8px; margin-top: 12px; }
.award { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, #fff); border: 3px solid var(--c); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 70%, #000 0%); animation: pop-in 0.35s cubic-bezier(.3,1.6,.6,1) both; }
.award-emoji { font-size: 1.6rem; line-height: 1.1; }
.award b { font-size: 0.86rem; }
.award-name { font-weight: 900; color: color-mix(in srgb, var(--c) 75%, #000); font-size: 0.82rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award small { color: #8a7660; font-size: 0.72rem; }
.res-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.res-buttons p { margin: 0; }
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 40; pointer-events: none; }
.toast { background: var(--ink); color: #fff; font-weight: 800; padding: 10px 18px; border-radius: 14px; box-shadow: var(--shadow); animation: pop-in 0.25s; transition: opacity 0.4s, transform 0.4s; }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- touch ---------- */
.touchpad { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.stick-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 60%; pointer-events: auto; }
.stick-base { position: absolute; left: 90px; top: calc(100% - 110px); width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,0.18); border: 3px solid rgba(255,255,255,0.5); }
.stick-base.active { background: rgba(255,255,255,0.28); }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: rgba(255,255,255,0.85); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.touch-buttons { position: absolute; right: 16px; bottom: 16px; width: 230px; height: 200px; pointer-events: auto; }
.tb { position: absolute; border: none; border-radius: 50%; font: 900 0.85rem var(--font); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,0.3); opacity: 0.88; }
.tb.down { transform: scale(0.9); opacity: 1; }
.tb.grab { width: 88px; height: 88px; right: 0; bottom: 0; background: #4cc76b; }
.tb.use { width: 72px; height: 72px; right: 96px; bottom: 6px; background: #3d8bf0; }
.tb.dash { width: 64px; height: 64px; right: 14px; bottom: 100px; background: #e8563a; }
.tb.throw { width: 58px; height: 58px; right: 96px; bottom: 90px; background: #f2a930; }
.tb.emote { width: 44px; height: 44px; right: 168px; bottom: 76px; background: #ff6fae; }

/* ---------- playground ---------- */
.playground { position: fixed; right: 12px; top: 80px; width: 280px; z-index: 30; background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; pointer-events: auto; font-size: 0.8rem; }
.playground select { width: 100%; font: 700 0.9rem var(--font); padding: 4px; border-radius: 8px; }
.playground label { display: block; font-weight: 700; margin: 4px 0; }
.playground input[type=range] { width: 100%; accent-color: var(--red); }
.pg-json { width: 100%; height: 160px; font: 11px ui-monospace, monospace; border-radius: 8px; border: 2px solid #ecdcc6; margin-top: 6px; user-select: text; }
.pg-json.bad { border-color: #e8563a; }
.pg-row { display: flex; gap: 6px; margin-top: 6px; }

/* ---------- small screens ---------- */
body.compact .slots { grid-template-columns: repeat(4, 1fr); }
body.compact .levels { grid-template-columns: repeat(4, 1fr); }
body.compact .ticket { width: 92px; }
body.compact .ticket .dish { width: 50px; height: 50px; }
body.compact .part, body.compact .part img { width: 22px; height: 22px; }
body.compact .score, body.compact .clock { font-size: 1.2rem; }
body.compact .orders { max-width: calc(100% - 180px); }
body.compact #screen-title { padding-left: 18px; }
body.compact .tutorial-card { top: 64px; bottom: auto; width: min(440px, 52vw); padding: 6px 12px; font-size: 0.78rem; transform: translate(-50%, -260%); }
body.compact .tutorial-card.show { transform: translate(-50%, 0); }
body.compact .tutorial-card h3 { font-size: 0.95rem; }
body.compact .portrait { width: 56px; height: 56px; }
body.compact .slot { min-height: 120px; }
@media (max-width: 760px) {
  .slots, .levels { grid-template-columns: repeat(4, 1fr); }
  .clock { top: auto; bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo span, .ticket.urgent, .clock.hurry { animation: none; }
}
