:root, [data-ui-theme="light"] {
  --bg-shell: #F1F5F9;
  --bg-page: #F1F5F9;
  --bg-panel: #FFFFFF;
  --bg-elevated: #F8FAFC;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --modal-backdrop: rgba(15, 23, 42, 0.48);
  --shadow-card: 0 8px 28px rgba(15, 23, 42, 0.08);
  --felt: #112A24;
  --felt-inner: #173A32;
  --felt-border: #1F4D42;
  --ivory: #FAF8F5;
  --pip-ink: #18181B;
  --ink: #0F172A;
  --ink-dim: #475569;
  --border: #CBD5E1;
  --gold: #B45309;
  --gold-text: #92400E;
  --gold-soft: rgba(245, 158, 11, 0.14);
  --emerald: #059669;
  --emerald-text: #065F46;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --danger-text: #B91C1C;
  --crimson: #DC2626;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

[data-ui-theme="dark"] {
  --bg-shell: #000000;
  --bg-page: #000000;
  --bg-panel: #1C1C1E;
  --bg-elevated: #2C2C2E;
  --topbar-bg: rgba(28, 28, 30, 0.84);
  --modal-backdrop: rgba(0, 0, 0, 0.72);
  --shadow-card: 0 12px 34px rgba(0, 0, 0, 0.72);
  --ink: #F5F5F7;
  --ink-dim: #98989D;
  --border: #38383A;
  --gold: #FFD60A;
  --gold-text: #FFE666;
  --gold-soft: rgba(255, 214, 10, 0.16);
  --emerald: #30D158;
  --emerald-text: #63E686;
  --emerald-soft: rgba(48, 209, 88, 0.16);
  --danger-text: #FF6961;
  --crimson: #FF453A;
}

[data-ui-theme="dark"] .topbar {
  backdrop-filter: saturate(180%) blur(20px);
}
[data-ui-theme="dark"] .btn-gold {
  background: #F59E0B;
  color: #09090B;
  border-color: #D97706;
}
[data-ui-theme="dark"] .btn-gold:hover:not(:disabled) {
  background: #FBBF24;
  color: #09090B;
}
[data-ui-theme="dark"] .tag-bot {
  background: rgba(10, 132, 255, 0.18);
  color: #64D2FF;
}
[data-ui-theme="dark"] .spectator-banner {
  background: rgba(10, 132, 255, 0.16);
  border-color: rgba(10, 132, 255, 0.45);
  color: #E5F3FF;
}

[data-felt="crimson"] { --felt: #3A111B; --felt-inner: #511927; --felt-border: #6B2133; }
[data-felt="midnight"] { --felt: #10223E; --felt-inner: #193560; --felt-border: #224478; }
[data-felt="royal"] { --felt: #2B2210; --felt-inner: #403318; --felt-border: #9A7422; }

/* Dice Skin Variants */
[data-dice-skin="obsidian"] .die-btn {
  background: #171D28;
  border-color: #364154;
  box-shadow: 0 5px 0 #0B0E14, 0 8px 16px rgba(0, 0, 0, 0.5);
  color: #F0C24B;
}
[data-dice-skin="gold_leaf"] .die-btn {
  background: linear-gradient(145deg, #F6CF65 0%, #D99B26 100%);
  border-color: #FDE68A;
  box-shadow: 0 5px 0 #92600A, 0 8px 16px rgba(0, 0, 0, 0.45);
  color: #231707;
}
[data-dice-skin="neon"] .die-btn {
  background: #0B1F2E;
  border-color: #22D3EE;
  box-shadow: 0 5px 0 #082F49, 0 0 12px rgba(34, 211, 238, 0.25);
  color: #3CF0C5;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.2s ease;
}

.hidden { display: none !important; }
.muted { color: var(--ink-dim); font-size: 13px; margin: 4px 0 0; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }

button { font-family: inherit; cursor: pointer; touch-action: manipulation; }

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  min-height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 7px 18px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  gap: 10px;
}

.topbar-row-main { display: contents; }
.topbar-left { order: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-nav { order: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-utils { order: 3; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-hud { display: contents; }
.profile-hub-btn { gap: 7px; }
.hud-level-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(240, 194, 75, 0.35);
}

.lang-select {
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: 12px;
  color: var(--ink-dim);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: #1F2937;
  font-size: 13.5px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
[data-ui-theme="dark"] .btn-google {
  background: #2C2C2E;
  color: #F5F5F7;
  border-color: #48484A;
}

.arc-tier {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 5px;
  text-transform: uppercase;
}
.arc-tier.easy { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.arc-tier.medium { background: rgba(14, 165, 233, 0.16); color: #0EA5E9; }
.arc-tier.hard { background: rgba(245, 158, 11, 0.18); color: var(--gold); }
.arc-tier.legend { background: rgba(139, 92, 246, 0.18); color: #A855F7; }

.arc-progress-wrap {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.arc-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-shell);
  overflow: hidden;
  border: 1px solid var(--border);
}
.arc-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.arc-progress-txt {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-dim);
  white-space: nowrap;
}

.link-btn {
  background: transparent;
  border: none;
  padding: 2px 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
}

.prof-verify-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
}

.team-score-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.team-card {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.team-card.team-a { border-left: 4px solid #3B82F6; }
.team-card.team-b { border-left: 4px solid #EF4444; }
.tag-team-a, .tag-team-b {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 4px;
}
.tag-team-a { background: rgba(59, 130, 246, 0.16); color: #3B82F6; }
.tag-team-b { background: rgba(239, 68, 68, 0.16); color: #EF4444; }
.turn-card-chip.sabotage-chip {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(56, 189, 248, 0.18);
  color: #E0F2FE;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.brand-home-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.brand-home-btn:hover { background: var(--gold-soft); }
.brand-home-btn:active { transform: scale(0.97); }
.brand-home-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.brand-die { font-size: 20px; }

.pill-btn, .round-pill, .turn-pill, .points-pill, .inv-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  white-space: nowrap;
}

.pill-btn strong, .points-pill strong { color: var(--ink); }
.pill-btn:hover { border-color: var(--gold); color: var(--ink); }

.points-pill {
  background: var(--gold-soft);
  border-color: rgba(234, 179, 8, 0.45);
  color: var(--gold-text);
  font-weight: 700;
}
.points-pill.pulse { animation: goldPulse 0.6s ease; }

.market-btn strong { color: var(--emerald); }
.market-btn.locked { border-color: rgba(239, 68, 68, 0.45); color: var(--danger-text); }
.market-btn.locked strong { color: var(--danger-text); }

.market-lock-banner {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
}
.market-lock-banner.is-locked {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.42);
  color: var(--danger-text);
}
.market-lock-banner.is-open {
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-text);
}

.lobby-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.timer-pills { display: flex; gap: 6px; }
.timer-pill {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
}
.timer-pill.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}
.timer-pill:disabled { opacity: 0.6; cursor: not-allowed; }

.turn-timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.turn-timer-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.turn-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--gold);
  transition: width 0.25s linear;
}
.turn-timer-fill.low { background: var(--crimson); }
.turn-timer-txt { font-size: 11px; font-weight: 800; color: #FEF08A; min-width: 28px; text-align: right; }

.ach-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.ach-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
  opacity: 0.55;
  font-size: 11px;
}
.ach-card.unlocked {
  opacity: 1;
  border-color: var(--gold);
  background: var(--gold-soft);
}
.ach-ico { font-size: 18px; }
.ach-card strong { display: block; color: var(--ink); }
.ach-card.unlocked strong { color: var(--gold-text); }

.modal-leaderboard { max-width: 580px; }
.leaderboard-list { display: flex; flex-direction: column; gap: 7px; }
.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
}
.lb-row.top1 { border-color: var(--gold); background: var(--gold-soft); }
.lb-left { display: flex; align-items: center; gap: 10px; }
.lb-rank { width: 24px; font-weight: 900; color: var(--gold); text-align: center; }
.lb-right { text-align: right; font-size: 12px; }
.lb-right strong { display: block; font-size: 15px; color: var(--gold); }

.score-pick-btn.penta-pick {
  border: 1.5px solid var(--gold);
  background: rgba(245, 158, 11, 0.24);
  color: #FEF08A;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.35);
}

.round-pill { color: var(--ink); font-weight: 700; }
.turn-pill.mine { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.45); color: var(--emerald); font-weight: 700; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 15px;
}

.btn-gold {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #CA8A04;
  background: #EAB308;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.btn-gold:hover:not(:disabled) { background: #FACC15; transform: translateY(-1px); }
.btn-gold:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { padding: 11px 22px; font-size: 14px; border-radius: var(--radius-md); }

.btn-subtle {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.btn-subtle:hover { border-color: var(--gold); }

/* Auth & Profile Helpers */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
}

.auth-tab {
  padding: 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--gold);
}

.field-lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.avatar-opt {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-shell);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-opt.selected {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.auth-error {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
  font-size: 12px;
}

.authed-welcome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.big-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-shell);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.prof-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.prof-stat {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
  text-align: center;
}
.prof-stat strong { display: block; font-size: 16px; color: var(--gold); }
.prof-stat span { font-size: 10px; color: var(--ink-dim); }

/* Market Modal */
.modal-market { max-width: 700px; }
.modal-profile { max-width: 480px; }

.market-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.market-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.market-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.market-card-top > div { min-width: 0; }
.market-owned { flex-shrink: 0; }

.market-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-shell);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.market-card-title { font-size: 14px; font-weight: 700; color: var(--gold); }
.market-owned { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--bg-shell); color: var(--ink-dim); }
.market-card-foot { display: flex; align-items: center; justify-content: space-between; }
.market-price { font-size: 13px; font-weight: 800; color: var(--gold-text); }

/* Lobby View */
.lobby-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lobby-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.lobby-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.lobby-top h2 { margin: 2px 0; font-size: 22px; }

.lobby-players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.lobby-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
}

.tag-host { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); margin-left: 6px; }
.tag-bot { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(56, 189, 248, 0.16); color: #38BDF8; margin-left: 6px; }

.lobby-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Main Game Grid */
.game-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 14px;
  padding: 12px 16px;
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

/* Felt Dice Tray */
.felt-tray {
  --ink: #F8FAFC;
  --ink-dim: rgba(248, 250, 252, 0.72);
  --gold: #FACC15;
  --gold-text: #FEF08A;
  --gold-soft: rgba(250, 204, 21, 0.16);
  --bg-shell: rgba(15, 23, 42, 0.55);
  color: #F8FAFC;
  background: radial-gradient(circle at center, var(--felt-inner) 0%, var(--felt) 100%);
  border: 2px solid var(--felt-border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
}

.tray-head { display: flex; align-items: flex-start; justify-content: space-between; }
.tray-head h2 { margin: 2px 0 0; font-size: 16px; }

.rolls-badge { text-align: right; font-size: 11px; color: var(--ink-dim); }
.rolls-pips { display: flex; gap: 5px; justify-content: flex-end; margin-top: 4px; }
.roll-pip { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.28); }
.roll-pip.on { background: var(--gold); border-color: #FEF08A; box-shadow: 0 0 8px rgba(234, 179, 8, 0.6); }

.special-banner {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: #FEF08A;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.dice-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  padding: 8px 0 10px;
}

.die-btn {
  position: relative;
  aspect-ratio: 1;
  border-radius: 13px;
  background: var(--ivory);
  border: 2.5px solid #D6D3CD;
  box-shadow: 0 5px 0 #B8B2A6, 0 8px 16px rgba(0, 0, 0, 0.35);
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pip-ink);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.die-btn:hover:not(:disabled) { transform: translateY(-3px); }
.die-btn:disabled { cursor: default; }

.die-btn.held {
  border-color: var(--gold);
  transform: translateY(-5px);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.4), 0 6px 0 #B45309;
}

.die-btn.tumble {
  animation: dieTumble 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--die-i, 0) * 40ms);
}

@keyframes dieTumble {
  0% { transform: rotate(-18deg) scale(0.84) translateY(-6px); }
  45% { transform: rotate(170deg) scale(1.09) translateY(-4px); }
  80% { transform: rotate(352deg) scale(0.97) translateY(2px); }
  100% { transform: rotate(360deg) scale(1) translateY(0); }
}

.die-lock-tag {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #111827;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.die-svg { width: 100%; height: 100%; }

/* Turn-Start Special Card Inventory Bar */
.turn-cards-wrap {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.turn-cards-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #D1FAE5;
  margin-bottom: 6px;
}

.turn-cards-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.turn-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold);
  background: rgba(234, 179, 8, 0.16);
  color: #FEF08A;
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.12s ease;
}

.turn-card-chip:hover:not(:disabled) {
  background: rgba(234, 179, 8, 0.3);
  transform: translateY(-1px);
}

.turn-card-chip:disabled {
  opacity: 0.42;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--ink-dim);
  cursor: not-allowed;
}

.turn-card-empty {
  font-size: 11px;
  color: var(--ink-dim);
}

.tray-hint { font-size: 12px; color: #A7F3D0; text-align: center; min-height: 16px; }

.tray-controls { display: flex; align-items: center; gap: 10px; }
.react-bar { display: flex; gap: 4px; }
.react-btn {
  width: 34px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  font-size: 16px;
}
.react-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* Chat Panel */
.chat-panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-item { font-size: 12px; line-height: 1.35; color: var(--ink-dim); }
.chat-item .time { font-size: 10px; color: #64748B; margin-right: 5px; }
.chat-item.kind-chat strong { color: var(--gold); }
.chat-item.kind-penta { color: var(--gold-text); font-weight: 700; }
.chat-item.kind-win { color: var(--emerald); font-weight: 700; }

.chat-form { display: flex; gap: 6px; }
.chat-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-size: 12px;
}

/* Scorecard Panel */
.scorecard-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scorecard-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.score-table th, .score-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.score-table th:first-child, .score-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-panel);
  z-index: 2;
}

.score-table thead th {
  font-size: 12px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.col-active { background: rgba(234, 179, 8, 0.08) !important; }
.col-active-head { color: var(--gold); border-bottom-color: var(--gold) !important; }

.cat-name-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-name { font-weight: 600; color: var(--ink); display: inline; }
.cat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-dim);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}
.cat-info-btn:hover, .cat-info-btn:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
  outline: none;
}
.score-tip-pop {
  position: fixed;
  z-index: 260;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold);
  background: var(--bg-panel);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
}

.row-summary td { background: var(--bg-elevated); font-weight: 700; color: var(--ink); }

.row-grand td {
  background: rgba(234, 179, 8, 0.14);
  font-weight: 900;
  font-size: 14px;
  color: var(--gold);
  border-top: 2px solid var(--gold);
  border-bottom: none;
}

.score-filled { font-weight: 800; color: var(--ink); }
.score-zero { color: #64748B; font-weight: 600; }

.score-pick-btn {
  width: 100%;
  min-width: 54px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(16, 185, 129, 0.6);
  background: var(--emerald-soft);
  color: var(--emerald);
  font-size: 12px;
  font-weight: 800;
  transition: all 0.12s ease;
}

.score-pick-btn:hover { background: var(--emerald); color: #06281E; border-style: solid; }
.score-pick-btn.zero-opt { border-color: rgba(148, 163, 184, 0.35); background: rgba(148, 163, 184, 0.08); color: var(--ink-dim); }
.score-pick-btn.zero-opt:hover { background: var(--crimson); color: #fff; border-color: var(--crimson); }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  max-height: 92vh;
  overflow-y: auto;
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-entry { max-width: 450px; }
.modal-finished { max-width: 500px; text-align: center; }
.modal-rules { max-width: 580px; }

.entry-head { text-align: center; margin-bottom: 16px; }
.entry-head h1 { margin: 4px 0; font-size: 30px; color: var(--gold); }

.entry-form { display: flex; flex-direction: column; gap: 11px; }
.entry-form label span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-dim); margin-bottom: 5px; }
.entry-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-size: 14px;
}

.register-extra { display: flex; flex-direction: column; gap: 11px; }
.room-row { display: flex; gap: 8px; }

.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.modal-head h2 { margin: 2px 0 0; font-size: 20px; }
.modal-footer, .modal-footer-row { display: flex; justify-content: center; margin-top: 16px; }

.podium-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; text-align: left; }
.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.podium-row.rank-1 { border-color: var(--gold); background: var(--gold-soft); }
.podium-rank { font-size: 18px; font-weight: 900; margin-right: 10px; }
.podium-score { font-size: 18px; font-weight: 900; color: var(--gold); text-align: right; }
.podium-pts { font-size: 11px; color: var(--emerald); font-weight: 700; }

.rules-content h3 { margin: 12px 0 6px; font-size: 14px; color: var(--gold); }
.rules-content ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--ink-dim); }

/* Reactions & Toasts */
.reaction-layer { position: fixed; bottom: 90px; left: 220px; pointer-events: none; z-index: 240; }

.float-react {
  position: absolute;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  animation: reactFloat 1.5s ease forwards;
}

@keyframes reactFloat {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -10px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -75px) scale(0.95); }
}

.toast-wrap {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: 13px;
}
.toast.error { border-color: var(--crimson); color: var(--crimson); }
.toast.info { border-color: var(--gold); color: var(--gold); }

.arc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: #111827;
  font-size: 10px;
  font-weight: 900;
}

.prof-email-box {
  font-size: 12px;
  color: var(--ink-dim);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
}

.modal-archive { max-width: 680px; }
.subhead { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold); }

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.archive-ms-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
}
.archive-ms-card.ready { border-color: var(--gold); background: var(--gold-soft); }
.archive-ms-card.claimed { border-color: rgba(16, 185, 129, 0.35); opacity: 0.85; }

.archive-matches {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
}

.archive-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
}

.btn-claim {
  padding: 6px 11px;
  border-radius: 6px;
  border: none;
  background: var(--gold);
  color: #111827;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.btn-claim:disabled {
  background: var(--bg-shell);
  color: var(--ink-dim);
  border: 1px solid var(--border);
  cursor: default;
}

.invite-banner {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold-text);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

/* Main Hub View */
.hub-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  animation: viewFade 0.2s ease;
}

.hub-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  align-items: start;
}

.hub-left-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hub-right-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.hub-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hub-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.hub-card-head h2, .hub-card-head h3 { margin: 2px 0 0; }

.hub-list { display: flex; flex-direction: column; gap: 8px; }

.hub-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
}
.hub-room-row.is-waiting-open {
  border-color: rgba(16, 185, 129, 0.45);
}
.rooms-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--ink-dim);
}
.rooms-open-dot {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: var(--emerald-soft);
  color: var(--emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.35);
  vertical-align: middle;
}
.hub-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.hub-page-nums {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.page-btn {
  padding: 5px 10px;
  min-width: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--gold); }
.page-btn.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-text);
}
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-info {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-dim);
  white-space: nowrap;
}

.mode-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-pill {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
}
.mode-pill.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}
.mode-pill:disabled { opacity: 0.6; cursor: not-allowed; }

.lobby-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.card-action-bar {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nudge-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nudge-cell { display: flex; gap: 3px; justify-content: center; }
.nudge-btn {
  flex: 1;
  padding: 4px 2px;
  border-radius: 5px;
  border: 1px solid var(--gold);
  background: var(--bg-shell);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}
.nudge-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.copy-grid { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }

.market-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 2px solid var(--tb);
  background: var(--tp);
  flex-shrink: 0;
}

.rule-checks-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.rule-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.rule-check input { width: auto; accent-color: var(--gold); }
.rule-check small { color: var(--ink-dim); font-weight: 400; }

.spectator-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.45);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.tag-league {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-shell);
  border: 1px solid var(--border);
  margin-left: 5px;
}
.tag-ko {
  display: inline-block;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--crimson);
  border: 1px solid rgba(239, 68, 68, 0.4);
  margin-left: 4px;
}
.col-eliminated { opacity: 0.5; }

.special-banner.card-pop { animation: cardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.score-filled.just-scored, .score-zero.just-scored {
  display: inline-block;
  animation: scorePop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--emerald);
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 95;
  animation: confettiFall 1.4s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes viewFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardPop {
  0% { opacity: 0; transform: scale(0.92); }
  65% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes scorePop {
  0% { transform: scale(1.6); }
  100% { transform: scale(1); }
}
@keyframes goldPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); box-shadow: 0 0 14px rgba(245, 158, 11, 0.5); }
  100% { transform: scale(1); }
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--tx, 0px), var(--ty, 180px)) rotate(var(--rot, 360deg)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.match-rule-banner {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--emerald);
  color: #A7F3D0;
}
.mini-link-btn {
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.38);
  color: #FEF08A;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
.felt-color-hint {
  text-align: center;
  font-size: 11px;
  color: rgba(248, 250, 252, 0.55);
  user-select: none;
}

.themes-panel {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.modal-loadout { max-width: 620px; }
.loadout-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.loadout-slot {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px dashed var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--ink-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.loadout-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  color: var(--ink);
  background: rgba(234, 179, 8, 0.08);
}
.loadout-pool {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.loadout-card-btn {
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.loadout-card-btn:hover { border-color: var(--gold); }
.loadout-card-btn.selected {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
}

@media (max-width: 1120px) {
  .game-grid { grid-template-columns: 340px 1fr; gap: 10px; padding: 10px; }
  .hub-grid { grid-template-columns: 340px 1fr; }
}

@media (max-width: 780px) {
  .app-shell { height: auto; min-height: 100vh; min-height: 100dvh; overflow-y: auto; overflow-x: clip; max-width: 100%; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: calc(6px + env(safe-area-inset-top)) 10px 7px;
  }
  .topbar-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    order: 1;
  }
  .topbar-left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .topbar-utils {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }
  .topbar-nav {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: 100%;
  }
  .pill-btn, .round-pill, .turn-pill, .points-pill { padding: 4px 8px; font-size: 11px; min-height: 30px; }
  .icon-btn { min-height: 32px; min-width: 32px; }
  .react-btn { min-height: 38px; min-width: 38px; }
  .lang-select { height: 30px; padding: 0 6px; font-size: 11px; }

  input[type="text"], input[type="password"], input[type="email"] { font-size: 16px; }

  .hub-view { padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); }
  .lobby-view { padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); }
  .hub-grid, .game-grid, .market-grid, .archive-grid, .ach-grid, .loadout-pool { grid-template-columns: minmax(0, 1fr); }
  .game-grid { padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); gap: 10px; max-width: 100%; }
  .left-col { display: contents; }
  .spectator-banner { order: 0; min-width: 0; max-width: 100%; }
  .felt-tray { order: 1; padding: 10px 10px; gap: 8px; min-width: 0; max-width: 100%; }
  .felt-tray > *, .turn-cards-wrap, .team-score-bar { min-width: 0; max-width: 100%; }
  .die-btn { min-width: 0; }
  .scorecard-panel { order: 2; padding: 10px; min-width: 0; max-width: 100%; }
  .scorecard-scroll { max-height: none; overflow-x: auto; overflow-y: visible; }
  .chat-panel { order: 3; max-height: 230px; min-height: 170px; min-width: 0; max-width: 100%; }

  #btn-roll { min-height: 46px; font-size: 15px; }
  .turn-card-chip { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  .nudge-btn { min-height: 36px; }
  .score-pick-btn { min-height: 38px; padding: 6px 10px; font-size: 13px; }
  .prof-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-card { padding: 16px; width: 100%; max-width: 100%; overflow-x: hidden; }
}

@media (max-width: 600px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 90dvh;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 480px) {
  .brand { font-size: 15px; }
  .dice-row { gap: 5px; padding: 4px 0 6px; }
  .die-btn { padding: 4px; border-radius: 10px; }
  .score-table th, .score-table td { padding: 5px 6px; font-size: 12px; }
  .cat-hint { display: none; }
  .tray-controls { flex-wrap: wrap; }
  .react-bar { width: 100%; justify-content: space-between; }
  .react-btn { flex: 1; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .lobby-actions { flex-direction: column; align-items: stretch; }
  .modal-footer-row { flex-wrap: wrap; }
  .archive-ms-card, .archive-match-row { flex-direction: column; align-items: flex-start; }
  .loadout-slots { grid-template-columns: 1fr; }
  .reaction-layer { left: 50%; }
}

/* Report & Admin Panel Styles */
.admin-nav-btn { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.08); }
.btn-report-mini {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1.2;
}
.btn-report-mini:hover { border-color: var(--crimson); color: var(--crimson); }
.chat-item { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.chat-item-body { flex: 1; min-width: 0; word-break: break-word; }
.chat-item.flagged { background: rgba(239, 68, 68, 0.08); border-left: 2px solid var(--crimson); padding-left: 6px; border-radius: 4px; }
.chat-flag-btn { flex-shrink: 0; opacity: 0.72; }
.chat-flag-btn:hover { opacity: 1; }
.report-quote {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border-left: 3px solid var(--crimson);
  font-size: 12px;
  word-break: break-word;
}
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
select {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}

.modal-admin { max-width: 900px; width: 96%; max-height: 90vh; overflow-y: auto; }
.modal-profile { max-width: 780px; width: 96%; max-height: 90vh; overflow-y: auto; }
.admin-tabs-4 { grid-template-columns: repeat(4, 1fr); }
.admin-tabs-5 { grid-template-columns: repeat(5, 1fr); }
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.admin-kpi-card {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-kpi-card strong { font-size: 18px; color: var(--gold); }
.admin-kpi-card span { font-size: 11px; color: var(--ink-dim); }
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
}
.admin-user-row, .admin-report-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-user-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-user-row.is-banned { border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.06); }
.admin-user-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.admin-edit-panel {
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--gold);
}
.admin-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.admin-inv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.admin-inv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 11px;
}
.admin-inv-item input { width: 56px; padding: 4px 6px; font-size: 12px; }
.tag-admin, .tag-banned, .tag-status {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.tag-admin { background: rgba(16, 185, 129, 0.16); color: #047857; border: 1px solid rgba(16, 185, 129, 0.4); }
.tag-banned { background: rgba(239, 68, 68, 0.16); color: #DC2626; border: 1px solid rgba(239, 68, 68, 0.45); }
.tag-status.open { background: rgba(245, 158, 11, 0.18); color: #B45309; }
.tag-status.info { background: rgba(239, 68, 68, 0.16); color: #DC2626; }
.tag-status.resolved { background: rgba(16, 185, 129, 0.16); color: #047857; }
.tag-status.dismissed { background: rgba(100, 116, 139, 0.16); color: var(--ink-dim); }
.admin-report-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-report-foot input { flex: 1; min-width: 140px; padding: 6px 8px; font-size: 12px; }
.btn-danger-sm {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #DC2626;
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 780px) {
  .admin-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-tabs-4 { grid-template-columns: repeat(2, 1fr); }
  .admin-tabs-5 { grid-template-columns: repeat(2, 1fr); }
  .admin-edit-grid, .admin-inv-grid, .appearance-grid { grid-template-columns: 1fr; }
  .admin-user-row { flex-direction: column; align-items: flex-start; }
  .site-footer { padding: 10px 10px; }
  .footer-inner { flex-direction: column; gap: 6px; }
  .footer-links { justify-content: center; }
  .guide-cards-grid { grid-template-columns: 1fr; }
}

/* Site Footer */
.site-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}
.footer-inner {
  width: 100%;
  max-width: 1120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  text-align: center;
}
.footer-brand {
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.footer-dot { opacity: 0.45; }
.footer-brand .muted { font-weight: 500; font-size: 11px; margin: 0; }
.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-dim);
  font-size: 11.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.footer-link:hover { border-color: var(--gold); color: var(--ink); }

/* Coupons & Guide Docs */
.coupon-redeem-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.coupon-redeem-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-size: 13.5px;
}
#coupon-code-input {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.coupon-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
}
.coupon-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.coupon-card.is-claimed { border-color: rgba(16, 185, 129, 0.4); opacity: 0.85; }
.coupon-card.is-inactive { opacity: 0.65; }
.coupon-code-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gold-soft);
  border: 1px dashed var(--gold);
  color: var(--gold-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.coupon-reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.coupon-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-shell);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}
.guide-section { max-height: 54vh; overflow-y: auto; padding-right: 2px; }
.guide-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.guide-card-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
}
.entry-form select,
.entry-form textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-shell);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
}

/* Friends, Invites & Inbox */
.modal-friends, .modal-invite { max-width: 600px; }
.modal-inbox { max-width: 780px; }
.presence-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.presence-dot.is-lobby { background: var(--emerald); box-shadow: 0 0 6px rgba(16, 185, 129, 0.55); }
.presence-dot.is-playing { background: #F59E0B; }
.presence-dot.is-offline { background: #64748B; opacity: 0.6; }

.invitee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
}
.invitee-row input[type="checkbox"] { width: auto; accent-color: var(--gold); }

.inbox-dm-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 10px;
  min-height: 290px;
}
.dm-peers-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 2px;
}
.dm-peer-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  text-align: left;
  font-size: 12.5px;
}
.dm-peer-btn.active { border-color: var(--gold); background: var(--gold-soft); }
.dm-chat-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.dm-chat-head {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}
.dm-messages-box {
  flex: 1;
  min-height: 200px;
  max-height: 36vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-shell);
  border: 1px solid var(--border);
}
.dm-bubble {
  max-width: 82%;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12.5px;
  align-self: flex-start;
  word-break: break-word;
}
.dm-bubble.is-mine {
  align-self: flex-end;
  background: var(--gold-soft);
  border-color: rgba(234, 179, 8, 0.45);
}
.dm-bubble .dm-time {
  display: block;
  font-size: 10px;
  color: var(--ink-dim);
  margin-top: 3px;
  text-align: right;
}
.notif-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.notif-row.is-unread {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.live-invite-wrap {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  width: calc(100% - 32px);
}
.live-invite-card {
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1.5px solid var(--gold);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: modalIn 0.2s ease;
}

@media (max-width: 780px) {
  .inbox-dm-layout { grid-template-columns: 1fr; }
  .dm-peers-col { max-height: 130px; }
  .hide-xs { display: none; }
}

/* General Lobby Chat & Unified Profile Appearance */
.lobby-chat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lobby-chat-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  height: 240px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.lchat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}
.lchat-msg.is-mine {
  border-color: rgba(240, 194, 75, 0.45);
  background: var(--gold-soft);
}
.lchat-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
}
.lchat-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}
.lchat-lvl {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-shell);
  border: 1px solid var(--border);
  color: var(--gold);
}
.lchat-time {
  font-size: 10px;
  color: var(--ink-dim);
}
.lchat-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lchat-act-btn {
  padding: 1px 6px;
  font-size: 10.5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-dim);
}
.lchat-act-btn:hover { border-color: var(--gold); color: var(--ink); }
.lchat-body {
  font-size: 13px;
  line-height: 1.38;
  word-break: break-word;
}
.lobby-chat-lock {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.prof-level-card {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prof-level-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.xp-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--bg-shell);
  border: 1px solid var(--border);
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
  transition: width 0.25s ease;
}
.appearance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.appearance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.appearance-card strong { display: block; font-size: 13.5px; }
.appearance-card .muted { font-size: 11.5px; margin-top: 2px; }
.appearance-toggle-btn { white-space: nowrap; flex-shrink: 0; font-weight: 700; }
@media (max-width: 780px) {
  .appearance-grid { grid-template-columns: 1fr; }
  .appearance-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .appearance-toggle-btn { width: 100%; }
  .reconnect-meta { flex-direction: column; align-items: stretch; }
}

.reconnect-card {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.reconnect-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hub-room-row.is-reconnect {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.tag-dc {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.45);
}

/* Clickable Player Profile Links, Modal & Start Countdown */
.player-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
}
.player-profile-link:hover {
  color: var(--gold);
  text-decoration: underline;
}
.modal-player-card {
  max-width: 480px;
  width: 95%;
}
.pc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-bottom: 12px;
}
.pc-avatar {
  font-size: 38px;
  line-height: 1;
  flex-shrink: 0;
}
.pc-meta {
  min-width: 0;
  flex: 1;
}
.pc-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.lobby-countdown-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
}
.scroll-top-btn {
  position: fixed;
  right: 16px;
  bottom: 54px;
  z-index: 65;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #CA8A04;
  background: #EAB308;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.scroll-top-btn:hover { background: #FACC15; transform: translateY(-2px); }
[data-ui-theme="dark"] .scroll-top-btn {
  background: #F59E0B;
  color: #09090B;
  border-color: #D97706;
}
.lchat-prune-note {
  font-size: 11px;
  margin: -4px 0 0;
}
.lchat-msg.is-bot {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.1);
}
.game-quick-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.game-quick-actions button {
  flex: 1 1 auto;
  padding: 6px 10px;
  font-size: 12px;
}
