:root {
  --bg: #0d1030;
  --bg-2: #161a48;
  --surface: rgba(255, 255, 255, 0.065);
  --surface-2: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f6ff;
  --muted: #a3a9d6;
  --faint: #6c72a6;
  --red: #ef4655;
  --red-d: #b81f30;
  --green: #1fbf6f;
  --green-d: #0d8048;
  --yellow: #f7b731;
  --yellow-d: #c27d06;
  --blue: #3b82f6;
  --blue-d: #1d4fbf;
  --purple: #8b5cf6;
  --purple-d: #5b2fc2;
  --orange: #fb8a2e;
  --orange-d: #c2560a;
  --accent-1: #ffd451;
  --accent-2: #ff8a3d;
  --danger: #ff5a6a;
  --radius: 20px;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fredoka', 'Outfit', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(120% 80% at 50% 0%, #232a75 0%, var(--bg-2) 40%, var(--bg) 100%) fixed;
  background-color: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- soft colored orbs in the background ---------- */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
/* a radial gradient instead of filter: blur() — the blur was re-rendered every frame (and under
   every backdrop-filter card), which made animations stutter on mid-range phones */
.bg-orbs i { --c: #fff; position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; background: radial-gradient(circle, var(--c) 0%, transparent 68%); opacity: 0.2; animation: orb 24s ease-in-out infinite alternate; will-change: transform; }
.bg-orbs i:nth-child(1) { --c: var(--red); top: -18vmax; left: -14vmax; }
.bg-orbs i:nth-child(2) { --c: var(--green); top: -18vmax; right: -16vmax; animation-delay: -6s; }
.bg-orbs i:nth-child(3) { --c: var(--blue); bottom: -20vmax; left: -16vmax; animation-delay: -12s; }
.bg-orbs i:nth-child(4) { --c: var(--yellow); bottom: -20vmax; right: -14vmax; animation-delay: -18s; }
/* in a game the cards are the show: keep the background still so the GPU goes to them */
body[data-screen="Game"] .bg-orbs i { animation-play-state: paused; }
@keyframes orb { to { transform: translate(6vmax, 4vmax) scale(1.12); } }

.screen { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; animation: screenIn 0.45s var(--ease-out); }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.045));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 700; font-size: 16px; letter-spacing: 0.01em;
  transition: transform 0.15s var(--spring), filter 0.2s, opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-big { height: 56px; font-size: 17px; width: 100%; border-radius: 16px; }
.btn-small { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-primary {
  color: #2b1500;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 10px 26px -10px rgba(255, 138, 61, 0.8), inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -3px 0 rgba(0,0,0,0.12);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: linear-gradient(135deg, #5b6cff, #8a4dff); box-shadow: 0 10px 24px -12px #6b5bff, inset 0 1px 0 rgba(255,255,255,0.3); color: #fff; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: linear-gradient(135deg, #ff6b7a, #e5304a); color: #fff; }
.btn-quiet-danger { width: 100%; height: 46px; margin-top: 10px; background: transparent; color: #ff9aa5; font-size: 15px; font-weight: 600; }
.btn-quiet-danger:hover { background: rgba(255, 90, 106, 0.1); }
.btn-quiet-danger .ico { width: 18px; height: 18px; }
.exit-btn { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px 0 10px; border-radius: 13px; font-size: 14px; font-weight: 700; color: #ff9aa5; background: rgba(255, 90, 106, 0.1); border: 1px solid rgba(255, 90, 106, 0.3); transition: transform 0.15s var(--spring), background 0.2s; }
.exit-btn:hover { background: rgba(255, 90, 106, 0.18); }
.exit-btn:active { transform: scale(0.94); }
.exit-btn .ico { width: 18px; height: 18px; }
.sound-pill { position: fixed; z-index: 45; left: 50%; top: calc(62px + var(--safe-top)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 12px; border-radius: 999px; font-size: 14px; font-weight: 700; color: #2b1500; background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); box-shadow: 0 10px 26px -8px rgba(255, 138, 61, 0.8); animation: pillIn 0.4s var(--spring), pillNudge 2.4s ease-in-out 1s infinite; white-space: nowrap; }
.sound-pill .ico { width: 18px; height: 18px; }
@keyframes pillIn { from { opacity: 0; transform: translate(-50%, -10px) scale(0.9); } }
@keyframes pillNudge { 0%, 85%, 100% { transform: translateX(-50%); } 90% { transform: translateX(-50%) scale(1.06); } 95% { transform: translateX(-50%) scale(0.98); } }
.link-btn { color: var(--muted); font-size: 15px; font-weight: 600; padding: 10px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255,255,255,0.2); }

.icon-btn { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); transition: transform 0.15s var(--spring), background 0.2s; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.off { color: var(--faint); }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px 4px; letter-spacing: 0.02em; }
.field input, .code-input {
  width: 100%; height: 52px; border-radius: 14px; padding: 0 16px;
  font: 600 17px var(--font); color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 1.5px solid var(--line); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus, .code-input:focus { border-color: #8f8cff; box-shadow: 0 0 0 4px rgba(143, 140, 255, 0.2); background: rgba(0,0,0,0.32); }
.field input::placeholder, .code-input::placeholder { color: var(--faint); }
.code-input { font-family: var(--display); font-size: 22px; letter-spacing: 0.32em; text-transform: uppercase; text-align: center; padding: 0 8px 0 16px; }
.code-input::placeholder { letter-spacing: 0.2em; font-size: 18px; }
.form-msg { min-height: 20px; margin: 12px 0 0; font-size: 14px; text-align: center; color: var(--danger); font-weight: 500; }
.form-msg.ok { color: var(--muted); }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- home ---------- */
.home-wrap { width: 100%; max-width: 420px; margin: 0 auto; padding: calc(28px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; flex: 1; justify-content: center; }
.brand { font-family: var(--display); font-weight: 700; font-size: 52px; margin: 8px 0 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; text-shadow: 0 6px 24px rgba(0,0,0,0.35); }
.brand span { font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); color: #2b1500; transform: translateY(-4px); text-shadow: none; }
.tagline { color: var(--muted); margin: 6px 0 26px; font-size: 16px; text-align: center; }
.home-card { width: 100%; padding: 22px 18px 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; font-weight: 600; margin: 20px 0 14px; text-transform: uppercase; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 10px; }
.join-row .code-input { flex: 1; min-width: 0; }
.join-row .btn { height: 52px; padding: 0 22px; }
/* invite mode (opened from a ?code= link) */
.invite { text-align: center; padding: 16px 14px 14px; margin-bottom: 18px; border-radius: 18px; background: linear-gradient(135deg, rgba(91, 108, 255, 0.24), rgba(138, 77, 255, 0.12)); border: 1px solid rgba(143, 140, 255, 0.42); animation: screenIn 0.4s var(--ease-out); }
.invite-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #c3c1ff; }
.invite-code { font-family: var(--display); font-size: 36px; font-weight: 700; letter-spacing: 0.22em; padding-left: 0.22em; margin: 2px 0 12px; background: linear-gradient(135deg, #fff, #c8ccff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.invite-seats { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; min-height: 44px; }
.invite-seats .avatar { width: 40px; height: 40px; font-size: 17px; animation: pop 0.4s var(--spring) both; }
.mini-open { --pc: var(--red); width: 40px; height: 40px; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--pc) 60%, transparent); display: grid; place-items: center; color: color-mix(in srgb, var(--pc) 75%, white); font-size: 18px; font-weight: 300; }
.invite-status { font-size: 15px; color: var(--muted); font-weight: 500; min-height: 22px; line-height: 22px; }
.invite-status b { color: var(--text); }
.invite-status.bad { color: #ffb3bb; }
.invite-alt { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.invite-alt .btn { width: 100%; height: 44px; }
.link-btn.small { font-size: 13.5px; padding: 8px; }
.resume { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; margin-bottom: 18px; border-radius: 16px; background: linear-gradient(135deg, rgba(31,191,111,0.18), rgba(59,130,246,0.14)); border: 1px solid rgba(31,191,111,0.4); animation: screenIn 0.4s var(--ease-out); }
.resume-info { flex: 1; min-width: 0; }
.resume-label { font-size: 13px; color: #a8f0c8; font-weight: 600; }
.resume-code { font-family: var(--display); font-size: 22px; letter-spacing: 0.18em; font-weight: 700; }

/* ---------- no connection ---------- */
.no-net { text-align: center; padding: 16px 14px 14px; margin-bottom: 18px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,212,81,0.16), rgba(255,138,61,0.1)); border: 1px solid rgba(255,180,80,0.45); animation: screenIn 0.4s var(--ease-out); }
.no-net-icon { width: 48px; height: 48px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,212,81,0.16); color: var(--accent-1); }
.no-net-icon .ico { width: 26px; height: 26px; }
.no-net-title { font-family: var(--display); font-size: 21px; font-weight: 600; }
.no-net-text { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
/* online actions step back while there's no connection */
body.no-net-mode #createBtn, body.no-net-mode .join-row, body.no-net-mode .divider:not(.solo-divider), body.no-net-mode #inviteJoinBtn, body.no-net-mode #inviteWatchBtn { opacity: 0.4; }
body.no-net-mode .invite-status .dots { display: none; }
/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 6px; max-width: 640px; width: 100%; margin: 0 auto; }
.topbar-title { flex: 1; text-align: center; font-weight: 700; font-size: 17px; }
.topbar-right { position: relative; display: flex; gap: 8px; }
#screenGame .topbar-title { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.watch-chip { font-size: 12.5px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: rgba(143, 140, 255, 0.16); border: 1px solid rgba(143, 140, 255, 0.4); color: #cfcdff; white-space: nowrap; animation: pop 0.3s var(--spring); }
.watch-chip.me { background: linear-gradient(135deg, #5b6cff, #8a4dff); border-color: transparent; color: #fff; }
.code-chip { font-family: var(--display); letter-spacing: 0.2em; font-size: 16px; font-weight: 600; padding: 7px 12px 7px 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
/* ---------- lobby ---------- */
.lobby-wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 8px 16px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; flex: 1; }
.code-card { padding: 18px; text-align: center; }
.code-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.room-code { font-family: var(--display); font-size: 46px; font-weight: 700; letter-spacing: 0.2em; margin: 4px 0 12px; padding-left: 0.2em; background: linear-gradient(135deg, #fff, #c8ccff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.code-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.code-actions .ico { width: 17px; height: 17px; }
.qr-box { margin: 16px auto 4px; width: 188px; height: 188px; padding: 12px; background: #fff; border-radius: 16px; animation: pop 0.35s var(--spring); }
.qr-box svg { width: 100%; height: 100%; display: block; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seat-name { font-weight: 700; font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-sub { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.seat.empty .seat-name { color: var(--faint); font-weight: 600; }
.seat-empty-ico { width: 52px; height: 52px; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--pc) 50%, transparent); display: grid; place-items: center; color: color-mix(in srgb, var(--pc) 80%, white); font-size: 24px; font-weight: 300; }
.seat-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,0.3); display: grid; place-items: center; color: var(--muted); }
.seat-remove .ico { width: 14px; height: 14px; }
.tag { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,0.14); color: #fff; }
.tag.host { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); color: #2b1500; }
.lobby-hint { text-align: center; color: var(--faint); font-size: 14px; margin: -4px 0 0; }
.lobby-actions { margin-top: auto; padding-top: 8px; }
.app-footer { padding: 14px 0 2px; font-size: 11px; text-align: center; color: #f8fafc; opacity: 0.85; }
.app-footer .icon { margin: 0 4px; color: #f87171; }

/* Cross-promo: other AppDoodle games. Home and game over only, never during play. */
.more-games { width: 100%; display: flex; align-items: center; gap: 14px; margin-top: 6px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; text-align: left; transition: background 0.15s, transform 0.15s; }
.more-games:hover { background: var(--surface-2); }
.more-games:active { transform: scale(0.98); }
.more-games > .ico:first-child { width: 26px; height: 26px; color: var(--accent-1); }
.more-games-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.more-games-text b { font-size: 15px; }
.more-games-text small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.more-games-go { width: 18px; height: 18px; color: var(--muted); }
.finish-more { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 4px; font-size: 14px; font-weight: 600; color: var(--accent-1); text-decoration: none; }
.finish-more .ico { width: 16px; height: 16px; }
.app-footer a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.35); }
.lobby-wrap .app-footer { padding-top: 0; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 600; height: 56px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- emoji reactions ---------- */
/* hangs under the emoji button (inside .topbar-right), whatever the window width */
.emoji-pop { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; display: grid; grid-template-columns: repeat(4, 48px); gap: 6px; padding: 10px; border-radius: 20px; background: rgba(24, 28, 72, 0.96); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: pop 0.25s var(--spring); transform-origin: top right; }
.emoji-pop button { font-size: 28px; height: 48px; border-radius: 12px; transition: transform 0.15s var(--spring), background 0.15s; }
.emoji-pop button:hover { background: var(--surface-2); }
.emoji-pop button:active { transform: scale(0.8); }
/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 60; left: 0; right: 0; top: calc(6px + var(--safe-top)); /* over the top bar, so player panels and dice stay visible */ display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  --pc: #8f8cff;
  display: flex; align-items: center; gap: 10px; max-width: 420px;
  padding: 10px 16px 10px 12px; border-radius: 16px; font-weight: 600; font-size: 14.5px;
  background: rgba(20, 24, 64, 0.94); border: 1px solid color-mix(in srgb, var(--pc) 45%, transparent);
  box-shadow: 0 14px 34px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toastIn 0.4s var(--spring);
}
.toast.out { animation: toastOut 0.3s ease-in forwards; }
.toast .t-ico { font-size: 20px; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--pc) 25%, transparent); flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.95); } }
/* ---------- connection banner ---------- */
.conn-banner { position: fixed; z-index: 70; top: calc(8px + var(--safe-top)); left: 50%; transform: translate(-50%, -150%); display: flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; background: #3b2d0a; color: #ffd98a; border: 1px solid rgba(255, 200, 80, 0.4); box-shadow: 0 10px 30px rgba(0,0,0,0.4); transition: transform 0.4s var(--spring); white-space: nowrap; }
.conn-banner.show { transform: translate(-50%, 0); }
.conn-banner .conn-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffc248; animation: blink 0.9s infinite; }
.conn-banner.offline { background: #3d1218; color: #ffb3bb; border-color: rgba(255, 90, 106, 0.45); }
.conn-banner.offline .conn-dot { background: var(--danger); }
body.disconnected .table, body.disconnected .opps, body.disconnected .hand-wrap { filter: saturate(0.6); opacity: 0.75; transition: opacity 0.3s, filter 0.3s; }

/* ---------- overlays, sheets, dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(8, 10, 32, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.finish-card { position: relative; width: 100%; max-width: 380px; padding: 26px 20px 18px; text-align: center; animation: pop 0.5s var(--spring); background: linear-gradient(180deg, rgba(40, 46, 110, 0.97), rgba(22, 26, 70, 0.97)); }
.trophy { font-size: 64px; line-height: 1; margin-top: -60px; filter: drop-shadow(0 10px 20px rgba(255, 190, 60, 0.45)); animation: trophy 1.6s ease-in-out infinite alternate; }
@keyframes trophy { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-6px) rotate(4deg); } }
.finish-card h2 { font-family: var(--display); font-size: 30px; margin: 10px 0 2px; }
.finish-sub { color: var(--muted); margin: 0 0 16px; }
.podium { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.podium li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); animation: screenIn 0.5s var(--ease-out) both; }
.podium li.first { background: linear-gradient(120deg, rgba(255, 212, 81, 0.22), rgba(255, 138, 61, 0.1)); border-color: rgba(255, 212, 81, 0.5); }
.podium li.me .p-name::after { content: ' (you)'; color: var(--muted); font-weight: 500; }
.podium .p-rank { font-size: 26px; width: 32px; text-align: center; }
.podium .p-rank .rank-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; font-weight: 800; color: var(--muted); background: rgba(255,255,255,0.1); }
.podium .p-name { flex: 1; text-align: left; font-weight: 700; }
.podium .p-left { font-size: 12px; color: var(--faint); font-weight: 600; }
.finish-actions { display: flex; flex-direction: column; gap: 8px; }
.finish-actions .btn-ghost { width: 100%; }

/* Game over fits short phones and full rooms: the card centers when it fits, the overlay scrolls when it doesn't */
#finishOverlay { overflow-y: auto; overscroll-behavior: contain; padding: calc(48px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); }
#finishOverlay .finish-card { margin: auto; max-height: none; overflow: visible; }
@media (max-height: 760px) {
  #finishOverlay { padding-top: calc(40px + var(--safe-top)); }
  .finish-card { padding: 18px 18px 12px; }
  .trophy { font-size: 52px; margin-top: -50px; }
  .finish-card h2 { font-size: 26px; margin-top: 6px; }
  .finish-sub { margin-bottom: 12px; }
  .podium { gap: 6px; margin-bottom: 14px; }
  .podium li { padding: 6px 12px; }
  .finish-actions { gap: 6px; }
  .finish-actions .btn-big, .finish-actions .waiting { height: 50px; }
  .finish-actions .btn-ghost { height: 42px; }
  .finish-more { margin-top: 8px; }
}

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(5, 7, 25, 0.55); animation: fadeIn 0.25s; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; padding: 10px 14px calc(18px + var(--safe-bottom)); border-radius: 26px 26px 0 0; background: linear-gradient(180deg, #262c70, #1a1e52); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -20px 50px rgba(0,0,0,0.5); animation: sheetUp 0.35s var(--ease-out); display: flex; flex-direction: column; gap: 4px; max-height: 86vh; overflow-y: auto; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.25); margin: 0 auto 10px; flex: none; }
.sheet-item { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 14px; border-radius: 14px; font-weight: 600; font-size: 16px; text-align: left; }
.sheet-item:hover, .sheet-item:active { background: var(--surface-2); }
.sheet-item.danger { color: var(--danger); }
.sheet h3 { font-family: var(--display); font-size: 24px; margin: 0 6px 6px; }
.rules-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.rules-list li { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.05); line-height: 1.45; color: #d9dcf5; font-size: 15px; }
.rules-list b { display: block; color: #fff; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.pip { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #fff; color: #151936; font-weight: 800; font-size: 13px; }
.star-ico { color: var(--accent-1); }

.dialog-overlay { z-index: 80; }
.dialog { width: 100%; max-width: 360px; padding: 22px 20px 18px; animation: pop 0.3s var(--spring); background: linear-gradient(180deg, #2a3077, #1d2159); }
.dialog h3 { margin: 0 0 6px; font-size: 20px; }
.dialog p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.dialog-actions { display: flex; gap: 10px; }
.choice-actions { display: flex; flex-direction: column; gap: 10px; }
.choice-actions .btn { width: 100%; }
.dialog-actions .btn { flex: 1; }

.splash { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: radial-gradient(120% 80% at 50% 0%, #232a75, var(--bg)); }
.splash-text { color: var(--muted); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
#inviteMsg:empty { min-height: 0; margin: 0; }
@media (max-height: 720px) and (orientation: portrait) {
  .lobby-wrap { gap: 12px; }
  .code-card { padding: 12px 14px; }
  .room-code { font-size: 36px; margin: 0 0 8px; }
  .seats { gap: 10px; }
  .seat { min-height: 104px; padding: 10px 10px 8px; gap: 6px; }
  .seat .avatar.big { width: 48px; height: 48px; font-size: 21px; }
  .seat-empty-ico { width: 46px; height: 46px; }
}

/* ======================================================================
   Wild: player colours, cards, table, hand
   ====================================================================== */

/* ---------- player colours (avatars, seats, toasts): 10 hues ---------- */
[data-hue="0"][data-hue] { --pc: #ef4655; --pd: #b81f30; }
[data-hue="1"][data-hue] { --pc: #3b82f6; --pd: #1d4fbf; }
[data-hue="2"][data-hue] { --pc: #1fbf6f; --pd: #0d8048; }
[data-hue="3"][data-hue] { --pc: #f7b731; --pd: #c27d06; }
[data-hue="4"][data-hue] { --pc: #8b5cf6; --pd: #5b2fc2; }
[data-hue="5"][data-hue] { --pc: #fb8a2e; --pd: #c2560a; }
[data-hue="6"][data-hue] { --pc: #14b8a6; --pd: #0b7a6e; }
[data-hue="7"][data-hue] { --pc: #ec4899; --pd: #a3195f; }
[data-hue="8"][data-hue] { --pc: #6366f1; --pd: #3a3cc0; }
[data-hue="9"][data-hue] { --pc: #84cc16; --pd: #4d7c0f; }
.toast[data-c="red"] { --pc: var(--red); } .toast[data-c="yellow"] { --pc: var(--yellow); } .toast[data-c="green"] { --pc: var(--green); } .toast[data-c="blue"] { --pc: var(--blue); }

/* ---------- avatar ---------- */
.avatar {
  --pc: var(--red); --pd: var(--red-d);
  position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 19px; color: #fff;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 60%, white), var(--pc) 55%, var(--pd));
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18), 0 6px 14px -6px var(--pc);
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.avatar.big { width: 56px; height: 56px; font-size: 24px; }
.avatar.sm { width: 36px; height: 36px; font-size: 16px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: #35e08a; border: 2.5px solid var(--bg-2); transition: background 0.3s; }
.avatar.offline { filter: grayscale(0.85) brightness(0.75); }
.avatar.offline .presence { background: #7a7f9e; }
.mini-open { width: 40px; height: 40px; border-radius: 50%; border: 2px dashed rgba(255,255,255,0.25); display: grid; place-items: center; color: var(--faint); font-size: 18px; font-weight: 300; }

/* ---------- home logo: a fan of cards ---------- */
.logo { margin-bottom: 10px; height: 128px; width: 170px; position: relative; }
.logo-fan { position: absolute; inset: 0; animation: fanSway 5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.logo-card { position: absolute; left: 50%; bottom: 6px; width: 70px; height: 102px; margin-left: -35px; border-radius: 11px; border: 4px solid #fff; transform-origin: 50% 110%; box-shadow: 0 14px 30px -10px rgba(0,0,0,0.6); }
.logo-card::after { content: ''; position: absolute; inset: 0; border-radius: 7px; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 5px, transparent 5px 12px); }
.lc-1 { background: linear-gradient(155deg, #ff7a86, var(--red) 50%, var(--red-d)); transform: rotate(-30deg); }
.lc-2 { background: linear-gradient(155deg, #ffd770, var(--yellow) 50%, var(--yellow-d)); transform: rotate(-10deg); }
.lc-3 { background: linear-gradient(155deg, #5be79f, var(--green) 50%, var(--green-d)); transform: rotate(10deg); }
.lc-4 { background: linear-gradient(155deg, #7fb0ff, var(--blue) 50%, var(--blue-d)); transform: rotate(30deg); }
.logo-card.lc-4::before { content: '+4'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 30px var(--display); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.25); z-index: 1; transform: rotate(-6deg); }
@keyframes fanSway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }

/* ---------- lobby ---------- */
.lobby-info { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.deck-info { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }
.deck-info b { color: var(--text); }
.deck-info .mini-backs { display: inline-flex; }
.deck-info .mini-backs i { width: 12px; height: 17px; border-radius: 3px; background: linear-gradient(145deg, #4a52c4, #1b1e4b); border: 1.5px solid #fff; margin-left: -5px; box-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.deck-info .mini-backs i:first-child { margin-left: 0; }
.timer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.timer-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.timer-label .ico { width: 17px; height: 17px; }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.seg button { height: 32px; padding: 0 13px; border-radius: 999px; font: 700 13.5px var(--font); color: var(--muted); transition: background 0.2s, color 0.2s; }
.seg button[aria-pressed="true"] { background: linear-gradient(135deg, #5b6cff, #8a4dff); color: #fff; }
.seg button:disabled { cursor: default; }
.seg.readonly button:not([aria-pressed="true"]) { opacity: 0.45; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.seat {
  --pc: var(--red); --pd: var(--red-d);
  position: relative; min-height: 112px; border-radius: 18px; padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 24%, transparent), rgba(255,255,255,0.04));
  border: 1.5px solid color-mix(in srgb, var(--pc) 55%, transparent);
  animation: pop 0.4s var(--spring) both;
}
.seat.empty { background: rgba(255,255,255,0.025); border: 1.5px dashed rgba(255,255,255,0.18); }
.seat.me { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 45%, transparent), 0 14px 30px -14px var(--pc); }
.seat .seat-num { position: absolute; top: 7px; left: 9px; font-size: 11px; font-weight: 800; color: var(--faint); }
.seat-name { font-size: 14.5px; }
.seat-empty-ico { width: 46px; height: 46px; border-radius: 50%; border: 2px dashed rgba(255,255,255,0.22); display: grid; place-items: center; color: var(--faint); font-size: 22px; font-weight: 300; }
.seat.empty .seat-name { color: var(--faint); font-weight: 600; font-size: 13px; }

.add-player { width: 100%; border-style: dashed; }

/* ======================================================================
   Cards
   ====================================================================== */
.wc {
  --cw: 72px; --cc: #2a2f6e; --cd: #121433;
  position: relative; flex: none; width: var(--cw); height: calc(var(--cw) * 1.45);
  border-radius: calc(var(--cw) * 0.14); padding: calc(var(--cw) * 0.055);
  background: #fdfdff;
  box-shadow: 0 calc(var(--cw) * 0.08) calc(var(--cw) * 0.2) calc(var(--cw) * -0.08) rgba(0,0,0,0.6), inset 0 -2px 0 rgba(0,0,0,0.08);
  font-family: var(--display); color: #fff; user-select: none; -webkit-user-select: none;
}
.wc.c-red { --cc: var(--red); --cd: var(--red-d); }
.wc.c-yellow { --cc: var(--yellow); --cd: var(--yellow-d); }
.wc.c-green { --cc: var(--green); --cd: var(--green-d); }
.wc.c-blue { --cc: var(--blue); --cd: var(--blue-d); }
.wc.c-wild { --cc: #353b8c; --cd: #15173c; }
.wc-in {
  position: relative; width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center;
  border-radius: calc(var(--cw) * 0.095);
  background: linear-gradient(155deg, color-mix(in srgb, var(--cc) 70%, white) 0%, var(--cc) 42%, var(--cd) 100%);
}
.wc-in::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.075) 0 calc(var(--cw) * 0.07), transparent calc(var(--cw) * 0.07) calc(var(--cw) * 0.17)); }
.wc-in::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 calc(var(--cw) * 0.018) rgba(255,255,255,0.35); pointer-events: none; }
.wc-emb { position: absolute; width: 82%; height: 82%; fill: rgba(255,255,255,0.17); color: rgba(255,255,255,0.17); transform: rotate(-12deg); }
.wc-mid { position: relative; z-index: 1; display: grid; place-items: center; font-weight: 700; line-height: 1; text-shadow: 0 calc(var(--cw) * 0.035) 0 rgba(0,0,0,0.28); }
.wc-mid.num { font-size: calc(var(--cw) * 0.64); -webkit-text-stroke: calc(var(--cw) * 0.012) rgba(0,0,0,0.12); }
.wc-mid.num.underline { text-decoration: underline; text-decoration-thickness: calc(var(--cw) * 0.04); text-underline-offset: calc(var(--cw) * 0.05); }
.wc-mid.icon .wc-ico { width: calc(var(--cw) * 0.52); height: calc(var(--cw) * 0.52); filter: drop-shadow(0 calc(var(--cw) * 0.03) 0 rgba(0,0,0,0.25)); }
.wc-cap { margin-top: calc(var(--cw) * 0.05); padding: calc(var(--cw) * 0.025) calc(var(--cw) * 0.07); border-radius: 999px; background: rgba(0,0,0,0.22); font-size: calc(var(--cw) * 0.12); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: none; }
.wc-mid.plus { font-size: calc(var(--cw) * 0.44); letter-spacing: -0.02em; }
.wc-mid .mini-stack { position: absolute; left: 50%; top: 50%; width: calc(var(--cw) * 0.36); height: calc(var(--cw) * 0.5); margin: calc(var(--cw) * -0.25) 0 0 calc(var(--cw) * -0.18); z-index: -1; }
.wc-mid .mini-stack i { position: absolute; inset: 0; border-radius: calc(var(--cw) * 0.05); background: rgba(255,255,255,0.22); border: calc(var(--cw) * 0.015) solid rgba(255,255,255,0.45); }
.wc-mid .mini-stack i:first-child { transform: rotate(-14deg) translate(-12%, 2%); }
.wc-mid .mini-stack i:last-child { transform: rotate(12deg) translate(12%, -2%); }
.wc-wheel { width: calc(var(--cw) * 0.66); height: calc(var(--cw) * 0.66); filter: drop-shadow(0 calc(var(--cw) * 0.04) calc(var(--cw) * 0.05) rgba(0,0,0,0.4)); animation: wheelSpin 16s linear infinite; }
.wc-mid.four { display: grid; place-items: center; }
.wc-mid.four .wc-wheel { width: calc(var(--cw) * 0.7); height: calc(var(--cw) * 0.7); opacity: 0.85; }
.wc-mid.four b { position: absolute; font-size: calc(var(--cw) * 0.4); text-shadow: 0 calc(var(--cw) * 0.03) 0 rgba(0,0,0,0.45), 0 0 calc(var(--cw) * 0.12) rgba(0,0,0,0.5); }
@keyframes wheelSpin { to { transform: rotate(360deg); } }
.wc-corner { position: absolute; z-index: 1; font-size: calc(var(--cw) * 0.21); font-weight: 700; line-height: 1; text-shadow: 0 1px 0 rgba(0,0,0,0.3); display: grid; place-items: center; }
.wc-corner.tl { top: 6%; left: 8%; }
.wc-corner.br { bottom: 6%; right: 8%; transform: rotate(180deg); }
.wc-corner .wc-ico { width: calc(var(--cw) * 0.22); height: calc(var(--cw) * 0.22); }
.wc-chosen { position: absolute; z-index: 2; bottom: 7%; left: 50%; width: calc(var(--cw) * 0.34); height: calc(var(--cw) * 0.34); margin-left: calc(var(--cw) * -0.17); border-radius: 50%; display: grid; place-items: center; border: calc(var(--cw) * 0.025) solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.wc-chosen.c-red { background: var(--red); } .wc-chosen.c-yellow { background: var(--yellow); } .wc-chosen.c-green { background: var(--green); } .wc-chosen.c-blue { background: var(--blue); }
.wc-chosen-emb { width: 70%; height: 70%; fill: #fff; color: #fff; }
/* card back */
.wc.back .wc-in { background: radial-gradient(120% 90% at 50% 30%, #4650c8 0%, #262b7a 45%, #121433 100%); }
.wc-logo { position: relative; z-index: 1; width: 70%; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6%; transform: rotate(45deg); }
.wc-logo i { border-radius: 26%; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }
.wc-logo i:nth-child(1) { background: var(--red); } .wc-logo i:nth-child(2) { background: var(--yellow); }
.wc-logo i:nth-child(3) { background: var(--blue); } .wc-logo i:nth-child(4) { background: var(--green); }
.wc-logo b { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-45deg); font-size: calc(var(--cw) * 0.16); font-weight: 700; letter-spacing: 0.02em; padding: 2px calc(var(--cw) * 0.06); border-radius: 999px; background: #fff; color: #1b1e4b; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }

/* ======================================================================
   Game screen
   ====================================================================== */
#screenGame { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.arena {
  --cur: #8f8cff; /* the colour in play */
  --tcw: 82px;    /* table card width */
  --hcw: 74px;    /* hand card width */
  flex: 1; min-height: 0; width: 100%; max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 2px 0 calc(4px + var(--safe-bottom));
}
.arena[data-cur="red"] { --cur: var(--red); } .arena[data-cur="yellow"] { --cur: var(--yellow); }
.arena[data-cur="green"] { --cur: var(--green); } .arena[data-cur="blue"] { --cur: var(--blue); }

/* ---------- opponents ---------- */
.opps { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 4px 10px 0; }
.opp {
  --pc: var(--red); --pd: var(--red-d); --p: 0;
  position: relative; width: 82px; padding: 8px 4px 7px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  transition: background 0.3s, box-shadow 0.3s, opacity 0.3s, transform 0.35s var(--spring), border-color 0.3s;
  cursor: default;
}
.opp.active {
  background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 34%, transparent), color-mix(in srgb, var(--pc) 8%, transparent));
  border-color: color-mix(in srgb, var(--pc) 75%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--pc) 50%, transparent), 0 10px 30px -10px var(--pc);
  transform: translateY(2px) scale(1.06);
}
.opp.next::before { content: 'next'; position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,0.16); color: var(--muted); }
.opp.done, .opp.out { opacity: 0.5; }
.opp-av { position: relative; }
.opp-ring { position: absolute; inset: -5px; border-radius: 50%; opacity: 0; background: conic-gradient(var(--ring, var(--pc)) calc(var(--p) * 1turn), rgba(255,255,255,0.12) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); transition: opacity 0.3s; }
.opp.active .opp-ring { opacity: 1; }
.opp.active.no-clock .opp-ring { background: conic-gradient(var(--pc), transparent 35%, var(--pc) 70%, transparent); animation: spin 2.2s linear infinite; }
.opp-ring.low { --ring: #ff3b4e; }
.opp-name { max-width: 100%; font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.opp-count { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; color: var(--muted); height: 18px; }
.opp.active .opp-count { color: #fff; }
.mini-fan { position: relative; width: 22px; height: 17px; }
.mini-fan i { position: absolute; bottom: 0; left: 6px; width: 10px; height: 15px; border-radius: 2.5px; background: linear-gradient(145deg, #4a52c4, #1b1e4b); border: 1.3px solid #fff; transform-origin: 50% 100%; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.mini-fan i:nth-child(1) { transform: rotate(-22deg); } .mini-fan i:nth-child(3) { transform: rotate(22deg); }
.opp-badge { position: absolute; z-index: 2; top: -8px; right: -6px; font-size: 10.5px; font-weight: 800; padding: 3px 7px; border-radius: 999px; white-space: nowrap; animation: pop 0.35s var(--spring); }
.opp-badge.one { background: linear-gradient(135deg, #ff5a6a, #ff8a3d); color: #fff; box-shadow: 0 4px 12px -2px rgba(255, 90, 106, 0.7); }
.opp-badge.safe { background: #1fbf6f; color: #062b18; }
.opp-medal { position: absolute; top: -9px; right: -5px; font-size: 20px; animation: pop 0.5s var(--spring); }
.catch-btn { position: absolute; z-index: 3; left: 50%; bottom: -12px; transform: translateX(-50%); height: 28px; padding: 0 12px; border-radius: 999px; font: 700 13px var(--display); color: #fff; background: linear-gradient(135deg, #ff3b4e, #c3122a); box-shadow: 0 6px 16px -4px rgba(255, 59, 78, 0.9), inset 0 1px 0 rgba(255,255,255,0.35); animation: catchPulse 0.7s ease-in-out infinite alternate; white-space: nowrap; }
@keyframes catchPulse { to { transform: translateX(-50%) scale(1.12); } }
.opps.many .opp { width: 66px; padding: 6px 3px 6px; gap: 2px; border-radius: 14px; }
.opps.many .opp .avatar { width: 32px; height: 32px; font-size: 14px; }
.opps.many .opp-name { font-size: 11.5px; }
.opps.many .opp-count { font-size: 12px; }
.opps.many .mini-fan { display: none; }
.opp .bubble, .me-bar .bubble { position: absolute; z-index: 6; top: 70%; left: 50%; margin-left: -18px; font-size: 32px; pointer-events: none; animation: bubble 2.2s var(--ease-out) forwards; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4)); }
.me-bar .bubble { top: auto; bottom: 100%; left: 30px; }
@keyframes bubble { 0% { transform: scale(0.2) translateY(10px); opacity: 0; } 15% { transform: scale(1.25); opacity: 1; } 25% { transform: scale(1); } 80% { opacity: 1; transform: translateY(-6px); } 100% { opacity: 0; transform: translateY(-20px) scale(0.9); } }
/* things that happen to a player: skipped, +4, caught */
.stamp { position: absolute; z-index: 4; left: 50%; top: 40%; transform: translate(-50%, -50%); font: 700 15px var(--display); white-space: nowrap; padding: 4px 10px; border-radius: 10px; color: #fff; pointer-events: none; animation: stamp 1.5s var(--ease-out) forwards; box-shadow: 0 8px 20px -6px rgba(0,0,0,0.6); }
.stamp.skip { background: #1b1e4b; border: 2px solid #ff5a6a; color: #ffb3bb; }
.stamp.plus { background: linear-gradient(135deg, #ff5a6a, #ff8a3d); }
.stamp.caught { background: #c3122a; }
.stamp.call { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); color: #2b1500; }
@keyframes stamp { 0% { transform: translate(-50%, -50%) scale(2.2) rotate(-12deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -90%) scale(0.95) rotate(-6deg); opacity: 0; } }
.opp.shake, .me-bar.shake { animation: shake 0.4s; }

/* ---------- the table ---------- */
.table { position: relative; flex: 1; min-height: 150px; width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(28px, 9vw, 60px); }
.table-glow { position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--cur) 42%, transparent), transparent 66%); transition: background 0.6s; pointer-events: none; }
.dir-ring { position: absolute; left: 50%; top: 50%; width: 250px; height: 250px; margin: -125px 0 0 -125px; color: color-mix(in srgb, var(--cur) 70%, white); opacity: 0.45; pointer-events: none; animation: ringSpin 18s linear infinite; transition: color 0.6s; }
.dir-ring svg { width: 100%; height: 100%; overflow: visible; }
.dir-ring path { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 2 9; }
.dir-ring path[marker-end] { stroke-dasharray: none; }
.dir-ring.ccw { animation-direction: reverse; }
.dir-ring.ccw svg { transform: scaleX(-1); }
.dir-ring.flip { animation: ringSpin 18s linear infinite, ringFlip 0.7s var(--spring); }
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes ringFlip { 0% { scale: 1; } 40% { scale: 1.25 0.6; opacity: 0.9; } 100% { scale: 1; } }
.deck { position: relative; z-index: 1; width: var(--tcw); height: calc(var(--tcw) * 1.45); border-radius: calc(var(--tcw) * 0.14); transition: transform 0.2s var(--spring); }
.deck-stack { position: absolute; inset: 0; }
.deck-stack > i { position: absolute; inset: 0; border-radius: calc(var(--tcw) * 0.14); background: #fdfdff; padding: calc(var(--tcw) * 0.055); box-shadow: 0 8px 18px -8px rgba(0,0,0,0.6); }
.deck-stack > i::after { content: ''; position: absolute; inset: calc(var(--tcw) * 0.055); border-radius: calc(var(--tcw) * 0.095); background: radial-gradient(120% 90% at 50% 30%, #4650c8 0%, #262b7a 45%, #121433 100%); }
.deck-stack > i:nth-child(1) { transform: translate(4px, 4px); }
.deck-stack > i:nth-child(2) { transform: translate(2px, 2px); }
.deck .wc { position: absolute; inset: 0; --cw: var(--tcw); }
.deck-count { position: absolute; z-index: 2; top: -9px; right: -10px; min-width: 28px; height: 24px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: #1b1e4b; border: 2px solid rgba(255,255,255,0.7); color: #fff; }
.deck-label { position: absolute; z-index: 2; left: 50%; bottom: -30px; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; transition: color 0.2s; }
.deck.can-draw { cursor: pointer; animation: deckBob 1.4s ease-in-out infinite; }
.deck.can-draw::after { content: ''; position: absolute; inset: -7px; border-radius: calc(var(--tcw) * 0.2); border: 3px solid var(--accent-1); animation: rollPulse 1.1s ease-out infinite; pointer-events: none; }
.deck.can-draw .deck-label { color: var(--accent-1); }
.deck:active { transform: scale(0.95); }
@keyframes deckBob { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -6px; } 90% { translate: 0 0; } }
@keyframes rollPulse { from { transform: scale(0.94); opacity: 1; } to { transform: scale(1.18); opacity: 0; } }
.pile { position: relative; z-index: 1; width: var(--tcw); height: calc(var(--tcw) * 1.45); }
.pile .wc { --cw: var(--tcw); position: absolute; left: 0; top: 0; }
.pile .wc.top { box-shadow: 0 14px 30px -10px rgba(0,0,0,0.7), 0 0 0 3px color-mix(in srgb, var(--cur) 70%, white), 0 0 34px -4px var(--cur); transition: box-shadow 0.5s; }
.pile .wc.landed { animation: land 0.35s var(--spring); }
@keyframes land { from { scale: 1.18; } }
.pile-empty { position: absolute; inset: 0; border-radius: calc(var(--tcw) * 0.14); border: 2px dashed rgba(255,255,255,0.2); }
.pile-wrap { position: relative; z-index: 1; }
.stack-badge { position: absolute; z-index: 3; right: -26px; top: -16px; min-width: 50px; height: 38px; padding: 0 12px; border-radius: 14px; display: grid; place-items: center; font: 700 22px var(--display); color: #fff; background: linear-gradient(135deg, #ff3b4e, #ff8a3d); box-shadow: 0 10px 24px -6px rgba(255, 59, 78, 0.85), inset 0 1px 0 rgba(255,255,255,0.4); animation: stackIn 0.45s var(--spring), stackThrob 1s ease-in-out 0.5s infinite alternate; transform-origin: 30% 80%; }
.stack-badge.bump { animation: stackBump 0.5s var(--spring), stackThrob 1s ease-in-out 0.5s infinite alternate; }
@keyframes stackIn { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
@keyframes stackBump { 0% { transform: scale(1.7) rotate(-12deg); } 100% { transform: none; } }
@keyframes stackThrob { to { transform: scale(1.08) rotate(-3deg); } }
.color-tag { position: absolute; z-index: 2; left: 50%; bottom: -34px; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 6px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #fff; background: var(--cur); box-shadow: 0 6px 16px -6px var(--cur), inset 0 1px 0 rgba(255,255,255,0.35); transition: background 0.5s; white-space: nowrap; }
.color-tag svg { width: 17px; height: 17px; fill: #fff; color: #fff; }
.color-tag.changed { animation: pop 0.5s var(--spring); }
.arena[data-cur="yellow"] .color-tag { color: #3a2600; } .arena[data-cur="yellow"] .color-tag svg { fill: #3a2600; color: #3a2600; }

/* ---------- what you need ---------- */
.need { width: calc(100% - 20px); max-width: 600px; min-height: 48px; display: block; padding: 8px 12px; border-radius: 16px; font-weight: 600; font-size: 14px; line-height: 1.3; color: var(--muted); text-align: center; border: 1px solid transparent; transition: background 0.3s, border-color 0.3s; }
.need b { color: var(--text); }
.need.mine { background: rgba(255,255,255,0.07); border-color: color-mix(in srgb, var(--cur) 55%, transparent); color: var(--text); animation: statusIn 0.4s var(--spring); }
.need.warn { background: rgba(255, 59, 78, 0.12); border-color: rgba(255, 90, 106, 0.6); }
.need.pulse { animation: needPulse 0.45s; }
@keyframes needPulse { 30% { transform: scale(1.04); border-color: #fff; } }
@keyframes statusIn { from { transform: scale(0.94); opacity: 0; } }
.need .or { margin: 0 3px; color: var(--faint); font-weight: 600; font-size: 12.5px; }
.need .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, #fff); box-shadow: 0 0 8px var(--pc, #fff); margin-right: 2px; }
.need-card { display: inline-flex; vertical-align: middle; margin: 2px 1px; align-items: center; gap: 5px; height: 30px; padding: 0 10px 0 6px; border-radius: 9px; font-weight: 800; font-size: 13px; color: #fff; border: 2px solid #fff; box-shadow: 0 4px 10px -4px rgba(0,0,0,0.6); }
.need-card.c-red { background: var(--red); } .need-card.c-yellow { background: var(--yellow); color: #3a2600; } .need-card.c-green { background: var(--green); } .need-card.c-blue { background: var(--blue); }
.need-emb { width: 17px; height: 17px; fill: currentColor; color: currentColor; }
.need-card.any { padding: 0 9px; background: #fff; color: #1b1e4b; border-color: rgba(255,255,255,0.7); font-family: var(--display); font-size: 16px; }
.need-card.any .wc-ico { width: 18px; height: 18px; color: #1b1e4b; }
.need-card.wild { padding: 0 6px; background: #262b7a; gap: 3px; font-family: var(--display); font-size: 14px; }
.need-card.wild .wc-wheel { width: 20px; height: 20px; animation: none; }
.need-count { white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ---------- my bar and hand ---------- */
.me-bar { position: relative; width: 100%; max-width: 640px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 12px 6px; }
.me-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.me-bar.active .me-sub { color: var(--accent-1); }
.me-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sort-btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.sort-btn .ico { width: 15px; height: 15px; }
.call-btn { position: relative; height: 42px; padding: 0 18px; border-radius: 999px; font: 700 17px var(--display); color: #fff; letter-spacing: 0.01em; background: linear-gradient(135deg, #ff3b4e, #ff8a3d); box-shadow: 0 10px 24px -6px rgba(255, 70, 85, 0.9), inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -3px 0 rgba(0,0,0,0.15); animation: callPulse 0.8s ease-in-out infinite alternate; white-space: nowrap; }
.call-btn::before { content: ''; position: absolute; inset: -5px; border-radius: inherit; border: 2.5px solid #ff8a3d; animation: rollPulse 1s ease-out infinite; }
.call-btn:active { transform: scale(0.94); }
@keyframes callPulse { to { transform: scale(1.07) rotate(-2deg); } }
.turn-clock { position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.07); overflow: hidden; opacity: 0; transition: opacity 0.3s; }
.turn-clock i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 1)); background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); border-radius: inherit; }
.turn-clock.on { opacity: 1; }
.turn-clock.low i { background: linear-gradient(90deg, #ff3b4e, #ff6b7a); }
.hand-wrap { position: relative; width: 100%; flex: none; }
.hand {
  display: flex; align-items: flex-end; justify-content: center;
  padding: 42px 14px 16px; min-height: calc(var(--hcw) * 1.45 + 58px);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.hand::-webkit-scrollbar { display: none; }
.hand.scroll { justify-content: flex-start; }
.hand .wc {
  --cw: var(--hcw); --ty: 0px; --rot: 0deg; --arc: 0px;
  margin-left: var(--ov, -20px); transform: translateY(calc(var(--ty) + var(--arc))) rotate(var(--rot));
  transform-origin: 50% 130%;
  transition: transform 0.28s var(--spring), filter 0.25s, margin 0.3s var(--ease-out), opacity 0.2s;
}
.hand .wc:first-child { margin-left: 0; }
.hand.my-turn .wc { cursor: pointer; }
.hand .wc.selected { --ty: -36px; z-index: 5; animation: none; filter: none; }
.hand .wc.selected::after { content: 'Tap to play'; position: absolute; z-index: 3; left: 50%; bottom: 10%; transform: translateX(-50%); font: 700 11.5px var(--font); white-space: nowrap; color: #2b1500; background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); padding: 3px 8px; border-radius: 999px; box-shadow: 0 4px 10px rgba(0,0,0,0.4); animation: pop 0.25s var(--spring); }
.hand .wc.drawn { --ty: -22px; z-index: 4; }
.hand .wc.drawn::after { content: 'New'; position: absolute; z-index: 3; left: 50%; top: 4px; transform: translateX(-50%); font: 800 10.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: #062b18; background: #35e08a; padding: 2px 7px; border-radius: 999px; }
.hand .wc.new { animation: cardIn 0.5s var(--spring) both; }
@keyframes cardIn { from { translate: 0 30px; opacity: 0; } }
.hand .wc.leaving { opacity: 0; }
.hand .wc.dragging { transition: none; z-index: 20; filter: none; }
.hand .wc.nope { animation: nope 0.35s; }
@keyframes nope { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
.hand.hidden-hand .wc { filter: none; }
.hand-empty { color: var(--faint); font-weight: 600; font-size: 14px; padding-bottom: 30px; }
.drawn-actions { position: absolute; z-index: 8; left: 50%; top: -6px; transform: translateX(-50%); display: flex; gap: 8px; animation: pop 0.35s var(--spring); }
.drawn-actions .btn { height: 40px; padding: 0 18px; font-size: 15px; box-shadow: 0 10px 24px -8px rgba(0,0,0,0.7); }
.drawn-actions .btn-ghost { background: rgba(28, 32, 82, 0.95); }
.watch-note { text-align: center; color: var(--muted); font-weight: 600; font-size: 14px; padding: 24px 0 18px; }

/* ---------- flying cards ---------- */
.fly-layer { position: fixed; inset: 0; z-index: 66; pointer-events: none; overflow: hidden; }
.fly { position: absolute; left: 0; top: 0; perspective: 900px; will-change: transform; }
.fly-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.fly .wc { position: absolute; inset: 0; width: 100%; height: 100%; --cw: var(--fw, 72px); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fly .fly-back { transform: rotateY(180deg); }
.fly.only-back .fly-back { transform: none; }
.float-text { position: fixed; z-index: 67; pointer-events: none; font: 700 26px var(--display); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.3), 0 0 18px rgba(255, 90, 106, 0.8); animation: floatUp 1.3s var(--ease-out) forwards; transform: translate(-50%, -50%); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

/* ---------- colour picker ---------- */
.picker-overlay { z-index: 75; }
.picker { width: 100%; max-width: 360px; padding: 20px 18px 16px; text-align: center; animation: pop 0.3s var(--spring); background: linear-gradient(180deg, #2a3077, #1d2159); }
.picker h3 { font-family: var(--display); font-size: 24px; margin: 0; }
.picker-sub { color: var(--muted); margin: 4px 0 16px; font-size: 14.5px; }
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pick { --cc: var(--red); --cd: var(--red-d); position: relative; height: 104px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; font-weight: 800; font-size: 16px; background: linear-gradient(155deg, color-mix(in srgb, var(--cc) 70%, white), var(--cc) 45%, var(--cd)); box-shadow: 0 12px 24px -10px var(--cc), inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -4px 0 rgba(0,0,0,0.15); transition: transform 0.15s var(--spring); }
.pick:active { transform: scale(0.94); }
.pick svg { width: 36px; height: 36px; fill: #fff; color: #fff; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.2)); }
.pick.c-yellow { --cc: var(--yellow); --cd: var(--yellow-d); color: #3a2600; } .pick.c-yellow svg { fill: #3a2600; color: #3a2600; }
.pick.c-green { --cc: var(--green); --cd: var(--green-d); } .pick.c-blue { --cc: var(--blue); --cd: var(--blue-d); }
.picker .btn { width: 100%; }


/* splash: two cards flipping */
.spinner-cards { position: relative; width: 70px; height: 80px; }
.spinner-cards .wc { --cw: 46px; position: absolute; left: 12px; top: 6px; animation: spinCard 1.4s var(--ease-out) infinite; }
.spinner-cards .wc:last-child { animation-delay: -0.7s; }
@keyframes spinCard { 0% { transform: rotate(-16deg) translateX(-8px); } 50% { transform: rotate(16deg) translateX(8px) translateY(-8px); } 100% { transform: rotate(-16deg) translateX(-8px); } }

/* rules sheet card pictures */
.rules-list li.rules-cards { display: flex; gap: 12px; align-items: center; }
.rules-list .rc .wc { --cw: 42px; }
.rules-list em { font-style: normal; font-weight: 700; color: #fff; }

/* ---------- sizes ---------- */
@media (max-width: 380px) {
  .arena { --tcw: 72px; --hcw: 66px; }
  .opp { width: 74px; }
  /* five controls in the top bar: Leave becomes an icon so the room code fits */
  #screenGame .exit-btn { width: 42px; padding: 0; justify-content: center; }
  #screenGame .exit-btn span { display: none; }
  #screenGame .code-chip { letter-spacing: 0.12em; font-size: 15px; padding: 7px 10px; }
}
@media (min-width: 700px) {
  .arena { --tcw: 96px; --hcw: 86px; }
  .opp { width: 92px; }
  .need { font-size: 15px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .arena { --tcw: 70px; --hcw: 66px; }
  .hand { padding-top: 34px; }
  .table { min-height: 130px; }
  .dir-ring { width: 210px; height: 210px; margin: -105px 0 0 -105px; }
}
/* Phones held sideways: players on the left, table on the right, hand along the bottom. */
@media (orientation: landscape) and (max-height: 540px) {
  .topbar { padding-top: calc(4px + var(--safe-top)); padding-bottom: 2px; }
  .arena {
    --tcw: 62px; --hcw: 58px; max-width: none;
    display: grid; grid-template-columns: minmax(200px, 42%) 1fr; grid-template-rows: 1fr auto auto auto;
    grid-template-areas: "opps table" "need need" "me me" "hand hand"; column-gap: 10px; row-gap: 2px;
  }
  .opps { grid-area: opps; align-content: center; }
  .table { grid-area: table; min-height: 120px; }
  .need { grid-area: need; justify-self: center; min-height: 38px; padding: 4px 10px; }
  .me-bar { grid-area: me; justify-self: center; padding-bottom: 4px; }
  .hand-wrap { grid-area: hand; }
  .hand { padding-top: 30px; padding-bottom: 4px; min-height: calc(var(--hcw) * 1.45 + 36px); }
  .dir-ring { width: 180px; height: 180px; margin: -90px 0 0 -90px; }
  .opps.many .opp, .opp { width: 64px; padding: 5px 3px; }
  .opp .avatar { width: 30px; height: 30px; font-size: 13px; }
  .mini-fan { display: none; }
}

/* ---------- solo vs computer ---------- */
.btn-emoji { font-size: 20px; line-height: 1; }
.solo-divider { margin-top: 8px; }
.solo-resume { display: block; margin: 10px auto 0; }
.solo-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 6px; }
.solo-row .seg button { padding: 0 11px; }
.solo-note { text-align: center; color: var(--faint); font-size: 13px; margin: 6px 0 12px; }

/* ---------- you're next ---------- */
.me-bar.next .me-sub { color: #c3c1ff; }
.me-bar.next .avatar { box-shadow: 0 0 0 2px rgba(195, 193, 255, 0.55); animation: nextPulse 1.6s ease-in-out infinite; }
.hand.up-next .wc { box-shadow: 0 0 0 1px rgba(195, 193, 255, 0.35), 0 calc(var(--cw) * 0.08) calc(var(--cw) * 0.3) calc(var(--cw) * -0.06) rgba(140, 130, 255, 0.6), inset 0 -2px 0 rgba(0,0,0,0.08); }
@keyframes nextPulse { 50% { box-shadow: 0 0 0 5px rgba(195, 193, 255, 0.15); } }
@media (prefers-reduced-motion: reduce) { .me-bar.next .avatar { animation: none; } }

/* ---------- missed turns ---------- */
.opp-missed { position: absolute; z-index: 2; left: 50%; bottom: -8px; transform: translateX(-50%); white-space: nowrap; font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 999px; background: #3b2d0a; color: #ffd98a; border: 1px solid rgba(255, 200, 80, 0.45); }

/* ---------- big hands: two overlapping rows ---------- */
.hand.two-rows { flex-direction: column; align-items: center; justify-content: flex-end; padding-top: 34px; }
.hand-row { display: flex; align-items: flex-end; justify-content: center; }
/* the front row covers the bottom of the back row; corners stay readable */
.hand-row + .hand-row { margin-top: calc(var(--hcw) * -0.86); }

/* ---------- last moves ---------- */
.move-log { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.move-log li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); font-size: 14.5px; line-height: 1.35; color: #d9dcf5; }
.move-log li:first-child { background: rgba(255,255,255,0.1); color: #fff; }
.move-log li.empty { justify-content: center; color: var(--faint); }
.move-log .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, rgba(255,255,255,0.35)); }
.log-card { display: inline-block; padding: 1px 7px; border-radius: 6px; font-weight: 700; font-size: 13px; color: #fff; background: #353b8c; white-space: nowrap; }
.log-card.c-red { background: var(--red); }
.log-card.c-yellow { background: var(--yellow); color: #2b1d00; }
.log-card.c-green { background: var(--green); }
.log-card.c-blue { background: var(--blue); }
.log-card.c-wild { background: linear-gradient(135deg, var(--red), var(--yellow), var(--green), var(--blue)); }
#pile { cursor: pointer; }

/* ---------- house rules in the lobby ---------- */
#lastCardRow { margin-top: 8px; }
.rule-note { margin: 6px 0 0; text-align: center; font-size: 12.5px; color: var(--faint); }
.rule-note:empty { display: none; }

/* ---------- avatars ---------- */
.avatar .emo { font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.2em; line-height: 1; text-shadow: none; }
.name-row { display: flex; gap: 10px; align-items: center; }
.name-row input { flex: 1; min-width: 0; }
.avatar-pick { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: rgba(0, 0, 0, 0.25); border: 1.5px solid var(--line); transition: transform 0.15s var(--spring), border-color 0.2s; }
.avatar-pick.letter { font: 700 22px var(--display); color: var(--muted); }
.avatar-pick:active { transform: scale(0.92); }
.avatar-pick[aria-expanded="true"] { border-color: #8f8cff; }
.avatar-pick .emo, .avatar-grid button { font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin-top: 10px; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); animation: screenIn 0.25s var(--ease-out); }
.avatar-grid button { height: 42px; border-radius: 10px; font-size: 24px; transition: transform 0.15s var(--spring), background 0.15s; }
.avatar-grid button:active { transform: scale(0.88); }
.avatar-grid button.on { background: rgba(143, 140, 255, 0.3); box-shadow: inset 0 0 0 2px #8f8cff; }
.avatar-grid button.letter { font: 700 18px var(--display); color: var(--muted); }

/* ---------- wild: the new colour washes across the table ---------- */
.color-wave { position: fixed; z-index: 4; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; pointer-events: none; --wc: #fff;
  background: radial-gradient(circle, transparent 38%, color-mix(in srgb, var(--wc) 55%, transparent) 60%, transparent 72%);
  animation: colorWave 0.8s var(--ease-out) forwards; }
.color-wave.c-red { --wc: var(--red); } .color-wave.c-yellow { --wc: var(--yellow); }
.color-wave.c-green { --wc: var(--green); } .color-wave.c-blue { --wc: var(--blue); }
@keyframes colorWave { from { transform: scale(0.4); opacity: 1; } to { transform: scale(6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .color-wave { display: none; } }

/* ---------- a +2/+4 stack heats up ---------- */
.stack-badge[data-heat="1"] { background: linear-gradient(135deg, #ff3b4e, #ffb03d); box-shadow: 0 0 18px 2px rgba(255, 140, 50, 0.7), inset 0 1px 0 rgba(255,255,255,0.4); }
.stack-badge[data-heat="2"] { background: linear-gradient(135deg, #ff2440, #ff9a1f); box-shadow: 0 0 26px 6px rgba(255, 90, 40, 0.8), inset 0 1px 0 rgba(255,255,255,0.4); animation: stackIn 0.45s var(--spring), heatPulse 0.6s ease-in-out infinite alternate; }
.stack-badge[data-heat="3"] { background: linear-gradient(135deg, #ff1030, #ffcc33); box-shadow: 0 0 34px 10px rgba(255, 70, 20, 0.9), inset 0 1px 0 rgba(255,255,255,0.5); animation: stackIn 0.45s var(--spring), heatPulse 0.35s ease-in-out infinite alternate; }
.stack-badge[data-heat="3"]::before { content: '🔥'; position: absolute; top: -26px; left: 50%; translate: -50% 0; font-size: 26px; animation: flame 0.4s ease-in-out infinite alternate; }
@keyframes heatPulse { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes flame { from { transform: scale(1) rotate(-6deg); } to { transform: scale(1.18) rotate(6deg); } }
/* the table's edge glows hot */
.arena[data-heat="2"] .table-glow, .arena[data-heat="3"] .table-glow { background: radial-gradient(circle, color-mix(in srgb, var(--cur) 42%, transparent), rgba(255, 80, 30, 0.28) 55%, transparent 70%); }
.arena[data-heat="3"] .table-glow { animation: heatGlow 0.8s ease-in-out infinite alternate; }
@keyframes heatGlow { from { opacity: 0.75; } to { opacity: 1; transform: scale(1.06); } }
.pile.shake { animation: shake 0.4s; }
@media (prefers-reduced-motion: reduce) {
  .stack-badge[data-heat], .stack-badge[data-heat="3"]::before, .arena[data-heat="3"] .table-glow { animation: none; }
}

/* ---------- podium reveal ---------- */
.podium li.wait { opacity: 0; transform: translateY(12px) scale(0.96); animation: none; }
.podium li.show { opacity: 1; transform: none; animation: podIn 0.4s var(--spring) both; }
@keyframes podIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
.podium li.first.land { animation: firstLand 0.7s var(--spring) both; }
@keyframes firstLand { 0% { opacity: 0; transform: scale(1.35); } 55% { opacity: 1; transform: scale(0.97); box-shadow: 0 0 0 6px rgba(255, 212, 81, 0.35), 0 0 40px rgba(255, 212, 81, 0.6); } 100% { transform: none; } }
.podium li.me { box-shadow: inset 0 0 0 2px rgba(143, 140, 255, 0.7); }
#finishOverlay.revealing .trophy { animation: trophyWait 0.5s ease-in-out infinite alternate; }
@keyframes trophyWait { from { transform: scale(0.92); opacity: 0.6; } to { transform: scale(1); opacity: 1; } }

/* ---------- quick-chat phrases ---------- */
.phrase-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); max-width: 222px; }
.emoji-pop button.phrase { height: 32px; padding: 0 10px; font: 600 13px var(--font); color: var(--text); background: rgba(255,255,255,0.08); border-radius: 999px; white-space: nowrap; }
.bubble.say { font: 700 13px var(--font); white-space: nowrap; color: #1b1e4b; background: #fff; padding: 6px 11px; border-radius: 14px; margin-left: 0; translate: -50% 0; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45)); animation-duration: 2.7s; }
.bubble.say::after { content: ''; position: absolute; left: 50%; top: -5px; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: #fff; }
.me-bar .bubble.say { translate: 0 0; }
.me-bar .bubble.say::after { display: none; }

/* ---------- awards ---------- */
.finish-card { max-height: calc(100dvh - 40px); overflow-y: auto; }
.awards { display: flex; flex-direction: column; gap: 6px; margin: -6px 0 16px; transition: opacity 0.4s; }
.awards:empty { display: none; }
.award { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; text-align: left; background: rgba(255, 190, 60, 0.08); border: 1px solid rgba(255, 190, 60, 0.25); animation: podIn 0.4s var(--spring) both; }
.award.me { border-color: rgba(143, 140, 255, 0.6); }
.aw-ico { flex: none; width: 30px; font-size: 22px; text-align: center; }
.aw-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.aw-text b { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: #ffd166; }
.aw-text span { font-size: 13.5px; color: #d9dcf5; }
#finishOverlay.revealing .awards { opacity: 0; }

/* ---------- wooden spoon for last place ---------- */
.podium .p-spoon { font-size: 12px; font-weight: 600; color: #e8b77a; text-align: right; max-width: 40%; line-height: 1.2; }
.spoon-ico { font-size: 24px; animation: spoonWobble 1.2s ease-in-out infinite alternate; transform-origin: 50% 85%; }
.podium li.spoon { background: rgba(200, 140, 80, 0.1); border-color: rgba(200, 140, 80, 0.35); }
@keyframes spoonWobble { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .spoon-ico { animation: none; } }

.need-card.wild .nw-label { font: 800 12px var(--font); white-space: nowrap; padding-right: 3px; }
