/* HIGHBANDS — bright, warm, modern café theme (cream glass, espresso ink, caramel / terracotta / sage accents) */
:root {
  --espresso: #2a1b12;
  --roast: #4a3326;
  --mocha: #7a5a44;
  --caramel: #c98a4b;
  --terracotta: #c7764e;
  --sage: #5f9e6e;
  --crema: #f4e7d4;
  --foam: #fffaf3;
  --paper: #fbf6ec;
  --gold: #b9832a;
  --berry: #d0566f;
  --ink: #2a1b12;
  --muted: rgba(42, 27, 18, .6);
  --line: rgba(74, 51, 38, .13);
  --glass: rgba(255, 251, 245, .78);
  --glass-strong: rgba(255, 251, 245, .95);
  --tint: rgba(74, 51, 38, .06);
  --tint-2: rgba(74, 51, 38, .1);
  --radius: 18px;
  --shadow: 0 14px 40px -16px rgba(74, 45, 25, .35), 0 2px 6px -2px rgba(74, 45, 25, .12);
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f3ece2; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: #f0cf9f; color: var(--espresso); }

#scene { position: fixed; inset: 0; }
html { touch-action: pan-x pan-y; }   /* phones/tablets: no pinch / double-tap page zoom (it pushes the UI off-screen); scrolling still works */
#scene canvas { display: block; outline: none; touch-action: none; width: 100% !important; height: 100% !important; } /* never leave a gap while the size catches up */
.labels-layer { position: absolute; inset: 0; pointer-events: none; }
.labels-layer.far .seat-label i { display: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 62%, rgba(60, 35, 15, .14) 100%); }

.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .7); box-shadow: var(--shadow); }
.glass-strong { background: var(--glass-strong); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); border: 1px solid rgba(255, 255, 255, .8); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.ico { width: 20px; height: 20px; flex: none; }
.icon-btn { width: 30px; height: 30px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 18px; color: var(--muted); }
.icon-btn:hover { background: var(--tint); color: var(--ink); }

/* ---------- loader (Cozy latte: the cup fills as the café boots; --p = progress set by index.html) */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; overflow: hidden; background: radial-gradient(circle at 50% 38%, #fffaf2 0%, #f6ebdd 45%, #ead8c0 100%); transition: opacity .8s, visibility .8s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader-beans { position: absolute; inset: 0; pointer-events: none; }
.loader-beans i { position: absolute; width: 26px; height: 36px; border-radius: 50%; background: #8b5a3c; opacity: .09; animation: bean-drift 9s ease-in-out infinite; }
.loader-beans i::after { content: ""; position: absolute; left: 50%; top: 5px; bottom: 5px; width: 4px; margin-left: -2px; border-radius: 4px; background: #fffaf2; transform: rotate(8deg); }
.loader-beans i:nth-child(1) { left: 8%; top: 14%; transform: rotate(-30deg); }
.loader-beans i:nth-child(2) { left: 84%; top: 10%; transform: rotate(25deg) scale(.8); animation-delay: -2s; }
.loader-beans i:nth-child(3) { left: 16%; top: 72%; transform: rotate(60deg) scale(1.2); animation-delay: -4s; }
.loader-beans i:nth-child(4) { left: 78%; top: 66%; transform: rotate(-15deg); animation-delay: -6s; }
.loader-beans i:nth-child(5) { left: 46%; top: 6%; transform: rotate(80deg) scale(.7); animation-delay: -1s; }
.loader-beans i:nth-child(6) { left: 4%; top: 44%; transform: rotate(10deg) scale(.9); animation-delay: -3s; }
.loader-beans i:nth-child(7) { left: 92%; top: 40%; transform: rotate(-60deg) scale(1.1); animation-delay: -5s; }
.loader-beans i:nth-child(8) { left: 54%; top: 86%; transform: rotate(35deg) scale(.85); animation-delay: -7s; }
@keyframes bean-drift { 50% { translate: 0 -14px; } }
.loader-cup { position: relative; width: 120px; height: 124px; }
.loader-cup .cup { position: absolute; z-index: 1; bottom: 14px; left: 18px; width: 78px; height: 64px; background: #fff; border-radius: 6px 6px 34px 34px; overflow: hidden; box-shadow: 0 12px 26px -12px rgba(74,45,25,.5), inset 0 0 0 2px #ead9c2; }
.loader-cup .cup b { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--p, 0%) * .86); background: linear-gradient(#b07a50, #6e4129); }
.loader-cup .cup b::before { content: ""; position: absolute; left: -10%; right: -10%; top: -3px; height: 7px; border-radius: 50%; background: #d9a878; animation: crema 2.2s ease-in-out infinite; }
@keyframes crema { 50% { transform: translateX(4px) scaleY(.7); } }
.loader-cup::after { content: ""; position: absolute; z-index: 0; right: 6px; bottom: 30px; width: 20px; height: 26px; border: 7px solid #fff; border-left: 0; border-radius: 0 16px 16px 0; filter: drop-shadow(0 4px 6px rgba(74,45,25,.18)); }
.loader-cup .saucer { position: absolute; bottom: 4px; left: 2px; width: 110px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 8px 18px -8px rgba(74,45,25,.45), inset 0 -3px 0 #efe1cc; }
.loader-cup .steam { position: absolute; top: 0; left: 36px; display: flex; gap: 11px; }
.loader-cup .steam i { width: 6px; height: 34px; border-radius: 6px; background: linear-gradient(transparent, rgba(122,74,44,.3)); animation: steam 1.8s ease-in-out infinite; }
.loader-cup .steam i:nth-child(2) { animation-delay: .3s; } .loader-cup .steam i:nth-child(3) { animation-delay: .6s; }
@keyframes steam { 0% { transform: translateY(10px) scaleY(.6); opacity: 0 } 50% { opacity: 1 } 100% { transform: translateY(-14px) scaleY(1.1); opacity: 0 } }
.loader-brand { font: 900 34px/1 var(--display); letter-spacing: .06em; margin: 10px 0 2px; color: #a3202a; }
.loader-brand span, .brand h1 span { color: var(--terracotta); }
.loader-msg { margin: 0; color: #6b3f26; font-weight: 600; }
.loader-pct { margin: 0; font: 700 13px var(--mono); color: #a0724f; }
.loader-joke { margin: 14px 0 0; max-width: 320px; min-height: 2.6em; text-align: center; font: italic 500 15px/1.35 var(--display); color: #8b6a55; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.loader-joke.in { opacity: 1; transform: none; }
.loader.err .loader-msg { color: #a3202a; }
.loader.err .loader-pct, .loader.err .loader-joke { display: none; }
@media (prefers-reduced-motion: reduce) { .loader-beans i, .loader-cup .steam i, .loader-cup .cup b::before { animation: none; } }

/* ---------- top bar */
.topbar { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; align-items: flex-start; gap: 12px; z-index: 10; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: var(--radius); }
.brand-mark { width: 58px; height: 45px; display: grid; place-items: center; filter: drop-shadow(0 2px 4px rgba(142,34,41,.25)); }
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand h1 { font: 900 21px/1 var(--display); margin: 0; letter-spacing: .05em; color: #a3202a; }
.brand p { margin: 3px 0 0; font: italic 500 13px var(--display); color: var(--mocha); white-space: nowrap; }
.status { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; font-size: 14px; margin-left: auto; margin-top: 6px; white-space: nowrap; }
.status .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(208, 86, 111, .12); color: #a83a52; letter-spacing: .04em; text-transform: uppercase; }
.badge.live { background: rgba(95, 158, 110, .15); color: #2f6b3e; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 999px; margin-top: 6px; }
.me-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--c, var(--caramel)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.me-name { font-weight: 700; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.beans { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #f7e6cc; color: #8a5a1f; font-weight: 700; }
.bean-ico { width: 12px; height: 16px; border-radius: 50%; background: #8a5330; transform: rotate(30deg); position: relative; box-shadow: inset -2px -2px 0 rgba(0,0,0,.25); }
.bean-ico::after { content: ""; position: absolute; inset: 2px 5px; border-left: 2px solid #c98a55; border-radius: 50%; }
.beans.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.25); background: #f3cf8a; } }

.announce { position: fixed; top: 86px; left: 50%; transform: translateX(-50%); z-index: 9; padding: 10px 18px; border-radius: 999px; font-weight: 500; max-width: min(720px, calc(100vw - 32px)); text-align: center; border-color: rgba(201, 138, 75, .5); }

/* ---------- status line (note) */
.note-box { position: fixed; top: 0; left: 0; z-index: 30; display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 12px; border-radius: 999px; width: min(340px, calc(100vw - 32px)); transform: translate(-50%, calc(-100% - 10px)); animation: noteIn .16s ease-out; }
.note-box::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
@keyframes noteIn { from { opacity: 0; margin-top: 6px; } }
.seat-label.me { pointer-events: auto; cursor: pointer; }
.seat-label.me:hover { filter: brightness(1.05); box-shadow: 0 0 0 2px rgba(255,255,255,.8), 0 4px 12px -4px rgba(74,45,25,.35); }
.seat-label .sl-hint { opacity: .8; }
.note-box input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 7px 4px; font-size: 14px; }
.note-box input::placeholder { color: var(--muted); }
.note-box .chip { padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.note-box:focus-within { box-shadow: var(--shadow), 0 0 0 2px rgba(201,138,75,.45); }

/* ---------- dock */
.dock { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 10; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 22px; }
.dock button { position: relative; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; color: var(--roast); transition: background .2s, transform .15s; }
.dock button:hover { background: var(--tint); }
.dock button:active { transform: scale(.94); }
.dock button.on { background: #f5e2c6; color: #8a5a1f; }
.dock button .lbl { position: absolute; right: 60px; white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: var(--espresso); color: var(--foam); font-size: 13px; font-weight: 500; opacity: 0; transform: translateX(6px); pointer-events: none; transition: .18s; }
.dock button:hover .lbl { opacity: 1; transform: none; }
.dock .accent { background: linear-gradient(135deg, #e9b47a, var(--terracotta)); color: #fff; }
.dock .accent:hover { background: linear-gradient(135deg, #f0c08a, #d0825a); }
.dock .danger { color: #b5423a; }
.music-hint { position: fixed; z-index: 30; transform: translate(6px, -50%); padding: 7px 12px; border-radius: 12px; background: rgba(255, 250, 242, .92); color: #6b4a2e; font-size: 13px; font-weight: 500; box-shadow: 0 4px 14px rgba(60, 35, 15, .15); pointer-events: none; white-space: nowrap; opacity: 0; transition: opacity .6s, transform .6s; }
.music-hint.show { opacity: .88; transform: translate(0, -50%); animation: hintNudge 1.6s ease-in-out 3; }
.music-hint.below { transform: translateY(6px); }
.music-hint.below.show { transform: none; animation: none; }
@keyframes hintNudge { 50% { transform: translate(-5px, -50%); } }
.dock hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }
.dock .small { height: 40px; opacity: .7; }

/* ---------- view bar */
.viewbar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10; display: flex; gap: 4px; padding: 6px; border-radius: 999px; }
.viewbar button { padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--mocha); white-space: nowrap; transition: .2s; }
.viewbar button:hover { color: var(--ink); background: var(--tint); }
.viewbar button.on { color: #fff; background: var(--espresso); }

/* ---------- study timer */
.timer { position: fixed; right: 84px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; border-radius: 22px; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--tint-2); }
.ring .prog { stroke: var(--caramel); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .8s, stroke .4s; }
.ring.full .prog { stroke: var(--sage); }
.ring-inner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-inner b { font: 700 19px var(--mono); }
.ring-inner small { font-size: 10.5px; color: var(--muted); max-width: 70px; line-height: 1.2; }
.timer-side { display: grid; gap: 8px; min-width: 200px; }
.timer-seat { font-size: 13px; color: var(--muted); }
.timer-seat b { color: var(--ink); }
.status-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.status-pick button { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; background: var(--tint); }
.status-pick button.on { background: #f5e2c6; box-shadow: inset 0 0 0 1.5px var(--caramel); }
.row.tight { gap: 6px; flex-wrap: nowrap; }
.row.tight .chip { flex: 1; padding: 8px 8px; font-size: 13px; }
.chip { padding: 8px 12px; border-radius: 12px; background: var(--tint); font-weight: 500; font-size: 14px; text-align: center; }
.chip:hover { background: var(--tint-2); }
.chip.on { background: rgba(95,158,110,.18); color: #2f6b3e; }
.timer.paused .ring .prog { stroke: #a9a29a; }

/* ---------- joystick (touch) */
.joystick { position: fixed; left: 26px; bottom: 200px; z-index: 11; width: 116px; height: 116px; border-radius: 50%; background: rgba(255, 251, 245, .55); border: 1.5px solid rgba(255,255,255,.85); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); touch-action: none; display: grid; place-items: center; }
.joystick .knob { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #f0c08a, var(--terracotta)); box-shadow: 0 6px 14px -4px rgba(120,60,20,.5); pointer-events: none; }
body.seated .joystick { opacity: .55; }

/* ---------- chat (bottom-left) */
.chat { position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: min(360px, calc(100vw - 32px)); z-index: 10; display: flex; flex-direction: column; border-radius: 18px; background: rgba(18, 12, 8, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 10px 30px -14px rgba(0,0,0,.6); }
.chat.dragging { user-select: none; }
.chat-head { cursor: grab; touch-action: none; }
.chat.dragging .chat-head { cursor: grabbing; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 0 14px; font-size: 13px; font-weight: 800; color: #fff8ec; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.chat-title { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 0 rgba(95,158,110,.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(95,158,110,0); } 100% { box-shadow: 0 0 0 0 rgba(95,158,110,0); } }
.chat-log { max-height: calc(5 * 1.4em + 16px + 12px); overflow-y: auto; padding: 6px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.4; scrollbar-width: thin; scrollbar-color: rgba(74,51,38,.2) transparent; mask-image: linear-gradient(to bottom, transparent, #000 8px); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8px); }
.chat-log .m { word-wrap: break-word; color: #fffaf0; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.chat-log .m b { color: var(--nc, #ffd27a); font-weight: 800; margin-right: 6px; }
.chat-log .m time { font-size: 11px; font-weight: 500; color: rgba(255,248,236,.6); margin-left: 6px; }
/* system lines: action in light cream, names bold light orange, places / titles light blue */
.chat-log .sys { font-size: 12.5px; font-weight: 600; color: #f6ecdc; }
.chat-log .sys b.nm { color: #ffc26b; font-weight: 800; margin: 0; }
.chat-log .sys .loc { color: #9fdcff; font-weight: 700; }
.chat-quick { display: flex; gap: 4px; padding: 2px 12px 0; }
.chat-quick button { font-size: 15px; padding: 3px 6px; border-radius: 8px; opacity: .8; }
.chat-quick button:hover { opacity: 1; background: var(--tint); }
.chat-form { display: flex; gap: 6px; padding: 8px 10px 10px; }
.chat-form input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.85); outline: none; }
.chat-form input:focus { border-color: var(--caramel); background: #fff; }
.chat-form button { width: 40px; border-radius: 12px; background: var(--espresso); color: #fff; font-weight: 700; }
.chat.collapsed .chat-log, .chat.collapsed .chat-form, .chat.collapsed .chat-quick { display: none; }
.chat.collapsed { width: auto; }

/* ---------- 3D labels */
.seat-label { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 10px; border-radius: 12px; background: rgba(255, 251, 245, .92); color: var(--espresso); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 4px 12px -4px rgba(74,45,25,.35); font-size: 12px; white-space: nowrap; margin-top: -4px; }
.seat-label .sl-row { display: flex; align-items: center; gap: 5px; }
.seat-label b { font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.seat-label i { font-style: normal; font-size: 11px; color: var(--mocha); max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.seat-label.me { background: linear-gradient(135deg, #f3c48c, #e3a066); border-color: transparent; }
.seat-label.me i { color: #5a3820; }
.seat-label.break { opacity: .7; }
.seat-label.walking { border-radius: 999px; }
.seat-label.npc { background: #2a1b12; color: #fff4e4; border-color: transparent; }
.seat-label.npc i { color: #e9c9a0; }
.seat-label.npc.clickable { pointer-events: auto; cursor: pointer; }
.seat-label.npc.clickable:hover { filter: brightness(1.25); }
.npc-say { pointer-events: none; }
.npc-say span { display: block; max-width: 240px; white-space: normal; text-align: center; padding: 9px 13px; border-radius: 16px; background: #fffdf8; color: var(--espresso); font: 600 13.5px/1.35 var(--font); box-shadow: 0 10px 26px -10px rgba(74,45,25,.55); border: 1px solid #fff; opacity: 0; transform: translateY(8px) scale(.9); transition: opacity .25s, transform .3s cubic-bezier(.2,.9,.3,1.3); position: relative; margin-bottom: 18px; }
.npc-say span::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-top-color: #fffdf8; border-bottom: 0; }
.npc-say.in span { opacity: 1; transform: none; }
.skip-chip { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 12; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 13.5px; }
.bar-offer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }

.labels-layer.far .seat-label { padding: 3px 8px; font-size: 11px; }
@keyframes float { 50% { transform: translateY(-5px); } }

/* ---------- side panel */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 30; display: flex; flex-direction: column; border-radius: 24px 0 0 24px; border-right: 0; transform: translateX(105%); transition: transform .38s cubic-bezier(.2,.8,.2,1); }
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 10px 24px; }
.panel-head h2 { margin: 0; font: 800 24px var(--display); }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 20px 30px 24px; scrollbar-width: thin; }
.panel-body h3 { font: 700 14px var(--font); color: var(--terracotta); text-transform: uppercase; letter-spacing: .08em; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.panel-body h3 small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.hint.vi, .vi { font-style: italic; }

/* seats */
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.seat-card { text-align: left; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); transition: .15s; }
.seat-card:hover:not(:disabled) { background: #eef7f0; border-color: rgba(95,158,110,.5); transform: translateY(-1px); }
.seat-card small { display: block; color: var(--muted); font-size: 11.5px; }
.seat-card b { display: block; font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-card .seat-note { display: block; font-size: 11.5px; color: var(--mocha); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.seat-card.free b { color: #3f8a55; }
.seat-card.taken { opacity: .72; cursor: default; background: var(--tint); }
.seat-card.mine { background: #fbeedb; border-color: var(--caramel); opacity: 1; }

/* tabs (board etc.) */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 4px 0 8px; scrollbar-width: none; }
.tabs button { padding: 7px 12px; border-radius: 999px; background: var(--tint); white-space: nowrap; font-size: 13.5px; font-weight: 500; }
.tabs button.on { background: var(--espresso); color: #fff; }
.price { font: 700 14px var(--mono); color: #8a5a1f; white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: #f7e6cc; }
.price.free { color: #2f6b3e; background: rgba(95,158,110,.14); }

/* board */
.board-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); margin-bottom: 6px; }
.board-row.me { background: #fbeedb; border-color: rgba(201,138,75,.5); }
.board-row .rk { font: 800 18px var(--display); text-align: center; color: var(--muted); }
.board-row:nth-child(1) .rk, .board-row:nth-child(2) .rk, .board-row:nth-child(3) .rk { font-size: 22px; }
.board-row .who b { display: block; }
.board-row .who small { color: var(--muted); font-size: 12px; }
.board-row .val { font: 700 14px var(--mono); color: #8a5a1f; text-align: right; }
.hall { padding: 16px; border-radius: 18px; text-align: center; background: linear-gradient(135deg, #b8862e, #f1d48a 40%, #c9993d 65%, #f6e2a6); color: #3a2510; margin-bottom: 8px; box-shadow: inset 0 0 0 3px rgba(90,58,20,.7), inset 0 0 0 5px #f1d48a; }
.hall h4 { margin: 4px 0 2px; font: 900 22px var(--display); }
.hall p { margin: 0; font: italic 500 13px var(--display); }

/* sound / forms */
.mix-row { display: grid; grid-template-columns: 44px 1fr 46px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); margin-bottom: 8px; }
.mix-row .em { font-size: 24px; text-align: center; }
.mix-row b { display: block; font-size: 14.5px; }
.mix-row small { color: var(--muted); font-size: 12px; }
.mix-row input[type=range] { width: 100%; accent-color: var(--caramel); margin-top: 6px; }
.toggle { width: 44px; height: 26px; border-radius: 999px; background: rgba(74,51,38,.2); position: relative; transition: .2s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.toggle.on { background: var(--sage); }
.toggle.on::after { left: 21px; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--roast); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: #fff; outline: none; }
.field textarea { min-height: 120px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(201,138,75,.18); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 14px; font-weight: 700; background: var(--tint); transition: .15s; }
.btn:hover { background: var(--tint-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--espresso); color: #fff; }
.btn.primary:hover { background: #3d2a1e; }
.btn.green { background: var(--sage); color: #fff; }
.btn.danger { background: rgba(181, 66, 58, .1); color: #a63a32; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- modals */
#modals { position: relative; z-index: 50; }
.modal-wrap { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; background: rgba(60, 40, 25, .28); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; overflow-y: auto; }
.modal-wrap.open { opacity: 1; }
.modal { position: relative; margin: auto; width: min(520px, 100%); padding: 28px; border-radius: 26px; background: var(--glass-strong); border: 1px solid #fff; box-shadow: 0 30px 80px -24px rgba(74,45,25,.45); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transform: translateY(14px) scale(.98); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.modal-wrap.open .modal { transform: none; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 12px; font-size: 22px; color: var(--muted); z-index: 3; }
.modal-x:hover { background: var(--tint); color: var(--ink); }
.modal h2 { font: 800 28px/1.15 var(--display); margin: 0 0 8px; }
.modal h3 { font: 700 14px var(--font); color: var(--terracotta); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.modal h3 small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.modal .lead { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }

/* welcome */
.welcome { width: min(480px, 100%); text-align: center; }
.welcome .logo { font-size: 46px; width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 26px; display: grid; place-items: center; background: linear-gradient(135deg, #f6d9b0, var(--caramel)); box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), 0 18px 40px -14px rgba(201,138,75,.7); }
.welcome h2 { font-size: 38px; letter-spacing: .01em; }
.welcome h2 span { color: var(--terracotta); }
.welcome .tag { font: italic 500 17px var(--display); color: var(--mocha); margin: 0 0 6px; }
.welcome .live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.welcome form { display: grid; gap: 10px; text-align: left; }
.welcome .input { font-size: 17px; padding: 14px 16px; text-align: center; }
.warn { text-align: left; padding: 14px 16px; border-radius: 16px; background: #fdf1de; border: 1px solid rgba(201,138,75,.45); font-size: 14px; line-height: 1.5; margin: 12px 0; }
.warn b { color: #8a4f1c; }
.warn label { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-weight: 500; cursor: pointer; }
.warn input { margin-top: 3px; accent-color: var(--terracotta); width: 18px; height: 18px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.stats-mini { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; flex-wrap: wrap; }
.stats-mini div { padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); min-width: 92px; }
.stats-mini b { display: block; font: 700 20px var(--mono); color: #8a5a1f; }
.stats-mini small { color: var(--muted); font-size: 12px; }

/* quiz */
.quiz { width: min(620px, 100%); }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding-right: 36px; }
.quiz-top .cat { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--terracotta); }
.quiz-top .streak { font: 700 13px var(--mono); color: #8a5a1f; }
.quiz .passage { padding: 14px 16px; border-radius: 14px; background: #fff; border-left: 3px solid var(--caramel); font: 500 15px/1.6 var(--display); margin-bottom: 12px; color: var(--roast); }
.quiz .q { font: 600 20px/1.45 var(--font); margin: 0 0 16px; }
.quiz .q em { color: #8a4f1c; font-style: normal; background: #fbe9cf; padding: 0 4px; border-radius: 4px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 13px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-size: 15.5px; transition: .15s; }
.opt:hover:not(:disabled) { background: #fdf6ec; border-color: rgba(201,138,75,.5); }
.opt .k { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--tint); font: 700 13px var(--mono); }
.opt.right { background: #e8f4ea; border-color: var(--sage); }
.opt.wrong { background: #fbe9e7; border-color: #d9776c; }
.opt:disabled { cursor: default; }
.tfng-opts { grid-template-columns: repeat(3, 1fr); }
.tfng-opts .opt { justify-content: center; font-weight: 700; }
.fill-row { display: flex; gap: 8px; }
.fill-row input { flex: 1; font-size: 17px; }
.feedback { margin-top: 14px; padding: 14px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; display: none; }
.feedback.show { display: block; animation: rise .3s; }
.feedback.ok { background: #e8f4ea; }
.feedback.no { background: #fbe9e7; }
.feedback b { display: block; font-size: 16px; margin-bottom: 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.quiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; flex-wrap: wrap; }
.bean-pop { position: fixed; z-index: 80; pointer-events: none; font: 800 22px var(--mono); color: #b0701f; text-shadow: 0 2px 8px rgba(255,255,255,.9); animation: pop 1.1s forwards; }
@keyframes pop { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-50px); } }

/* ---------- speaking with the barista */
.speak { width: min(640px, 100%); }
/* short laptop screens: the setup is taller than the window → "Start talking →" stays pinned to the bottom edge */
.speak .sp-go { position: sticky; bottom: -24px; z-index: 2; margin: 8px -28px -28px; padding: 14px 28px 20px; border-radius: 0 0 26px 26px;
  background: linear-gradient(to bottom, rgba(255,251,245,0), rgba(255,251,245,.97) 40%); }
@media (max-width: 640px) { .speak .sp-go { bottom: -10px; margin: 6px -16px -20px; padding: 12px 16px 14px; border-radius: 0 0 22px 22px; } }
.sp-intro, .sp-q { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 8px; padding-right: 30px; }
.sp-lexi { flex: none; width: 76px; height: 76px; margin-bottom: 30px; border-radius: 24px; display: grid; place-items: center; font-size: 38px; background: linear-gradient(135deg, #f6d9b0, var(--caramel)); position: relative; box-shadow: 0 10px 22px -10px rgba(201,138,75,.8); }
.sp-lexi span { position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 100px; text-align: center; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 700 10px var(--font); background: var(--espresso); color: #fff; padding: 2px 7px; border-radius: 9px; letter-spacing: .04em; }
.sp-lexi.sm { width: 50px; height: 50px; margin-bottom: 0; font-size: 25px; border-radius: 16px; }
.bubble { position: relative; flex: 1; padding: 13px 16px; border-radius: 4px 18px 18px 18px; background: #fff; border: 1px solid var(--line); line-height: 1.5; font-size: 14.5px; }
.bubble .vi { display: block; margin-top: 6px; color: var(--mocha); font-size: 13px; }
.bubble.big { padding: 16px 48px 16px 18px; }
.bubble.big p { margin: 0; font: 600 21px/1.4 var(--display); }
.bubble.big small { display: block; color: var(--terracotta); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.sp-say { position: absolute; top: 10px; right: 10px; }
.sp-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.sp-all { margin-left: auto; display: flex; gap: 6px; }
.sp-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-topics .chip { font-size: 13px; padding: 7px 11px; border: 1px solid transparent; }
.sp-topics .chip small { color: var(--muted); margin-left: 3px; }
.sp-topics .chip.on { background: #fbeedb; border-color: rgba(201,138,75,.55); color: var(--espresso); }
.sp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0 6px; }
.sp-opts > div:first-child { grid-column: 1 / -1; } /* "Order" has three long buttons — give it the full row */
.sp-opts label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--tint); gap: 2px; }
.seg button { flex: 1; padding: 7px 6px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--mocha); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--espresso); box-shadow: 0 1px 4px rgba(74,45,25,.15); }
.sp-stage { min-height: 190px; display: grid; place-items: center; padding: 14px 0; }
.sp-mic { width: 104px; height: 104px; border-radius: 50%; font-size: 42px; background: linear-gradient(135deg, #f0c08a, var(--terracotta)); color: #fff; box-shadow: 0 16px 34px -12px rgba(199,118,78,.8), 0 0 0 10px rgba(199,118,78,.12); transition: transform .15s; animation: breathe 2.4s ease-in-out infinite; }
.sp-mic:hover { transform: scale(1.05); }
@keyframes breathe { 50% { box-shadow: 0 16px 34px -12px rgba(199,118,78,.8), 0 0 0 18px rgba(199,118,78,.06); } }
.sp-cta { text-align: center; margin: 12px 0 0; line-height: 1.6; }
.sp-rec { display: flex; gap: 20px; align-items: center; width: 100%; }
.sp-ring { position: relative; width: 120px; height: 120px; flex: none; }
.sp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sp-ring circle { fill: none; stroke-width: 8; }
.sp-ring .track { stroke: var(--tint-2); }
.sp-ring-prog { stroke: var(--terracotta); stroke-linecap: round; stroke-dasharray: 301.6; stroke-dashoffset: 301.6; transition: stroke .3s; }
.sp-ring.done .sp-ring-prog { stroke: var(--sage); }
.sp-ring > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.sp-ring b { font: 700 24px var(--mono); }
.sp-ring small { font-size: 11px; color: var(--muted); }
.sp-rec-side { flex: 1; display: grid; gap: 8px; min-width: 0; }
.sp-level { height: 8px; border-radius: 99px; background: var(--tint); overflow: hidden; }
.sp-level i { display: block; height: 100%; background: linear-gradient(90deg, var(--sage), #e3b04b, var(--terracotta)); transform-origin: left; transform: scaleX(0); transition: transform .08s; }
.sp-voiced { font-size: 13px; color: var(--mocha); font-weight: 600; }
.sp-tr { padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; line-height: 1.5; max-height: 140px; overflow-y: auto; }
.sp-tr.live { border-style: dashed; }
.sp-result { width: 100%; display: grid; gap: 10px; }
.sp-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-stats > * { padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 13px; }
.sp-stats b { font: 700 16px var(--mono); margin-right: 4px; }
.sp-audio { width: 100%; height: 38px; }
.sp-tip { font-size: 13.5px; padding: 10px 12px; border-radius: 12px; background: #eef5fb; color: #2b4a63; line-height: 1.5; }
.sp-react { display: flex; gap: 10px; align-items: center; }
.sp-react .bubble { font-size: 14px; font-style: italic; }
.sp-lead { display: block; font-style: italic; color: var(--muted); margin-bottom: 2px; }

/* ---- mock speaking tests (speaking-test.js) + speaking kit (speaking-kit.js) ---- */
.ex-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.ex-opt { position: relative; }
.ex-opt b { white-space: normal; }
.ex-opt.soon { opacity: .55; cursor: not-allowed; background: var(--tint); }
.ex-opt.soon:hover { transform: none; background: var(--tint); border-color: var(--line); }
.ex-soon { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 99px; background: var(--espresso); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; }
.ex-opt[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translate(-50%, -4px); width: 250px; padding: 9px 11px; border-radius: 10px; background: var(--espresso); color: #fff; font: 500 12.5px/1.45 var(--font); text-align: left; white-space: normal; box-shadow: 0 12px 28px -10px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5; }
.ex-opt[data-tip]:hover::after, .ex-opt[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.ex-pick .ex-opt:first-child[data-tip]::after { left: 0; transform: translate(0, -4px); }
.ex-pick .ex-opt:first-child[data-tip]:hover::after, .ex-pick .ex-opt:first-child[data-tip]:focus-visible::after { transform: none; }
.ex-pick .ex-opt:last-child[data-tip]::after { left: auto; right: 0; transform: translate(0, -4px); }
.ex-pick .ex-opt:last-child[data-tip]:hover::after, .ex-pick .ex-opt:last-child[data-tip]:focus-visible::after { transform: none; }
.ex-check { margin: 14px 0; padding-left: 4px; list-style: none; display: grid; gap: 7px; font-size: 14px; line-height: 1.45; }
.ex-beans { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #eef7f0; border: 1px solid rgba(95,158,110,.35); font-size: 13.5px; line-height: 1.5; }
.ex-beans span { display: block; margin-top: 4px; color: #2f6b3e; }
.ex-beans span:first-child { margin-top: 0; }
.ex-ok { color: #2f6b3e; font-weight: 700; }
.ex-hint { margin: 0 0 10px; padding: 12px 14px; border-radius: 12px; background: #fffaf0; border: 1px solid var(--caramel); font-size: 13.5px; line-height: 1.5; max-height: 260px; overflow-y: auto; }
.ex-hint h4 { margin: 0 0 4px; font-size: 13px; }
.ex-hint h4 + ul { margin-top: 0; }
.ex-hint ul { margin: 0 0 8px; padding-left: 18px; }
.ex-hint i { color: var(--mocha); }
.ex-hint .ex-ph { list-style: none; padding-left: 0; display: grid; gap: 3px; }
.ex-hint .ex-ph li { display: flex; gap: 6px; align-items: baseline; }
.ex-hint .ex-ph .icon-btn { flex: none; font-size: 13px; }
.ex-ready { display: flex; gap: 8px; align-items: center; margin: 6px 0 14px; padding: 10px 12px; border-radius: 12px; background: #fff6e8; border: 1px dashed var(--caramel); font-weight: 600; cursor: pointer; }
.ex-q { margin-bottom: 10px; }
.ex-stage { display: flex; gap: 18px; align-items: center; justify-content: center; min-height: 128px; margin: 10px 0; }
.ex-rec { flex: 1; min-width: 0; }
.ex-prep { margin: 0; }
.kit-cd .sp-ring.warn .sp-ring-prog { stroke: #c0392b; }
.kit-cd .sp-ring.warn b { color: #c0392b; }
.kit-cd .sp-ring-prog { transition: stroke-dashoffset .1s linear, stroke .3s; }
.kit-rec { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kit-rec.idle { flex-direction: column; text-align: center; }
.kit-rec.on .sp-level { flex: 1; min-width: 80px; }
.kit-rec .kit-time { font: 700 16px var(--mono); }
.kit-dot { width: 10px; height: 10px; border-radius: 50%; background: #d33; animation: kitblink 1s infinite; }
@keyframes kitblink { 50% { opacity: .25; } }
.kit-play { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.kit-play a.btn { text-decoration: none; }
.kit-play .on { background: var(--sage); }
.kit-card { margin: 4px 0 6px; padding: 14px 16px; border-radius: 12px; background: #fffdf6; border: 2px solid var(--espresso); box-shadow: 4px 4px 0 var(--tint-2); font-size: 14.5px; line-height: 1.45; }
.kit-card small { display: block; color: var(--terracotta); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.kit-card h4 { margin: 4px 0 6px; font: 700 17px/1.35 var(--display); }
.kit-card p { margin: 4px 0; }
.kit-card ul { margin: 2px 0 4px; padding-left: 20px; }
.kit-card-end { font-weight: 600; }
.ex-review h4 { margin: 14px 0 6px; }
.ex-clips { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ex-clip { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 11px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.ex-clip > div:first-child { min-width: 0; }
.ex-clip small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ex-clip b { display: block; font-size: 13.5px; font-weight: 600; }
.ex-clip .muted { font-size: 12px; }
.ex-clip details { font-size: 12.5px; margin-top: 3px; }
.ex-clip details summary { cursor: pointer; color: var(--mocha); }
.ex-cardrev summary { cursor: pointer; font-weight: 600; margin: 4px 0; }
/* mock test: mode, card history, pause, feedback, self-check, teacher preview */
.ex-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.ex-mode-opt { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.ex-mode-opt:has(input:checked) { border-color: var(--caramel); background: #fff6e8; }
.ex-mode-opt input { margin-top: 3px; accent-color: var(--caramel); }
.ex-mode-opt small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.ex-cards { display: grid; gap: 6px; margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--tint); font-size: 13.5px; }
.ex-cards label { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; cursor: pointer; }
.ex-cards select { max-width: 100%; font: inherit; font-size: 12.5px; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--line); }
.linkish { background: none; border: 0; padding: 0; color: var(--mocha); text-decoration: underline; font: inherit; font-size: 12px; cursor: pointer; justify-self: start; }
.kit-cd .sp-ring.paused { opacity: .55; }
.kit-rec.paused .kit-dot { animation: none; background: #999; }
.ex-hinted { color: var(--gold); font-weight: 700; }
.ex-modetag { margin: 0 0 8px; font-size: 13px; color: var(--mocha); }
.ex-fb { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.ex-fb li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.ex-fb li > span { font-size: 18px; line-height: 1.2; }
.ex-fb small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ex-self { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ex-self fieldset { margin: 0; padding: 8px 11px 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.ex-self legend { font-size: 12.5px; padding: 0 4px; }
.ex-self legend i { color: var(--muted); }
.ex-self .ex-score { margin-left: 4px; padding: 1px 7px; border-radius: 99px; background: var(--tint-2); font-weight: 700; }
.ex-self label { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; margin-top: 4px; cursor: pointer; }
.ex-self input { margin-top: 2px; accent-color: var(--sage); }
.t-warn { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: #8a4b12; }
.t-prev { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.t-prev details summary { cursor: pointer; color: var(--mocha); }
@media (max-width: 640px) { .ex-mode, .ex-self { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .ex-pick { grid-template-columns: 1fr; }
  .ex-opt[data-tip]::after, .ex-pick .ex-opt:first-child[data-tip]::after, .ex-pick .ex-opt:last-child[data-tip]::after { left: 0; right: 0; width: auto; top: calc(100% + 4px); transform: none; }
  .ex-stage { flex-direction: column; }
  .ex-clip { flex-direction: column; align-items: stretch; }
}
.sp-reward { padding: 10px 14px; border-radius: 12px; background: var(--tint); font-weight: 600; font-size: 14px; }
.sp-reward span { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); font-style: italic; }
.sp-reward.ok { background: #e8f4ea; color: #2f6b3e; }

/* ---------- menu book */
.menubook-modal { width: min(1080px, 100%); padding: 18px 18px 16px; background: rgba(255, 251, 245, .9); }
.mb-top { display: flex; align-items: center; gap: 12px; padding: 0 40px 10px 4px; }
.mb-wallet { padding: 6px 12px; border-radius: 999px; background: #f7e6cc; color: #8a5a1f; font-weight: 700; font-size: 14px; }
.mb-hint { font-size: 12.5px; color: var(--muted); }
.mb-stage { position: relative; display: flex; justify-content: center; padding: 6px 40px 6px 0; perspective: 2400px; }
.book { --pw: min(460px, calc((100vw - 140px) / 2)); --ph: min(620px, calc(100vh - 210px), calc(var(--pw) * 1.38)); position: relative; width: calc(var(--pw) * 2); height: var(--ph); transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,.7,.2,1); }
.book.closed { transform: translateX(-25%); }
.book.ended { transform: translateX(25%); }
.leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.45,.05,.2,1); cursor: pointer; }
.leaf.flipped { transform: rotateY(-180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; border-radius: 3px 12px 12px 3px; }
.face.back { transform: rotateY(180deg); border-radius: 12px 3px 3px 12px; }
.face .shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(60,35,15,.16), transparent 9%); }
.face.back .shade { background: linear-gradient(-90deg, rgba(60,35,15,.16), transparent 9%); }
.leaf:not(.flipped) { box-shadow: 0 18px 40px -18px rgba(60,35,15,.45); }
.book.single { --pw: min(440px, calc(100vw - 76px)); width: var(--pw); }
.book.single.closed, .book.single.ended { transform: none; }
.book.single .leaf { left: 0; width: 100%; }
.book.single .leaf.flipped { opacity: 0; pointer-events: none; transition: transform .7s cubic-bezier(.45,.05,.2,1), opacity .3s .45s; }
.pg { position: absolute; inset: 0; padding: 26px 26px 34px; display: flex; flex-direction: column; }
.pg.paper { background: linear-gradient(180deg, #fffdf8, #fbf4e7); color: var(--espresso); }
.pg.paper::after { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(201,138,75,.25); border-radius: 6px; pointer-events: none; }
.pg-num { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font: 500 12px var(--display); color: var(--muted); }
.pg-head { text-align: center; margin-bottom: 12px; }
.pg-head small { display: block; font: 700 11px var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--terracotta); }
.pg-head h2 { font: 900 30px/1.1 var(--display); margin: 4px 0 0; }
.pg-head h2::after { content: "☕"; display: block; font-size: 13px; margin-top: 6px; opacity: .5; }
.pg.cover, .pg.back-cover { background: radial-gradient(circle at 30% 20%, #5c3c28, #2f1e14 70%); color: #f6e7cf; justify-content: center; align-items: center; text-align: center; }
.pg.cover::before, .pg.back-cover::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 2px, transparent 2px 6px); }
.cv-frame { position: relative; border: 1.5px solid rgba(233,193,120,.6); outline: 1px solid rgba(233,193,120,.3); outline-offset: 6px; border-radius: 8px; padding: 40px 26px; width: 82%; }
.cv-logo { font-size: 44px; }
.cv-frame h1 { font: 900 min(40px, calc(var(--pw) / 10)) / 1 var(--display); margin: 12px 0 6px; letter-spacing: .02em; color: #fff3df; }
.cv-frame h1 span { color: #e9c178; }
.cv-frame p { font: italic 500 16px var(--display); margin: 0; color: #e8d3b3; }
.cv-frame small { display: block; margin-top: 12px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #c9ad86; }
.cv-rule { width: 60px; height: 2px; background: #e9c178; margin: 18px auto 4px; }
.cv-hint { margin-top: 24px; font-size: 12px; color: #e9c178; animation: float 2s ease-in-out infinite; }
.how { padding-left: 20px; line-height: 1.6; font-size: 14.5px; margin: 6px 0; }
.how li { margin-bottom: 8px; }
.pg .vi { font-size: 13px; color: var(--mocha); }
.wallet { margin-top: auto; align-self: center; padding: 10px 18px; border-radius: 999px; background: #f7e6cc; color: #8a5a1f; font-weight: 600; }
.toc { list-style: none; margin: 4px 0; padding: 0; }
.toc button { width: 100%; display: flex; align-items: baseline; gap: 6px; padding: 9px 4px; font-size: 15px; text-align: left; border-radius: 8px; }
.toc button:hover { background: rgba(201,138,75,.1); }
.toc i { font-size: 12px; color: var(--muted); }
.toc .dots { flex: 1; border-bottom: 1.5px dotted rgba(74,51,38,.3); transform: translateY(-4px); }
.toc b { font: 700 14px var(--display); }
.notes { padding-left: 4px; list-style: none; line-height: 1.6; font-size: 14.5px; }
.notes li { margin-bottom: 8px; }
.mb-items { display: grid; grid-template-rows: repeat(4, 1fr); gap: 4px; flex: 1; min-height: 0; }
.mb-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 12px; text-align: left; min-height: 0; transition: background .15s; }
.mb-item:hover { background: rgba(201,138,75,.1); }
.mb-cup { width: clamp(56px, calc(var(--ph) / 7.5), 92px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c) 22%, #fff), #fff 70%); display: grid; place-items: center; }
.mb-cup img { width: 112%; height: 112%; object-fit: contain; opacity: 0; transition: opacity .3s; }
.mb-cup img.in { opacity: 1; }
.mb-txt { min-width: 0; display: grid; gap: 1px; }
.mb-txt b { font: 700 15.5px/1.2 var(--display); }
.mb-txt b i { font: 500 11px var(--font); color: var(--muted); }
.mb-txt small { font-size: 12px; line-height: 1.35; color: var(--mocha); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mb-txt small.en { color: var(--muted); font-style: italic; -webkit-line-clamp: 1; }
.mb-price { font: 700 14px var(--mono); color: #8a5a1f; white-space: nowrap; }
.mb-price::after { content: " ☕"; font-size: 11px; }
.mb-price.free { color: #2f6b3e; }
.mb-price.free::after, .mb-price.big::after { content: ""; }
.mb-price.big { font-size: 20px; }
.mb-marks { position: absolute; left: 100%; top: 30px; display: grid; gap: 4px; z-index: 5; transform: translateZ(1px); }
.mb-marks button { display: flex; align-items: center; gap: 6px; height: 36px; width: 40px; padding: 0 9px; border-radius: 0 10px 10px 0; background: #ead7bc; font-size: 16px; overflow: hidden; transition: width .2s, background .2s; box-shadow: 2px 2px 6px -2px rgba(60,35,15,.3); }
.mb-marks button { justify-content: center; }
.mb-marks button em { display: none; font-style: normal; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.mb-marks button:hover { width: 128px; justify-content: flex-start; }
.mb-marks button:hover em { display: inline; }
.mb-marks button.on { background: var(--terracotta); color: #fff; }
.mb-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.mb-pos { min-width: 70px; text-align: center; font: 500 13px var(--display); color: var(--muted); }
.mb-detail { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 18px; background: rgba(255,250,243,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: 26px; opacity: 0; transition: opacity .2s; }
.mb-detail.in { opacity: 1; }
.mbd-card { position: relative; display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; width: min(760px, 100%); padding: 22px; border-radius: 22px; background: #fffdf8; box-shadow: 0 30px 70px -24px rgba(60,35,15,.5); border: 1px solid #fff; }
.mbd-x { position: absolute; top: 10px; right: 10px; }
.mbd-view { position: relative; aspect-ratio: 1; border-radius: 18px; background: radial-gradient(circle at 50% 60%, #fff, #f1e5d2); overflow: hidden; }
.mbd-view canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.mbd-view canvas:active { cursor: grabbing; }
.mbd-view small { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.mbd-info { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.mbd-info > small { font: 700 11px var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--terracotta); }
.mbd-info h3 { font: 900 28px/1.15 var(--display); margin: 0; color: var(--espresso); text-transform: none; letter-spacing: 0; display: block; }
.mbd-info h3 i { font: 500 14px var(--font); color: var(--muted); }
.mbd-info p { margin: 0; line-height: 1.5; color: var(--roast); }
.mbd-info p.en { font-style: italic; color: var(--muted); }
.mbd-buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.mbd-buy .btn { padding: 12px 26px; }

/* ---------- board games picker */
.boardgames-modal { width: min(620px, 100%); }
.bg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.bg-game { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 12px 14px; border-radius: 18px; background: #fffaf2; border: 1px solid rgba(201,138,75,.35); box-shadow: 0 10px 22px -16px rgba(60,35,15,.6); transition: transform .2s, box-shadow .2s; text-align: center; }
@media (hover: hover) { .bg-game:not([disabled]):hover { transform: translateY(-3px); box-shadow: 0 16px 28px -16px rgba(60,35,15,.7); } }   /* touch: a tap leaves :hover stuck */
.bg-game img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; margin-bottom: 6px; background: #f3e9d6; }
.bg-game b { font: 800 18px/1.15 var(--display); }
.bg-game i { font-size: 14px; color: var(--muted); }
.bg-game small { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--terracotta); }
.bg-game.soon { opacity: .6; cursor: default; }

/* ---------- library */
.library-pick { width: min(760px, 100%); }
.lb-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lb-cover { position: relative; aspect-ratio: 3 / 4; padding: 16px 14px 14px 20px; border-radius: 4px 12px 12px 4px; text-align: left; color: #fff4df; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(90deg, rgba(0,0,0,.22), transparent 10%), radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--c) 75%, #fff), var(--c) 75%); box-shadow: 0 14px 26px -14px rgba(60,35,15,.6); transition: transform .2s; }
.lb-cover:hover { transform: translateY(-4px) rotate(-1deg); }
.lb-cover b { font: 900 19px/1.15 var(--display); }
.lb-cover small { font-size: 12px; opacity: .85; }
.lb-cover span { margin-top: auto; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.library-book .pg.cover, .library-book .pg.back-cover { background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--bc) 78%, #fff), color-mix(in srgb, var(--bc) 80%, #000) 75%); }
.lb-title { font-size: min(34px, calc(var(--pw) / 11)) !important; line-height: 1.15 !important; }
.lb-page { padding-bottom: 38px; }
.lb-body { flex: 1; min-height: 0; overflow-y: auto; font-size: 14px; line-height: 1.5; padding-right: 4px; scrollbar-width: thin; user-select: text; }
.lb-body h4 { margin: 10px 0 4px; font: 700 12px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--terracotta); }
.lb-body p { margin: 4px 0 8px; }
.lb-f { margin: 3px 0; padding: 5px 10px; border-radius: 8px; background: #f4e7d4; font: 700 12.5px/1.45 var(--mono); color: #5a3820; }
.lb-li { position: relative; padding-left: 16px; margin: 3px 0; }
.lb-li::before { content: ""; position: absolute; left: 4px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--caramel); }
.lb-ex { margin: 4px 0; padding: 4px 10px; border-left: 3px solid var(--sage); font: italic 500 14px/1.45 var(--display); color: #2f4a36; background: rgba(95,158,110,.07); border-radius: 0 8px 8px 0; }
.lb-tip { margin: 8px 0 4px; padding: 7px 10px; border-radius: 10px; background: #fdf1de; border: 1px dashed rgba(201,138,75,.6); font-size: 13px; }

.bk-sw { width: 30px; height: 30px; border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.bk-sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--espresso); }
.bk-dot { display: inline-block; width: 10px; height: 14px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }

.praise-box { margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; background: #fff7e6; border: 1px dashed rgba(201,138,75,.6); font-size: 14px; line-height: 1.45; }

/* receipt */
.receipt-wrap { width: min(400px, 100%); padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.receipt-wrap .modal-x { color: #fff; top: -6px; right: -6px; background: rgba(42,27,18,.55); }
.receipt { position: relative; background: #fffdf8; color: #241a13; font: 13px/1.5 var(--mono); padding: 26px 24px 30px; filter: drop-shadow(0 30px 40px rgba(74,45,25,.35)); animation: print 1.1s cubic-bezier(.2,.8,.2,1); transform-origin: top; }
.receipt::before, .receipt::after { content: ""; position: absolute; left: 0; right: 0; height: 12px; background: linear-gradient(-45deg, transparent 8px, #fffdf8 0) 0 0 / 16px 12px repeat-x, linear-gradient(45deg, transparent 8px, #fffdf8 0) 0 0 / 16px 12px repeat-x; }
.receipt::before { top: -11px; transform: rotate(180deg); }
.receipt::after { bottom: -11px; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-20px); } to { clip-path: inset(0 0 0 0); } }
.receipt .c { text-align: center; }
.receipt h3 { font: 900 24px/1 'DM Sans', system-ui, sans-serif; margin: 4px 0; letter-spacing: .1em; }
.rc-logo { display: flex; justify-content: center; margin: 2px 0 8px; }
.rc-logo img { margin: 0 auto; width: 170px; max-width: 70%; height: auto; }
.receipt .tg { font: italic 500 13px var(--display); margin: 0; }
.receipt .dash { border-top: 1.5px dashed #b9ad9c; margin: 10px 0; }
.receipt .ln { display: flex; justify-content: space-between; gap: 10px; }
.receipt .ln span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt .sm { font-size: 11.5px; color: #6f6458; }
.receipt .big { font-size: 15px; font-weight: 700; }
.receipt .verdict { text-align: center; padding: 14px 8px 4px; }
.receipt .verdict h4 { font: 900 28px/1 var(--display); margin: 0 0 8px; letter-spacing: .03em; }
.receipt .verdict.full h4 { color: #2e7d32; }
.receipt .verdict.under h4 { color: #c0392b; }
.receipt .verdict p { margin: 4px 0; }
.receipt .stamp { position: absolute; right: 12px; top: 30px; transform: rotate(-14deg); border: 3px solid currentColor; border-radius: 10px; padding: 4px 10px; font: 900 16px var(--display); letter-spacing: .08em; opacity: .75; }
.receipt .stamp.full { color: #2e7d32; } .receipt .stamp.under { color: #c0392b; }
.barcode { height: 46px; margin: 12px auto 4px; width: 80%; background: repeating-linear-gradient(90deg, #241a13 0 2px, transparent 2px 4px, #241a13 4px 5px, transparent 5px 8px, #241a13 8px 11px, transparent 11px 12px); }
.receipt-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }

/* teacher */
.teacher { width: min(900px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.t-head { padding: 22px 26px 0; }
.t-head h2 { display: flex; align-items: center; gap: 10px; }
.t-tabs { display: flex; gap: 6px; padding: 12px 26px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.t-tabs::-webkit-scrollbar { display: none; }
.t-tabs button { padding: 8px 14px; border-radius: 12px; font-weight: 500; color: var(--mocha); white-space: nowrap; }
.t-tabs button.on { background: #f5e2c6; color: #7a4a1a; }
.t-body { padding: 18px 26px 26px; overflow-y: auto; }
.t-body h3 { margin: 20px 0 10px; }
.t-body h3:first-child { margin-top: 0; }
.card { padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--line); margin-bottom: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row small { color: var(--muted); display: block; font-size: 12.5px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cat-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff; text-align: left; border: 1px solid var(--line); }
.cat-chip.on { border-color: var(--caramel); background: #fbeedb; }
.cat-chip small { color: var(--muted); display: block; font-size: 11.5px; }
.q-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.q-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
.q-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.q-table td.q { max-width: 380px; }
.tag-type { font: 700 10.5px var(--mono); padding: 2px 7px; border-radius: 6px; background: #e3f0f8; color: #2b5a78; text-transform: uppercase; }
.err { color: #a63a32; font-size: 13px; }
.ok-txt { color: #2f6b3e; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.code { font: 12px/1.6 var(--mono); background: #f6efe4; padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; color: var(--roast); }

/* youtube dock */
.yt-dock { position: fixed; right: 84px; bottom: 140px; z-index: 11; width: 300px; border-radius: 16px; overflow: hidden; }
.yt-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 6px 12px; font-size: 13px; font-weight: 700; }
.yt-frame { aspect-ratio: 16 / 9; }
.yt-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-dock.min .yt-frame { height: 0; aspect-ratio: auto; overflow: hidden; }

/* toasts */
#toasts { position: fixed; top: 92px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(460px, calc(100vw - 32px)); }
.toast { padding: 11px 16px; border-radius: 14px; background: var(--glass-strong); border: 1px solid #fff; box-shadow: var(--shadow); font-size: 14.5px; opacity: 0; transform: translateY(-8px); transition: .3s; pointer-events: auto; text-align: center; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.toast.in { opacity: 1; transform: none; }
.toast.good { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(95,158,110,.55); }
.toast.bad { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(208,86,111,.5); }
.toast.gold { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(201,138,75,.65); }

/* ---------- responsive */
@media (max-width: 1180px) and (min-width: 641px) {
  .announce { top: 190px; }
  #toasts { top: 192px; }
}
@media (max-width: 900px) {
  .status { display: none; }
  .timer { right: 84px; bottom: 16px; }
  .yt-dock { right: 84px; bottom: 150px; width: 260px; }
  .mbd-card { grid-template-columns: 1fr; max-height: calc(100vh - 80px); overflow-y: auto; }
  .mbd-view { max-height: 42vh; aspect-ratio: auto; height: 42vh; }
}
@media (max-width: 760px) {
  .menubook-modal { padding: 14px 10px 12px; }
  .mb-stage { padding-right: 36px; }
  .mb-hint { display: none; }
  .book.single { --ph: min(600px, calc(100vh - 200px)); }
  .pg { padding: 22px 18px 32px; }
  .pg-head h2 { font-size: 25px; }
  .mb-marks button { width: 36px; height: 34px; padding: 0 8px; }
  .mb-marks button:hover { width: 36px; justify-content: center; }
  .mb-marks button:hover em { display: none; }
}
@media (max-width: 640px) {
  .topbar { left: 16px; right: 16px; }
  .brand { padding: 8px 12px 8px 8px; }
  .brand-mark { width: 46px; height: 36px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 10px; white-space: nowrap; }
  .me { margin-left: auto; padding: 6px 8px; }
  .me-name { display: none; }
  .dock { top: auto; transform: none; left: 16px; right: 16px; bottom: max(10px, env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; padding: 6px; border-radius: 20px; }
  .dock button { width: 38px; height: 42px; }
  .dock hr { display: none; }
  .dock button .lbl { display: none; }
  .rightbar { display: contents; }
  .rightbar .dock { position: fixed; }
  .rightbar .viewbar { position: fixed; top: 76px; right: 16px; flex-direction: row; padding: 4px; border-radius: 16px; }
  .rightbar .viewbar button { width: 38px; height: 36px; }
  .rightbar .viewbar button span { display: none; }
  .timer { left: 16px; right: 16px; bottom: 74px; padding: 8px 12px 8px 8px; gap: 10px; }
  .ring { width: 66px; height: 66px; }
  .ring-inner b { font-size: 14px; } .ring-inner small { display: none; }
  .timer-side { min-width: 0; flex: 1; }
  .chat { bottom: 74px; width: calc(100vw - 32px); }
  body.seated .chat { bottom: 206px; }
  .chat-log { font-size: 13px; }
  .chat-quick { display: none; }
  .joystick { left: auto; right: 22px; bottom: 190px; width: 104px; height: 104px; }
  body.seated .joystick { bottom: 320px; }
  #toasts { top: 178px; }
  .panel { width: 100vw; border-radius: 22px 22px 0 0; top: 12vh; transform: translateY(105%); }
  .panel.open { transform: none; }
  .announce { top: 178px; }
  .grid2 { grid-template-columns: 1fr; }
  .modal { padding: 22px 18px; }
  .yt-dock { left: 16px; right: auto; bottom: auto; top: 178px; width: 220px; }
  .sp-rec { flex-direction: column; }
  .sp-rec-side { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Chó the café cat */
.seat-label.npc.cat { background: #f0a35e; color: #3b2418; padding: 2px 9px; font-size: 11px; }
.labels-layer.far .seat-label.npc.cat { display: none; }
.seat-label.npc.guest { background: #4a2f5c; color: #fff1fb; }
.seat-label.npc.guest i { color: #f0c8e6; }
.sp-single-intro { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #fff3e2; border: 1px dashed #e3b07c; }
.praise-box div + div { margin-top: 4px; }
.regulars-h { margin: 14px 0 6px; font-size: 14px; color: var(--mocha); }

/* Chó scratches the screen */
.claw-marks { position: fixed; inset: 0; z-index: 9999; pointer-events: none; display: flex; justify-content: center; align-items: center; gap: 34px; transform: rotate(-24deg); }
.claw-marks i { display: block; width: 14px; height: 0; border-radius: 10px; background: linear-gradient(180deg, rgba(160,20,30,0), #c0222f 18%, #e04050 60%, rgba(160,20,30,0)); box-shadow: 0 0 12px rgba(200,30,40,.5); animation: claw 1.7s ease-out forwards; }
.claw-marks i:nth-child(2) { animation-delay: .05s; margin-top: 40px; }
.claw-marks i:nth-child(3) { animation-delay: .1s; }
@keyframes claw { 0% { height: 0; opacity: 1; } 18% { height: 62vh; opacity: 1; } 70% { height: 62vh; opacity: .9; } 100% { height: 62vh; opacity: 0; } }

/* ---------- daily practice report */
.report-modal textarea { width: 100%; font: 14px/1.5 var(--mono, monospace); padding: 10px 12px; border-radius: 12px; border: 1px solid #e3cfb4; background: #fffdf9; resize: vertical; }
.rp-sample { margin: 8px 0 10px; } .rp-sample summary { cursor: pointer; color: var(--mocha); font-weight: 600; }
.rp-sample pre, .rp-text { white-space: pre-wrap; font: 13px/1.5 var(--mono, monospace); background: #fff7ec; border: 1px dashed #e3b07c; border-radius: 10px; padding: 10px 12px; margin: 8px 0; max-height: 300px; overflow: auto; }
.rp-checks { list-style: none; padding: 0; margin: 8px 0 12px; font-size: 13px; line-height: 1.6; }
.rp-checks .ok { color: #3f7d4f; } .rp-checks .bad { color: #b3403a; font-weight: 600; }
.rp-nav { align-items: center; gap: 8px; } .rp-nav input { padding: 6px 8px; border-radius: 8px; border: 1px solid #e3cfb4; }
.rp-list { display: grid; gap: 8px; margin-top: 10px; }
.rp-row { border: 1px solid #eadbc6; border-radius: 12px; padding: 8px 12px; background: #fffdf9; }
.rp-row.revoked { opacity: .6; }
.rp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-head .rp-beans { margin-left: auto; font-weight: 700; color: #a8742c; }
.badge.warn { background: #ffe7c2; color: #8a5a10; }

/* ---------- HIGHBANDS brand */
.welcome .logo:has(img) { background: none; box-shadow: none; width: 124px; height: 95px; border-radius: 0; filter: drop-shadow(0 10px 18px rgba(142,34,41,.25)); }
.welcome .logo + h2 { font-family: var(--display); font-weight: 900; letter-spacing: .06em; color: #a3202a; }
.cv-logo.hb { font-size: 0; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.menubook-modal .cover .cv-frame h1 { font-family: var(--display); letter-spacing: .06em; }
.hb-logo { display: block; max-width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }

/* green "online" dot on Cô PA's name tag */
.seat-label .online-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; flex: none; margin-right: 5px; box-shadow: 0 0 0 2px #fff, 0 0 8px 2px rgba(34,197,94,.7); animation: onlinePulse 2s ease-in-out infinite; display: inline-block; vertical-align: middle; }
@keyframes onlinePulse { 0%,100% { box-shadow: 0 0 0 2px #fff, 0 0 4px 1px rgba(34,197,94,.5); } 50% { box-shadow: 0 0 0 2px #fff, 0 0 12px 4px rgba(34,197,94,.85); } }

/* ---------- right toolbar: camera views on top of the café actions */
.rightbar { position: fixed; right: 16px; top: 84px; bottom: 16px; z-index: 10; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 8px; pointer-events: none; }
.rightbar > * { pointer-events: auto; }
.rightbar .dock { position: static; transform: none; }
.dock-toggle { display: none; } /* phones only */
.rightbar .viewbar { position: static; transform: none; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 20px; }
.rightbar .viewbar button { position: relative; display: grid; place-items: center; width: 48px; height: 38px; padding: 0; border-radius: 12px; font-size: 19px; }
.rightbar .viewbar button[hidden] { display: none; }
.rightbar .viewbar button span { position: absolute; right: 60px; white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: var(--espresso); color: var(--foam); font-size: 13px; font-weight: 500; opacity: 0; transform: translateX(6px); pointer-events: none; transition: .18s; }
.rightbar .viewbar button:hover span { opacity: 1; transform: none; }
@media (max-height: 820px) and (min-width: 641px) {
  .rightbar .dock { padding: 6px; gap: 2px; }
  .rightbar .dock button { width: 44px; height: 40px; }
  .rightbar .dock .small { height: 34px; }
  .rightbar .viewbar button { width: 44px; height: 32px; font-size: 17px; }
}

/* receipt: study time stands out */
.receipt .ln.study { color: #c8202f; font-weight: 900; }
.receipt .ln.study span { font-weight: 900; }

/* receipt: the band tip as a yellow highlighter strip (dark text keeps it readable) */
.receipt .band-tip { line-height: 1.6; }
.receipt .band-tip mark { color: inherit; padding: 1px 3px; border-radius: 3px; background: linear-gradient(transparent 12%, #fdf3b4 12%, #fdf3b4 92%, transparent 92%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* seated learners: digital study clock above the name */
.seat-label .sl-clock { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; letter-spacing: .06em; line-height: 1; color: #7dffb0; background: #1d1410; padding: 3px 7px 2px; border-radius: 6px; margin-bottom: 2px; text-shadow: 0 0 6px rgba(125,255,176,.55); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.seat-label.break .sl-clock { color: #ffd27a; text-shadow: 0 0 6px rgba(255,210,122,.5); }
.labels-layer.far .seat-label .sl-clock { font-size: 10px; padding: 2px 5px 1px; }

/* Chó's hover menu: Ôm / Vuốt / Cho ăn */
.cat-menu { position: fixed; left: 0; top: 0; z-index: 40; width: 228px; padding: 8px; border-radius: 16px; display: flex; flex-direction: column; gap: 4px; color: var(--espresso); }
.cat-menu[hidden] { display: none; }
.cat-menu .cm-head { display: flex; align-items: baseline; gap: 6px; padding: 2px 6px 4px; font-size: 13px; }
.cat-menu .cm-head small { margin-left: auto; font-size: 11px; color: var(--mocha); text-align: right; }
.cat-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 9px; border-radius: 11px; border: 1px solid transparent; background: rgba(255,255,255,.55); color: inherit; font: inherit; cursor: pointer; transition: background .15s, transform .15s; }
.cat-menu button:hover:not(:disabled) { background: #fff; border-color: rgba(240,163,94,.6); transform: translateX(2px); }
.cat-menu button:disabled { opacity: .5; cursor: not-allowed; }
.cat-menu button.hot { background: #fff1dc; border-color: #f0a35e; animation: catHot 1.2s ease-in-out infinite; }
.cat-menu .ci { font-size: 20px; width: 26px; text-align: center; flex: none; }
.cat-menu .ct { display: flex; flex-direction: column; min-width: 0; }
.cat-menu .ct b { font-size: 13px; }
.cat-menu .ct small { font-size: 11px; color: var(--mocha); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes catHot { 50% { box-shadow: 0 0 0 3px rgba(240,163,94,.35); } }

/* speaking: a note under the chosen list (e.g. "for reference only") */
.sp-note { margin: 8px 0 2px; padding: 8px 12px; border-radius: 10px; background: #fff6d6; border: 1px solid #f1d98a; color: #5a4310; font-size: 13px; }

/* welcome: Đăng nhập / Tạo tài khoản tabs + 3-digit PIN */
.welcome .w-tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 14px; border-radius: 14px; background: rgba(74,45,25,.08); }
.welcome .w-tabs button { border: 0; background: transparent; padding: 10px 8px; border-radius: 10px; font: 700 14px 'DM Sans', system-ui, sans-serif; color: var(--mocha); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.welcome .w-tabs button.on { background: #fff; color: #a3202a; box-shadow: 0 2px 8px -3px rgba(74,45,25,.35); }
.welcome form[hidden], #wForms[hidden] { display: none; }
.welcome .input.pin { letter-spacing: .6em; font-weight: 700; text-indent: .6em; }
.welcome .input.pin::placeholder { letter-spacing: normal; font-weight: 400; text-indent: 0; }
.welcome .w-pins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.welcome .w-pinform { display: grid; gap: 12px; }
.welcome .w-remember { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--mocha); cursor: pointer; }
.welcome .w-help { text-align: center; margin: 2px 0 0; line-height: 1.5; }

/* top bar: people in the café */
.status .in-cafe { white-space: nowrap; }
@media (max-width: 640px) { .status .in-cafe .muted { display: none; } }
/* host label: the green "online" dot only while the teacher is logged in */
.seat-label.npc.host-off .online-dot { display: none; }
/* teacher mode (playing the host): no beans */
body.is-teacher #meChip .beans { display: none; }
.chat-log .m.host b { font-weight: 900; }

/* ⭐ customer review (after the bill) */
.btn.gold { background: #e9b949; color: #3b2418; }
.btn.gold:hover { background: #f0c75e; }
.review-modal { max-width: 560px; }
.review-modal .rv-gift { color: #8a5a00; }
.review-modal fieldset.rv-part { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 12px; margin: 0 0 12px; }
.review-modal legend { font-weight: 800; padding: 0 6px; }
.rv-stars { display: flex; align-items: center; gap: 2px; margin: 2px 0 8px; }
.rv-stars button { font-size: 28px; line-height: 1; padding: 0 2px; border: 0; background: none; color: #d8cfc2; cursor: pointer; transition: transform .12s, color .12s; }
.rv-stars button.on { color: #f2b01e; }
.rv-stars button:hover { transform: scale(1.15); }
.rv-stars .rv-sv { margin-left: 8px; font-weight: 700; color: var(--mocha); }
.review-modal textarea { width: 100%; resize: vertical; min-height: 84px; }
.rv-count { text-align: right; font-size: 12px; color: #b4472f; margin-top: 4px; }
.rv-count.ok { color: #15803d; }

/* speaking: Thu âm / Nghe lại + phrases */
.sp-recbtns { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.sp-mic { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.sp-mic small { font-size: 13px; font-weight: 800; margin-top: 4px; letter-spacing: .02em; }
.sp-play.on { background: #2a1b12; color: #fff; }
.sp-recbtns2 { justify-content: center; gap: 8px; margin: 10px 0 4px; }
.sp-phrases { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: #fff8e8; border: 1px solid #f0dfb8; }
.sp-phrases h4 { margin: 0 0 6px; font-size: 14px; }
.sp-ph { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px dashed #ecdcb8; }
.sp-ph:first-of-type { border-top: 0; }
.sp-ph .icon-btn { flex: none; width: 30px; height: 30px; font-size: 14px; }
.sp-ph b { font-size: 15px; color: #2a1b12; }
.sp-ph .ipa { font-family: 'DM Mono', ui-monospace, monospace; font-size: 13px; color: #8a4b1f; margin-left: 4px; }
.sp-ph small { display: block; color: #555; font-size: 13px; margin-top: 2px; }
.sp-phrases .hint { margin: 6px 0 0; font-size: 12px; }

/* library: shelves as tabs, search, "Đọc tiếp", PDF badge */
.lb-tools { margin: 0 0 10px; }
.lb-tools .input { width: 100%; }
.lb-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: thin; }
.lb-tabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 13px; color: var(--mocha); cursor: pointer; white-space: nowrap; }
.lb-tabs button small { font-weight: 600; opacity: .6; margin-left: 2px; }
.lb-tabs button.empty { opacity: .55; }
.lb-tabs button.on { background: var(--espresso); color: #fff; border-color: var(--espresso); opacity: 1; }
#lbList { max-height: min(62vh, 620px); overflow-y: auto; padding: 4px 2px 6px; }
.lb-h { margin: 14px 0 8px; font-size: 15px; }
.lb-h:first-child { margin-top: 2px; }
.lb-more { border: 0; background: none; font: inherit; font-weight: 800; color: var(--espresso); cursor: pointer; padding: 0; }
.lb-more small { font-weight: 600; color: var(--muted); margin-left: 4px; }
.lb-cover .lb-pdf { position: absolute; bottom: 12px; right: 10px; font: 800 10px/1 'DM Sans', sans-serif; font-style: normal; letter-spacing: .08em; background: rgba(255,255,255,.9); color: #b4472f; padding: 3px 6px; border-radius: 6px; }
@media (max-width: 560px) { .lb-shelf { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } .lb-cover b { font-size: 16px; } }
/* PDF viewer */
.pdf-modal { width: min(980px, 100%); }
.pdf-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 36px 10px 0; }
.pdf-frame { height: min(78vh, 900px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #525659; }
.pdf-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.pdf-hint { margin: 8px 0 0; font-size: 12px; }

/* quiz: choose the course (Tất cả · Chung · IPR · IFA · IFB · IIC) */
.quiz-courses { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.quiz-courses button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; color: var(--mocha); cursor: pointer; }
.quiz-courses button small { font-weight: 600; opacity: .6; }
.quiz-courses button.empty { opacity: .5; }
.quiz-courses button.on { background: var(--espresso); color: #fff; border-color: var(--espresso); opacity: 1; }
.quiz-empty { text-align: center; padding: 28px 10px; }

/* ---------------- claw machine (Máy gắp thú) — 2D, candy-striped cabinet like the original */
.modal.claw-modal { width: min(620px, 100%); padding: 16px; background: var(--cl-bgz, #fff); --cl-body: #7cc6f2; --cl-stripe: #a9dcf8; --cl-dark: #1d4e7a; }
.cl-tabs { display: flex; gap: 6px; margin: 0 40px 12px 0; }
.cl-tabs button { padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; background: rgba(255,255,255,.7); color: var(--muted); }
.cl-tabs button.on { background: var(--espresso); color: #fff; }
.cl-tabs b { font-weight: 600; opacity: .75; margin-left: 2px; }
.cl-play { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 28px; border: 5px solid var(--cl-dark);
  background: repeating-linear-gradient(135deg, var(--cl-body) 0 14px, var(--cl-stripe) 14px 28px); box-shadow: 0 10px 24px -10px rgba(0,0,0,.35); }
.cl-head { display: flex; justify-content: center; padding: 4px 12px; border-radius: 16px; background: rgba(255,255,255,.9); border: 3px solid var(--cl-dark); }
.cl-title { font-weight: 800; font-size: 18px; color: #2a2f45; }
.cl-stage { position: relative; aspect-ratio: 5 / 4; max-height: 56vh; border-radius: 16px; overflow: hidden; border: 4px solid var(--cl-dark); container-type: size; user-select: none; }
.cl-bg, .cl-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cl-bg { container-type: size; }
.cl-scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cl-chute { position: absolute; bottom: 0; left: 2%; z-index: 5; height: 30%; width: 24%; border-radius: 12px 12px 0 0; border: 3px solid var(--cl-dark); border-bottom: 0; background: rgba(255,255,255,.25); backdrop-filter: blur(1px); pointer-events: none; }
.cl-chute i { position: absolute; left: 10%; right: 10%; top: 10%; height: 14%; border-radius: 999px; background: var(--cl-dark); opacity: .55; }
.cl-chute span { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: 4.5cqmin; font-weight: 800; letter-spacing: .05em; color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.cl-pile { position: absolute; inset: 0; pointer-events: none; }
.cl-toy, .cl-held { position: absolute; aspect-ratio: 1; }
.cl-toy { translate: -50% 0; }
.cl-toy svg, .cl-held svg { width: 100%; height: 100%; display: block; }
.cl-toy.rare { filter: drop-shadow(0 0 1.6cqmin rgba(255,214,90,.95)); }
.cl-held { z-index: 5; display: none; left: 0; top: 0; pointer-events: none; }
.cl-rail { position: absolute; left: 0; right: 0; top: 0; z-index: 6; height: 3.5cqmin; background: var(--cl-dark); }
.cl-carr { position: absolute; top: 0; left: 50%; z-index: 7; translate: -50% 0; pointer-events: none; }
.cl-house { margin: 0 auto; height: 6cqmin; width: 16cqmin; border-radius: 0 0 12px 12px; border: 3px solid var(--cl-dark); border-top: 0; background: #e2e8f0; }
.cl-swing { display: flex; flex-direction: column; align-items: center; transform-origin: top; }
.cl-swing.idle { animation: clSway 2.8s ease-in-out infinite; }
@keyframes clSway { 0%, 100% { rotate: -9deg; } 50% { rotate: 9deg; } }
.cl-cable { height: 6cqh; width: 1.6cqmin; border-radius: 999px; background: var(--cl-dark); }
.cl-head2 { position: relative; height: 21cqmin; width: 27cqmin; }
.cl-arm { position: absolute; top: 28%; height: 72%; width: 50%; }
.cl-arm.l { left: 0; transform-origin: 100% 0; rotate: 12deg; }
.cl-arm.r { left: 50%; transform-origin: 0 0; rotate: -12deg; }
.cl-arm svg { width: 100%; height: 100%; display: block; }
.cl-arm.r svg { scale: -1 1; }
.cl-arm path { fill: none; stroke-linecap: round; }
.cl-arm path.o { stroke: var(--cl-dark); stroke-width: 12; }
.cl-arm path.i { stroke: #f1f5f9; stroke-width: 5.5; }
.cl-arm circle { fill: #f9a8d4; stroke: var(--cl-dark); stroke-width: 3; }
.cl-hub { position: absolute; top: 0; left: 50%; translate: -50% 0; height: 8cqmin; width: 13cqmin; border-radius: 1.8cqmin; border: 3px solid var(--cl-dark); background: #f1f5f9; }
.cl-hub i { position: absolute; left: 25%; right: 25%; top: 30%; height: 30%; border-radius: 999px; background: #f9a8d4; }
.cl-glare { position: absolute; inset: 0; z-index: 9; pointer-events: none; background: linear-gradient(115deg, transparent 28%, rgba(255,255,255,.28) 30%, rgba(255,255,255,.08) 38%, transparent 40%); }
.cl-msg { position: absolute; left: 50%; top: 30%; z-index: 8; transform: translate(-50%, 8px); padding: 6px 16px; border-radius: 999px; background: rgba(0,0,0,.55); font-weight: 800; font-size: clamp(14px, 4cqmin, 20px); color: #fff; opacity: 0; transition: .3s; pointer-events: none; white-space: nowrap; }
.cl-msg.show { opacity: 1; transform: translate(-50%, 0); }
.cl-msg.win { background: #fff3c4; color: #8a5a12; box-shadow: 0 6px 18px -6px rgba(0,0,0,.4); }
.cl-msg.jackpot { background: linear-gradient(90deg, #ff5f8f, #c2185b); color: #fff; }
.claw-modal.cl-jackpot .cl-play { animation: clJack 1.2s ease-out 2; }
@keyframes clJack { 30% { box-shadow: 0 0 0 8px #ffd34d, 0 0 60px 10px rgba(255,95,143,.7); } }
.cl-ctrl { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 16px; border: 3px solid var(--cl-dark); background: rgba(255,255,255,.45); }
.cl-door { flex: 1 1 0; min-width: 64px; max-width: 120px; height: 62px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; border: 3px solid var(--cl-dark); background: color-mix(in srgb, var(--cl-dark) 80%, transparent); color: rgba(255,255,255,.7); font-weight: 800; font-size: 11px; letter-spacing: .15em; }
.cl-door > * { grid-area: 1 / 1; }
.cl-door-img:not(:empty) + span { display: none; }
.cl-door-img svg { height: 52px; width: 52px; display: block; }
.cl-pop { animation: clPrize .5s ease-out both; }
@keyframes clPrize { 0% { opacity: 0; transform: translateY(-60%) scale(.4); } 60% { opacity: 1; transform: translateY(6%) scale(1.12); } 100% { transform: none; } }
.cl-door.ready { cursor: pointer; animation: clPulse 1s ease-in-out infinite; }
.cl-door.pop { animation: clPop .45s ease-out; }
@keyframes clPulse { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.75); } }
@keyframes clPop { 40% { transform: scale(1.1); } }
.cl-coin { flex: none; margin-left: auto; display: grid; justify-items: center; gap: 1px; padding: 6px 10px; border-radius: 12px; background: var(--cl-dark); color: #ffd77a; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.cl-coin b { font-size: 12px; letter-spacing: 1px; }
.cl-coin small { font-size: 10.5px; color: rgba(255,255,255,.8); }
.cl-slot { width: 24px; height: 5px; border-radius: 3px; background: #0b0b0e; box-shadow: 0 0 0 2px #ffd77a; margin-bottom: 3px; }
.cl-coin.paid .cl-slot { animation: clCoin .5s; }
@keyframes clCoin { 50% { box-shadow: 0 0 0 2px #ffd77a, 0 0 14px 4px #ffd77a; } }
.cl-coin:disabled { opacity: .45; cursor: not-allowed; }
.cl-grab { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #f43f5e; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .05em; border: 3px solid var(--cl-dark); box-shadow: 0 3px 0 var(--cl-dark); transition: transform .08s; }
.cl-grab:not(:disabled) { box-shadow: 0 3px 0 var(--cl-dark), 0 0 0 4px rgba(253,164,175,.7); }
.cl-grab:not(:disabled):active { transform: translateY(2px); }
.cl-grab:disabled { opacity: .6; cursor: not-allowed; }
.cl-lever { flex: none; position: relative; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--cl-dark); background: rgba(255,255,255,.7); touch-action: none; cursor: grab; outline: none; }
.cl-stick { position: absolute; left: 50%; bottom: 50%; width: 16px; height: 36px; margin-left: -8px; transform-origin: 50% 100%; transition: transform .075s; }
.cl-stick::before { content: ''; position: absolute; bottom: 0; left: 50%; width: 6px; height: 24px; margin-left: -3px; border-radius: 999px; background: var(--cl-dark); }
.cl-stick i { position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; background: #fb7185; outline: 3px solid var(--cl-dark); }
.cl-lever.held { cursor: grabbing; }
.claw-modal:not(.cl-live) .cl-lever { opacity: .6; cursor: not-allowed; }
.cl-star { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.7); border: 3px solid var(--cl-dark); color: #fbbf24; font-size: 24px; line-height: 1; }
@media (hover: hover) { .cl-star:not(:disabled):hover { background: #fff; } }   /* touch: a tap leaves :hover stuck */
.cl-star:disabled { opacity: .6; cursor: not-allowed; }
.cl-star.spin { animation: clSpin .55s ease-out both; }
@keyframes clSpin { 0% { rotate: 0deg; scale: 1; } 50% { scale: 1.3; } 100% { rotate: 360deg; scale: 1; } }
.cl-hint { margin: 0 auto; text-align: center; font-size: 12.5px; font-weight: 600; color: #334155; background: rgba(255,255,255,.85); border-radius: 999px; padding: 3px 12px; }
.cl-col { max-height: min(68vh, 620px); overflow-y: auto; padding: 4px; border-radius: 16px; background: rgba(255,255,255,.75); }
.cl-col .lead { margin: 6px 8px; }
.cl-col h3 { margin: 16px 8px 8px; font-size: 15px; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; padding: 0 4px; }
.cl-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); text-align: center; font-size: 12.5px; }
.cl-card-img { width: 60px; height: 60px; margin: 4px 0; }
.cl-card .n { color: var(--muted); font-size: 12px; }
.cl-card .btn { margin-top: 4px; font-size: 11.5px; padding: 4px 8px; }
.cl-card.locked .cl-card-img { filter: brightness(0) opacity(.16); }
.cl-card.locked b { color: var(--muted); }
.cl-card.rare { background: linear-gradient(160deg, #fff0f3, #ffe1e8); box-shadow: inset 0 0 0 2px #f2a3b6; }
.cl-card.on-desk { background: #fff3d6; box-shadow: inset 0 0 0 2px var(--caramel); }
.cl-toast-img { display: inline-block; width: 28px; height: 28px; vertical-align: middle; }
.cl-toast-img svg { width: 100%; height: 100%; }

/* ---------------- Cá ngựa (Ludo) — board-game corner */
.modal.ludo-modal { width: min(980px, 100%); padding: 16px; }
.ld-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 40px 12px 0; }
.ld-top h2 { margin: 0; font-size: 20px; }
.ld-modes { display: flex; gap: 6px; }
.ld-modes button { padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; background: var(--tint); color: var(--muted); }
.ld-modes button.on { background: var(--espresso); color: #fff; }
.ld-pack { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--mocha); }
.ld-pack select { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; font: inherit; font-weight: 700; color: var(--mocha); max-width: 210px; cursor: pointer; }
.ld-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ld-board-box { aspect-ratio: 1; max-height: 72vh; margin: 0 auto; width: 100%; }
.ld-board { width: 100%; height: 100%; display: block; filter: drop-shadow(0 10px 18px rgba(60,35,15,.3)); }
.ld-h { transition: transform .45s cubic-bezier(.3,1.35,.5,1); }
.ld-h .ring { opacity: 0; }
.ld-h.can { cursor: pointer; }
.ld-h.can .ring { opacity: 1; animation: ldPulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@media (hover: hover) { .ld-h.can:hover { filter: brightness(1.06) drop-shadow(0 3px 4px rgba(60,35,15,.35)); } }   /* touch: a tap leaves :hover stuck */
.ld-h.out { opacity: .35; }
@keyframes ldPulse { 50% { transform: scale(1.25); opacity: .35; } }
.ld-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* portrait tablets: side-by-side squeezes the board to ~370px — stack it, board on top */
@media (orientation: portrait) and (min-width: 761px) and (max-width: 1100px) {
  .ld-wrap { grid-template-columns: 1fr; gap: 12px; }
  .ld-board-box { max-height: none; max-width: min(100%, 58vh); }
}
.ld-lead { margin: 0; font-size: 14px; line-height: 1.45; }
.ld-players { display: grid; gap: 6px; }
.ld-p { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: var(--tint); font-size: 13.5px; }
.ld-p i { width: 14px; height: 14px; border-radius: 50%; background: var(--pc); }
.ld-p small { color: var(--muted); font-size: 12px; }
.ld-p.turn { background: #fff; box-shadow: inset 0 0 0 2px var(--pc); font-weight: 700; }
.ld-p.out { opacity: .45; text-decoration: line-through; }
.ld-p em { color: var(--muted); font-style: normal; }
.ld-dice-row { display: flex; align-items: center; gap: 12px; }
.ld-die { flex: none; width: 58px; height: 58px; padding: 7px; border-radius: 14px; background: #fff; border: 3px solid var(--espresso); box-shadow: 0 4px 0 var(--espresso); }
.ld-die:disabled { opacity: .7; cursor: default; }
.ld-die.go { animation: ldBounce 1s ease-in-out infinite; cursor: pointer; }
.ld-die.rolling { animation: ldRoll .55s linear; }
@keyframes ldBounce { 50% { transform: translateY(-4px); box-shadow: 0 8px 0 var(--espresso), 0 0 0 5px rgba(233,169,10,.35); } }
@keyframes ldRoll { to { transform: rotate(720deg) scale(.9); } }
.ld-die.land { animation: ldLand .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes ldLand { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: none; } }
.ld-boom { font-size: 30px; text-anchor: middle; dominant-baseline: central; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: ldBoom .75s ease-out forwards; }
@keyframes ldBoom { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(1.6) translateY(-10px); opacity: 0; } }
.ld-face { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; place-items: center; }
.ld-face i { width: 9px; height: 9px; border-radius: 50%; }
.ld-face i.on { background: var(--espresso); }
.ld-timer { position: relative; flex: 1; height: 10px; border-radius: 999px; background: var(--tint); overflow: visible; }
.ld-timer i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #e9a90a, #e5484d); transition: width .4s linear; }
.ld-timer[data-s]::after { content: attr(data-s) 's'; position: absolute; right: 0; top: 13px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ld-status { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff7e6; font-size: 14px; }
.ld-quiz { padding: 12px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px #f3d68a; }
.ld-qhead { font-size: 12px; font-weight: 800; color: #a66f00; margin-bottom: 6px; }
.ld-q { margin: 0 0 8px; font-weight: 700; font-size: 15px; line-height: 1.4; }
.ld-passage { font-size: 13px; color: var(--mocha); background: var(--tint); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; max-height: 140px; overflow: auto; }
.ld-opts { display: grid; gap: 6px; }
.ld-opts button { text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--tint); font-size: 13.5px; }
.ld-opts button b { margin-right: 4px; color: var(--muted); }
@media (hover: hover) { .ld-opts button:not(:disabled):hover { background: #f3e6d3; } }   /* touch: a tap leaves :hover stuck */
.ld-opts button.right, .ld-fill button.right { background: #d9f5e3; box-shadow: inset 0 0 0 2px #2f9e5b; }
.ld-opts button.wrong, .ld-fill button.wrong { background: #fde2e2; box-shadow: inset 0 0 0 2px #e5484d; }
.ld-fill { display: flex; gap: 6px; }
/* spot the error: the sentence as a row of tappable words (Quiz .opts and games .ld-opts) */
.err-hint { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.err-hint i { font-weight: 400; }
.err-words, .err-words.opts:not(.tfng-opts), .err-words.ld-opts { display: flex; flex-wrap: wrap; gap: 6px; grid-template-columns: none; }
.err-words button, .err-words .opt { padding: 7px 11px; border-radius: 10px; font-size: 15.5px; font-weight: 600; text-align: center; gap: 0; }
.err-words.ld-opts button { padding: 6px 9px; font-size: 14.5px; }
/* listen & type: play button + who reads, above the usual fill-in box */
.ls-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ls-play { min-width: 112px; }
.ls-who { font-size: 13px; color: var(--mocha); }
.ls-q { margin: 0 0 8px; font-weight: 700; font-size: 15px; }
.ls-q i { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.ld-fill .input { flex: 1; min-width: 0; }
.ld-fb { margin-top: 8px; font-size: 13px; }
.ld-fb .ok { color: #2f9e5b; } .ld-fb .no { color: #c03535; }
.ld-log { margin: 0; padding: 8px 10px 8px 26px; border-radius: 12px; background: var(--tint); font-size: 12.5px; color: var(--mocha); max-height: 150px; overflow: auto; }
.ld-log li + li { margin-top: 3px; }
.ld-log li:first-child { font-weight: 700; color: var(--espresso); }
.ld-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ld-actions:empty { display: none; }
.ld-win { padding: 12px; border-radius: 14px; background: linear-gradient(90deg, #fff3c4, #ffe0a3); font-weight: 800; font-size: 17px; text-align: center; }
.ld-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ld-seat { display: grid; grid-template-columns: 16px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 10px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.ld-seat i { grid-row: span 2; width: 16px; height: 16px; border-radius: 50%; background: var(--pc); }
.ld-seat span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .ld-seat:not(:disabled):hover { box-shadow: inset 0 0 0 2px var(--pc); } }   /* touch: a tap leaves :hover stuck */
.ld-seat.taken { background: color-mix(in srgb, var(--pc) 14%, #fff); }
.ld-seat.mine { box-shadow: inset 0 0 0 3px var(--pc); }
.ld-seat.mine span { color: var(--espresso); font-weight: 700; }
.ld-nh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.ld-nh button { padding: 5px 11px; border-radius: 999px; background: var(--tint); font-weight: 700; font-size: 12.5px; color: var(--muted); }
.ld-nh button.on { background: var(--espresso); color: #fff; }
.ld-nh button:disabled { cursor: default; }
.modal.ludo-modal { position: relative; }
.ld-info { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--espresso); color: var(--espresso); font: italic 800 15px Georgia, serif; }
@media (hover: hover) { .ld-info:hover { background: var(--espresso); color: #fff; } }   /* touch: a tap leaves :hover stuck */
.ld-rules-pop { position: absolute; z-index: 5; left: 16px; right: 16px; top: 56px; max-height: calc(100% - 72px); overflow: auto; padding: 16px 18px; border-radius: 18px; background: #fffaf2; box-shadow: 0 18px 50px -12px rgba(60,35,15,.45), inset 0 0 0 2px #e3d3b8; font-size: 14px; line-height: 1.5; }
.ld-rules-pop h3 { margin: 0 0 8px; font-size: 17px; }
.ld-rules-pop ol { margin: 0 0 12px; padding-left: 20px; }
.ld-rules-pop li + li { margin-top: 5px; }

/* ================================================================
   PHONE & TABLET — kept last so it wins over the desktop rules above
   ================================================================ */
/* touch screens: 16px inputs stop iOS from zooming in on focus; no hover-only tooltips */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
  .dock button .lbl, .rightbar .viewbar button span { display: none; }
  /* a tap leaves :hover stuck on touch screens — don't let it repaint the buttons */
  .dock button:hover:not(.accent):not(.on), .viewbar button:hover:not(.on) { background: none; }
  .dock .accent:hover { background: linear-gradient(135deg, #e9b47a, var(--terracotta)); }
  .mb-hint { display: none; }
  /* small game buttons: keep the look, grow the finger target to ~44px */
  .ld-info, .ty-mute, .one-tool { position: relative; }
  .ld-info::after, .ty-mute::after, .one-tool::after, .ty-drawer-btn::after { content: ''; position: absolute; inset: -7px; }
}

/* ---------- phone, portrait */
@media (max-width: 640px) {
  :root { --gut: 10px; --dockH: 0px; --dockTop: calc(max(8px, env(safe-area-inset-top)) + 58px); --safeB: max(8px, env(safe-area-inset-bottom)); }
  .topbar { left: var(--gut); right: var(--gut); top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  .brand { gap: 8px; padding: 6px 12px 6px 6px; border-radius: 18px; min-width: 0; }
  .brand-mark { width: 42px; height: 33px; }
  .brand h1 { font-size: 16px; }
  .brand p { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .me { margin-top: 4px; padding: 5px 6px; gap: 6px; flex: none; }
  .me-dot { width: 22px; height: 22px; }
  .beans { padding: 4px 9px; }

  /* tool dock → hidden behind one ☰ ▾ button on the left; tapping it drops the list down the left edge */
  .rightbar { display: contents; }
  .dock-toggle { position: fixed; z-index: 13; top: var(--dockTop); left: var(--gut); display: flex; align-items: center; gap: 4px; height: 42px; padding: 0 10px 0 12px; border-radius: 14px; color: var(--roast); font-size: 18px; transition: background .2s; }
  .dock-toggle .dt-arrow { font-size: 13px; transition: transform .25s; }
  body.dock-open .dock-toggle { background: var(--espresso); color: var(--foam); }
  body.dock-open .dock-toggle .dt-arrow { transform: rotate(180deg); }
  .rightbar .dock { position: fixed; z-index: 13; top: calc(var(--dockTop) + 48px); left: var(--gut); right: auto; bottom: auto; max-height: calc(100dvh - var(--dockTop) - 58px - var(--safeB)); overflow-y: auto; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px; border-radius: 18px; transform-origin: top left; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transition: opacity .18s, transform .18s, visibility 0s .18s; }
  body.dock-open .rightbar .dock { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s; }
  /* each tool: icon + its name (there's no hover tooltip on a phone) */
  .rightbar .dock button, .rightbar .dock .small { width: auto; height: 42px; justify-content: flex-start; gap: 10px; padding: 0 14px 0 10px; border-radius: 12px; opacity: 1; }
  .rightbar .dock button svg { width: 20px; height: 20px; flex: none; }
  .rightbar .dock button .lbl { display: inline; position: static; opacity: 1; transform: none; padding: 0; background: none; color: inherit; font-size: 14px; font-weight: 600; pointer-events: none; }
  .rightbar .dock hr { display: block; margin: 4px 6px; }
  .rightbar .dock .small .lbl { font-weight: 500; opacity: .75; }

  /* views → a small column under the bean chip */
  .rightbar .viewbar { position: fixed; z-index: 11; top: calc(max(8px, env(safe-area-inset-top)) + 58px); right: var(--gut); bottom: auto; left: auto; transform: none; flex-direction: column; gap: 2px; padding: 4px; border-radius: 16px; }
  .rightbar .viewbar button { width: 40px; height: 36px; font-size: 17px; border-radius: 11px; }
  .rightbar .viewbar button span { display: none; }

  /* chat sits right above the dock, 3 lines */
  .chat { left: var(--gut) !important; right: var(--gut); top: auto !important; width: auto; bottom: calc(var(--safeB) + var(--dockH) + 8px) !important; border-radius: 16px; }
  .chat.collapsed { right: auto; }
  .chat-head { padding: 6px 8px 0 12px; }
  .chat-log { max-height: calc(3 * 1.4em + 10px); font-size: 13px; padding: 4px 12px; }
  .chat-quick { display: none; }
  .chat-form { padding: 6px 8px 8px; }
  .chat-form input { padding: 8px 12px; }
  .chat-form button { width: 42px; }

  /* seated: the timer goes above the dock, chat moves up over it */
  .timer { left: var(--gut); right: var(--gut); bottom: calc(var(--safeB) + var(--dockH) + 8px); padding: 8px 10px 8px 8px; gap: 10px; border-radius: 18px; }
  .ring { width: 62px; height: 62px; }
  .ring-inner b { font-size: 13px; } .ring-inner small { display: none; }
  .timer-side { min-width: 0; flex: 1; gap: 6px; }
  .timer-seat { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .status-pick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .status-pick button { flex: none; width: 30px; height: 30px; font-size: 15px; }
  .row.tight .chip { padding: 7px 4px; font-size: 12.5px; }
  body.seated .chat { bottom: calc(var(--safeB) + var(--dockH) + 136px) !important; }   /* timer card is ~124px tall with 3 buttons */
  body.seated .chat-log { max-height: calc(2 * 1.4em + 10px); }

  /* joystick: right thumb, above the chat */
  .joystick { left: auto; right: 14px; bottom: calc(var(--safeB) + var(--dockH) + 160px); width: 100px; height: 100px; }
  .joystick .knob { width: 44px; height: 44px; }
  body.seated .joystick { display: none; }

  .skip-chip { bottom: calc(var(--safeB) + var(--dockH) + 160px); }
  .announce, #toasts { top: calc(max(8px, env(safe-area-inset-top)) + 58px); }
  /* leave room for the ☰ button on the left and the view column on the right */
  .announce { max-width: calc(100vw - 2 * var(--gut) - 116px); left: calc(var(--gut) + 58px); transform: none; border-radius: 16px; font-size: 13.5px; padding: 8px 12px; }
  #toasts { width: calc(100vw - 2 * var(--gut) - 116px); left: calc(var(--gut) + 58px); transform: none; }
  .dock-toggle .dt-arrow { font-size: 15px; }
  .toast { font-size: 13.5px; padding: 9px 12px; }
  .yt-dock { left: var(--gut); right: auto; top: calc(max(8px, env(safe-area-inset-top)) + 58px); bottom: auto; width: min(240px, calc(100vw - 80px)); }

  /* sheets & dialogs */
  .panel { width: 100vw; top: 8vh; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .panel.open { transform: none; }
  .panel-head { padding: 16px 14px 8px 18px; }
  .panel-head h2 { font-size: 21px; }
  .panel-body { padding: 4px 14px calc(24px + env(safe-area-inset-bottom)) 18px; }
  .modal-wrap { padding: max(10px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom)); }
  .modal { padding: 20px 16px; border-radius: 22px; }
  .modal h2 { font-size: 23px; padding-right: 30px; }
  .modal .lead { margin-bottom: 12px; font-size: 14px; }
  .modal-x { top: 10px; right: 10px; }
  .modal .row { flex-wrap: wrap; }
  .modal .row > .btn { flex: 1 1 auto; }
  .cat-menu { width: min(228px, calc(100vw - 20px)); }
  .quiz-courses { padding-right: 30px; }
  .receipt { padding: 24px 16px 28px; font-size: 12.5px; }
  .receipt-wrap .modal-x { top: 4px; right: 4px; }
  .receipt .stamp { top: 44px; right: 8px; font-size: 14px; }
  .receipt .ln.sm { flex-wrap: wrap; column-gap: 10px; row-gap: 0; }
  .receipt .ln.sm span:first-child { white-space: normal; }
  .receipt-actions { flex-wrap: wrap; }
  .quiz-courses button { padding: 6px 10px; }
}

/* ---------- phone, landscape (short screens) */
@media (max-height: 500px) and (min-width: 641px) {
  .topbar { top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); }
  .brand { padding: 5px 12px 5px 5px; gap: 8px; }
  .brand-mark { width: 38px; height: 30px; }
  .brand h1 { font-size: 15px; }
  .brand p { display: none; }
  .me { margin-top: 2px; margin-left: auto; padding: 4px 6px; }
  .me-dot { width: 20px; height: 20px; }
  .status { margin-top: 2px; padding: 6px 12px; font-size: 13px; }

  /* dock: two columns on the right edge */
  .rightbar { top: 54px; bottom: max(8px, env(safe-area-inset-bottom)); right: max(10px, env(safe-area-inset-right)); gap: 6px; justify-content: flex-start; }
  .rightbar .dock { display: grid; grid-template-columns: repeat(2, 40px); gap: 2px; padding: 5px; border-radius: 18px; }
  .rightbar .dock button, .rightbar .dock .small { width: 40px; height: 36px; border-radius: 11px; }
  .rightbar .dock hr { display: none; }
  /* views: on the right too, two columns above the dock */
  .rightbar .viewbar { position: static; transform: none; display: grid; grid-template-columns: repeat(2, 40px); padding: 5px; gap: 2px; border-radius: 16px; }
  .rightbar .viewbar button { width: 40px; height: 32px; font-size: 16px; border-radius: 10px; }
  .rightbar .viewbar button span { display: none; }

  .chat { width: min(300px, 42vw); bottom: max(8px, env(safe-area-inset-bottom)); left: max(10px, env(safe-area-inset-left)); }
  .chat-log { max-height: calc(2 * 1.4em + 10px); font-size: 12.5px; }
  .chat-quick { display: none; }
  .chat-form { padding: 4px 8px 8px; }
  .chat-form input { padding: 6px 10px; }
  .joystick { left: auto; right: 130px; bottom: max(14px, env(safe-area-inset-bottom)); width: 92px; height: 92px; }
  .joystick .knob { width: 40px; height: 40px; }
  body.seated .joystick { display: none; }
  .timer { right: 130px; bottom: max(8px, env(safe-area-inset-bottom)); padding: 6px 10px 6px 6px; gap: 10px; }
  .ring { width: 58px; height: 58px; }
  .ring-inner b { font-size: 13px; } .ring-inner small { display: none; }
  .timer-side { min-width: 180px; gap: 5px; }
  .status-pick button { width: 28px; height: 28px; font-size: 14px; }
  .announce, #toasts { top: 54px; }
  .skip-chip { bottom: 14px; }
  .panel { top: 0; }
  .modal-wrap { padding: 8px; }
  .modal { padding: 18px 18px; }
  .modal h2 { font-size: 22px; }
  /* quiz: answers in two columns so A–D fit without scrolling */
  .opts:not(.tfng-opts) { grid-template-columns: 1fr 1fr; }
  .opt { padding: 9px 12px; font-size: 14.5px; }
  .quiz-courses { margin-bottom: 8px; padding-right: 30px; }
  /* menu book: keep pages tall enough for 4 drinks — the dialog scrolls instead of squashing them */
  .menubook-modal { padding: 10px 12px; }
  .mb-top { padding-bottom: 4px; }
  .book { --pw: min(380px, calc((100vw - 130px) / 2)); --ph: max(400px, calc(100vh - 90px)); }
  .mb-nav { margin-top: 6px; }
}

/* ---------- tablet */
@media (min-width: 641px) and (max-width: 1180px) and (min-height: 501px) {
  .chat { width: min(380px, calc(100vw - 120px)); }
  .joystick { left: 24px; bottom: 230px; width: 120px; height: 120px; }
  .timer { right: 92px; }
  .rightbar .dock button { width: 50px; height: 46px; }
  .rightbar .viewbar button { width: 50px; height: 40px; }
  .panel { width: min(480px, 70vw); }
}

/* claw machine on phones */
@media (max-width: 640px), (max-height: 500px) {
  .modal.claw-modal { padding: 10px 8px 8px; }
  .cl-play { padding: 7px; gap: 6px; border-width: 4px; border-radius: 22px; }
  .cl-title { font-size: 15px; }
  .cl-ctrl { gap: 6px; padding: 6px; }
  .cl-door { height: 52px; min-width: 52px; }
  .cl-door-img svg { width: 44px; height: 44px; }
  .cl-coin { padding: 5px 7px; }
}
@media (max-height: 500px) and (min-width: 641px) {
  .modal.claw-modal { width: min(760px, 100%); }
  .cl-play { display: grid; grid-template-columns: 1fr 200px; grid-template-areas: "head head" "stage ctrl" "hint hint"; }
  .cl-head { grid-area: head; }
  .cl-stage { grid-area: stage; aspect-ratio: auto; height: calc(100vh - 150px); max-height: none; }
  .cl-ctrl { grid-area: ctrl; flex-wrap: wrap; justify-content: center; align-content: center; }
  .cl-coin { margin-left: 0; }
  .cl-hint { grid-area: hint; }
}

/* Cá ngựa on phones: board on top, panel below */
@media (max-width: 760px) {
  .modal.ludo-modal { padding: 12px 10px; }
  .ld-wrap { grid-template-columns: 1fr; gap: 10px; }
  .ld-board-box { max-height: none; max-width: min(100%, 52vh); }
  .ld-top h2 { font-size: 17px; }
}

/* ---------- Café TV (js/tv.js): CSS3D iframe over the wall screen. Zoom: desktop TV 4/5 + chat 1/5; portrait phone TV on top +
   chat below (or centred / rotated full screen); phone held sideways = full-screen TV. Chat box geometry comes from --tv-c* vars. */
.tv-layer { position: absolute; inset: 0; pointer-events: none; }
.tv-screen { background: #000; backface-visibility: hidden; }
.tv-screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.tv-cast { position: relative; width: 100%; height: 100%; background: #000; }
.tv-cast video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tv-cast-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 80px; color: #f3e9dc; font: 700 34px/1.45 system-ui, sans-serif; text-align: center; }
.tv-cast-note[hidden] { display: none; }
.tv-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; opacity: .6; font-size: 13px; }
.tv-or::before, .tv-or::after { content: ''; flex: 1; border-top: 1px solid currentColor; }
.tv-cast-btn { width: 100%; }
.tv-stat { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
@media (max-width: 560px) { .tv-stat { display: none; } }
.tv-hint { margin: 8px 0 0; font-size: 13px; opacity: .8; line-height: 1.45; }
body.tv-zoom #scene { z-index: 40; } /* #scene is fixed = own stacking context */
body.tv-zoom .tv-layer { position: fixed; width: 100% !important; height: 100% !important; z-index: 40; pointer-events: auto; background: rgba(8, 6, 5, .96); }
.tv-bar { position: fixed; top: 0; left: 0; right: var(--tv-br, 0); height: 48px; padding-top: env(safe-area-inset-top); z-index: 42; display: flex; align-items: center; gap: 6px; padding-left: 10px; padding-right: 10px; color: #fff6e8; font-size: 14px; overflow-x: auto; scrollbar-width: none; }
.tv-now { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-b { flex: none; height: 34px; min-width: 34px; justify-content: center; padding: 0 10px; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff6e8; font-weight: 700; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.tv-b:hover { background: rgba(255,255,255,.24); }
.tv-b.danger { background: #b4442f; }
.tv-vol { width: 90px; flex: none; }
body.tv-zoom:not(.tv-nochat) .chat { left: var(--tv-cl) !important; top: var(--tv-ct) !important; width: var(--tv-cw) !important; right: auto !important; bottom: 0 !important; max-width: none; z-index: 45; border-radius: 0; background: rgba(18, 12, 8, .92); padding-bottom: env(safe-area-inset-bottom); }
body.tv-zoom:not(.tv-nochat) .chat .chat-log { max-height: none; flex: 1; }
body.tv-zoom:not(.tv-nochat) .chat.collapsed .chat-log, body.tv-zoom:not(.tv-nochat) .chat.collapsed .chat-form { display: flex; }
body.tv-zoom.tv-nochat .chat { display: none; }
/* rotated / phone-sideways: video fills the screen, bar shrinks to a few icons in the corner */
body.tv-mini .tv-bar { left: auto; right: 0; background: none; opacity: .75; }
body.tv-mini .tv-now, body.tv-mini .tv-vol, body.tv-mini .tv-bar a.tv-b { display: none; }
body.tv-mini .tv-bar:hover, body.tv-mini .tv-bar:active { opacity: 1; }
.tv-tap { position: fixed; top: calc(env(safe-area-inset-top) + 70px); left: 50%; transform: translateX(-50%); z-index: 46; padding: 10px 16px; border-radius: 999px; background: #b4442f; color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 8px 24px -8px rgba(0,0,0,.6); }
body.tv-zoom .tv-tap { top: calc(env(safe-area-inset-top) + 56px); }
@media (pointer: coarse) { .tv-vol { display: none; } }
@media (max-width: 699px) { .tv-now { display: none; } }
@media (max-width: 560px) { .tv-b .l { display: none; } .tv-bar { gap: 5px; padding-left: 8px; padding-right: 8px; } }
.chat-new { align-self: center; margin: 2px 0 4px; padding: 5px 12px; border-radius: 999px; background: #c8743a; color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 4px 14px -6px rgba(0,0,0,.6); }
.chat.collapsed .chat-new { display: none; }

/* ---------- Werewolf (Ma Sói): dark night / brighter day, pass-and-play */
.modal.ww-modal { width: min(880px, 100%); min-height: min(640px, calc(100vh - 32px)); padding: 22px 24px 26px; overflow: hidden; color: #eef0ff; border: 1px solid rgba(160,170,255,.25); background: linear-gradient(180deg, #0b1230, #251f4a 70%, #2f2450); transition: background .8s; }
.modal.ww-modal.day { color: #2b2a3a; background: linear-gradient(180deg, #bfe3ff, #fdf2d8 75%); border-color: #fff; }
.ww-modal > * { position: relative; z-index: 1; }
.ww-modal .ww-sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; transition: opacity .8s; }
.ww-modal.day .ww-sky { opacity: 0; }
.ww-stars { position: absolute; inset: 0; background-image: radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 70%, #fff, transparent), radial-gradient(1.5px 1.5px at 55% 15%, #fff, transparent), radial-gradient(1px 1px at 75% 45%, #fff, transparent), radial-gradient(1.5px 1.5px at 90% 80%, #fff, transparent), radial-gradient(1px 1px at 20% 90%, #fff, transparent), radial-gradient(1px 1px at 65% 85%, #fff, transparent), radial-gradient(1.5px 1.5px at 42% 38%, #fff, transparent); animation: ww-twinkle 4s ease-in-out infinite alternate; }
.ww-stars.s2 { transform: translate(7%, 11%); animation-delay: -2s; animation-duration: 5.5s; }
.ww-moon { position: absolute; bottom: -34px; left: -34px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 40% 38%, #fff8dc, #f1dc98 70%, #d6be78); box-shadow: 0 0 60px 18px rgba(246,231,176,.25); animation: ww-float 7s ease-in-out infinite; opacity: .9; }
@keyframes ww-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes ww-float { 50% { transform: translateY(8px); } }
/* night ↔ day (js/werewolf.js skyFade): the old sky fades out over the new one; the sun rises at dawn */
.ww-modal > .ww-fade { position: absolute; inset: 0; z-index: 0; pointer-events: none; animation: wwFade 1.6s ease-in-out forwards; }
.ww-fade.to-day { background: linear-gradient(180deg, #0b1230, #251f4a 70%, #2f2450); }
.ww-fade.to-night { background: linear-gradient(180deg, #bfe3ff, #fdf2d8 75%); }
.ww-fade.to-day::after { content: ''; position: absolute; left: 50%; bottom: -150px; width: 190px; height: 190px; margin-left: -95px; border-radius: 50%;
  background: radial-gradient(circle, #fff7d1 0 34%, #ffd36b 50%, rgba(255,190,80,0) 70%); animation: wwSun 1.6s ease-out forwards; }
@keyframes wwFade { 0%, 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wwSun { from { transform: translateY(0) scale(.7); } to { transform: translateY(-300px) scale(1.5); } }
/* victims' cards flip in one after another */
.ww-dead.flip { perspective: 600px; }
.ww-dead.flip li { animation: wwFlip .55s cubic-bezier(.3,1.3,.5,1) backwards; transform-origin: 50% 0; }
.ww-dead.flip li:nth-child(2) { animation-delay: .3s; } .ww-dead.flip li:nth-child(3) { animation-delay: .6s; }
@keyframes wwFlip { from { transform: rotateX(-95deg); opacity: 0; } 60% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ww-stars, .ww-moon { animation: none; } }
.ww-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ww-top h2 { margin: 0 !important; font-size: 24px !important; }
.ww-top h2 i { font-weight: 500; font-size: 17px; opacity: .75; }
.ww-phase { padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.14); font-size: 13px; font-weight: 700; }
.ww-modal.day .ww-phase { background: rgba(0,0,0,.08); }
.ww-tools { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ww-tools button { white-space: nowrap; }
/* phones: the tool row wraps; × stays pinned top-right so it is always reachable */
@media (max-width: 600px) {
  .ww-top { position: relative; padding-right: 46px; }
  .ww-tools { margin-left: 0; width: 100%; justify-content: flex-start; }
  .ww-tools #wwClose { position: absolute; top: 0; right: 0; min-width: 38px; min-height: 38px; }
  .ww-tools button { min-height: 34px; }
}
.ww-tools button { padding: 6px 11px; border-radius: 99px; font-size: 13px; font-weight: 700; color: inherit; background: #2c2758; border: 1px solid rgba(255,255,255,.2); }
.ww-modal.day .ww-tools button { background: rgba(255,255,255,.7); border-color: rgba(0,0,0,.1); }
.ww-tools button#wwVi:not(.on) { opacity: .45; text-decoration: line-through; }
.ww-tools #wwClose { font-size: 18px; line-height: 1; padding: 4px 11px; }
.ww-modal i.vi, .ww-modal p.vi { opacity: .72; }
.ww-modal.no-vi .vi { display: none !important; }
.ww-say { min-height: 64px; margin: 4px 0 14px; padding: 12px 16px; border-radius: 16px; background: rgba(255,255,255,.08); font: 600 19px/1.4 var(--display); }
.ww-modal.day .ww-say { background: rgba(255,255,255,.65); }
.ww-say p { margin: 0; } .ww-say p.vi { font: 500 15px/1.4 var(--font); margin-top: 4px; }
.ww-body { display: flex; flex-direction: column; gap: 12px; }
.ww-btn { padding: 11px 22px; border-radius: 99px; font-weight: 800; font-size: 15px; color: #1d1838; background: linear-gradient(180deg, #ffe7a6, #f3c35c); box-shadow: 0 8px 18px -10px rgba(0,0,0,.6); }
.ww-btn:disabled { opacity: .4; cursor: default; }
.ww-btn.ghost { background: rgba(255,255,255,.14); color: inherit; border: 1px solid rgba(255,255,255,.25); }
.ww-modal.day .ww-btn.ghost { background: rgba(255,255,255,.75); border-color: rgba(0,0,0,.12); }
.ww-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.ww-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ww-p { padding: 12px 8px; border-radius: 14px; font-weight: 700; color: inherit; background: rgba(255,255,255,.1); border: 2px solid transparent; }
.ww-modal.day .ww-p { background: rgba(255,255,255,.75); }
.ww-p.sel { border-color: #f3c35c; background: rgba(243,195,92,.25); }
.ww-p:disabled { opacity: .3; }
.ww-setup { display: flex; flex-direction: column; gap: 12px; }
.ww-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ww-row label { font-weight: 700; min-width: 150px; }
.ww-row small a { color: #f3c35c; }
.ww-step { display: flex; align-items: center; gap: 4px; }
.ww-step button { width: 34px; height: 34px; border-radius: 50%; font-size: 18px; font-weight: 800; color: inherit; background: rgba(255,255,255,.15); }
.ww-step b { min-width: 34px; text-align: center; font-size: 20px; }
.ww-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.ww-names input, .ww-chk select { padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: inherit; font: inherit; }
.ww-names input::placeholder { color: rgba(238,240,255,.5); }
.ww-chk select option { color: #222; }
.ww-roles { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.ww-chk { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ww-chk.off { opacity: .45; }
.ww-chk small { font-weight: 500; opacity: .8; }
.ww-sum { margin: 0; line-height: 1.9; }
.ww-role { display: inline-flex; gap: 4px; align-items: baseline; padding: 1px 9px; border-radius: 99px; background: rgba(255,255,255,.12); font-weight: 700; white-space: nowrap; }
.ww-modal.day .ww-role, .ww-rules .ww-role { background: rgba(0,0,0,.06); }
.ww-role.r-werewolf { background: rgba(217,90,90,.3); }
.ww-role i { font-weight: 500; }
.ww-reveal { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ww-card { position: relative; width: min(300px, 80vw); aspect-ratio: 3 / 4; perspective: 900px; }
.ww-card > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; text-align: center; border-radius: 20px; backface-visibility: hidden; transition: transform .35s; }
.ww-card-back { background: linear-gradient(160deg, #3a3170, #1b1640); border: 2px solid rgba(243,195,92,.5); font-size: 54px; }
.ww-card-back b { font: 800 22px var(--display); } .ww-card-back small { font-size: 13px; opacity: .7; }
.ww-card-front { background: linear-gradient(160deg, #fdf3dc, #f0dcb0); color: #2b2238; transform: rotateY(180deg); }
.ww-card-front.r-werewolf { background: linear-gradient(160deg, #5a1f2a, #2a0e18); color: #ffe4e4; }
.ww-card-front span { font-size: 64px; } .ww-card-front b { font: 900 28px var(--display); }
.ww-card-front p { margin: 6px 0 0; font-size: 14px; line-height: 1.4; } .ww-card-front .mates { font-weight: 800; }
.ww-card.flip .ww-card-back { transform: rotateY(-180deg); } .ww-card.flip .ww-card-front { transform: rotateY(0); }
.ww-btn.hold { padding: 16px 34px; font-size: 18px; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.ww-big { font: 800 24px/1.35 var(--display); text-align: center; padding: 18px; }
.ww-big i, .ww-big small { display: block; margin-top: 6px; font: 500 15px var(--font); }
.ww-note { text-align: center; margin: 0; font-weight: 700; }
.ww-dead, .ww-tally, .ww-final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ww-dead li { font: 700 20px var(--display); text-align: center; }
.ww-tally li, .ww-final li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.1); }
.ww-modal.day .ww-tally li, .ww-modal.day .ww-final li { background: rgba(255,255,255,.7); }
.ww-tally li span, .ww-final li span { flex: 1; font-weight: 700; }
.ww-final li.dead span { text-decoration: line-through; opacity: .6; }
.ww-final li.won { box-shadow: inset 3px 0 0 #f3c35c; }
.ww-timer { font: 900 clamp(64px, 16vw, 120px)/1 var(--mono); text-align: center; letter-spacing: .04em; }
.ww-timer.low { color: #e0614f; animation: ww-pulse 1s infinite; }
@keyframes ww-pulse { 50% { opacity: .5; } }
.ww-alive { text-align: center; margin: 0; opacity: .8; }
.ww-win { font: 900 34px var(--display); text-align: center; display: flex; flex-direction: column; } .ww-win i { font: 500 17px var(--font); }
.ww-paused { position: absolute !important; inset: 0; z-index: 5 !important; display: flex; align-items: center; justify-content: center; background: rgba(8,10,28,.9); color: #fff; }
.ww-paused[hidden] { display: none; }
.ww-paused > div { display: flex; flex-direction: column; align-items: center; gap: 8px; font: 800 30px var(--display); } .ww-paused i { font: 500 16px var(--font); opacity: .7; }
.ww-rules { width: min(640px, 100%); }
.ww-rules h2 i { font-weight: 500; font-size: 18px; color: var(--muted); }
.ww-rules i { color: var(--muted); }
.ww-rule-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.ww-rule-list p { margin: 4px 0 0; }
.ww-rule-list small { display: block; color: var(--terracotta); font-weight: 700; }

/* ---------- Werewolf online room (+ NPCs) */
.modal.ww-modal.ww-online { width: min(1040px, 100%); }
.ww-on-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 760px) { .ww-on-wrap { grid-template-columns: 1fr; } }
.ww-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ww-seats { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 3px; border-radius: 14px; background: rgba(255,255,255,.07); max-height: 230px; overflow-y: auto; font-size: 14px; }
.ww-modal.day .ww-seats, .ww-modal.day .ww-chat { background: rgba(255,255,255,.65); }
.ww-seats li { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 8px; }
.ww-seats li.me { background: rgba(243,195,92,.18); }
.ww-seats li.dead span { text-decoration: line-through; opacity: .55; }
.ww-seats em { font-style: normal; margin-left: auto; }
.ww-npc { display: inline-block; padding: 0 6px; border-radius: 99px; font: 800 10px/1.6 var(--font); letter-spacing: .04em; background: #7c6cf0; color: #fff; vertical-align: middle; white-space: nowrap; }
.ww-chat { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: rgba(255,255,255,.07); }
.ww-log { height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; font-size: 14px; line-height: 1.4; padding-right: 4px; scrollbar-width: thin; }
@media (max-width: 760px) { .ww-log { height: 180px; } }
.ww-log p { margin: 0; }
.ww-log p.sys { opacity: .7; font-style: italic; font-size: 13px; }
.ww-log b { font-weight: 800; } .ww-log b.bot { color: #b9adff; }
.ww-modal.day .ww-log b.bot { color: #5a49d6; }
abbr.ww-tip { text-decoration: underline dotted rgba(243,195,92,.9); text-underline-offset: 3px; cursor: help; }
.ww-quick { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.ww-quick:empty { display: none; }
.ww-quick button { padding: 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; color: inherit; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); }
.ww-modal.day .ww-quick button { background: #fff; border-color: rgba(0,0,0,.1); }
.ww-send { display: flex; gap: 6px; }
.ww-send input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: inherit; font: inherit; }
.ww-modal.day .ww-send input { background: #fff; border-color: rgba(0,0,0,.12); }
.ww-send input:disabled { opacity: .5; }
.ww-send .ww-btn { padding: 8px 14px; }
.ww-seg { display: inline-flex; border-radius: 99px; overflow: hidden; border: 1px solid rgba(255,255,255,.25); }
.ww-seg button { padding: 6px 14px; font-weight: 700; color: inherit; background: transparent; }
.ww-seg button.on { background: #f3c35c; color: #1d1838; }
.ww-count { display: inline-block; min-width: 3.2em; font: 800 14px var(--mono); opacity: .85; }
.ww-count.low { color: #e0614f; }
.ww-center { justify-content: center; }
.ww-sleep { opacity: .8; }
.ww-paused small { font: 500 14px var(--font); opacity: .7; }

/* ---------------- World Tycoon (js/tycoon.js) — phase 1: simple 2D board, reuses the Cá ngựa quiz / timer / log styles */
.modal.ty-modal { width: min(1080px, 100%); padding: 16px; position: relative; }
.ty-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 40px 12px 0; }
.ty-top h2 { margin: 0; font-size: 20px; }
.ty-vi { font-style: italic; font-weight: 400; color: var(--muted); font-size: .86em; margin-left: 4px; }
.ty-top h2 .ty-vi { font-size: 14px; }
.ty-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.ty-board-box { position: relative; width: 100%; max-width: min(100%, 76vh); margin: 0 auto; }
.ty-board { display: grid; grid-template-columns: 1.45fr repeat(9, 1fr) 1.45fr; grid-template-rows: 1.45fr repeat(9, 1fr) 1.45fr; aspect-ratio: 1; gap: 2px; padding: 6px; border-radius: 16px; background: #cfe3c4; box-shadow: 0 10px 24px -10px rgba(40,60,30,.45), inset 0 0 0 3px #a9c79a; }
.ty-sq { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; min-height: 0; padding: 2px; border-radius: 5px; background: #fffdf6; font-size: 9px; line-height: 1.05; text-align: center; overflow: hidden; color: var(--espresso); box-shadow: inset 0 0 0 1px rgba(74,51,38,.12); }
@media (hover: hover) { .ty-sq:hover { box-shadow: inset 0 0 0 2px var(--caramel); z-index: 1; } }   /* touch: a tap leaves :hover stuck */
.ty-sq.owned { box-shadow: inset 0 0 0 2.5px var(--own); }
.ty-sq.mort { opacity: .55; }
.ty-sq.s-c { background: #fff6dc; font-size: 10px; font-weight: 700; }
.ty-strip { position: absolute; background: #999; }
.s-b .ty-strip { left: 0; right: 0; top: 0; height: 22%; } .s-t .ty-strip { left: 0; right: 0; bottom: 0; height: 22%; }
.s-l .ty-strip { top: 0; bottom: 0; right: 0; width: 22%; } .s-r .ty-strip { top: 0; bottom: 0; left: 0; width: 22%; }
.ty-ico { font-size: 15px; line-height: 1; }
.s-c .ty-ico { font-size: 22px; }
.ty-nm { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ty-sq small { font-size: 8.5px; color: var(--muted); font-weight: 700; }
.ty-lv { font-size: 8px; color: #b9832a; letter-spacing: -1px; }
.ty-toks { position: absolute; inset: auto 2px 2px 2px; display: flex; justify-content: center; gap: 1px; flex-wrap: wrap; pointer-events: none; }
.ty-tok { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: transform .3s; }
.ty-tok.cur { transform: scale(1.3); animation: tyBob 1s ease-in-out infinite; }
@keyframes tyBob { 50% { transform: scale(1.3) translateY(-2px); } }
.ty-center { grid-area: 2 / 2 / 11 / 11; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-radius: 12px; background: radial-gradient(circle at 50% 45%, #eaf5e1, #d5e9c9); }
.ty-logo { font-family: var(--display); font-weight: 800; font-size: clamp(14px, 3vw, 26px); text-align: center; color: #2f5a2a; display: flex; flex-direction: column; }
.ty-logo .ty-vi { font-size: .55em; margin: 0; }
.ty-dice { display: flex; gap: 10px; }
.ld-die.ty-die { width: clamp(34px, 6vw, 54px); height: clamp(34px, 6vw, 54px); padding: 5px; }
.ty-clock { font-size: 12.5px; color: #2f5a2a; }
.ty-card { position: absolute; inset: 14% 12%; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 14px 30px -10px rgba(0,0,0,.4), inset 0 0 0 3px #e9a90a; text-align: center; font-size: 13.5px; animation: tyCard .35s ease-out; }
.ty-card.d-diary { box-shadow: 0 14px 30px -10px rgba(0,0,0,.4), inset 0 0 0 3px #2f80ed; }
.ty-card p { margin: 0; font-weight: 700; }
.ty-card small { color: var(--muted); }
@keyframes tyCard { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }
.ty-pop { position: absolute; z-index: 3; left: 12%; right: 12%; top: 12%; max-height: 76%; overflow: auto; padding: 12px 14px; border-radius: 14px; background: #fffaf2; box-shadow: 0 16px 40px -12px rgba(60,35,15,.5), inset 0 0 0 2px #e3d3b8; font-size: 13px; }
.ty-pop h4, .ty-offer h4 { margin: 0 0 6px; font-size: 15px; }
.ty-grp { margin: 0 0 6px; padding-left: 8px; border-left: 5px solid var(--gc); font-weight: 700; }
.ty-rent { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.ty-rent td { padding: 2px 4px; border-bottom: 1px dashed var(--line); }
.ty-rent td:last-child { text-align: right; font-weight: 700; }
.ty-rent tr.on { background: #fff1c9; }
.ty-owner { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 12.5px; }
.ty-owner i, .ty-p i, .ty-seat i, .ty-rank i { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.ty-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ty-players { display: grid; gap: 5px; }
.ty-p { display: grid; grid-template-columns: 13px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--tint); font-size: 13.5px; }
.ty-p i { grid-row: span 2; }
.ty-p span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-p small { grid-column: 2 / 4; font-size: 11.5px; color: var(--muted); }
.ty-p.turn { background: #fff; box-shadow: inset 0 0 0 2px var(--caramel); font-weight: 700; }
.ty-p.out { opacity: .45; }
.ty-phase .ld-timer { display: block; flex: none; margin-bottom: 8px; }
.ty-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ty-roll { font-size: 16px; padding: 12px; }
.ty-offer { padding: 12px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px #f3d68a; font-size: 13px; }
.ty-debt { padding: 10px 12px; border-radius: 12px; background: #fde2e2; font-size: 13.5px; }
.ty-manage { border-radius: 12px; background: var(--tint); padding: 6px 10px; font-size: 13px; }
.ty-manage summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.ty-manage ul { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 4px; max-height: 210px; overflow: auto; }
.ty-manage li { display: flex; align-items: center; gap: 5px; }
.ty-manage li .btn.sm { padding: 4px 8px; min-width: 32px; }
.ty-manage .hint { margin: 4px 0 0; font-size: 11.5px; }
.ty-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ty-mn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ty-seat { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); font-size: 13px; overflow: hidden; }
.ty-seat em { color: var(--muted); }
.ty-set { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ty-set label { min-width: 0; }
.ty-set label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; color: var(--mocha); }
.ty-set select { width: 100%; min-width: 0; min-height: 36px; text-overflow: ellipsis; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 8px; font: inherit; font-weight: 600; color: var(--espresso); }
.ty-result h3 { margin: 0 0 4px; }
.ty-rank { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.ty-rank li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--tint); font-size: 14px; }
.ty-rank li:first-child { background: linear-gradient(90deg, #fff3c4, #ffe0a3); }
.ty-rank li.me { box-shadow: inset 0 0 0 2px var(--caramel); }
.ty-rank li b { flex: 1; }
.ty-rules { top: 56px; }
.ty-rules li { margin-bottom: 6px; }
.ty-rules .ty-vi { display: block; margin: 0; }
@media (max-width: 820px) {
  .modal.ty-modal { padding: 12px 8px; }
  .ty-wrap { grid-template-columns: 1fr; gap: 10px; }
  .ty-top h2 { font-size: 16px; }
  .ty-board { gap: 1px; padding: 3px; }
  .ty-sq { font-size: 6.5px; border-radius: 3px; padding: 1px; }
  .ty-sq small, .ty-lv { font-size: 6px; }
  .ty-ico { font-size: 11px; } .s-c .ty-ico { font-size: 15px; }
  .ty-tok { width: 8px; height: 8px; border-width: 1px; }
  .ty-pop { left: 4%; right: 4%; top: 6%; max-height: 88%; }
}
/* NPC avatar picture in the speaking window + teacher picker */
.sp-lexi .sp-ava { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.t-avas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.t-ava { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 14px; }
.t-ava-ctl { flex: 1; min-width: 0; display: grid; gap: 6px; }
.t-ava-ctl .row { display: flex; gap: 6px; align-items: center; margin: 0; }
.t-ava-ctl .input { width: 64px; flex: none; text-align: center; }
.t-ava-ctl label.btn { cursor: pointer; }
/* ---------------- World Tycoon phase 2: full-screen 3D (mode-3d) + shared blocks; mode-2d keeps the phase-1 layout */
.modal.ty-modal.mode-2d { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; gap: 12px 16px; }
.mode-2d .ty-top { grid-column: 1 / -1; }
.mode-2d .ty-stage { position: relative; width: 100%; max-width: min(100%, 76vh); margin: 0 auto; }
.mode-2d .ty-hud { display: grid; gap: 5px; }
.mode-2d .ty-pc { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--tint); position: relative; }
.mode-2d .ty-pc.turn { background: #fff; box-shadow: inset 0 0 0 2px var(--caramel); }
.mode-2d .ty-drawer-btn, .mode-2d .ty-dr-head .ty-tool, .mode-2d .ty-canvas { display: none; }
.mode-2d .ty-drawer .ld-log { max-height: 180px; overflow: auto; }
.ty-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ty-tools { display: flex; gap: 6px; margin-left: auto; }
.ty-tool { width: 34px; height: 34px; border-radius: 12px; background: rgba(255,255,255,.85); box-shadow: 0 2px 8px -2px rgba(0,0,0,.25); font-size: 16px; }
.ty-tool:disabled { opacity: .4; }
.ty-clock { font-size: 13px; color: #2f5a2a; white-space: nowrap; }
.ty-ava { width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden; background: radial-gradient(circle at 50% 35%, #fff, var(--tc)); box-shadow: 0 0 0 3px var(--tc); display: grid; place-items: center; }
.ty-ava img { width: 120%; height: 120%; object-fit: cover; margin-top: 8%; }
.ty-ava i { font-style: normal; font-weight: 800; color: #fff; }
.ty-pc-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.ty-pc-n { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-pc-n em { font-weight: 400; color: var(--muted); }
.ty-cash { font-size: 17px; font-weight: 900; color: #7a4e10; }
.ty-cash.bump { animation: tyBump .5s; }
@keyframes tyBump { 40% { transform: scale(1.25); color: #c27b00; } }
.ty-pc-s { font-size: 11px; color: var(--muted); }
.ty-pc.out { opacity: .45; filter: grayscale(1); }
.ty-floats { position: absolute; left: 50%; top: 0; pointer-events: none; }
.ty-float { position: absolute; transform: translateX(-50%); font-weight: 900; font-size: 15px; white-space: nowrap; animation: tyFloat 1.6s ease-out forwards; text-shadow: 0 1px 0 #fff, 0 0 6px #fff; }
.ty-float.up { color: #1f9a4a; } .ty-float.down { color: #d23b3b; }
@keyframes tyFloat { from { opacity: 0; transform: translate(-50%, 6px); } 15% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -38px); } }
.ty-pill, .ty-rollbox, .ty-card-pop { position: relative; }
.ty-bar { display: block; margin-top: 8px; }
.ty-card-pop .ty-bar { margin-bottom: 14px; }   /* room for the "12s" label (absolute, below the bar) so the popup doesn't scroll */
.ty-bar.low i { background: #e5484d; }
.ty-roll span { display: block; font-size: 11px; }
.ty-mlist { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 4px; max-height: 240px; overflow: auto; }
.ty-mlist li { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.ty-mlist .btn.sm { padding: 4px 8px; min-width: 32px; }
.ty-mn { cursor: pointer; }
.ty-dr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ty-dr-sub { display: block; margin-top: 10px; font-size: 13px; }
.ty-free { color: #1f7a3f; font-weight: 700; }
.ty-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.ty-bub { position: absolute; left: 0; top: 0; padding: 5px 10px; border-radius: 14px; background: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); margin-top: -8px; }
.ty-bub::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.ty-bub.soft { opacity: .92; font-weight: 600; }
.ty-total { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font: 900 84px/1 var(--display); color: #fff; text-shadow: 0 4px 0 #c27b00, 0 10px 24px rgba(0,0,0,.35); animation: tyPop .35s cubic-bezier(.2,1.6,.4,1); text-align: center; }
.ty-total small { display: block; font-size: 22px; color: #ffe27a; }
@keyframes tyPop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }
.ty-stamp { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-8deg); padding: 10px 22px; border: 5px solid #d23b3b; border-radius: 14px; color: #d23b3b; background: rgba(255,255,255,.85); font: 900 34px/1.1 var(--display); text-align: center; animation: tyStamp .4s cubic-bezier(.2,1.6,.4,1); }
.ty-stamp small { display: block; font: 600 13px var(--font); color: #7a3030; }
@keyframes tyStamp { from { transform: translate(-50%, -50%) rotate(-8deg) scale(2.2); opacity: 0; } }
.ty-flip { position: absolute; left: 50%; top: 45%; width: min(300px, 78vw); height: 190px; transform: translate(-50%, -50%); perspective: 900px; pointer-events: auto; cursor: pointer; }
.ty-flip-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,1.3,.5,1); transform: translateY(40px) rotateY(0) scale(.7); }
.ty-flip.open .ty-flip-in { transform: rotateY(180deg); }
.ty-flip-back, .ty-flip-front { position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px; text-align: center; box-shadow: 0 16px 36px -12px rgba(0,0,0,.5); }
.ty-flip-back { background: #e9a90a; color: #fff; font-size: 18px; } .ty-flip-back span { font-size: 46px; }
.d-diary .ty-flip-back { background: #2f80ed; }
.ty-flip-front { background: #fff; transform: rotateY(180deg); box-shadow: 0 16px 36px -12px rgba(0,0,0,.5), inset 0 0 0 4px #e9a90a; font-size: 13.5px; }
.d-diary .ty-flip-front { box-shadow: 0 16px 36px -12px rgba(0,0,0,.5), inset 0 0 0 4px #2f80ed; }
.ty-flip-front p { margin: 0; font-weight: 700; font-size: 15px; }
.ty-flip-front small { color: var(--muted); }
.ty-setpop { position: absolute; z-index: 8; top: 56px; right: 14px; width: min(320px, calc(100% - 28px)); padding: 14px; border-radius: 16px; background: #fffaf2; box-shadow: 0 16px 40px -12px rgba(60,35,15,.5); font-size: 13.5px; }
.ty-setpop h4 { margin: 0 0 8px; }
.ty-sw { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.ty-paused { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(30,40,30,.45); backdrop-filter: blur(3px); }
.ty-paused > div { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 32px; border-radius: 20px; background: #fff; font-size: 22px; }
.ty-paused[hidden], .ty-setpop[hidden], .ty-pop[hidden] { display: none; }

/* ----- mode-3d: full screen, HUD in the corners, popups over the board */
.modal-wrap:has(.ty-modal.mode-3d) { padding: 0; }
.modal.ty-modal.mode-3d { width: 100vw; max-width: none; height: 100vh; height: 100dvh; margin: 0; padding: 0; border-radius: 0; border: 0; overflow: hidden; transform: none; background: linear-gradient(180deg, #5aa7e0 0%, #8cc6ee 45%, #bfe0f6 100%); }
.mode-3d .ty-stage { position: absolute; inset: 0; }
/* sky: soft clouds drifting behind the (transparent) canvas */
.mode-3d .ty-stage::before, .mode-3d .ty-stage::after { content: ''; position: absolute; pointer-events: none; width: 340px; height: 110px; border-radius: 60px; background: radial-gradient(60px 50px at 30% 60%, #fff 98%, transparent), radial-gradient(80px 70px at 55% 45%, #fff 98%, transparent), radial-gradient(60px 45px at 78% 62%, #fff 98%, transparent); opacity: .75; filter: blur(1px); animation: tyCloud 90s linear infinite; z-index: 0; }
.mode-3d .ty-stage::before { top: 9%; left: -360px; }
.mode-3d .ty-stage::after { top: 64%; left: -360px; transform: scale(.7); opacity: .55; animation-duration: 130s; animation-delay: -60s; }
@keyframes tyCloud { to { translate: calc(100vw + 720px) 0; } }
.ty-f3d { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; }
.ty-f3d span { display: block; font: 900 22px/1 var(--display); color: #fff; white-space: nowrap; animation: tyRise 1.5s ease-out forwards; }
.ty-f3d.up span { color: #3fdc5a; text-shadow: 0 2px 0 #1d6b2c, 0 0 10px rgba(255,255,255,.8); }
.ty-f3d.down span { color: #ff5a5f; text-shadow: 0 2px 0 #7a1d22, 0 0 10px rgba(255,255,255,.8); font-size: 18px; }
@keyframes tyRise { 0% { transform: translateY(10px) scale(.4); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
.ty-rush { position: absolute; z-index: 9; left: 50%; top: 30%; transform: translate(-50%, -50%); padding: 14px 28px; border-radius: 22px; background: linear-gradient(135deg, #ff7a18, #e5304a); color: #fff; font: 900 38px/1.1 var(--display); text-align: center; letter-spacing: 1px; box-shadow: 0 14px 40px -10px rgba(229,48,74,.7); animation: tyRush 3.2s ease-in-out forwards; pointer-events: none; }
.ty-rush small { display: block; font: 700 14px/1.4 var(--body, system-ui); letter-spacing: 0; opacity: .95; }
@keyframes tyRush { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-6deg); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); opacity: 1; } 20% { transform: translate(-50%, -50%) scale(1) rotate(0); } 85% { opacity: 1; } 100% { transform: translate(-50%, -60%) scale(.9); opacity: 0; } }
.ty-rushtag { color: #e5304a; animation: tyBlink 1s ease-in-out infinite; }
@keyframes tyBlink { 50% { opacity: .45; } }
.ty-modal.rush .ty-top { box-shadow: 0 0 0 2px #ff7a18, 0 6px 18px -8px rgba(229,48,74,.6); }
.mode-3d .ty-board { display: none; }
.mode-3d .ty-canvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.mode-3d .ty-top { position: absolute; z-index: 5; top: 8px; left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 10px; border-radius: 18px; background: rgba(255,255,255,.78); backdrop-filter: blur(8px); box-shadow: 0 6px 18px -8px rgba(0,0,0,.3); flex-wrap: nowrap; gap: 10px; max-width: calc(100% - 70px); }
.mode-3d .ty-top h2 { font-size: 15px; white-space: nowrap; }
.mode-3d .ty-top h2 .ty-vi { display: none; }
.mode-3d.in-game .ty-top .ld-modes { display: none; }
.mode-3d .modal-x { z-index: 6; background: rgba(255,255,255,.85); }
.mode-3d .ty-side { display: contents; }
.mode-3d .ty-hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.mode-3d .ty-pc { position: absolute; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 30px; background: rgba(255,255,255,.88); box-shadow: 0 8px 20px -10px rgba(0,0,0,.45); min-width: 150px; max-width: 220px; pointer-events: auto; transition: box-shadow .3s, transform .3s; }
.mode-3d .ty-pc.turn { box-shadow: 0 0 0 3px var(--tc), 0 0 22px 4px var(--tc); transform: scale(1.05); }
.mode-3d .ty-pc .ty-ava { width: 46px; height: 46px; }
.mode-3d .c-tl { top: 64px; left: 12px; } .mode-3d .c-tr { top: 64px; right: 12px; }
.mode-3d .c-bl { bottom: 12px; left: 12px; } .mode-3d .c-br { bottom: 12px; right: 12px; }
.mode-3d .ty-act { position: absolute; z-index: 4; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(440px, calc(100% - 400px)); min-width: 240px; }
.mode-3d .ty-act:empty { display: none; }
.mode-3d .ty-pill, .mode-3d .ty-rollbox { padding: 10px 14px; border-radius: 18px; background: rgba(255,255,255,.9); box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); text-align: center; }
.mode-3d .ty-pill .ld-status { margin: 0; font-size: 13.5px; }
.mode-3d .ty-rollbox { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.mode-3d .ty-rollbox .ty-bar { flex-basis: 100%; margin-top: 2px; }
.mode-3d .ty-roll { font-size: 20px; padding: 12px 28px; border-radius: 40px; animation: tyPulse 1.4s ease-in-out infinite; }
@keyframes tyPulse { 50% { transform: scale(1.06); } }
.mode-3d .ty-card-pop { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 140px); overflow: auto; padding: 16px; border-radius: 22px; background: #fffaf2; box-shadow: 0 30px 70px -20px rgba(0,0,0,.55); animation: tyIn .3s cubic-bezier(.2,1.4,.4,1); }
.mode-3d .ty-card-pop.is-right { box-shadow: 0 0 0 4px #2f9e5b, 0 30px 70px -20px rgba(0,0,0,.55); }
.mode-3d .ty-card-pop.is-wrong { box-shadow: 0 0 0 4px #e5484d, 0 30px 70px -20px rgba(0,0,0,.55); animation: tyShake .4s; }
@keyframes tyIn { from { opacity: 0; transform: translate(-50%, -40%) scale(.92); } }
@keyframes tyShake { 25% { margin-left: -8px; } 75% { margin-left: 8px; } }
.mode-3d .ty-drawer { position: absolute; z-index: 6; top: 64px; right: 12px; bottom: 80px; width: 300px; padding: 12px; border-radius: 18px; background: rgba(255,250,242,.96); box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); overflow: auto; transform: translateX(calc(100% + 24px)); transition: transform .3s cubic-bezier(.2,.8,.2,1); font-size: 13px; }
.mode-3d.drawer-open .ty-drawer { transform: none; }
.mode-3d .ty-drawer:empty { display: none; }
.mode-3d .ty-drawer .ld-log { max-height: none; }
/* desktop: with the log column open, the board + HUD + popups use the space left of it */
@media (min-width: 821px) {
  .mode-3d .ty-stage, .mode-3d .ty-hud, .mode-3d .ty-top, .mode-3d .ty-act, .mode-3d .ty-pop, .mode-3d .ty-panel { transition: right .3s, left .3s; }
  .mode-3d.in-game.drawer-open .ty-stage, .mode-3d.in-game.drawer-open .ty-hud { right: 324px; }
  .mode-3d.in-game.drawer-open .ty-top, .mode-3d.in-game.drawer-open .ty-act, .mode-3d.in-game.drawer-open .ty-pop, .mode-3d.in-game.drawer-open .ty-panel { left: calc((100% - 324px) / 2); }
  .mode-3d.in-game.drawer-open .ty-card-pop { left: calc((100vw - 324px) / 2); }
  .mode-3d.in-game.drawer-open .ty-act:has(.ty-card-pop) { left: 0; right: 324px; }
  .mode-3d.in-game.drawer-open .ty-act:has(.ty-card-pop) .ty-card-pop { left: 50%; }
  .mode-3d.in-game.drawer-open .ty-drawer-btn { display: none; }
}
.ty-drawer-btn { display: none; }
.mode-3d.in-game .ty-drawer-btn { display: flex; position: absolute; z-index: 5; right: 12px; bottom: 84px; gap: 6px; align-items: center; padding: 8px 12px; border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: 0 6px 16px -8px rgba(0,0,0,.4); font-size: 13px; font-weight: 700; }
.mode-3d .ty-panel { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100% - 90px); overflow: auto; padding: 18px; border-radius: 22px; background: rgba(255,250,242,.95); box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); }
.mode-3d .ty-panel:empty { display: none; }
.ty-ph { margin-top: 0 !important; }
.mode-3d .ty-pop { position: absolute; z-index: 7; left: 50%; top: 50%; right: auto; transform: translate(-50%, -50%); width: min(360px, calc(100% - 24px)); max-height: calc(100% - 100px); }
.mode-3d .ty-rules { z-index: 9; }
@media (max-width: 820px) {
  .modal.ty-modal.mode-2d { grid-template-columns: 1fr; }
  .mode-3d .ty-top { top: 6px; left: 8px; right: 52px; transform: none; max-width: none; padding: 4px 8px; gap: 6px; }
  .mode-3d .ty-top h2 { display: none; }
  .mode-3d .ty-top .ld-modes button { padding: 5px 8px; font-size: 12px; }
  .mode-3d .ty-tool { width: 30px; height: 30px; font-size: 14px; }
  .mode-3d .ty-pc { min-width: 0; max-width: 46vw; padding: 4px 10px 4px 4px; gap: 6px; }
  .mode-3d .ty-pc .ty-ava { width: 34px; height: 34px; }
  .mode-3d .ty-cash { font-size: 14px; } .mode-3d .ty-pc-n { font-size: 11px; max-width: 90px; } .mode-3d .ty-pc-s { display: none; }
  .mode-3d .c-tl, .mode-3d .c-tr { top: 52px; }
  .mode-3d .ty-act { width: calc(100% - 24px); min-width: 0; bottom: 64px; }
  .mode-3d .ty-drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62dvh; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .mode-3d.in-game .ty-drawer-btn { bottom: auto; top: 52px; left: 50%; right: auto; transform: translateX(-50%); padding: 6px 10px; }
  .mode-3d .ty-drawer-btn span { display: none; }
  .ty-total { font-size: 64px; }
}
.mode-3d .ty-act:has(.ty-card-pop) { inset: 0; transform: none; width: auto; min-width: 0; pointer-events: none; }
.mode-3d .ty-act:has(.ty-card-pop) .ty-card-pop { position: absolute; pointer-events: auto; }
.mode-2d .ty-top { grid-row: 1; }
.mode-2d .ty-stage { grid-row: 2; grid-column: 1; }
.mode-2d .ty-side { grid-row: 2; grid-column: 2; }
@media (max-width: 820px) { .mode-2d .ty-side { grid-row: 3; grid-column: 1; } }

/* World Tycoon — NPC players (Phase 3): label, speech bubble (EN, Vietnamese on hover / tap), voice switch */
.ty-npc { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #2b2540; color: #fff !important; font-style: normal; font-size: 10px; font-weight: 700 !important; letter-spacing: .02em; vertical-align: 1px; }
.ty-seat.npc { box-shadow: inset 0 0 0 2px #d9d2f0; background: #f6f3ff; }
.ty-say { position: absolute; z-index: 6; left: 0; bottom: calc(100% + 10px); width: max-content; max-width: min(280px, 70vw); padding: 8px 12px; border-radius: 14px; background: #fff; color: #2b2540; font-size: 13px; line-height: 1.35; font-weight: 600; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5), 0 0 0 2px var(--tc, #ccc); cursor: help; pointer-events: auto; animation: tySay .35s cubic-bezier(.2,1.4,.4,1); }
.ty-say::after { content: ''; position: absolute; left: 22px; bottom: -7px; border: 7px solid transparent; border-top-color: #fff; border-bottom: 0; }
.ty-say-vi { display: none; margin-top: 4px; padding-top: 4px; border-top: 1px dashed #d8d2e6; font-style: normal; font-weight: 500; color: #6a5f80; font-size: 12px; }
.ty-say:hover .ty-say-vi, .ty-say.show-vi .ty-say-vi { display: block; }
.mode-3d .c-tl .ty-say, .mode-3d .c-tr .ty-say { bottom: auto; top: calc(100% + 10px); }
.mode-3d .c-tl .ty-say::after, .mode-3d .c-tr .ty-say::after { bottom: auto; top: -7px; border-top-color: transparent; border-bottom: 7px solid #fff; border-top: 0; }
.mode-3d .c-tr .ty-say, .mode-3d .c-br .ty-say { left: auto; right: 0; }
.mode-3d .c-tr .ty-say::after, .mode-3d .c-br .ty-say::after { left: auto; right: 22px; }
.mode-2d .ty-say { left: 8px; }
@keyframes tySay { from { opacity: 0; transform: translateY(6px) scale(.9); } }
.ty-logh { display: flex; align-items: center; gap: 6px; }
.ty-mute { margin-left: auto; border: 0; background: var(--tint, #f3eee6); border-radius: 10px; padding: 2px 8px; font-size: 15px; cursor: pointer; line-height: 1.4; }
@media (hover: hover) { .ty-mute:hover { filter: brightness(.95); } }   /* touch: a tap leaves :hover stuck */

/* World Tycoon · first-time "Manage" guide (coach popup pointing at My properties) */
.ty-tip { position: absolute; z-index: 30; display: flex; flex-direction: column; border-radius: 16px; background: #fffaf2; color: #3b2a1e; box-shadow: 0 18px 44px -12px rgba(0,0,0,.55), 0 0 0 2px #e8a33d; font-size: 13px; line-height: 1.4; animation: tyTipIn .3s ease-out; }
.ty-tip-in { padding: 12px 14px; overflow: auto; min-height: 0; overscroll-behavior: contain; }
.ty-tip-in > b { display: block; font-size: 14.5px; }
.ty-tip .ty-vi { display: block; font-size: 11.5px; opacity: .75; font-style: italic; }
.ty-tip ul { margin: 8px 0 6px; padding: 0; list-style: none; display: grid; gap: 6px; }
.ty-tip .hint { margin: 0 0 8px; font-size: 11.5px; }
.ty-tip .btn { width: 100%; position: sticky; bottom: 0; }
@media (max-width: 700px) { .ty-tip { font-size: 12px; } .ty-tip ul { gap: 4px; margin: 6px 0 4px; } }
.ty-tip::after { content: ''; position: absolute; width: 16px; height: 16px; background: #fffaf2; box-shadow: 2px 2px 0 0 #e8a33d; transform: rotate(-45deg); left: var(--ax, 50%); bottom: -8px; margin-left: -8px; }
.ty-tip.below::after { bottom: auto; top: -8px; transform: rotate(135deg); }
.ty-tip.side::after { left: auto; right: -8px; bottom: auto; top: var(--ay, 50%); margin: -8px 0 0; transform: rotate(-45deg); }
.ty-drawer.ty-tip-on .ty-dr-head, .ty-drawer.ty-tip-on .ty-mlist, .ty-drawer.ty-tip-on .ty-dr-head + .hint { border-radius: 10px; animation: tyTipGlow 1.4s ease-in-out infinite; }
@keyframes tyTipIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes tyTipGlow { 50% { box-shadow: 0 0 0 3px rgba(232,163,61,.65); } }
.ww-tools select#wwNarr { max-width: 150px; padding: 6px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; color: inherit; background: #2c2758; border: 1px solid rgba(255,255,255,.2); }
.ww-modal.day .ww-tools select#wwNarr { background: rgba(255,255,255,.7); border-color: rgba(0,0,0,.1); }
@media (max-width: 600px) { .ww-tools select#wwNarr { max-width: 96px; } }

/* Werewolf chat: VI translation tooltip for [en|vi] phrases (hover on desktop, tap on phones) */
.ww-vi-pop { position: fixed; z-index: 10000; max-width: min(280px, calc(100vw - 16px)); padding: 6px 10px; border-radius: 10px; background: #2b2540; color: #fff; font-size: 13px; line-height: 1.35; box-shadow: 0 8px 22px -8px rgba(0,0,0,.5); pointer-events: none; }
.ww-vi-pop[hidden] { display: none; }
abbr.ww-tip:focus { outline: none; background: rgba(243,195,92,.25); border-radius: 4px; }
.ww-voice .ww-seg { flex-wrap: wrap; }
.ww-voice select[data-nrate] { padding: 5px 8px; border-radius: 8px; }
.ww-tools select#wwNarr:disabled { opacity: .6; }

/* ---- small screens pass (phones landscape / short windows): quiz popups fit without scrolling */
@media (max-height: 500px) {
  .mode-3d .ty-card-pop { max-height: calc(100dvh - 52px); padding: 10px 14px; width: min(600px, calc(100vw - 24px)); }
  .mode-3d .ty-act:has(.ty-card-pop) .ty-card-pop { top: calc(50% + 18px); }
  .ld-opts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ld-opts button { padding: 6px 9px; }
  .ld-qhead { margin-bottom: 2px; }
}

/* short desktop / laptop windows: the icon rail would run off the bottom → two columns */
@media (max-height: 760px) and (min-width: 641px) {
  .rightbar .dock { display: grid; grid-template-columns: repeat(2, 40px); gap: 2px; padding: 6px; }
  .rightbar .dock button, .rightbar .dock .small { width: 40px; height: 36px; }
  .rightbar .dock hr { grid-column: 1 / -1; margin: 2px 4px; }
}
@media (max-height: 760px) and (min-height: 501px) and (min-width: 641px) {
  .timer { right: 124px; }   /* the two-column rail is ~94px wide → keep the study timer clear of it (it used to cover ⚙️) */
}
@media (max-height: 430px) and (min-width: 641px) {   /* phones held sideways */
  .rightbar .dock { grid-template-columns: repeat(3, 38px); }
  .rightbar .dock button, .rightbar .dock .small { width: 38px; height: 34px; }
}

/* ---------- ⭐ Rate us + 🏆 Bảng vàng thành tích (js/guestbook.js) */
.mb-top { flex-wrap: wrap; }
.mb-hint + [data-bact], .mb-wallet + [data-bact] { margin-left: auto; }
.rate-modal .rt-count { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 4px; text-align: left; }
.rate-modal .rt-count em { font-style: normal; }
.rate-modal .rt-count.ok { color: #15803d; }
.rate-modal .rt-cls { max-width: 220px; }
.gb-manage { max-width: 640px; width: 100%; }
.gb-list { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.gb-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.gb-row p { margin: 4px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ach-modal { width: min(980px, 100%); }
.ach-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-right: 36px; }
.ach-head h2 { margin: 0; color: #9a7413; }
.ach-head .btn { margin-left: auto; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; max-height: 68vh; overflow: auto; padding: 4px; }
.ach-card { position: relative; margin: 0; border-radius: 14px; background: linear-gradient(160deg, #fff8e1, #f3e1a8); border: 2px solid #e2c15a; box-shadow: 0 4px 14px rgba(150, 110, 20, .18); overflow: hidden; }
.ach-img { display: block; width: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.ach-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ach-card figcaption { padding: 8px 12px 10px; font-size: 14px; color: #5b4310; }
.ach-card figcaption small { color: #8a7038; }
.ach-card figcaption p { margin: 4px 0 0; font-size: 13px; font-style: italic; overflow-wrap: anywhere; }
.ach-band { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #c9a227; color: #fff; font-weight: 800; font-size: 12.5px; }
.ach-del { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 999px; width: 32px; height: 32px; background: rgba(255, 255, 255, .9); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.ach-view { width: min(900px, 100%); text-align: center; }
.ach-view img { max-width: 100%; max-height: 74vh; border-radius: 10px; }
.ach-add { max-width: 520px; width: 100%; }
.ach-drop { display: grid; place-items: center; min-height: 150px; border: 2px dashed #d8b85a; border-radius: 14px; background: #fffaf0; color: #8a7038; font-weight: 700; cursor: pointer; text-align: center; padding: 10px; }
.ach-drop img { max-width: 100%; max-height: 240px; border-radius: 8px; }
.ach-two { gap: 12px; flex-wrap: wrap; }
.ach-two .field { flex: 1 1 140px; }

/* Sound panel → Café voices: English note with Vietnamese on hover / tap */
.vi-tip { position: relative; border-bottom: 1px dotted currentColor; cursor: help; outline: none; }
.vi-tip::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); width: min(280px, 80vw); padding: 8px 10px; border-radius: 10px; background: var(--espresso); color: #fff; font: 500 12.5px/1.45 var(--font); white-space: normal; box-shadow: 0 12px 28px -10px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5; }
.vi-tip:hover::after, .vi-tip:focus::after { opacity: 1; }
.vi-tip.blk { display: block; border-bottom: 0; }  /* whole option card is the hover target */
.vi-tip.blk small { text-decoration: underline dotted; text-underline-offset: 3px; }
.vi-tip.tip-r::after { left: auto; right: 0; }
.vc-mode { margin-bottom: 6px; }
.vc-row select { width: 100%; margin-top: 4px; }

/* ---------- welcome card: Cozy latte style (login / sign-up / teacher / welcome back) */
.modal.welcome { background: radial-gradient(circle at 50% 0%, #fffaf2 0%, #fbf1e3 55%, #f5e6d2 100%); border: 1px solid #f0dfc8; overflow: hidden; isolation: isolate; }
.modal.welcome::before { content: ""; position: absolute; z-index: -1; right: -46px; top: -46px; width: 150px; height: 150px; border-radius: 50%; border: 12px solid rgba(139,90,60,.07); }
.modal.welcome::after { content: ""; position: absolute; z-index: -1; left: -18px; bottom: -14px; width: 58px; height: 80px; border-radius: 50%; background: rgba(139,90,60,.07); transform: rotate(-28deg); }
.welcome .tag { color: #6b3f26; }
.welcome .live { padding: 5px 12px; border-radius: 999px; background: rgba(95,158,110,.12); color: #3f6f4b; font-weight: 600; }
.welcome .w-tabs { background: rgba(139,90,60,.1); }
.welcome .w-tabs button { color: #8b6a55; }
.welcome .w-tabs button.on { color: #6b3f26; box-shadow: 0 3px 10px -4px rgba(107,63,38,.45), inset 0 -2px 0 #d9a878; }
.welcome .input { background: #fffdf9; border-color: #ead9c2; border-radius: 14px; }
.welcome .input:focus { border-color: #b07a50; box-shadow: 0 0 0 4px rgba(176,122,80,.16); }
.welcome .w-remember input { accent-color: #8b5a3c; }
.welcome .btn.primary { background: linear-gradient(180deg, #5a3522 0%, #3b2216 100%); box-shadow: 0 10px 22px -12px rgba(59,34,22,.8), inset 0 1px 0 rgba(255,255,255,.12); border-radius: 16px; }
.welcome .btn.primary:hover { background: linear-gradient(180deg, #6b3f26 0%, #46291b 100%); transform: translateY(-1px); }
.welcome .btn.primary:active { transform: none; }
.welcome .btn.sm { background: rgba(139,90,60,.1); color: #6b3f26; }
.welcome .w-help { color: #8b6a55; }
.welcome .wb-title { font: 800 26px/1.2 var(--display); color: #3b2216; margin: 8px 0 4px; }
.welcome .wb-special { margin: 0 0 4px; font-size: 14px; color: #8b6a55; }
.welcome .wb-special i { font-family: var(--display); color: #6b3f26; }
.welcome .wb-stats div { display: grid; justify-items: center; gap: 2px; min-width: 98px; padding: 12px 14px; border: 0; border-radius: 18px; box-shadow: inset 0 -3px 0 rgba(74,45,25,.08); }
.welcome .wb-stats span { font-size: 18px; line-height: 1; }
.welcome .wb-stats b { color: #5a3522; }
.welcome .wb-stats .s-beans { background: #f6e7d2; }
.welcome .wb-stats .s-brew { background: #efdcc4; }
.welcome .wb-stats .s-streak { background: #fbe0c8; }
.welcome .wb-stats .s-streak b { color: #b4532a; }
/* ================================================================ IELTS One! (card game) — neutral slate style, full screen */
.modal-wrap:has(.one-modal) { padding: 0; }
.modal.one-modal { --ink: #1f2933; --sl: #466070; --pane: rgba(255,255,255,.92); width: 100vw; max-width: none; height: 100vh; height: 100dvh; margin: 0; padding: 0; border-radius: 0; border: 0; transform: none; overflow: hidden; display: flex; flex-direction: column; background: #dfe3e8; color: var(--ink); backdrop-filter: none; -webkit-backdrop-filter: none; }
.one-modal .modal-x { z-index: 9; top: 8px; right: 8px; }
.one-vi { font-style: italic; font-weight: 400; color: #5b6773; font-size: .85em; }
.one-top { order: 0; position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 52px 8px 14px; background: var(--pane); box-shadow: 0 2px 10px -6px rgba(0,0,0,.35); }
.one-top h2 { margin: 0; font-size: 18px; white-space: nowrap; }
.one-tools { display: flex; gap: 6px; margin-left: auto; }
.one-tool { min-width: 34px; height: 30px; padding: 0 8px; border-radius: 10px; background: #eef1f4; font-weight: 800; font-size: 13px; color: var(--ink); }
@media (hover: hover) { .one-tool:hover { background: #dde3e9; } }   /* touch: a tap leaves :hover stuck */
.one-pc-n { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.one-pc-n em { font-style: normal; font-weight: 600; color: #5b6773; font-size: 12px; }
.one-tag { padding: 1px 6px; border-radius: 999px; background: #2f9e5b; color: #fff; font-weight: 800; font-size: 11px; }
.one-tag.warn { background: #e5484d; }
.one-think { display: inline-block; animation: oneBob 1s ease-in-out infinite; }
@keyframes oneBob { 50% { transform: translateY(-3px); } }
.one-say { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 4; width: max-content; max-width: 230px; padding: 7px 10px; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px -6px rgba(0,0,0,.35); font-size: 12.5px; cursor: pointer; }
.one-say i { display: none; margin-top: 3px; color: #5b6773; }
.one-say.show-vi i, .one-say:hover i { display: block; }
.one-stage { order: 2; position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.one-table { width: 100%; height: 100%; display: grid; place-items: center; }
.one-piles { display: flex; align-items: center; gap: 22px; }
.one-deck { position: relative; display: inline-block; background: none; padding: 0; border-radius: 10px; }
.one-deck.ok, .one-deck.ok .one-card { cursor: pointer; }
.one-deck .one-card.off { cursor: default; }
.one-deck .one-card { --w: 76px; box-shadow: 3px 3px 0 #e9e5dc, 6px 6px 0 #d9d4ca, 0 8px 16px rgba(0,0,0,.35); }
/* your turn: the pile breathes (soft warm halo + small lift) and shows a "Tap to draw" tag */
.one-deck.ok .one-card { animation: oneDeckGlow 1.8s ease-in-out infinite; transition: transform .15s; }
@media (hover: hover) { .one-deck.ok:hover .one-card { animation: none; transform: translateY(-6px) scale(1.04); box-shadow: 0 6px 14px rgba(0,0,0,.35), 0 0 22px 8px rgba(255,214,102,.85); } }   /* touch: a tap leaves :hover stuck */
.one-deck.ok:active .one-card { transform: scale(.96); }
@keyframes oneDeckGlow {
  0%, 100% { transform: translateY(0); box-shadow: 0 4px 10px rgba(0,0,0,.35), 0 0 0 0 rgba(255,214,102,0); }
  50% { transform: translateY(-4px); box-shadow: 0 8px 14px rgba(0,0,0,.3), 0 0 18px 6px rgba(255,214,102,.75); }
}
.one-deck-tip { position: absolute; left: 50%; top: -30px; transform: translateX(-50%) rotate(18deg); white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: #fff8e1; color: #6b4a00; font-size: 11.5px; font-weight: 800; box-shadow: 0 3px 8px rgba(0,0,0,.3); pointer-events: none; animation: oneTip 1.8s ease-in-out infinite; }
.one-deck-tip .one-vi { font-weight: 600; color: #8a6d2a; }
@keyframes oneTip { 0%, 100% { opacity: .85; margin-top: 0; } 50% { opacity: 1; margin-top: -3px; } }
@media (max-width: 600px) { .one-deck-tip { font-size: 10px; top: -26px; padding: 2px 7px; } .one-deck-tip .one-vi { display: none; } }
.one-deck small { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; color: #e8edf1; font-weight: 700; font-size: 12px; }
.one-disc { position: relative; width: 84px; height: 126px; }
.one-disc-c { position: absolute; inset: 0; transform: rotate(var(--r)); }
.one-disc-c .one-card { --w: 84px; box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.one-state { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.one-col { padding: 6px 12px; border-radius: 999px; background: var(--cc); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 0 0 3px rgba(255,255,255,.7); }
@keyframes oneSpin { to { transform: rotate(360deg); } }
.one-bar { order: 3; position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 10px 0; padding: 8px 12px; border-radius: 14px; background: var(--pane); box-shadow: 0 2px 10px -6px rgba(0,0,0,.35); }
.one-bar:empty { display: none; }
.one-status { flex: 1 1 220px; min-width: 0; }
.one-status p { margin: 0 0 6px; font-size: 14px; }
.one-tbar { flex: none; height: 8px; }
.one-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.one-onebtn { background: #2f9e5b; color: #fff; font-weight: 900; animation: onePulse .9s ease-in-out infinite; }
.one-catch { font-weight: 900; animation: onePulse .7s ease-in-out infinite; }
.one-catch small { font-weight: 600; opacity: .85; }
@keyframes onePulse { 50% { transform: scale(1.07); } }
.one-hand { order: 4; position: relative; z-index: 3; }
.one-hand-in { display: flex; overflow-x: auto; overflow-y: visible; padding: 18px 16px max(12px, env(safe-area-inset-bottom)); justify-content: safe center; }
.one-hand-in > .one-card { --w: 70px; flex: none; transition: transform .15s, filter .15s; }
.one-hand-in > .one-card + .one-card { margin-left: -20px; }
.one-hand-in > .one-card.ok { transform: translateY(-12px); cursor: pointer; }
@media (hover: hover) { .one-hand-in > .one-card.ok:hover { transform: translateY(-20px); z-index: 2; } }   /* touch: a tap leaves :hover stuck */
.one-hand-in:has(.ok) > .one-card:not(.ok) { filter: grayscale(.45) brightness(.82); }
.one-hand-in > .one-card.drawn { box-shadow: 0 0 0 3px #ffd166; }
.one-card.nope { animation: oneNope .3s; }
@keyframes oneNope { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
.one-watch { text-align: center; padding: 10px; }
/* card art: flat-vector SVG (js/one-art.js) inside a button */
.one-card { --w: 64px; position: relative; display: inline-block; width: var(--w); height: calc(var(--w) * 1.5); padding: 0; border: 0; border-radius: calc(var(--w) * .11); background: none; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.25); vertical-align: top; }
.one-card .one-svg { display: block; width: 100%; height: 100%; }
/* players: flat portraits */
.one-ava { display: block; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.25); }
.one-ava svg { display: block; width: 100%; height: 100%; }
/* Flip deck: dark side theme + badge */
.one-badge { padding: 3px 10px; border-radius: 999px; background: #141724; color: #e4dcff; font-weight: 800; font-size: 12px; box-shadow: 0 0 0 1.5px #9b6bff; white-space: nowrap; }
.one-badge[hidden] { display: none; }
.modal.one-modal.dark-side { --ink: #e8eaf4; --pane: rgba(24,27,42,.92); background: #0d0f18; }
.one-modal.dark-side .one-vi, .one-modal.dark-side .one-pc-n em, .one-modal.dark-side .one-pc-c { color: #aab0c8; }
.one-modal.dark-side .one-tool { background: #262b42; color: #e8eaf4; }
.one-modal.flipping .one-card { animation: oneFlip .65s ease-in-out; }
@keyframes oneFlip { 50% { transform: scaleX(.05); } }
@media (max-width: 600px) { .one-ava { width: 36px; height: 36px; } .one-top .one-badge { order: 5; } }
/* pop-ups, panels */
.one-pop { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; padding: 12px; background: rgba(31,41,51,.25); }
.one-pop[hidden], .one-panel[hidden], .one-logbox[hidden] { display: none; }
.one-pop-in > .ld-timer { margin-bottom: 16px; }   /* room for the "15s" label under the bar (else a stray scrollbar) */
.one-qtop { display: flex; align-items: center; gap: 10px; margin: -2px 0 8px; font-size: 12.5px; font-weight: 700; color: #5b6670; }
.one-qtop .one-card { --w: 34px; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.one-qtop .one-col { padding: 3px 9px; font-size: 12px; box-shadow: none; margin-left: auto; }
body:has(.one-pop:not([hidden])) .one-fly { opacity: .3; }   /* cards dealt while the quiz is up stay behind it visually */
.one-pop-in { width: min(460px, 100%); max-height: calc(100% - 16px); overflow: auto; padding: 14px; border-radius: 18px; background: #fff; box-shadow: 0 24px 60px -16px rgba(0,0,0,.5); display: grid; gap: 10px; }
.one-colors p { margin: 0 0 8px; }
.one-colors > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.one-colors button { padding: 14px 8px; border-radius: 12px; background: var(--cc); color: #fff; font-weight: 800; font-size: 15px; display: flex; gap: 8px; align-items: center; justify-content: center; }
@media (hover: hover) { .one-colors button:hover { filter: brightness(1.08); } }   /* touch: a tap leaves :hover stuck */
.one-chal p { margin: 0 0 8px; }
.one-panel { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 24px)); max-height: calc(100% - 90px); overflow: auto; padding: 16px 18px; border-radius: 18px; background: #fff; box-shadow: 0 24px 60px -16px rgba(0,0,0,.45); display: grid; gap: 10px; }
.one-modal:not(.in-game) .one-panel { top: calc(50% + 24px); }
.one-panel h3 { margin: 0; }
.one-panel p { margin: 0; }
.one-modes { padding: 4px; border-radius: 999px; background: var(--tint); }
.one-modes button { flex: 1; background: transparent; }
.one-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.one-seat { padding: 8px 10px; border-radius: 10px; background: #eef1f4; font-size: 13.5px; font-weight: 700; }
.one-seat em { font-weight: 500; color: #5b6773; }
.one-seat.taken { background: #e3f1e8; }
.one-set { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.one-set label { display: grid; gap: 3px; min-width: 0; font-size: 12.5px; font-weight: 700; color: #3e4c59; }
.one-set select { padding: 7px 8px; border-radius: 9px; border: 1px solid #cfd6dd; background: #fff; font-size: 14px; width: 100%; min-width: 0; text-overflow: ellipsis; }
.one-rank { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.one-rank li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 10px; background: #eef1f4; font-size: 14px; }
.one-rank li.me { box-shadow: inset 0 0 0 2px #2f6fd6; }
.one-rank li:first-child { background: #fff3cf; }
.one-logbox { position: absolute; z-index: 7; right: 10px; top: 54px; width: min(320px, calc(100% - 20px)); max-height: 60%; overflow: auto; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); display: grid; gap: 6px; }
.one-logbox .ld-log { max-height: none; }
.one-rules { z-index: 8; }
@media (max-width: 600px) {
  .one-top { padding: 6px 48px 6px 10px; gap: 6px; }
  .one-top h2 { font-size: 15px; }
  .one-top h2 .one-vi { display: none; }
  .one-modes button { padding: 6px 8px; font-size: 12.5px; }
  .one-hand-in > .one-card { --w: 56px; }
  .one-hand-in > .one-card + .one-card { margin-left: -16px; }
  .one-deck .one-card { --w: 60px; } .one-disc { width: 66px; height: 99px; } .one-disc-c .one-card { --w: 66px; }
  .one-piles { gap: 14px; }
  .one-status p { font-size: 13px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .one-top { padding-top: 4px; padding-bottom: 4px; }
  .one-top h2 { font-size: 14px; }
  .one-hand-in { padding-top: 10px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .one-hand-in > .one-card { --w: 44px; }
  .one-hand-in > .one-card.ok { transform: translateY(-8px); }
  .one-deck .one-card { --w: 50px; } .one-disc { width: 54px; height: 81px; } .one-disc-c .one-card { --w: 54px; }
  .one-bar { margin-top: 4px; padding: 5px 10px; }
  .one-panel { max-height: calc(100% - 50px); }
}
.one-modal h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 18px; }
.one-modal .ld-quiz { box-shadow: inset 0 0 0 2px #cfd6dd; }
.one-modal .ld-qhead { color: #3e4c59; }
.one-modal.dark-side .ld-modes button:not(.on) { color: #c8cde0; background: rgba(255,255,255,.08); }
.one-modal.dark-side .one-bar .one-status { color: #e8eaf4; }
/* ----- IELTS ONE flat table: felt panel, opponents around the edges, tan centre mat with a direction ring */
.modal.one-modal { background: #262b37; }
.one-modal .one-top, .one-modal .one-bar { background: rgba(255,255,255,.94); }
.one-table { margin: 8px 10px; width: calc(100% - 20px); height: calc(100% - 16px); border-radius: 16px; background-color: #4c7b42; background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.4px), radial-gradient(rgba(0,0,0,.06) 1px, transparent 1.4px), radial-gradient(ellipse at center, rgba(255,255,255,.08), transparent 70%); background-size: 7px 7px, 11px 11px, 100% 100%; background-position: 0 0, 3px 4px, 0 0; box-shadow: inset 0 0 0 3px rgba(0,0,0,.12), inset 0 0 40px rgba(0,0,0,.25); }
.one-opps { position: absolute; inset: 8px 10px; z-index: 3; pointer-events: none; }
.one-pc { position: absolute; display: flex; gap: 6px; pointer-events: auto; font-size: 12px; color: #fff; }
.one-pc-who { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.one-pc .one-ava { width: 48px; height: 48px; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 3px 8px rgba(0,0,0,.35); }
.one-pc.turn .one-ava { box-shadow: 0 0 0 3px #ffd166, 0 0 16px 4px rgba(255,209,102,.7); }
.one-pc-n { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.one-pc-n em { font-style: normal; font-weight: 600; opacity: .8; }
.one-pc-c { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.one-pc-c b { padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.45); }
.one-pc-c em { font-style: normal; opacity: .8; }
.one-fan2 { display: flex; }
.one-mini { --mw: 52px; display: block; width: var(--mw); height: calc(var(--mw) * 1.5); flex: none; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.one-mini svg { display: block; width: 100%; height: 100%; }
.one-pc.pos-top { top: 6px; left: 50%; transform: translateX(-50%); flex-direction: row; align-items: flex-start; }
.one-pc.pos-top .one-mini + .one-mini { margin-left: calc(var(--mw) * -.55); }
.one-pc.pos-left, .one-pc.pos-right { top: 6px; flex-direction: column; align-items: center; }
.one-pc.pos-left { left: 8px; } .one-pc.pos-right { right: 8px; }
.one-pc.pos-left .one-fan2, .one-pc.pos-right .one-fan2 { flex-direction: column; align-items: center; padding: 10px calc(var(--mw) * .25) 0; }
.one-pc.pos-left .one-mini, .one-pc.pos-right .one-mini { transform: rotate(90deg); margin: calc(var(--mw) * -.05) 0; }
.one-pc.pos-left .one-mini + .one-mini, .one-pc.pos-right .one-mini + .one-mini { margin-top: calc(var(--mw) * -.85); }
.one-say { color: #1f2933; pointer-events: auto; }
.one-pc.pos-left .one-say { left: 0; transform: none; top: 56px; }
.one-pc.pos-right .one-say { left: auto; right: 0; transform: none; top: 56px; }
.one-pc.pos-top .one-say { top: calc(100% + 4px); }
.one-piles { gap: 26px; }
.one-deck { transform: rotate(-18deg); }
.one-mat { position: relative; display: grid; place-items: center; width: 150px; height: 150px; border-radius: 14px; background: #d8c690; box-shadow: inset 0 0 0 3px rgba(120,95,40,.25), 0 6px 16px -6px rgba(0,0,0,.45); }
.one-ring { position: absolute; inset: -16px; width: calc(100% + 32px); height: calc(100% + 32px); fill: none; stroke: #b9d64c; stroke-width: 4.5; stroke-linecap: round; animation: oneSpin 6s linear infinite; pointer-events: none; }
.one-ring .h { fill: #b9d64c; stroke: none; }
.one-mat.ccw .one-ring { animation-name: oneSpinCcw; }
@keyframes oneSpinCcw { from { transform: scaleX(-1); } to { transform: scaleX(-1) rotate(360deg); } }
.one-dir-t { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.85); }
.modal.one-modal.dark-side { background: #1b1e2b; }
.one-modal.dark-side .one-table { background-color: #2a2f45; }
.one-modal.dark-side .one-mat { background: #3a405c; box-shadow: inset 0 0 0 3px rgba(0,0,0,.25), 0 6px 16px -6px rgba(0,0,0,.6); }
.one-modal.dark-side .one-ring { stroke: #6f7aa3; } .one-modal.dark-side .one-ring .h { fill: #6f7aa3; }
.one-modal.dark-side .one-top, .one-modal.dark-side .one-bar { background: rgba(32,36,54,.95); }
@media (max-width: 600px) {
  .one-pc .one-ava { width: 36px; height: 36px; }
  .one-mini { --mw: 32px; }
  .one-pc-n { max-width: 70px; font-size: 11px; }
  .one-mat { width: 104px; height: 104px; } .one-piles { gap: 14px; }
}
.one-modal.dark-side .one-pop-in, .one-modal.dark-side .one-panel, .one-modal.dark-side .ld-quiz, .one-modal.dark-side .one-rules, .one-modal.dark-side .one-logbox { --ink: #1f2933; color: #1f2933; }
/* reference layout: status bar above the felt, tiled-grass felt, my portrait bottom-left, my hand overlapping the felt's bottom edge */
.one-bar { order: 1; }
.one-stage { order: 2; }
.one-hand { order: 3; margin-top: -92px; pointer-events: none; }
.one-hand-in { pointer-events: auto; width: max-content; max-width: 100%; margin: 0 auto; }
.one-table { background-color: #5c8d4c; background-image: linear-gradient(rgba(0,0,0,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.07) 1px, transparent 1px), radial-gradient(rgba(255,255,255,.07) 1.2px, transparent 1.6px), radial-gradient(rgba(20,60,20,.12) 1.2px, transparent 1.6px); background-size: 46px 46px, 46px 46px, 9px 9px, 13px 13px; background-position: 0 0, 0 0, 0 0, 4px 6px; box-shadow: inset 0 0 0 4px rgba(0,0,0,.18), inset 0 0 50px rgba(0,0,0,.2); }
.one-modal.dark-side .one-table { background-color: #2f3549; }
.one-pc.pos-left .one-fan2, .one-pc.pos-right .one-fan2 { padding-top: 18px; }
.one-pc.pos-me { left: 8px; bottom: 8px; }
.one-pc.pos-me .one-ava { width: 58px; height: 58px; }
.one-mat { transform: rotate(-4deg); }
.one-disc-c .one-card, .one-deck .one-card, .one-hand-in > .one-card { box-shadow: 0 4px 10px rgba(0,0,0,.35); }
@media (max-width: 600px) { .one-hand { margin-top: -64px; } .one-pc.pos-me .one-ava { width: 42px; height: 42px; } .one-pc.pos-me .one-pc-n { display: none; } }
.t-bg td { vertical-align: middle; }
.t-bg .input { width: 100%; min-width: 0; }
.t-bg-on { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 700; }
.t-bg-th { white-space: nowrap; }
.t-bg-th img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-right: 4px; background: var(--tint); }
.t-bg-th .btn { vertical-align: middle; cursor: pointer; }
.t-bg-th [hidden] { display: none; }
/* IELTS ONE: a card flying deck → hand (draw) or hand → discard pile (play); js/one.js fly() */
.one-fly { position: fixed; z-index: 9999; pointer-events: none; transform-origin: 0 0; will-change: transform; }
.one-fly .one-card { display: block; box-shadow: 0 10px 22px rgba(0,0,0,.4); }
/* IELTS ONE: Wild played → burst of the chosen colour from the discard pile; js/one.js colorBurst() */
.one-burst { position: fixed; z-index: 4; width: 0; height: 0; pointer-events: none; }
.one-burst i { position: absolute; left: 0; top: 0; display: block; animation-fill-mode: backwards; }
.one-burst .ring { width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%; border: 6px solid var(--cc); box-shadow: 0 0 18px var(--cc), inset 0 0 18px var(--cc); animation: oneRing .9s ease-out both; }
.one-burst .ring.r2 { border-width: 3px; animation-duration: 1.15s; }
.one-burst .dot { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--cc); box-shadow: 0 0 0 2px #fff; animation: oneDot .85s cubic-bezier(.2,.7,.3,1) both; }
@keyframes oneRing { from { transform: scale(.3); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
@keyframes oneDot { from { transform: rotate(var(--a)) translateX(10px) scale(1); opacity: 1; } to { transform: rotate(var(--a)) translateX(110px) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .one-deck.ok .one-card, .one-deck-tip { animation: none; } }
/* barista drink reminder: Vietnamese on hover (bubble over the barista + the toast) — app.js drinkNudge, scene say(…, vi) */
.npc-say.has-vi { pointer-events: auto; }
.npc-say.has-vi span { cursor: help; }
.npc-say span.vi { font-style: italic; }
.vi-hover { position: relative; cursor: help; border-bottom: 1px dotted currentColor; }
.vi-hover:hover::after { content: attr(data-vi); position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 5; width: max-content; max-width: min(280px, 80vw); padding: 6px 10px; border-radius: 10px; background: #2b1d14; color: #fff; font: italic 500 12.5px/1.35 var(--font); box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); white-space: normal; pointer-events: none; }
/* ================================================================ Xiangqi (Cờ tướng) — js/xiangqi.js */
.modal.xq-modal { width: min(1100px, 100%); height: min(900px, calc(100dvh - 48px)); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #f7eedf; }
.modal-wrap:has(.xq-modal) { overflow: hidden; }
.xq-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-right: 40px; }
.modal .xq-top h2 { font-size: 22px; margin: 0; }
.xq-tools { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.xq-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; }
.xq-modal.no-hist .xq-main { grid-template-columns: minmax(0, 1fr); }
.xq-modal.no-hist .xq-side { display: none; }
.xq-play { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.xq-wrap { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.xq-board { position: relative; flex: none; --u: 40px; border-radius: calc(var(--u) * .18); touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: linear-gradient(rgba(255,255,255,.07), rgba(0,0,0,.05)), repeating-linear-gradient(93deg, rgba(120,70,30,.07) 0 2px, transparent 2px 9px), repeating-linear-gradient(87deg, rgba(255,240,210,.12) 0 3px, transparent 3px 19px), linear-gradient(135deg, #ebc78f, #dcae6f 50%, #e7bf83);
  box-shadow: 0 0 0 5px #a8703c, 0 0 0 7px #7b4a22, 0 14px 30px -10px rgba(60,30,10,.6); }
.xq-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.xq-lines line, .xq-lines polyline { stroke: #6b3f1d; stroke-width: .035; fill: none; stroke-linecap: round; }
.xq-frame { fill: none; stroke: #6b3f1d; stroke-width: .07; }
.xq-coord text { font: 700 .28px system-ui, sans-serif; fill: #7a4b22; text-anchor: middle; }
.xq-river { position: absolute; left: 12%; right: 12%; top: calc(4.8 / 10.6 * 100%); height: calc(1 / 10.6 * 100%); display: flex; justify-content: space-between; align-items: center; pointer-events: none;
  font: 700 calc(var(--u) * .46) 'Noto Serif SC', 'Songti SC', 'STSong', 'KaiTi', serif; color: rgba(107,63,29,.72); letter-spacing: .1em; }
.xq-pcs, .xq-marks, .xq-fx { position: absolute; inset: 0; pointer-events: none; }
.xq-pc { position: absolute; width: calc(var(--u) * .9); height: calc(var(--u) * .9); transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; transition: left .28s ease, top .28s ease;
  background: radial-gradient(circle at 38% 30%, #fff3d9, #f1d19c 55%, #c99556); box-shadow: 0 calc(var(--u) * .06) calc(var(--u) * .1) rgba(60,30,10,.45), inset 0 calc(var(--u) * -.04) 0 rgba(120,70,30,.35); }
.xq-pc::before { content: ''; position: absolute; inset: calc(var(--u) * .07); border-radius: 50%; border: max(1px, calc(var(--u) * .028)) solid currentColor; opacity: .7; }
.xq-pc span { position: relative; font: 700 calc(var(--u) * var(--fs, .5)) / 1 'Noto Serif SC', 'Songti SC', 'STSong', 'KaiTi', serif; white-space: nowrap; }
.xq-pc.lb-vi span, .xq-pc.lb-en span { font-family: var(--font), system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; }
.xq-pc.s0 { color: #c0262d; } .xq-pc.s1 { color: #1d1d1d; }
.xq-pc.noanim { transition: none; }
.xq-pc.moving { z-index: 2; }
.xq-pc.check { box-shadow: 0 0 0 calc(var(--u) * .06) #e5484d, 0 0 calc(var(--u) * .45) #e5484d; animation: xqPulse 1s ease-in-out infinite; }
@keyframes xqPulse { 50% { box-shadow: 0 0 0 calc(var(--u) * .1) #e5484d, 0 0 calc(var(--u) * .7) #e5484d; } }
.xq-marks i { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; }
.xq-last { width: calc(var(--u) * .98); height: calc(var(--u) * .98); border: 2px dashed rgba(196,128,0,.75); }
.xq-last.to { border: 3px solid rgba(233,169,10,.9); box-shadow: 0 0 0 3px rgba(233,169,10,.3); }
.xq-sel { width: calc(var(--u) * 1.04); height: calc(var(--u) * 1.04); border: 3px solid #2f9e5b; box-shadow: 0 0 calc(var(--u) * .3) rgba(47,158,91,.7); }
.xq-dot { width: calc(var(--u) * .3); height: calc(var(--u) * .3); background: rgba(47,158,91,.8); box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.xq-dot.cap { width: calc(var(--u) * 1.04); height: calc(var(--u) * 1.04); background: none; border: 3px solid rgba(229,72,77,.9); box-shadow: none; }
.xq-tip { position: absolute; z-index: 6; max-width: min(270px, 92%); padding: 6px 10px; border-radius: 10px; background: #2b2540; color: #fff; font-size: 13px; line-height: 1.35; pointer-events: none; box-shadow: 0 8px 22px -8px rgba(0,0,0,.5); }
.xq-tip[hidden] { display: none; }
.xq-tip small { opacity: .7; margin-left: 4px; }
.xq-tip p { margin: 4px 0 0; font-size: 12px; opacity: .92; }
.xq-stamp { position: absolute; left: 50%; top: 50%; z-index: 5; transform: translate(-50%, -50%); padding: .25em .7em; border-radius: 14px; background: rgba(192,38,45,.92); color: #fff; text-align: center;
  font: 900 calc(var(--u) * .62) / 1.1 var(--display), serif; animation: xqStamp 1.5s ease forwards; white-space: nowrap; }
.xq-stamp small { display: block; font: 600 calc(var(--u) * .28) var(--font), sans-serif; opacity: .9; }
.xq-stamp.lost { background: rgba(43,37,64,.92); font-size: calc(var(--u) * .5); }
@keyframes xqStamp { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.xq-pop { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, 96%); max-height: 96%; overflow: auto; border-radius: 16px; box-shadow: 0 18px 50px -12px rgba(60,35,15,.55); }
.xq-pop[hidden] { display: none; }
.xq-pop .ld-timer { margin: 12px 0 14px; }
.xq-pop.shake { animation: xqShake .4s; }
@keyframes xqShake { 25% { margin-left: -8px; } 50% { margin-left: 8px; } 75% { margin-left: -4px; } }
.xq-panel { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 8px; overflow: auto; background: rgba(247,238,223,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.xq-panel[hidden] { display: none; }
.xq-card { width: min(470px, 100%); max-height: 100%; overflow: auto; padding: 16px 18px; border-radius: 18px; background: #fffaf2; box-shadow: 0 18px 50px -12px rgba(60,35,15,.45), inset 0 0 0 2px #e3d3b8; }
.modal .xq-card h3 { margin-top: 0; }
.xq-card .ld-lead { font-size: 13.5px; margin: 0 0 10px; }
.xq-set { margin: 10px 0; }
.xq-card .ty-seats { margin-bottom: 8px; }
.xq-res h3 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--espresso); }
.xq-pbar { position: relative; min-height: 40px; display: flex; }
.xq-pbar.empty { visibility: hidden; }
.xq-pb-in { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,.75); transition: box-shadow .2s, background .2s; }
.xq-pbar.turn .xq-pb-in { background: #fff6dc; box-shadow: inset 0 0 0 2px #e9a90a; }
.xq-disc, .xq-mini { border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-style: normal; font-weight: 700; font-family: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  background: radial-gradient(circle at 38% 30%, #fff3d9, #f1d19c 55%, #c99556); box-shadow: 0 1px 2px rgba(60,30,10,.4); }
.xq-disc { width: 28px; height: 28px; font-size: 15px; }
.xq-mini { width: 19px; height: 19px; font-size: 11px; }
.xq-disc.s0, .xq-mini.s0 { color: #c0262d; } .xq-disc.s1, .xq-mini.s1 { color: #1d1d1d; }
.xq-ava { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #fff8ea, #f0dcb8); box-shadow: 0 0 0 2px currentColor, 0 1px 3px rgba(60,30,10,.35); }
.xq-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.xq-ava i { position: absolute; right: -5px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font: 700 10px/1 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  background: radial-gradient(circle at 38% 30%, #fff3d9, #f1d19c 55%, #c99556); box-shadow: 0 1px 2px rgba(60,30,10,.4); }
.xq-ava.s0 { color: #c0262d; } .xq-ava.s1 { color: #1d1d1d; }
.xq-gear-note { font-size: 12px; font-weight: 600; color: #8a6a45; white-space: nowrap; }
.xq-gear-note i { font-weight: 400; opacity: .8; margin-left: 3px; }
.xq-pn { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; }
.xq-pn b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xq-pn em { font-style: normal; font-weight: 600; color: var(--muted); font-size: 12px; }
.xq-pn small { font-size: 11.5px; color: var(--muted); min-height: 1em; }
.xq-tray { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; max-height: 40px; overflow: hidden; }
.xq-clk { display: flex; gap: 5px; flex: none; }
.xq-gc, .xq-mt { font: 800 13px ui-monospace, Menlo, monospace; padding: 3px 7px; border-radius: 8px; background: var(--tint); }
.xq-gc.low, .xq-mt.low { background: #fde2e2; color: #c03535; }
.xq-say { position: absolute; z-index: 9; left: 36px; max-width: min(360px, calc(100% - 44px)); padding: 8px 12px; border-radius: 14px; background: #fff; color: var(--ink); font-size: 13.5px; line-height: 1.4; box-shadow: 0 10px 26px -10px rgba(60,35,15,.55); animation: xqSay .25s ease; }
#xqBarTop .xq-say { top: calc(100% + 6px); }
#xqBarBot .xq-say { bottom: calc(100% + 6px); }
@keyframes xqSay { from { opacity: 0; transform: translateY(4px); } }
.xq-say abbr.ww-tip { text-decoration-color: #c99a1a; }
.xq-act { min-height: 38px; display: flex; flex-direction: column; gap: 4px; }
.xq-actrow { display: flex; align-items: center; gap: 6px; }
.xq-msg { flex: 1; min-width: 0; margin: 0; font-size: 13.5px; line-height: 1.3; }
.xq-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: #eaf4ff; font-size: 13px; }
.xq-hstrip { display: none; gap: 8px; overflow: hidden; white-space: nowrap; font-size: 12px; color: var(--mocha); }
.xq-hstrip .s0, .xq-hist .s0 { color: #b2232a; } .xq-hstrip .s1, .xq-hist .s1 { color: #222; }
.xq-side { min-height: 0; display: flex; flex-direction: column; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.65); }
.xq-sh { font-size: 13px; }
.xq-hist { flex: 1; min-height: 0; overflow: auto; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; }
.xq-hist li { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 4px; padding: 2px 0; border-bottom: 1px dashed rgba(0,0,0,.06); }
.xq-hist li b { color: var(--muted); font-weight: 600; }
.xq-hist li.muted { display: block; border: 0; }
.xq-lbl { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; font-size: 13px; font-weight: 600; }
.xq-lbl select { min-height: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; font: inherit; background: #fff; }
.xq-rules .xq-howt { border-collapse: collapse; font-size: 13px; }
.xq-rules .xq-howt td { vertical-align: top; padding: 5px 4px; border-top: 1px solid var(--line); }
.xq-rules .xq-howt td:first-child { white-space: nowrap; }
@media (max-width: 760px) {
  .xq-gear-note i { display: none; }
  .xq-main { grid-template-columns: minmax(0, 1fr); }
  .xq-side { display: none; }
  .xq-modal:not(.no-hist) .xq-hstrip { display: flex; }
}
@media (max-width: 560px) {
  .xq-gear-note { font-size: 11px; }
  .xq-ava { width: 30px; height: 30px; }
  .modal-wrap:has(.xq-modal) { padding: 0; }
  .modal.xq-modal { width: 100vw; height: 100dvh; border-radius: 0; border: 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 5px; }
  .modal .xq-top h2 { font-size: 17px; }
  .xq-top { gap: 6px; }
  .xq-top .ld-modes button { padding: 6px 10px; font-size: 12.5px; }
  .xq-modal .modal-x { top: 6px; right: 6px; }
  .xq-pbar { min-height: 36px; }
  .xq-pb-in { padding: 3px 8px; gap: 6px; }
  .xq-mini { width: 16px; height: 16px; font-size: 9.5px; }
  .xq-msg { font-size: 12.5px; }
  .xq-msg .ty-vi { display: none; }
}

/* ---- chart reading questions (WT1): chartHTML in qtypes.js, used by Quiz + every board game */
.qchart { margin: 0 0 10px; padding: 8px 10px 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qchart figcaption { font: 600 12.5px/1.3 var(--font); color: var(--roast); margin-bottom: 4px; }
.qchart svg { display: block; width: 100%; height: auto; max-height: 210px; }
.qchart .qc-grid { stroke: var(--line); stroke-width: 1; }
.qchart .qc-ax { font: 9.5px var(--font); fill: var(--muted); }
.qchart .qc-val { font: 600 9px var(--font); fill: var(--roast); }
.qchart .qc-in { font: 700 10px var(--font); fill: #fff; text-anchor: middle; }
.qc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 11.5px; color: var(--mocha); }
.qc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ld-quiz .qchart { padding: 6px 8px 4px; margin-bottom: 6px; }
.ld-quiz .qchart svg { max-height: 150px; }
/* process diagram (chart.kind 'process'): numbered step cards joined by arrows, wraps on small screens */
.qproc figcaption small { font-weight: 500; color: var(--muted); }
.qp { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; row-gap: 9px; padding-top: 5px; }
.qp-step { position: relative; width: 64px; min-height: 56px; padding: 5px 3px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.qp-step > b { position: absolute; top: -7px; left: -5px; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 9px; background: var(--roast); color: #fff; font: 700 9.5px/17px var(--mono); }
.qp-i { font-size: 21px; line-height: 1.1; }
.qp-t { font: 600 9.5px/1.15 var(--font); color: var(--roast); overflow-wrap: anywhere; }
.qp-ask { border: 2px dashed var(--caramel); background: #fff6d6; }
.qp-ask .qp-i { font-size: 24px; }
.qp-arr { display: flex; flex-direction: column; align-items: center; min-width: 16px; padding: 0 1px; font: 700 13px/1 var(--font); color: var(--mocha); }
.qp-arr small { font: 600 8.5px/1 var(--font); color: var(--caramel); margin-bottom: 1px; }
.qp-more { padding: 0 3px; font-weight: 700; color: var(--muted); }
.qp-step.qp-pic { width: 84px; }
.qp-pic:not(.qp-ask) { background: #fff; }
.qp-pic.qp-ask { align-self: stretch; }
.qp-pic.qp-ask .qp-i { font-size: 28px; }
.qp-img { display: block; width: 76px; height: 58px; object-fit: contain; }
.ld-quiz .qp-step { width: 56px; min-height: 48px; }
.ld-quiz .qp-i { font-size: 18px; }
.ld-quiz .qp-more, .ld-quiz .qp-edge { display: none; }
.ld-quiz .qp-arr { min-width: 13px; }
/* game panels are 240–440px wide: picture cards take a quarter of the row each, so a 4-step window stays on one line */
.ld-quiz .qp-step.qp-pic { width: clamp(44px, calc(25% - 15px), 72px); }
.ld-quiz .qp-img { width: 100%; height: auto; aspect-ratio: 4 / 3; }
@media (max-width: 400px) {
  .ld-quiz .qp-step { width: 50px; min-height: 46px; padding: 4px 2px 3px; }
  .ld-quiz .qp-t { font-size: 8.5px; }
  .ld-quiz .qp-arr { min-width: 11px; font-size: 12px; }
  .ld-quiz .qchart { padding: 6px 4px 4px; }
}

/* ---- Put in order (type 'order'): tapped chips move into the numbered list */
.qo-list { list-style: none; counter-reset: qo; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; min-height: 8px; }
.qo-list li { counter-increment: qo; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 12px; border: 1px dashed transparent; }
.qo-list li::before { content: counter(qo); flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--caramel); color: #fff; font: 700 12.5px var(--mono); }
.qo-list li.right { background: #e8f4ea; border-color: var(--sage); }
.qo-list li.right::before { background: var(--sage); }
.qo-list li.wrong { background: #fbe9e7; border-color: #d9776c; }
.qo-list li.wrong::before { background: #d9776c; }
.qo-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.qo-chip { padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14.5px; font-weight: 600; text-align: left; line-height: 1.3; }
.qo-list .qo-chip { flex: 1; background: transparent; border: 0; padding: 4px 2px; }
.qo-chip:hover:not(:disabled) { background: #fdf6ec; border-color: rgba(201,138,75,.5); }
.qo-chip:disabled { cursor: default; }
.ld-quiz .qo-chip { padding: 6px 9px; font-size: 13px; background: var(--tint); border: 0; }
.ld-quiz .qo-list .qo-chip { background: transparent; }
.ld-quiz .qo-list li::before { width: 20px; height: 20px; font-size: 11px; }


/* ---- Say it (type 'say'): the word + IPA, a mic button */
.say-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 12px; margin-bottom: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.say-word { font: 700 28px var(--font); color: var(--roast); letter-spacing: .3px; text-align: center; }
.say-ipa { font: 500 17px var(--mono); color: var(--caramel); text-align: center; }
.say-word.phrase { font-size: 24px; }
.say-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.say-go.on, .say-rec.on { animation: sayPulse 1.1s ease-in-out infinite; }
@keyframes sayPulse { 50% { box-shadow: 0 0 0 6px rgba(201,138,75,.25); } }
.say-msg { font-size: 13.5px; color: var(--mocha); }
.say-msg i { color: var(--muted); }
.ld-quiz .say-card { padding: 8px; margin-bottom: 6px; }
.ld-quiz .say-word { font-size: 21px; }
.ld-quiz .say-word.phrase { font-size: 18px; }
.ld-quiz .say-ipa { font-size: 14px; }
.ld-quiz .say-msg { font-size: 12.5px; }

/* 🔊 Listening / 🎙️ Speaking ticks before the Quiz and the games (js/qtypes.js soundTicksHTML) */
.q-sound { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; background: #fff6d6; border: 1.5px solid #f0c75e; color: var(--espresso); }
.quiz .q-sound { margin-right: 30px; }
.q-tick { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; cursor: pointer; }
.q-tick input { width: 18px; height: 18px; accent-color: var(--espresso); margin: 0; }
.q-tick i { font-style: normal; font-weight: 600; font-size: 11px; opacity: .7; }
.q-tick.off { opacity: .5; cursor: default; }
.q-sound-msg { flex-basis: 100%; font-size: 12px; font-weight: 600; color: var(--berry, #a33); }
.q-sound-msg:empty { display: none; }
/* phones: the level and question-type rows scroll sideways instead of wrapping (keeps the question on screen) */
@media (max-width: 600px) {
  .quiz-levels, .quiz-types { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .quiz-levels::-webkit-scrollbar, .quiz-types::-webkit-scrollbar { display: none; }
  .quiz-levels button, .quiz-types button { flex: none; white-space: nowrap; }
  .q-sound { padding: 6px 10px; gap: 4px 12px; }
  .q-tick i { display: none; }
}
.quiz-top .streak { white-space: nowrap; flex: none; }

/* ---- Speaking practice: 💡 Hint (ideas + phrases, free) and 📝 Sample answer after answering */
.sp-hintbox { margin: 0 0 10px; }
.sp-hintbtn { background: #fff6d6; border-color: #f0c75e; }
.sp-hintbtn small { font-weight: 500; color: var(--mocha); margin-left: 4px; }
.sp-hintbtn.on { background: #f7e3a6; }
.sp-hint { margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: #fffdf6; border: 1px dashed #f0c75e; }
.sp-hint h4 { margin: 0 0 6px; font-size: 14px; }
.sp-hint h4 .vi { display: block; font-weight: 500; font-size: 12.5px; color: var(--mocha); }
.sp-ideas { margin: 0 0 4px; padding-left: 20px; font-size: 14.5px; line-height: 1.45; }
.sp-ideas li { margin: 3px 0; }
.sp-hint .sp-phrases { margin-top: 8px; }
.sp-sample { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: #eef6ef; border: 1px solid #c9e2cf; }
.sp-sample h4 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.sp-sample h4 .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.sp-sample p { margin: 0; font-size: 15px; line-height: 1.55; }
.sp-sample p.hint { margin-top: 6px; font-size: 12.5px; }
/* short laptop screens (≤ 820px tall): level/type chips on one scrolling line, so the question and answers fit better */
@media (max-height: 820px) {
  .quiz-levels, .quiz-types { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .quiz-levels::-webkit-scrollbar, .quiz-types::-webkit-scrollbar { display: none; }
}
.quiz-levels button, .quiz-types button { flex: none; white-space: nowrap; }

/* ---------- heart-to-heart: 💌 Tâm sự với cô · 💬 Trải lòng với … (js/heart.js) */
.modal.heart { width: min(560px, 100%); }
.heart .hz-text { width: 100%; resize: vertical; min-height: 110px; line-height: 1.5; }
.heart .hz-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.heart .hz-row .hz-send { margin-left: auto; }
.heart .hz-anon { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.heart .hz-list, .hz-inbox { display: flex; flex-direction: column; gap: 10px; max-height: 42vh; overflow-y: auto; }
.hz-inbox { max-height: none; }
.hz-item { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.7); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.hz-item.done { opacity: .75; }
.hz-meta { font-size: 12px; color: var(--muted); }
.hz-msg { white-space: pre-wrap; line-height: 1.5; }
.hz-reply { white-space: pre-wrap; line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: rgba(255,158,203,.14); border-left: 3px solid #ff9ecb; }
.hz-reply b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.hz-reply time { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.hz-item .row { display: flex; gap: 8px; }
.vent .hz-chat { display: flex; flex-direction: column; gap: 8px; min-height: 180px; max-height: 46vh; overflow-y: auto; padding: 12px; border-radius: 16px; background: var(--tint); margin: 12px 0; }
.hz-b { max-width: 82%; padding: 9px 13px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; }
.hz-b.me { align-self: flex-end; background: var(--roast); color: var(--foam); border-bottom-right-radius: 5px; }
.hz-b.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; display: flex; gap: 8px; align-items: flex-start; }
.hz-b.typing { color: var(--muted); }
.hz-ava { flex: none; }
.vent .hz-input { display: flex; gap: 8px; align-items: flex-end; }
.vent .hz-input textarea { flex: 1; resize: none; line-height: 1.45; }

/* util.js winBurst(): end-of-game celebration over the board */
.win-burst { position: fixed; z-index: 10000; width: 0; height: 0; pointer-events: none; }
.win-burst i { position: absolute; left: 0; top: 0; font-size: 22px; font-style: normal; line-height: 1; opacity: 0; }

/* Xiangqi: a captured piece pops and fades under the piece that took it */
.xq-ghost { z-index: 1; animation: xqGone .62s ease-in forwards; }
@keyframes xqGone { 0%, 40% { transform: translate(-50%, -50%); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(1.25) rotate(-8deg); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(.2) rotate(25deg); opacity: 0; } }
.xq-res.fresh { animation: xqResIn .45s cubic-bezier(.3,1.4,.5,1) backwards; }
@keyframes xqResIn { from { transform: scale(.7); opacity: 0; } }

