:root {
  --bg: #0d1124;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-line: rgba(255, 255, 255, 0.09);
  --ink: #f4f1e8;
  --muted: #9aa0bd;
  --gold: #ffcc33;
  --amber: #f2a51a;
  --foam: #fff4d6;
  --good: #5ee0a0;
  --bad: #ff7a6b;
  --green: #9be15d;
  --radius: 14px;
  --bounce: cubic-bezier(0.3, 1.6, 0.5, 1);
  --font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(242, 165, 26, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(61, 90, 254, 0.18), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
#app { position: relative; z-index: 1; flex: 1; display: flex; justify-content: center; padding: 28px 16px 12px; }
section { width: 100%; max-width: 1100px; animation: enter 0.3s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

h1, h2, h3 { margin: 0; line-height: 1.1; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.8rem; font-weight: 600; margin: 0 0 10px; }
.sub, .muted { color: var(--muted); }
.gold { color: var(--gold); font-weight: 700; }

/* ---------------- keys & buttons */
kbd, .kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 0.15em 0.45em;
  margin: 0 0.12em;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 3px;
  background: rgba(255, 255, 255, 0.06);
  font: 600 0.85em/1.3 var(--font);
  text-align: center;
  color: var(--ink);
}
.kbd { cursor: pointer; transition: transform 0.1s, background 0.15s; }
.kbd:hover { background: rgba(255, 204, 51, 0.18); border-color: var(--gold); }
.kbd:active { transform: translateY(2px); border-bottom-width: 1px; }
kbd.wide { min-width: 6em; }
kbd.down { transform: translateY(2px); border-bottom-width: 1px; background: rgba(255, 204, 51, 0.25); border-color: var(--gold); }
.keys { color: var(--muted); margin-top: 28px; font-size: 0.95rem; line-height: 2; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border-radius: 12px; cursor: pointer;
  font: 600 1.05rem var(--font); color: var(--ink); background: var(--panel); border: 1px solid var(--panel-line);
  transition: transform 0.15s var(--bounce), background 0.15s;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.08); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ffbf3a, var(--amber)); color: #1d1304; border-color: transparent; box-shadow: 0 6px 24px rgba(242, 165, 26, 0.3); }
.btn.primary kbd { color: #1d1304; border-color: rgba(0, 0, 0, 0.3); background: rgba(255, 255, 255, 0.25); }
.btn kbd { font-size: 0.75rem; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.back { background: none; border: none; color: var(--muted); font: 600 0.95rem var(--font); cursor: pointer; padding: 4px 0; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.link-btn { background: none; border: none; color: var(--gold); font: inherit; cursor: pointer; padding: 0; text-decoration: underline dotted; text-underline-offset: 3px; }

.flag { width: 32px; height: 24px; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); flex: none; }
.flag.big { width: 48px; height: 36px; border-radius: 6px; }

.foot { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 0.8rem; padding: 10px 16px 14px; }
.foot kbd { font-size: 0.75rem; }

.toast {
  position: fixed; left: 50%; bottom: 48px; transform: translate(-50%, 20px);
  background: #232a4d; border: 1px solid var(--panel-line); padding: 10px 18px; border-radius: 999px;
  opacity: 0; transition: 0.2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- background bubbles */
.bg-bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-bubbles i {
  position: absolute; bottom: -60px; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.5) 0 14%, transparent 17%), rgba(255, 220, 150, 0.04);
  box-shadow: inset 0 0 0 1.5px rgba(255, 230, 180, 0.22);
  animation: bubble-rise 16s linear infinite;
}
.bg-bubbles i:nth-child(1) { left: 6%; animation-duration: 19s; }
.bg-bubbles i:nth-child(2) { left: 14%; width: 10px; height: 10px; animation-delay: -6s; }
.bg-bubbles i:nth-child(3) { left: 27%; width: 26px; height: 26px; animation-duration: 23s; animation-delay: -12s; }
.bg-bubbles i:nth-child(4) { left: 41%; width: 12px; height: 12px; animation-delay: -3s; animation-duration: 14s; }
.bg-bubbles i:nth-child(5) { left: 55%; width: 22px; height: 22px; animation-delay: -9s; animation-duration: 21s; }
.bg-bubbles i:nth-child(6) { left: 66%; width: 9px; height: 9px; animation-delay: -15s; }
.bg-bubbles i:nth-child(7) { left: 74%; width: 30px; height: 30px; animation-delay: -2s; animation-duration: 26s; }
.bg-bubbles i:nth-child(8) { left: 83%; width: 14px; height: 14px; animation-delay: -11s; animation-duration: 17s; }
.bg-bubbles i:nth-child(9) { left: 91%; width: 20px; height: 20px; animation-delay: -7s; animation-duration: 20s; }
.bg-bubbles i:nth-child(10) { left: 48%; width: 8px; height: 8px; animation-delay: -18s; animation-duration: 13s; }
@keyframes bubble-rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(18px, -55vh); }
  100% { transform: translate(-10px, -115vh); opacity: 0; }
}

/* ---------------- home */
.brand { margin-bottom: 30px; }
.brand h1 { font-size: clamp(3rem, 9vw, 6rem); font-weight: 800; letter-spacing: -0.045em; text-transform: uppercase; }
.brand h1 span { display: inline-block; animation: title-float 4.5s ease-in-out infinite; }
.brand h1 .w2 { color: var(--amber); margin-left: 0.14em; animation-delay: -2.2s; }
@keyframes title-float { 50% { transform: translateY(-6px) rotate(-1.2deg); } }
.brand .tag { font-size: 1.15rem; color: var(--muted); margin: 8px 0 0; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.side { display: grid; gap: 14px; }
.side .link-btn { justify-self: start; }
.mini-board { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 16px 18px; }
.mini-board ol { list-style: none; margin: 0; padding: 0; counter-reset: n; display: grid; gap: 8px; }
.mini-board li { display: flex; align-items: center; gap: 10px; counter-increment: n; }
.mini-board li::before { content: counter(n); width: 1.2em; color: var(--muted); font-weight: 600; }
.mini-board li span { flex: 1; }
.mini-board li b { color: var(--gold); }
.mini-board p { margin: 0; }

.search { margin: 0 0 14px; display: flex; align-items: center; gap: 10px; font-size: 1.3rem; min-height: 1.6em; }
.search-label { color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.12em; }
.query { font-weight: 600; }
.caret { width: 2px; height: 1.2em; background: var(--gold); animation: blink-caret 1s steps(1) infinite; }
@keyframes blink-caret { 50% { opacity: 0; } }
.country-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px;
  max-height: 52vh; overflow-y: auto; padding: 4px; scrollbar-width: thin;
}
.country {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; width: 100%;
  background: var(--panel); border: 1px solid transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: transform 0.15s var(--bounce), background 0.15s;
}
.country:hover { border-color: rgba(255, 255, 255, 0.2); }
.country.sel { border-color: var(--amber); background: rgba(242, 165, 26, 0.16); box-shadow: 0 0 0 3px rgba(242, 165, 26, 0.18); transform: translateY(-2px); }
.country.sel .flag { animation: wave 0.5s ease-out; }
@keyframes wave { 30% { transform: rotate(-10deg) scale(1.15); } 60% { transform: rotate(6deg); } }

/* ---------------- name */
.setup.narrow { max-width: 640px; }
.name-screen { text-align: center; }
.name-screen .back { display: block; }
.name-screen h2 { justify-content: center; }
.name-screen .actions { justify-content: center; }
.name-hero { width: 170px; margin: 0 auto 6px; }
.name-input {
  margin-top: 22px; width: 100%; font: 600 1.8rem var(--font); color: var(--ink); background: var(--panel); text-align: center;
  border: 2px solid var(--panel-line); border-radius: var(--radius); padding: 14px 18px; outline: none;
}
.name-input:focus { border-color: var(--amber); }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }

/* ---------------- lobby */
.lobby h2 b { color: var(--gold); font-variant-numeric: tabular-nums; display: inline-block; animation: pop 0.5s var(--bounce); }
.dots i { font-style: normal; animation: dot 1.4s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }
.code-badge { margin-top: 18px; display: inline-flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 12px 20px; border-radius: var(--radius); background: var(--panel); border: 1px dashed var(--gold); color: var(--muted); }
.code-badge strong { font-size: 2rem; letter-spacing: 0.3em; color: var(--ink); }
.lobby-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.waiting { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 20px 16px; text-align: center; }
.duo { display: flex; align-items: flex-end; justify-content: center; }
.duo .buddy { width: 160px; }
.duo .stein { width: 110px; margin-left: -18px; }
.drink-pick { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.drink-pick .kbd { font-size: 1.2rem; }
#drink-name { min-width: 8em; }
#drink-name b { display: block; font-size: 1.1rem; }
#drink-name small { color: var(--muted); }
.howto-steps { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.howto-steps li { display: grid; grid-template-columns: 2em 8.5em minmax(0, 1fr); align-items: baseline; gap: 8px; counter-increment: s; padding: 12px 14px; border-radius: 12px; background: var(--panel); }
.howto-steps li::before { content: counter(s); font-weight: 800; color: var(--gold); }
.howto-steps b { font-size: 1.05rem; }
.howto-steps span { color: var(--muted); }
.howto-steps em { color: var(--green); font-style: normal; font-weight: 700; }
.roster { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.roster li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--panel); animation: pop-in 0.45s var(--bounce); }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }
.roster li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster li.me { border: 1px solid var(--amber); }
.roster li em { font-style: normal; font-size: 0.75rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; }
.roster li.more { color: var(--muted); justify-content: center; }

/* ---------------- buddy (character) */
.buddy { width: 100%; display: block; overflow: visible; }
.buddy .skin, .buddy .tuft { fill: #fff3dc; stroke: rgba(29, 27, 46, 0.25); stroke-width: 3; }
.buddy .sick { fill: #a5dc5a; opacity: var(--sick, 0); transition: opacity 0.3s; }
.buddy .outline { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 4; }
.buddy .cheek { fill: #ff8fa3; opacity: 0.6; transition: fill 0.3s; }
.buddy.queasy .cheek, .buddy.vomiting .cheek { fill: #6fbf3a; }
.buddy .eyes ellipse { fill: #1d1b2e; }
.buddy .glint { fill: #fff; }
.buddy .eyes path, .buddy .mouth { fill: none; stroke: #1d1b2e; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.buddy .mouth.sip, .buddy .mouth.open { fill: #5a2230; }
.buddy .eyes, .buddy .mouth { display: none; }
.buddy .eyes.open, .buddy .mouth.smile { display: inline; }
.buddy.happy .eyes.open { display: none; }
.buddy.happy .eyes.happy { display: inline; }
.buddy.queasy .mouth.smile { display: none; }
.buddy.queasy .mouth.queasy { display: inline; }
.buddy.sipping .mouth { display: none; }
.buddy.sipping .mouth.sip { display: inline; }
.buddy.vomiting .mouth, .buddy.dizzy .mouth { display: none; }
.buddy.vomiting .mouth.open, .buddy.dizzy .mouth.queasy { display: inline; }
.buddy.dizzy .eyes, .buddy.vomiting .eyes { display: none; }
.buddy.dizzy .eyes.dizzy, .buddy.vomiting .eyes.happy { display: inline; }
.buddy .eyes.open { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }

.buddy .buddy-all { transform-box: view-box; transform-origin: 100px 272px; animation: bob 2.8s ease-in-out infinite; }
.buddy.happy .buddy-all, .buddy.hop .buddy-all { animation: hop 0.5s ease-out; }
@keyframes bob { 50% { transform: translateY(-5px) scaleY(1.01); } }
@keyframes hop { 30% { transform: translateY(-24px) scaleY(1.05); } 60% { transform: translateY(0) scaleY(0.93); } 80% { transform: scaleY(1.02); } }
.buddy .buddy-head { transform-box: view-box; transform-origin: 100px 152px; transition: transform 0.15s; }
.buddy.sipping .buddy-head { transform: rotate(5deg) translateY(-3px); }
.buddy.queasy .buddy-head { animation: sway 1.1s ease-in-out infinite; }
.buddy.dizzy .buddy-head { animation: sway 1.7s ease-in-out infinite; }
.buddy.vomiting .buddy-head { transform: rotate(-16deg) translate(-6px, 6px) scale(1.04); }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.buddy .sweat { fill: #8fd3ff; opacity: 0; }
.buddy.oops .sweat { animation: sweat 0.7s ease-in; }
@keyframes sweat { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(16px); } }
.buddy .stars { opacity: 0; transform-box: view-box; transform-origin: 100px 34px; }
.buddy .stars polygon { fill: var(--gold); }
.buddy.dizzy .stars { opacity: 1; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.buddy .bucket { opacity: 0; transform-box: view-box; transform-origin: -18px 270px; transform: translateY(30px) scale(0.5); transition: 0.3s var(--bounce); }
.buddy.vomiting .bucket, .buddy.dizzy .bucket { opacity: 1; transform: none; }
.buddy .bucket-body { fill: #7f8ab0; }
.buddy .bucket-rim { fill: #b9c1dc; }
.buddy .bucket-handle { fill: none; stroke: #b9c1dc; stroke-width: 4; }
.buddy .puke { fill: none; stroke: var(--green); stroke-width: 15; stroke-linecap: round; stroke-dasharray: 280; stroke-dashoffset: 280; opacity: 0; }
.buddy.vomiting .puke { animation: puke 0.95s ease-out; }
@keyframes puke { 0% { opacity: 1; stroke-dashoffset: 280; } 30% { stroke-dashoffset: 0; } 70% { opacity: 1; stroke-dashoffset: 0; } 100% { opacity: 1; stroke-dashoffset: -280; } }
.buddy .splash circle { fill: var(--green); opacity: 0; }
.buddy.vomiting .splash circle { animation: splash 0.35s 0.28s ease-out 2; }
.buddy.vomiting .splash circle:nth-child(2) { animation-delay: 0.36s; }
@keyframes splash { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } }

/* ---------------- game */
.game { position: relative; }
.leave { position: absolute; top: -24px; right: 4px; background: none; border: none; color: var(--muted); font: 0.85rem var(--font); cursor: pointer; }
.leave:hover { color: var(--ink); }
.hud { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 12px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-line); }
.hud-timer { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; min-width: 3.4em; }
.hud-timer.urgent { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.hud-me { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 600; min-width: 0; }
.hud-me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-stats { display: flex; gap: 26px; }
.hud-stats div { text-align: center; }
.hud-stats b { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.hud-stats small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; }

.arena { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; margin-top: 18px; }
.bar {
  position: relative; border-radius: var(--radius); padding: 16px 20px 20px; min-height: 500px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 70%), var(--panel);
  border: 1px solid var(--panel-line); display: flex; flex-direction: column; align-items: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.scene { position: relative; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4%; z-index: 1; }
.scene.quake { animation: quake 0.5s; }
@keyframes quake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.buddy-wrap { width: min(230px, 38%); }
.mug-wrap { position: relative; width: min(270px, 46%); }
.mug-wrap.wobble { animation: wobble 0.45s; }
.mug-wrap.raise { animation: raise 0.65s ease-out; }
@keyframes wobble { 25% { transform: rotate(-5deg); } 60% { transform: rotate(4deg); } }
@keyframes raise { 35% { transform: translateY(-30px) rotate(-10deg) scale(1.04); } 70% { transform: translateY(2px) rotate(2deg); } }
.counter { width: calc(100% + 40px); height: 16px; margin-top: -6px; background: linear-gradient(#6b4528, #3b2414); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); }


.stein { width: 100%; display: block; overflow: visible; }
.stein .glass { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 5; stroke-linejoin: round; }
.stein .glass-tint { fill: rgba(255, 255, 255, 0.05); }
.stein .handle { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 14; stroke-linecap: round; }
.stein .shine { fill: rgba(255, 255, 255, 0.16); }
.stein .foam-body, .stein .foam-top circle { fill: var(--foam); }
.stein .foam-top { transform-box: fill-box; transform-origin: bottom; }
.stein .bubbles circle { fill: rgba(255, 255, 255, 0.55); animation: rise 2.4s linear infinite; }
.stein .bubbles circle:nth-child(2) { animation-delay: -0.8s; animation-duration: 2s; }
.stein .bubbles circle:nth-child(3) { animation-delay: -1.6s; }
.stein .bubbles circle:nth-child(4) { animation-delay: -0.4s; animation-duration: 2.8s; }
.stein .bubbles circle:nth-child(5) { animation-delay: -1.2s; }
@keyframes rise { from { transform: translateY(0); opacity: 0.9; } to { transform: translateY(-150px); opacity: 0; } }
.stein .zone { fill: rgba(255, 204, 51, 0.28); }
.stein .zone-line { fill: var(--gold); }
.stein .track { fill: rgba(255, 255, 255, 0.12); }
.stein .needle { fill: var(--ink); transition: opacity 0.2s; }
.stein .fill-mark { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.stein .zero-label { fill: rgba(255, 255, 255, 0.85); font: 800 22px var(--font); }
.stein .chrome { fill: #c9cfe4; }
.stein .tap-handle { fill: var(--amber); transform-box: view-box; transform-origin: 100px -46px; transition: transform 0.15s var(--bounce); }
.stein.pouring .tap-handle { transform: rotate(-30deg); }
.stein .overflow path { fill: var(--foam); opacity: 0; transition: opacity 0.15s; }
.stein.overflowing .overflow path, .stein.spilled .overflow path { opacity: 1; }
.stein.spilled .overflow path { animation: drip 0.9s forwards; }
@keyframes drip { to { opacity: 0; transform: translateY(30px); } }
.stein .puddle { fill: var(--foam); opacity: 0; transform-box: fill-box; transform-origin: center; }
.stein.spilled .puddle { animation: puddle 1.3s ease-out; }
@keyframes puddle { 0% { opacity: 0; transform: scaleX(0.3); } 25% { opacity: 0.8; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1.1); } }
.stein .sparkles path { fill: var(--gold); opacity: 0; transform-box: fill-box; transform-origin: center; }
.stein.sparkle .sparkles path { animation: twinkle 0.9s ease-out; }
.stein.sparkle .sparkles path:nth-child(2) { animation-delay: 0.08s; }
.stein.sparkle .sparkles path:nth-child(3) { animation-delay: 0.16s; }
.stein.sparkle .sparkles path:nth-child(4) { animation-delay: 0.05s; }
.stein.sparkle .sparkles path:nth-child(5) { animation-delay: 0.2s; }
@keyframes twinkle { 0% { opacity: 0; transform: scale(0) rotate(0); } 35% { opacity: 1; transform: scale(1.25) rotate(45deg); } 100% { opacity: 0; transform: scale(0.4) rotate(90deg); } }
.stein.swap { animation: swap 0.45s var(--bounce); }
@keyframes swap { 40% { transform: rotate(-8deg) scale(0.94); } }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.confetto {
  position: absolute; left: 50%; top: 18%; width: 8px; height: 12px; border-radius: 2px; background: var(--c);
  animation: confetti 1.3s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  40% { transform: translate(calc(var(--x) * 0.7), var(--y)) rotate(calc(var(--r) * 0.5)); opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 260px)) rotate(var(--r)); opacity: 0; }
}

.prompt { min-height: 74px; display: flex; align-items: center; justify-content: center; z-index: 1; text-align: center; margin-top: 14px; }
.howto { font-size: 1.2rem; margin: 0; line-height: 1.9; }
.howto.bad { color: var(--bad); }
.seq { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.seq.locked { opacity: 0.4; filter: grayscale(1); }
.arrow {
  width: 54px; height: 54px; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.15); transition: 0.12s var(--bounce);
}
.arrow.next { border-color: var(--gold); background: rgba(255, 204, 51, 0.18); transform: scale(1.14); animation: nudge 0.9s ease-in-out infinite; }
.arrow.hit { opacity: 0.28; transform: scale(0.85); }
@keyframes nudge { 50% { transform: scale(1.14) translateY(-3px); } }

.dpad { display: none; gap: 10px; margin-top: 14px; z-index: 1; }
.game.pointer .dpad { display: flex; }
.game:not(.drinking) .dpad { opacity: 0.3; pointer-events: none; }
.dpad button {
  width: 68px; height: 68px; font-size: 1.9rem; font-weight: 800; border-radius: 16px; cursor: pointer; touch-action: none;
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.18); border-bottom-width: 5px; color: var(--ink);
}
.dpad button.hit { animation: press 0.16s; }
@keyframes press { 50% { transform: translateY(3px) scale(0.94); background: rgba(255, 204, 51, 0.25); } }

.floaters { position: absolute; inset: 0; pointer-events: none; }
.floater {
  position: absolute; left: 50%; top: 10%; transform: translateX(-50%); white-space: nowrap;
  padding: 2px 14px; border-radius: 999px; background: rgba(13, 17, 36, 0.7);
  font-size: 1.5rem; font-weight: 800; animation: float 1.4s ease-out forwards; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.floater.good { color: var(--good); }
.floater.bad { color: var(--bad); }
.floater.meh { color: var(--muted); }
.floater.cheers { color: var(--gold); font-size: 2.2rem; }
.floater.sick { color: var(--green); font-size: 2.8rem; left: 30%; animation: float-sick 1.1s ease-out forwards; }
@keyframes float { from { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 25% { transform: translate(-50%, 0) scale(1); } to { opacity: 0; transform: translate(-50%, -70px); } }
@keyframes float-sick { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.5) rotate(-8deg); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15) rotate(6deg); } 40% { transform: translate(-50%, 0) scale(1) rotate(-4deg); } 100% { opacity: 0; transform: translate(-50%, -50px) rotate(3deg); } }

.table { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 18px; }
.table ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.table li { display: grid; grid-template-columns: 1.3em 32px minmax(0, 1fr) 1.4em 22px 2.2em; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.table li.me { background: rgba(242, 165, 26, 0.14); outline: 1px solid rgba(242, 165, 26, 0.6); }
.table li.bump { animation: bump 0.55s var(--bounce); }
.table li.sick { background: rgba(155, 225, 93, 0.14); }
@keyframes bump { 30% { transform: scale(1.05); background: rgba(255, 204, 51, 0.22); } }
.table .pos { color: var(--muted); font-weight: 600; }
.table .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-icon { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; }
.table .mood { display: grid; place-items: center; }
.table li.sick .face-icon { animation: sway 0.8s ease-in-out infinite; }
.blegh-count { color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.star { color: var(--gold); }
.table b { text-align: right; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.mini {
  height: 30px; border: 2px solid rgba(255, 255, 255, 0.6); border-top: none; border-radius: 0 0 5px 5px; position: relative; overflow: hidden;
  background: linear-gradient(to top, var(--bot), var(--top)) no-repeat bottom / 100% var(--lvl);
}
.mini::after { content: ''; position: absolute; left: 0; right: 0; bottom: var(--lvl); height: 4px; background: var(--foam); opacity: 0.9; }

.overlay { position: absolute; inset: 0; display: none; place-items: center; background: rgba(13, 17, 36, 0.72); border-radius: var(--radius); z-index: 5; backdrop-filter: blur(3px); }
.overlay.show { display: grid; }
.overlay .big { font-size: clamp(5rem, 16vw, 11rem); font-weight: 800; animation: count-pop 0.6s var(--bounce); text-align: center; }
.overlay .big.go { color: var(--gold); }
.overlay .msg { font-size: 1.4rem; text-align: center; line-height: 2.2; }
@keyframes count-pop { from { transform: scale(2) rotate(-8deg); opacity: 0; } }
@keyframes pop { from { transform: scale(1.6); opacity: 0; } }

/* ---------------- results */
.results { position: relative; max-width: 860px; }
.results .confetti { top: 40px; }
.cheers-big { font-size: clamp(3rem, 10vw, 6rem); font-weight: 800; color: var(--gold); letter-spacing: -0.03em; display: inline-block; animation: cheers-in 0.8s var(--bounce), title-float 4s 0.8s ease-in-out infinite; }
@keyframes cheers-in { from { transform: scale(0.3) rotate(-12deg); opacity: 0; } }
.results h2 { margin: 6px 0 24px; }
.standings { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 1.1rem; }
.standings th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 0 14px; }
.standings tbody tr { animation: row-in 0.45s var(--bounce) both; animation-delay: calc(var(--i) * 90ms + 150ms); }
@keyframes row-in { from { opacity: 0; transform: translateX(-24px); } }
.standings td { padding: 12px 14px; background: var(--panel); }
.standings td:first-child { border-radius: 10px 0 0 10px; font-weight: 800; width: 3em; }
.standings td:last-child { border-radius: 0 10px 10px 0; }
.standings .pl { display: flex; align-items: center; gap: 12px; }
.standings tr.first td { background: rgba(255, 204, 51, 0.14); }
.standings tr.me td { box-shadow: inset 0 1px 0 var(--amber), inset 0 -1px 0 var(--amber); }

/* ---------------- leaderboard */
.board-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.board-grid > div { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 18px; }
.board-grid ol { list-style: none; margin: 0; padding: 0; counter-reset: n; display: grid; gap: 8px; }
.board-grid li { display: grid; grid-template-columns: 1.6em 32px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; counter-increment: n; animation: enter 0.4s ease-out both; }
.board-grid .nations li { grid-template-columns: 1.6em 32px minmax(0, 9em) minmax(40px, 1fr) 3em 4.5em; }
.board-grid li::before { content: counter(n); color: var(--muted); font-weight: 600; }
.board-grid li.muted::before { content: none; }
.board-grid .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-grid b { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
.board-grid small { color: var(--muted); text-align: right; }
.barline { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.barline i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--gold)); border-radius: 4px; animation: grow 0.8s ease-out; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }

/* ---------------- battle pass cosmetics */
.hat-miner .beam { animation: flicker 3s ease-in-out infinite; }
.buddy .hat-miner .lamp { filter: drop-shadow(0 0 6px #fff4d6); }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.75; } 50% { opacity: 0.35; } 53% { opacity: 0.85; } }
.buddy .hat .prop { transform-box: fill-box; transform-origin: center; animation: prop 0.22s linear infinite; }
@keyframes prop { 50% { transform: scaleX(-1); } }
.buddy .hat .glint { transform-box: fill-box; transform-origin: center; animation: twinkle 2.4s ease-in-out infinite; }
.buddy.happy .hat-party, .buddy.hop .hat-party { animation: hat-bounce 0.5s ease-out; transform-box: view-box; transform-origin: 100px 40px; }
@keyframes hat-bounce { 30% { transform: translateY(-14px) rotate(8deg); } }

.stein.skin-terminal .glass, .stein.skin-terminal .handle, .mini-stein.skin-terminal .glass, .mini-stein.skin-terminal .handle { stroke: #3cff7a; }
.stein.skin-terminal { filter: drop-shadow(0 0 8px rgba(60, 255, 122, 0.35)); }
.stein.skin-terminal .glass-tint { fill: rgba(60, 255, 122, 0.06); }
.stein.skin-coal .glass, .stein.skin-coal .handle, .mini-stein.skin-coal .glass, .mini-stein.skin-coal .handle { stroke: #8a8fa6; }
.stein.skin-coal .glass-tint { fill: rgba(0, 0, 0, 0.45); }
.stein.skin-coal .shine { fill: rgba(255, 255, 255, 0.06); }
.stein.skin-gold .glass, .stein.skin-gold .handle, .mini-stein.skin-gold .glass, .mini-stein.skin-gold .handle { stroke: var(--gold); }
.stein.skin-gold { filter: drop-shadow(0 0 10px rgba(255, 204, 51, 0.35)); }
.stein.skin-gold .glass-tint { fill: rgba(255, 204, 51, 0.08); }
.stein.skin-glitch .glass, .stein.skin-glitch .handle, .mini-stein.skin-glitch .glass, .mini-stein.skin-glitch .handle { stroke: #b7c4ff; }
.stein.skin-glitch, .mini-stein.skin-glitch { animation: glitch 2.6s steps(1) infinite; }
@keyframes glitch {
  0%, 100% { filter: drop-shadow(-2px 0 rgba(255, 46, 136, 0.7)) drop-shadow(2px 0 rgba(41, 231, 255, 0.7)); transform: none; }
  91% { filter: drop-shadow(-5px 0 rgba(255, 46, 136, 0.9)) drop-shadow(5px 0 rgba(41, 231, 255, 0.9)); transform: translateX(3px) skewX(-4deg); }
  94% { transform: translateX(-4px); }
  97% { transform: none; }
}

.title-tag { display: block; font-size: 0.68rem; font-weight: 600; color: var(--gold); letter-spacing: 0.04em; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.85em; color: var(--green); }

.tip { margin: 0 0 22px; padding: 12px 16px; border-left: 3px solid var(--gold); background: rgba(255, 204, 51, 0.06); border-radius: 0 10px 10px 0; color: var(--muted); }
.tip b { color: var(--gold); margin-right: 4px; }
.fade-in { animation: enter 0.4s ease-out; display: inline-block; }

.floater.sick-sub { top: 24%; left: 30%; font-size: 1rem; color: var(--green); font-family: ui-monospace, Menlo, Consolas, monospace; }
.floater.combo { top: 24%; color: #7aa2ff; font-size: 1.6rem; }
.overlay .big small { display: block; font-size: 0.16em; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 4px; }

/* home: pass card */
.pass-mini {
  display: grid; gap: 6px; text-align: left; padding: 16px 18px; border-radius: var(--radius); cursor: pointer; color: var(--ink); font: inherit;
  background: linear-gradient(135deg, rgba(255, 204, 51, 0.16), rgba(61, 90, 254, 0.12)); border: 1px solid rgba(255, 204, 51, 0.4);
  transition: transform 0.15s var(--bounce);
}
.pass-mini:hover { transform: translateY(-2px); }
.pass-mini .pm-top { display: flex; justify-content: space-between; align-items: center; }
.pass-mini .eyebrow { margin: 0; }
.pass-mini b { font-size: 1.4rem; }
.pass-mini b small, .pass-mini > small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.xpbar { display: block; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.xpbar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--amber), var(--gold)); transition: width 1s cubic-bezier(0.3, 1, 0.4, 1); }

/* hub */
.tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.tab { white-space: nowrap; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--panel-line); background: var(--panel); color: var(--muted); font: 600 1rem var(--font); cursor: pointer; }
.tab.on { background: var(--gold); color: #1d1304; border-color: transparent; }
.tab-hint { color: var(--muted); font-size: 0.85rem; margin-left: 8px; }
.pass-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.pass-head .sub { margin: 6px 0 0; }
.pass-level { min-width: 280px; display: grid; gap: 6px; }
.pass-level .lvl b { font-size: 2rem; }
.pass-level .lvl small, .pass-level > small { color: var(--muted); }
.pass-main { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; margin-top: 22px; align-items: center; }
.pass-preview { background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 30px 12px 18px; min-height: 230px; }
.pass-preview .buddy { width: 170px; }
.pass-preview .stein { width: 105px; }
.pass-card { padding: 8px 4px; }
.reward-name { font-size: 2rem; text-transform: none; letter-spacing: -0.02em; color: var(--ink); font-weight: 800; margin: 0 0 8px; }
.reward-desc { color: var(--muted); font-size: 1.1rem; margin: 0 0 16px; }
.title-preview { font-size: 1.3rem; font-weight: 700; margin: 0 0 16px; }
.title-preview .title-tag { font-size: 0.85rem; }
.reward-status { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.reward-status .good { color: var(--good); font-weight: 700; }
.locked-msg { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.lock { width: 16px; height: 16px; flex: none; }
.track { display: flex; gap: 8px; overflow-x: auto; padding: 10px 4px 12px; margin-top: 22px; scrollbar-width: thin; }
.tier-cell {
  position: relative; flex: none; width: 76px; height: 92px; border-radius: 12px; cursor: pointer; padding: 22px 6px 6px;
  display: grid; place-items: center; background: var(--panel); border: 2px solid var(--panel-line); color: var(--muted); font: inherit;
  transition: transform 0.15s var(--bounce);
}
.tier-cell .tn { position: absolute; top: 5px; left: 8px; font-size: 0.75rem; font-weight: 700; }
.tier-cell .lock { position: absolute; top: 6px; right: 6px; width: 13px; height: 13px; }
.tier-cell:not(.got) .ricon { opacity: 0.35; filter: grayscale(0.8); }
.tier-cell.got { border-color: rgba(255, 204, 51, 0.35); color: var(--gold); }
.tier-cell.sel { border-color: var(--gold); transform: translateY(-4px); box-shadow: 0 6px 20px rgba(255, 204, 51, 0.2); }
.tier-cell.eq::after { content: 'ON'; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--good); color: #0d1124; }
.ricon { width: 46px; height: 46px; overflow: visible; }
.ticon { display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; border-radius: 10px; border: 2px dashed currentColor; }
.mini-stein .glass, .mini-stein .handle { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 3; }
.equipped-line { margin: 14px 0 4px; color: var(--muted); }
.equipped-line b { color: var(--gold); }
.fine { font-size: 0.85rem; }

/* results: xp */
.xp-panel { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 18px; margin: 0 0 18px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(255, 204, 51, 0.12), rgba(61, 90, 254, 0.1)); border: 1px solid rgba(255, 204, 51, 0.35); animation: enter 0.5s 0.3s ease-out both; }
.xp-gain { font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.xp-track { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.xp-track small { color: var(--muted); }
.unlocks { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.unlock { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); animation: pop-in 0.5s 1s var(--bounce) both; }
.unlock .ricon { width: 32px; height: 32px; }
.unlocks small { color: var(--muted); }
.standings .pl > span { min-width: 0; }

@media (max-width: 860px) {
  #app { padding-top: 20px; }
  .home-grid, .arena, .board-grid, .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .country-grid { max-height: 46vh; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hud { grid-template-columns: auto 1fr; gap: 12px; padding: 10px 14px; }
  .hud-timer { font-size: 2rem; }
  .hud-stats { grid-column: 1 / -1; justify-content: space-around; }
  .bar { min-height: 0; padding: 12px 12px 16px; }
  .counter { width: calc(100% + 24px); }
  .howto { font-size: 1rem; }
  .arrow { width: 42px; height: 42px; font-size: 1.4rem; }
  .dpad button { width: 64px; height: 64px; }
  .howto-steps li { grid-template-columns: 1.6em minmax(0, 1fr); }
  .howto-steps li span { grid-column: 2; }
  .standings .opt { display: none; }
  .pass-main { grid-template-columns: minmax(0, 1fr); }
  .tab-hint { display: none; }
  .pass-level { min-width: 0; width: 100%; }
  .board-grid .nations li { grid-template-columns: 1.6em 32px minmax(0, 1fr) 3em 4.5em; }
  .board-grid .nations .barline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .bg-bubbles { display: none; }
}
