/* Squid Arena — Playful Cute UI (Inspired by Quiz.com) */

:root {
  --bg: #FBF7ED;
  --bg-elevated: #FFFFFF;
  --bg-banner: #EFE3CE;
  --card: #FFFFFF;
  --card-strong: #FFFFFF;
  --card-dark: #1C4347;
  --border: #1E293B;
  --border-subtle: #E2E8F0;
  --border-strong: #0F172A;
  --text: #1E293B;
  --text-inverse: #FFFFFF;
  --muted: #64748B;
  --emerald: #05A36A;
  --emerald-light: #BEE88F;
  --emerald-glow: rgba(5, 163, 106, 0.2);
  --pink: #FF6B8B;
  --pink-light: #FFAAA6;
  --pink-glow: rgba(255, 107, 139, 0.2);
  --cyan: #0284C7;
  --cyan-light: #62D5E8;
  --cyan-glow: rgba(98, 213, 232, 0.2);
  --gold: #D97706;
  --gold-light: #FFD166;
  --gold-glow: rgba(255, 209, 102, 0.2);
  --slate: #475569;
  --radius: 18px;
  --radius-pill: 9999px;
  --font-sans: 'Be Vietnam Pro', 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Be Vietnam Pro', 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --neo-shadow: 0 4px 0 #1E293B;
  --neo-shadow-sm: 0 2px 0 #1E293B;
  --neo-shadow-lg: 0 6px 0 #1E293B;
  --surface-muted: #F8FAFC;
  --surface-sunken: #F1F5F9;
  --overlay: rgba(30, 41, 59, 0.55);
  --shadow-soft: 0 10px 24px rgba(30, 41, 59, 0.12);
}

/* Dark Mode Tokens (Playful Dark) */
[data-theme="dark"] {
  --bg: #0F172A;
  --bg-elevated: #1E293B;
  --bg-banner: #1E293B;
  --card: #1E293B;
  --card-strong: #263449;
  --card-dark: #0F172A;
  --border: #475569;
  --border-subtle: #334155;
  --border-strong: #94A3B8;
  --text: #F1F5F9;
  --text-inverse: #0F172A;
  --muted: #94A3B8;
  --emerald: #34D399;
  --emerald-light: #6EE7B7;
  --emerald-glow: rgba(52, 211, 153, 0.25);
  --pink: #FB7185;
  --pink-light: #FDA4AF;
  --pink-glow: rgba(251, 113, 133, 0.25);
  --cyan: #38BDF8;
  --cyan-light: #7DD3FC;
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --gold: #FBBF24;
  --gold-light: #FDE68A;
  --gold-glow: rgba(251, 191, 36, 0.25);
  --slate: #CBD5E1;
  --neo-shadow: 0 4px 0 #020617;
  --neo-shadow-sm: 0 2px 0 #020617;
  --neo-shadow-lg: 0 6px 0 #020617;
  --surface-muted: #263449;
  --surface-sunken: #111C2E;
  --overlay: rgba(2, 6, 23, 0.72);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .glass-card {
  box-shadow: 0 4px 0 #020617, 0 10px 28px rgba(0, 0, 0, 0.45);
  border-color: #334155;
}

[data-theme="dark"] .join-card {
  border-color: #475569 !important;
  box-shadow: 0 4px 0 #020617, 0 16px 36px rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] .join-card .pin-input {
  border-color: #475569 !important;
  box-shadow: 0 3px 0 #020617 !important;
  background: #111C2E !important;
}

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

/* Global Typography & Elements */
button, input, select, textarea {
  font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Playful Cute Scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--bg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

body.modal-open {
  overflow: hidden !important;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

.arena-app,
.topbar,
.modal-overlay,
.host-command-center,
.host-setup-grid {
  position: relative;
  z-index: 1;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ── CHECKBOX & RADIO PARITY (Đồng bộ Quiz.com Cute Playful) ── */
input[type="checkbox"],
.checkbox-custom {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--neo-shadow-sm);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all 0.12s ease-in-out;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
}

input[type="checkbox"]:hover,
.checkbox-custom:hover {
  border-color: var(--emerald);
  background: var(--surface-muted);
}

input[type="checkbox"]:checked,
.checkbox-custom:checked {
  background: var(--emerald);
  border-color: var(--border);
  box-shadow: var(--neo-shadow-sm);
}

input[type="checkbox"]:checked::before,
.checkbox-custom:checked::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2.2px solid #0F172A;
  border-bottom: 2.2px solid #0F172A;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}

/* Mobile Viewport Lock during active match */
.arena-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Glass Card & Playful Containers */
.glass-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--neo-shadow), var(--shadow-soft);
}

/* Anti-Nested Cards: Bỏ khung lồng khung triệt để */
.glass-card .glass-card {
  background: var(--surface-muted);
  border: 2px solid var(--border-subtle);
  box-shadow: none;
}

/* Background Canvas */
.bg-canvas,
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--neo-shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: var(--surface-muted);
  transform: translateY(-2px);
  box-shadow: var(--neo-shadow-lg);
  color: var(--text);
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: var(--neo-shadow-sm);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  background: #E2E8F0 !important;
  border-color: #94A3B8 !important;
  color: #475569 !important;
  font-weight: 700 !important;
}

.btn-primary {
  background: #05A36A !important;
  border: 2px solid var(--border) !important;
  color: #FFFFFF !important;
  font-weight: 800 !important;
  box-shadow: var(--neo-shadow) !important;
}

.btn-primary:hover:not(:disabled) {
  background: #048858 !important;
  color: #FFFFFF !important;
  box-shadow: var(--neo-shadow-lg) !important;
  transform: translateY(-2px);
}

.btn-pink {
  background: #FF6B8B !important;
  border: 2px solid var(--border) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: var(--neo-shadow) !important;
}

.btn-pink:hover:not(:disabled) {
  background: #FB7185 !important;
  box-shadow: var(--neo-shadow-lg) !important;
  transform: translateY(-2px);
}

.btn-cyan {
  background: #0284C7 !important;
  border: 2px solid var(--border) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: var(--neo-shadow) !important;
}

.btn-cyan:hover:not(:disabled) {
  background: #38BDF8 !important;
  box-shadow: var(--neo-shadow-lg) !important;
  transform: translateY(-2px);
}

.btn-emerald {
  background: #05A36A !important;
  border: 2px solid var(--border) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: var(--neo-shadow) !important;
}

.btn-emerald:hover:not(:disabled) {
  background: #34D399 !important;
  box-shadow: var(--neo-shadow-lg) !important;
  transform: translateY(-2px);
}

.btn-gold {
  background: #D97706 !important;
  border: 2px solid var(--border) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: var(--neo-shadow) !important;
}

.btn-gold:hover:not(:disabled) {
  background: #F59E0B !important;
  box-shadow: var(--neo-shadow-lg) !important;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  padding: 14px 22px;
  font-size: 16px;
  width: 100%;
}

.input,
.select {
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card) !important;
  color: var(--text) !important;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  box-shadow: 0 2px 0 rgba(30, 41, 59, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.select:focus {
  border-color: #05A36A;
  box-shadow: 0 0 0 3px rgba(5, 163, 106, 0.2);
}

.select option {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
}

.badge-emerald {
  color: #0F172A;
  border-color: var(--border);
  background: #BEE88F;
}

.badge-cyan {
  color: #0F172A;
  border-color: var(--border);
  background: #62D5E8;
}

.badge-pink {
  color: #0F172A;
  border-color: var(--border);
  background: #FFAAA6;
}

.badge-gold {
  color: #0F172A;
  border-color: var(--border);
  background: #FFD166;
}

/* Screen Containers */
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
}

.center-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
}

.join-card {
  width: 100%;
  max-width: 440px;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 2.5px solid var(--border);
  box-shadow: 0 6px 0 #1E293B, 0 16px 36px rgba(30, 41, 59, 0.08);
}

.join-card .input,
.join-card .select {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 0 rgba(30, 41, 59, 0.06);
}

.join-card .pin-input {
  padding: 10px 16px;
  font-size: 26px;
  letter-spacing: 0.35em;
  text-align: center;
  font-family: var(--font-mono, monospace);
  color: var(--text);
  background: var(--surface-sunken) !important;
  border: 2.5px solid var(--border) !important;
  border-radius: var(--radius-pill) !important;
  box-shadow: var(--neo-shadow) !important;
  height: 58px;
}
.join-card .pin-input::placeholder {
  color: var(--pink);
  opacity: 0.7;
}

.join-card .auth-mode-tabs {
  margin-bottom: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: 2px solid var(--border);
}

.join-card .auth-tab-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.join-card .auth-tab-btn.active {
  background: var(--card);
  color: var(--text);
  border: none;
  box-shadow: 0 2px 4px rgba(30, 41, 59, 0.12);
}

.join-card .btn-lg {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  height: 50px;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.brand-logo {
  width: 130px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.08));
}

.brand-logo-img {
  width: 100%;
  max-width: 130px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.16));
  border-radius: 12px;
}

.brand-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-sub {
  margin: 0;
  font-size: 10.5px;
  color: var(--muted);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pin-input {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.24em;
  font-variant-numeric: tabular-nums;
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  font-size: 13px;
}

/* Lobby Screen */
.lobby-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lobby-hero {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pin-pill {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--emerald);
  text-shadow: 0 0 18px var(--emerald-glow);
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 820px) {
  .lobby-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.panel-box {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

.player-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--neo-shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  max-width: 100%;
}

.player-chip:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 0 #1E293B;
}

.player-chip.is-me {
  background: #BEE88F;
  border-color: #1E293B;
  color: #1E293B;
  box-shadow: 0 2px 0 #1E293B;
}

.player-chip-slot {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

.player-chip.is-me .player-chip-slot {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.3);
}

.player-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.round-roadmap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roadmap-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 13px;
}

.roadmap-item.is-active {
  border-color: rgba(6, 182, 212, 0.6);
  background: rgba(6, 182, 212, 0.1);
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.countdown-card {
  width: 100%;
  max-width: 460px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--card) !important;
  border: 2px solid var(--border) !important;
  box-shadow: var(--neo-shadow-lg) !important;
}

.countdown-number {
  font-size: 84px;
  font-weight: 900;
  line-height: 1;
  color: var(--emerald);
  text-shadow: 0 4px 0 var(--border);
  animation: countdownPulse 0.85s ease-out infinite;
}

@keyframes countdownPulse {
  0% { transform: scale(0.86); opacity: 0.65; }
  45% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 0.95; }
}

.countdown-briefing-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-sunken);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
}

.briefing-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.briefing-icon {
  font-size: 15px;
  line-height: 1.4;
  flex-shrink: 0;
}

.briefing-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.briefing-content strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
  margin-right: 4px;
  white-space: nowrap;
}

.briefing-text {
  color: var(--text);
  font-weight: 600;
}

/* Arena Permanent Left Guide Box */
.arena-guide-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-rows-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-item-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.guide-label-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.guide-item-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.btn-opt-quick {
  padding: 2px 7px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-opt-quick:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Arena Screen — Mobile First (< 960px) & PC 3-Column (>= 960px) */
.arena-screen {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.arena-hud {
  height: 52px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 20;
}

.hud-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.hud-timer {
  justify-self: center;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--cyan);
  padding: 2px 14px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-sm);
  text-align: center;
}

.hud-timer.is-urgent {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.65);
  animation: timerBlink 0.7s ease-in-out infinite;
}

@keyframes timerBlink {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.progress-strip {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress-strip-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
  transition: width 0.2s ease;
}

.arena-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

/* Mobile First (< 960px): Ẩn 2 cột phụ trên thiết bị di động */
@media (max-width: 959.98px) {
  .arena-left-col,
  .arena-right-col {
    display: none !important;
  }
}

.arena-left-col .panel-box {
  padding: 12px 14px;
  gap: 8px;
}

.arena-left-col .stats-mini-grid {
  gap: 6px;
}

.arena-left-col .stat-tile {
  padding: 6px 8px;
}

.arena-left-col .guide-input-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 5px 8px;
  min-height: auto;
}

.arena-left-col .guide-input-keys {
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  white-space: normal;
}

.arena-left-col .mouse-badge,
.arena-left-col .touch-badge {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.arena-center-col {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.game-stage {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.game-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: none;
}

.mobile-bottom-bar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-elevated);
  border-top: 2px solid var(--border);
  z-index: 20;
}

.mobile-only {
  display: inline-flex;
}

/* Quick guidance bar (mobile & tablet only; PC uses the left column) */
.arena-stage-hud-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  flex-shrink: 0;
  background: rgba(14, 24, 20, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  line-height: 1.35;
  min-width: 0;
}

.arena-stage-hud-guide > div {
  min-width: 0;
  overflow: hidden;
}

.arena-stage-hud-guide > div > span:first-child {
  white-space: nowrap;
  flex-shrink: 0;
}

#stage-quick-rule {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* PC 3-Column Layout (>= 960px) */
@media (min-width: 960px) {
  .arena-hud {
    padding: 0 24px;
    height: 58px;
  }

  .hud-game-title {
    font-size: 15px;
  }

  .arena-body {
    position: relative;
    z-index: 1;
    display: grid !important;
    grid-template-columns: 280px minmax(360px, 1fr) 340px;
    justify-content: stretch;
    align-items: stretch;
    gap: 18px;
    padding: 16px 20px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .arena-left-col {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    min-height: 0;
    height: 100%;
    padding: 2px 4px 6px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
    visibility: visible;
    opacity: 1;
  }

  .arena-right-col {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 340px;
    min-width: 340px;
    max-width: 340px;
    min-height: 0;
    height: 100%;
    padding: 2px 4px 6px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
    visibility: visible;
    opacity: 1;
  }

  .arena-center-col {
    display: flex !important;
    flex-direction: column !important;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--card);
    box-shadow: var(--neo-shadow);
    width: 100%;
    min-width: 0;
    min-height: 0 !important;
    height: 100% !important;
    position: relative;
    overflow: hidden;
  }

  /* Ẩn thanh quick guide trên PC vì cột trái đã hiển thị đầy đủ cẩm nang & phím tắt */
  .arena-stage-hud-guide {
    display: none !important;
  }

  .mobile-bottom-bar,
  .mobile-only {
    display: none !important;
  }
}

/* Bottom Sheet Top Drawer (Mobile) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.top-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-height: 76dvh;
  border-radius: 12px 12px 0 0;
  background: var(--card-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-strong);
  padding: 14px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(105%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.top-drawer.is-open {
  transform: translateY(0);
}

.drawer-handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  margin: 0 auto 4px;
}

/* Leaderboard & Stats */
.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  padding: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-tile-label {
  font-size: 11px;
  color: var(--muted);
}

.stat-tile-val {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.lb-row.is-me {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.12);
}

.lb-row.is-passed {
  border-color: rgba(16, 185, 129, 0.3);
}

.lb-row.is-eliminated {
  opacity: 0.55;
}

.lb-rank {
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-row:nth-child(2) .lb-rank { color: #e2e8f0; }
.lb-row:nth-child(3) .lb-rank { color: #fb923c; }

.lb-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.lb-metric {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Memory 3D Card Flip CSS (also complements memory.canvas.js) */
.mem-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}

.mem-grid {
  display: grid;
  gap: var(--mem-gap, 10px);
  width: var(--mem-grid-w, 100%);
  height: var(--mem-grid-h, auto);
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  perspective: 1000px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.mem-card {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.mem-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 12px;
}

.mem-card.is-flipped .mem-card-inner {
  transform: rotateY(180deg);
}

.mem-card.is-matched .mem-card-front {
  border-color: var(--emerald);
  box-shadow: 0 0 18px var(--emerald-glow);
}

.mem-card.is-mismatch {
  animation: memMismatchShake 0.36s ease-in-out;
}

@keyframes memMismatchShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Result / Spectator / Podium */
.result-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-banner {
  padding: 26px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-lg), var(--shadow-soft);
}

.result-banner.is-passed {
  border-color: var(--border);
  box-shadow: var(--neo-shadow-lg), 0 10px 25px rgba(5, 163, 106, 0.15);
}

.result-banner.is-eliminated {
  border-color: var(--border);
  box-shadow: var(--neo-shadow-lg), 0 10px 25px rgba(225, 29, 72, 0.15);
}

.is-glitch {
  animation: eliminationGlitch 0.48s steps(2, end) 2;
}

/* Screen Shake Effect */
.is-shaking {
  animation: screenShake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-2px, 1px, 0); }
  20%, 80% { transform: translate3d(3px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 2px, 0); }
  40%, 60% { transform: translate3d(3px, -1px, 0); }
}

/* Card Success Flash Glow */
.is-flashing {
  animation: cardFlashGlow 0.5s ease-out;
}

@keyframes cardFlashGlow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50% { box-shadow: 0 0 28px 4px rgba(16, 185, 129, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Screen Transition Animation */
.screen:not(.hidden) {
  animation: screenFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: scale(0.985) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Floating Sound & Music HUD Audio Panel with Volume Slider */
.hud-audio-panel {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
  box-shadow: var(--neo-shadow-sm), var(--shadow-soft);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.hud-bgm-next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.hud-bgm-next-btn:hover {
  background: var(--surface-sunken);
  border-color: var(--border);
  transform: scale(1.06);
}

/* Mobile HUD adjustments to prevent header elements from crowding/breaking */
@media (max-width: 520px) {
  .hud-game-title {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .hud-audio-panel {
    bottom: 12px;
    right: 12px;
  }

  .arena-hud {
    height: 48px;
    padding: 4px 8px;
    gap: 6px;
  }

  .hud-left {
    gap: 4px;
    min-width: 0;
    flex-shrink: 1;
  }

  .hud-brand {
    display: none;
  }

  .hud-round-pill {
    padding: 2px 5px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #hud-round {
    padding: 2px 6px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hud-game-title {
    font-size: 12px;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
  }

  #hud-quota {
    font-size: 11px;
    padding: 2px 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hud-timer {
    font-size: 16px;
    font-weight: 800;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hud-right {
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .hud-right #btn-open-guide,
  .hud-right #btn-mute,
  .hud-right #btn-open-drawer {
    padding: 0 6px;
    font-size: 11px;
    height: 28px;
    line-height: 28px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .hud-right #btn-open-guide {
    display: none !important; /* Trên mobile đã có thanh hướng dẫn và nút Chi Tiết ↗ */
  }

  /* Compact quick mobile guide inside game stage */
  .arena-stage-hud-guide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: rgba(14, 24, 20, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
    gap: 8px;
    flex-shrink: 0;
  }

  .arena-stage-hud-guide span:first-child {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Desktop: Ẩn nút #btn-mute trên topbar vì đã có Floating Sound HUD Audio Panel ở góc dưới */
.hud-right #btn-mute {
  display: none !important;
}

@media (max-width: 640px) {
  /* Mobile: Floating Sound HUD bị ẩn, lúc này mới hiện nút #btn-mute trên HUD topbar cạnh Top Live */
  .hud-right #btn-mute {
    display: inline-flex !important;
    padding: 0 8px;
    font-size: 13px;
    height: 30px;
    line-height: 30px;
    white-space: nowrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
  }
}

.hud-audio-panel:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.hud-sound-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.hud-sound-btn:hover {
  transform: scale(1.08);
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}

.hud-sound-btn.is-muted {
  color: var(--muted);
  border-color: var(--border-subtle);
  background: var(--surface-sunken);
}

.hud-theme-btn {
  border-color: var(--border) !important;
}

.hud-volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  padding: 0;
  transition: max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, padding 0.2s ease;
}

.hud-audio-panel:hover .hud-volume-control,
.hud-audio-panel.is-expanded .hud-volume-control {
  max-width: 210px;
  opacity: 1;
  pointer-events: auto;
  padding: 0 10px 0 6px;
}

.hud-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 60px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-subtle);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.hud-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 2px var(--border);
  cursor: pointer;
  transition: transform 0.15s;
}

.hud-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.hud-volume-label {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  min-width: 32px;
  text-align: right;
  letter-spacing: -0.5px;
}

.hud-audio-panel.is-muted .hud-volume-label {
  color: var(--muted);
}
.hud-audio-panel.is-muted .hud-volume-slider {
  opacity: 0.4;
}

@media (max-width: 640px) {
  .hud-audio-panel {
    display: none !important;
  }
  .hud-sound-btn {
    width: 30px;
    height: 30px;
  }
  .hud-volume-slider {
    width: 46px;
  }
  .hud-volume-control {
    padding: 0 6px 0 0;
    gap: 6px;
  }
  .hud-volume-label {
    font-size: 10px;
    min-width: 26px;
  }

  /* Host Command Center Mobile Fixes */
  .host-shell {
    padding: 10px 8px 30px;
  }

  .host-pin-block {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .host-qr-img {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
  }

  .host-command-header-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 12px;
  }

  .cmd-share-btn-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .cmd-share-btn-row .btn {
    flex: 1 1 calc(50% - 6px);
    white-space: nowrap;
    padding: 4px 8px;
    font-size: 11.5px;
  }

  .host-stats-bar {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .host-control-deck {
    flex-wrap: wrap;
    gap: 8px;
  }

  .host-control-deck .btn {
    flex: 1 1 calc(50% - 8px);
    font-size: 12px;
    padding: 6px 10px;
  }

  .lobby-shell {
    padding: 12px 10px 24px;
  }

  .lobby-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
  }

  .lobby-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
}

@keyframes eliminationGlitch {
  0% { transform: translate(0, 0); filter: hue-rotate(0deg); }
  20% { transform: translate(-4px, 2px); filter: drop-shadow(3px 0 #f43f5e); }
  40% { transform: translate(4px, -2px); filter: drop-shadow(-3px 0 #06b6d4); }
  60% { transform: translate(-3px, -1px); filter: hue-rotate(25deg); }
  80% { transform: translate(3px, 2px); }
  100% { transform: translate(0, 0); filter: none; }
}

/* Podium Top 10 */
.podium-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin: 8px 0 14px;
}

.podium-pillar {
  padding: 14px 10px;
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.podium-pillar.rank-1 {
  order: 2;
  min-height: 168px;
  border-color: rgba(245, 158, 11, 0.75);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.22), rgba(16, 26, 23, 0.88));
  box-shadow: 0 0 28px var(--gold-glow);
  animation: podiumGlow 2.4s ease-in-out infinite;
}

.podium-pillar.rank-2 {
  order: 1;
  min-height: 138px;
  border-color: rgba(226, 232, 240, 0.45);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.18), rgba(16, 26, 23, 0.88));
}

.podium-pillar.rank-3 {
  order: 3;
  min-height: 120px;
  border-color: rgba(251, 146, 60, 0.5);
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.16), rgba(16, 26, 23, 0.88));
}

@keyframes podiumGlow {
  0%, 100% { box-shadow: 0 0 22px rgba(245, 158, 11, 0.28); }
  50% { box-shadow: 0 0 38px rgba(245, 158, 11, 0.52); }
}

.podium-medal {
  font-size: 24px;
  font-weight: 900;
}

.podium-name {
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.podium-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.podium-rest {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: auto;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--neo-shadow);
  animation: toastSlideIn 0.22s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-item.is-success {
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
  border-left: 6px solid #05A36A;
}

.toast-item.is-error {
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
  border-left: 6px solid #E11D48;
}

.toast-item.is-warn {
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
  border-left: 6px solid #D97706;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Host Command Center */
.host-shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.host-topbar {
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--card);
  border: 2px solid #1E293B;
  border-radius: var(--radius);
  box-shadow: 0 4px 0 #1E293B;
}

.host-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.host-status-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  border: 2px solid var(--border);
  background: var(--surface-muted);
  box-shadow: var(--neo-shadow-sm);
  white-space: nowrap;
}

.host-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: var(--neo-shadow-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.host-topbar-btn:hover {
  background: var(--surface-muted);
  transform: translateY(-1.5px);
  box-shadow: var(--neo-shadow);
  color: var(--text);
}

.host-topbar-btn:active {
  transform: translateY(1.5px);
  box-shadow: 0 1px 0 #1E293B;
}

.host-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 820px) {
  .host-setup-grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

.host-setup-sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.host-setup-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.rounds-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rounds-config-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rounds-config-list::-webkit-scrollbar {
  width: 6px;
}
.rounds-config-list::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}
.rounds-config-list::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.rounds-config-list::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.round-config-card {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--neo-shadow), var(--shadow-soft);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  color: var(--text);
}

.round-config-card:hover {
  box-shadow: var(--neo-shadow-lg);
  transform: translateY(-2px);
}

.round-config-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  align-items: start;
}

.jigsaw-upload-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(6, 182, 212, 0.35);
}

.jigsaw-preview-img {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--surface-sunken);
}

/* ── COMMAND CENTER BALANCED 3-ZONE HEADER ── */
.host-command-header-grid {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-sm);
}

@media (min-width: 860px) {
  .host-command-header-grid {
    grid-template-columns: minmax(380px, 1.25fr) 1fr minmax(380px, 1.15fr);
    align-items: center;
    gap: 16px;
  }
}

.cmd-zone-left {
  display: flex;
  align-items: center;
}

.cmd-qr-wrap {
  position: relative;
  cursor: pointer;
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.cmd-qr-wrap:hover {
  transform: scale(1.04);
}

.cmd-qr-wrap:hover .qr-zoom-hint {
  opacity: 1;
}

.qr-zoom-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--overlay);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.cmd-pin-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cmd-share-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.cmd-share-btn-row .btn {
  padding: 4px 10px;
  font-size: 11px;
}

.cmd-zone-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.cmd-pulse-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmd-timer-box {
  background: #FFF4E6;
  padding: 6px 20px;
  border-radius: 12px;
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

[data-theme="dark"] .cmd-timer-box {
  background: #263449;
}

.cmd-timer-box .hud-timer {
  font-size: 34px;
  font-weight: 900;
  color: #C2410C;
  line-height: 1;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .cmd-timer-box .hud-timer {
  color: var(--gold-light);
}

.cmd-game-current {
  font-size: 13px;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cmd-zone-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 420px;
}

.cmd-ops-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-ops-start {
  flex: 1.3;
  min-width: 130px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
  height: 38px;
  padding: 0 12px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cmd-ops-row .btn:not(.btn-ops-start) {
  flex: 1 1 auto;
  min-width: fit-content;
  height: 38px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cmd-ops-subrow {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.cmd-ops-subrow .btn {
  flex: 1 1 auto;
  min-width: fit-content;
  height: 32px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.host-pin-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.cmd-qr-wrap {
  position: relative;
  cursor: pointer;
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.host-qr-img {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #ffffff;
  padding: 4px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.cmd-pin-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.host-pin-huge {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--emerald);
  line-height: 1;
  text-shadow: 0 0 20px var(--emerald-glow);
}

.host-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.host-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.host-live-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 960px) {
  .host-live-grid {
    grid-template-columns: 1.35fr 0.65fr;
    align-items: stretch;
  }
}

.host-live-grid > .panel-box {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 280px;
}

.matrix-canvas-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 260px;
  border-radius: 12px;
  background: var(--surface-sunken);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
}

.matrix-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
}

/* Host V2: Custom Room Builder, Tabs, Matrix Hover, Modals, Player Table */
.tier-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tier-pill-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--neo-shadow-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.tier-pill-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
  transform: translateY(-1.5px);
  box-shadow: var(--neo-shadow);
}

.tier-pill-btn.is-selected {
  background: var(--emerald);
  border-color: var(--border);
  color: #0F172A;
  box-shadow: var(--neo-shadow);
}

.round-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.quota-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.matrix-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-sm), var(--shadow-soft);
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  transform: translate(12px, 12px);
  transition: opacity 0.1s ease;
}

.matrix-tooltip .tt-title {
  font-weight: 800;
  color: var(--emerald);
  margin-bottom: 2px;
}

.matrix-tooltip .tt-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.host-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 2px;
}

.host-tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px 12px 0 0;
  border: 2px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.host-tab-btn:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.host-tab-btn.is-active {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
  border-bottom: 2px solid var(--card);
  margin-bottom: -2px;
  box-shadow: 0 -3px 0 var(--emerald);
}

.host-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Modals */
.arena-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 8, 7, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.arena-modal-box {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: var(--neo-shadow-lg), var(--shadow-soft);
  padding: 0;
  display: flex;
  flex-direction: column;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.arena-modal-box .modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.arena-modal-box.modal-lg {
  max-width: 820px;
}

.arena-modal-box.modal-xl {
  max-width: 1040px;
  width: 96vw;
}

.history-match-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.history-match-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateX(2px);
}

.history-match-item.is-selected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

@media (max-width: 900px) {
  .history-modal-grid {
    grid-template-columns: 1fr !important;
  }
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border);
  background: var(--surface-muted) !important;
  color: var(--text);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.btn-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--neo-shadow-sm);
  transition: all 0.15s ease;
}

.btn-modal-close:hover {
  background: #E11D48;
  color: #FFFFFF;
  border-color: var(--border);
  transform: scale(1.05);
}

/* White QR Card */
.white-qr-card {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--neo-shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.white-qr-img {
  width: 280px;
  height: 280px;
  max-width: 100%;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #FFFFFF;
  padding: 8px;
  display: block;
}

.white-qr-pin {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--text);
  line-height: 1;
}

/* Player Directory Table */
.player-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: 0 2px 0 var(--border);
  scrollbar-width: thin;
}

.player-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  table-layout: fixed;
  color: var(--text);
}

.player-table th {
  padding: 10px 12px;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.player-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text);
}

.player-table tr:hover td {
  background: var(--surface-muted);
}

.player-table tr:last-child td {
  border-bottom: none;
}

.player-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  color: #ffffff;
  flex-shrink: 0;
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* Inspector Details */
.inspector-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.inspector-avatar-huge {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.inspector-field {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1.5px solid var(--border);
  box-shadow: var(--neo-shadow-sm);
}

.inspector-field-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 4px;
}

.inspector-field-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.inspector-round-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.round-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1.5px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

/* ========================================================
   PLAYER APP V2: OAUTH, PROFILE, AVATARS & IN-GAME GUIDE
   ======================================================== */

/* OAuth Login Bar */
.oauth-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* Auth Mode Segmented Tabs */
.auth-mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.auth-tab-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.auth-tab-pane {
  display: block;
}

.auth-tab-pane.hidden {
  display: none !important;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.6);
  box-shadow: none !important;
  transform: none !important;
}

.join-gate-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.join-gate-hint.is-ready {
  color: var(--emerald);
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.oauth-btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-oauth:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.btn-oauth.google:hover { border-color: rgba(66, 133, 244, 0.55); box-shadow: 0 0 12px rgba(66, 133, 244, 0.25); }
.btn-oauth.facebook:hover { border-color: rgba(24, 119, 242, 0.55); box-shadow: 0 0 12px rgba(24, 119, 242, 0.25); }
.btn-oauth.discord:hover { border-color: rgba(88, 101, 242, 0.55); box-shadow: 0 0 12px rgba(88, 101, 242, 0.25); }

.oauth-connected-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 12px;
}

/* Avatar Selector & Upload */
.avatar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview-display {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--emerald);
  box-shadow: 0 0 16px var(--emerald-glow);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-sunken);
  border: 2px solid var(--border-subtle);
  max-height: 140px;
  overflow-y: auto;
}

@media (max-width: 600px) {
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 160px;
  }
}

.avatar-option-btn {
  aspect-ratio: 1;
  padding: 4px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.avatar-option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.05);
}

.avatar-option-btn.is-selected {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.16);
  box-shadow: 0 0 10px var(--emerald-glow);
}

.prize-info-box {
  padding: 6px 12px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 3px solid var(--cyan);
  font-size: 12px;
  color: #a5f3fc;
  line-height: 1.45;
}

/* Rich Lobby Additions */
.lobby-invite-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .lobby-invite-box {
    flex-direction: column;
    align-items: stretch;
  }
}

.invite-link-pill {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-sunken);
  border: 2px solid var(--border-subtle);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roadmap-card-v2 {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 2px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}

.roadmap-card-v2.is-current {
  border-color: var(--cyan);
  background: rgba(98, 213, 232, 0.14);
  box-shadow: var(--neo-shadow-sm);
}

.roadmap-artwork-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

/* In-Game Guide Modal */
.guide-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.guide-card {
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid #1E293B;
  box-shadow: 0 8px 0 #1E293B, 0 24px 60px rgba(30, 41, 59, 0.15);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalScaleUp 0.2s ease;
  scrollbar-width: thin;
  color: #1E293B;
}

.guide-card::-webkit-scrollbar {
  width: 6px;
}

.guide-card::-webkit-scrollbar-track {
  background: transparent;
}

.guide-card::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.35);
  border-radius: 999px;
}

.guide-card::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.6);
}

.guide-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-controls-grid {
  display: block;
}

.guide-tab-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  height: 36px !important;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.guide-tab-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.5);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.guide-tab-btn.active {
  background: var(--cyan) !important;
  border-color: var(--cyan) !important;
  color: #03110d !important;
  font-weight: 800 !important;
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.6) !important;
}

.kbd-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-muted);
  border: 1.5px solid var(--border);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
}

.kbd-cap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  background: var(--surface-muted);
  border: 1.5px solid var(--border);
  border-bottom: 2.5px solid var(--border);
  border-radius: 6px;
  box-shadow: none;
  vertical-align: middle;
  line-height: 1;
}

.mouse-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.1);
  border: 1.5px solid rgba(2, 132, 199, 0.35);
  color: var(--cyan);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

.touch-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(5, 163, 106, 0.1);
  border: 1.5px solid rgba(5, 163, 106, 0.35);
  color: var(--emerald);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

.guide-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1.5px solid var(--border-subtle);
  font-size: 12.5px;
  min-height: 38px;
}

.guide-input-row:hover {
  background: var(--surface-sunken);
  border-color: var(--border);
}

.guide-input-action {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
  white-space: nowrap;
}

.guide-input-keys {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.guide-input-keys::-webkit-scrollbar {
  display: none;
}

@media (max-width: 640px) {
  .guide-input-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
  }
  .guide-input-keys {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Kicked Dialog */
.kicked-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.kicked-card {
  width: 100%;
  max-width: 440px;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--pink);
  box-shadow: var(--neo-shadow), var(--shadow-soft);
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalScaleUp 0.2s ease;
}

/* Universal Tooltip System (Đồng bộ Quiz.com Cute) */
.sa-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 280px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--card) !important;
  border: 2px solid var(--border) !important;
  box-shadow: var(--neo-shadow), var(--shadow-soft) !important;
  pointer-events: none;
  animation: fadeIn 0.12s ease-out;
}

.sa-tip-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--emerald) !important;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .sa-tip-title {
  color: #34D399 !important;
}

.sa-tip-body {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text) !important;
}

[data-theme="dark"] .sa-tip-body {
  color: #F8FAFC !important;
}

/* Universal Modal Architecture (Đồng bộ Quiz.com Cute) */
.guide-modal-backdrop,
.arena-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.guide-modal-sheet,
.arena-modal-card,
.arena-modal-box {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card) !important;
  border: 2px solid #1E293B;
  box-shadow: 0 8px 0 #1E293B, 0 24px 60px rgba(30, 41, 59, 0.15);
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #1E293B;
}

.guide-modal-sheet.modal-xl,
.arena-modal-card.modal-xl,
.arena-modal-box.modal-xl {
  max-width: 1180px;
  width: 96vw;
  height: 90vh;
  max-height: 920px;
}

.guide-modal-header,
.arena-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border);
  background: var(--surface-muted) !important;
  color: var(--text);
  flex-shrink: 0;
}

.guide-modal-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--border);
  background: var(--card);
  overflow-x: auto;
  flex-shrink: 0;
}

.guide-modal-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-modal-tab:hover {
  background: var(--surface-muted);
}

.guide-modal-tab.is-active {
  color: #0F172A;
  background: var(--emerald);
  border-color: var(--border);
  box-shadow: var(--neo-shadow-sm);
}

.guide-tab-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
  flex-shrink: 0;
}

.guide-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.guide-artwork-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 80px;
  overflow: hidden;
}

.guide-artwork-banner svg {
  height: 60px;
  width: auto;
  max-width: 100%;
}

.guide-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.guide-ctrl-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-ctrl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.guide-ctrl-key {
  font-weight: 700;
  color: var(--gold);
  min-width: 130px;
  flex-shrink: 0;
}

.guide-ctrl-desc {
  color: var(--muted);
}

.guide-callout {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 13px;
  color: var(--text);
}

.guide-tips {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.guide-tips li {
  line-height: 1.5;
}

/* ── Mobile Compact & Expandable Optimization (<= 640px) ── */
@media (max-width: 640px) {
  body {
    padding: 8px !important;
  }

  .glass-card {
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }

  .auth-mode-tabs {
    display: flex;
    gap: 4px;
  }

  .auth-tab-btn {
    padding: 8px 10px !important;
    font-size: 11.5px !important;
  }

  .oauth-btn-group {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .btn-oauth {
    padding: 9px 12px !important;
    font-size: 12.5px !important;
  }

  .field-row-2col {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Collapsible / Expandable details support */
  .mobile-compact-details summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: 12px;
  }

  .mobile-compact-details summary::-webkit-details-marker {
    display: none;
  }

  .mobile-compact-details summary::after {
    content: '▼';
    font-size: 9px;
    color: var(--cyan);
    transition: transform 0.15s ease;
  }

  .mobile-compact-details[open] summary::after {
    transform: rotate(180deg);
  }

  .host-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stat-tile {
    padding: 8px 10px !important;
  }

  .stat-tile-val {
    font-size: 18px !important;
  }

  .host-recent-rooms-box {
    padding: 8px !important;
  }
}

.host-recent-rooms-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
}

#btn-create-room {
  height: 46px;
  font-size: 14.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  border-radius: 10px;
}

#btn-clear-recent-rooms {
  font-size: 10.5px !important;
  padding: 2px 8px !important;
  height: 24px !important;
  border-radius: 6px !important;
  color: #f43f5e !important;
  border: 1px solid rgba(244, 63, 94, 0.35) !important;
  background: rgba(244, 63, 94, 0.08) !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.15s ease !important;
}

#btn-clear-recent-rooms:hover:not(:disabled) {
  color: #fff !important;
  border-color: #f43f5e !important;
  background: rgba(244, 63, 94, 0.28) !important;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.45) !important;
  transform: translateY(-1px);
}

.max-preset-btn {
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--muted) !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.15s ease !important;
}

.max-preset-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.max-preset-btn.is-active {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--emerald) !important;
  color: #34d399 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3) !important;
}

.btn-delete-round {
  transition: all 0.15s ease !important;
}

.btn-delete-round:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: #f43f5e !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.35) !important;
  transform: translateY(-1px);
}
