/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BOXES & LINES — Master Design System (style.css)
   Modern Glassmorphism, Neon Theme & Dynamic Animations
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

:root {
  /* Core Theme Colors */
  --bg-base:        #070a13;
  --bg-surface:     #0d1322;
  --bg-card:        rgba(17, 24, 39, 0.75);
  --bg-card-hover:  rgba(26, 36, 58, 0.85);
  --bg-glass:       rgba(255, 255, 255, 0.04);
  --border-subtle:  rgba(255, 255, 255, 0.09);
  --border-active:  rgba(167, 139, 250, 0.5);

  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent-purple:  #a78bfa;
  --accent-pink:    #f472b6;
  --accent-emerald: #34d399;
  --accent-blue:    #38bdf8;
  --accent-yellow:  #facc15;
  --accent-orange:  #fb923c;
  --accent-red:     #f87171;

  /* Typography */
  --font-sans:  'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Dimensions & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-height: 68px;

  /* Shadows & Glow */
  --shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 35px rgba(167, 139, 250, 0.25);
}

/* ── Reset & Baseline ────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  color: inherit;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Ambient Background Glows ────────────────────────── */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: orbFloat 14s ease-in-out infinite alternate;
}

.orb-1 {
  width: 650px;
  height: 650px;
  background: var(--accent-purple);
  top: -150px;
  left: -100px;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: var(--accent-pink);
  bottom: -150px;
  right: -80px;
  animation-delay: -5s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: var(--accent-emerald);
  top: 45%;
  left: 55%;
  transform: translate(-50%, -50%);
  animation-delay: -9s;
}

@keyframes orbFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.08) rotate(15deg); }
  100% { transform: translateY(20px) scale(0.95); }
}

/* ── Global Header Navigation ─────────────────────────── */
.global-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(8, 11, 20, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  outline: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.35));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-brand:hover .brand-icon {
  transform: scale(1.08) rotate(-4deg);
}

.brand-icon img {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.accent-amp {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.connection-status.offline {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

.retromafia-library-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  position: relative;
  white-space: nowrap;
}

.retromafia-library-btn .lib-icon {
  font-size: 1rem;
  line-height: 1;
}

.retromafia-library-btn .lib-text {
  color: #fbbf24;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.retromafia-library-btn .lib-arrow {
  color: #fbbf24;
  font-size: 0.88rem;
  font-weight: 800;
  transition: transform 0.2s ease;
}

.retromafia-library-btn:hover {
  border-color: #f59e0b;
  background: rgba(30, 41, 68, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.25), 0 0 10px rgba(245, 158, 11, 0.2);
}

.retromafia-library-btn:hover .lib-arrow {
  transform: translate(2px, -2px);
}

.retromafia-library-btn:active {
  transform: translateY(0);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

/* ── Screen Container Architecture ───────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  padding-top: calc(var(--nav-height) + 16px);
  padding-bottom: 30px;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

#screen-home.active,
#screen-join.active,
#screen-lobby.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: var(--nav-height);
  padding-bottom: 20px;
}

/* ── Generic Buttons & Utilities ─────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  box-shadow: 0 6px 20px rgba(167, 139, 250, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(167, 139, 250, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-active);
}

.btn-glow {
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.25);
}

.btn-danger-glass {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.btn-danger-glass:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: #f87171;
}

.btn-large {
  padding: 16px 36px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.hidden {
  display: none !important;
}

/* ════════════════════════════════════════════════════════
   1. HOME / HERO OPENING ANIMATIONS & STYLING
   ════════════════════════════════════════════════════════ */
@keyframes heroEntrance {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-anim-stagger-1 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.05s; }
.hero-anim-stagger-2 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.12s; }
.hero-anim-stagger-3 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.18s; }
.hero-anim-stagger-4 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.24s; }
.hero-anim-stagger-5 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.30s; }
.hero-anim-stagger-6 { animation: heroEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0.36s; }

.hero-container {
  max-width: 900px;
  width: 100%;
  margin: auto;
  padding: 10px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Hero Logo Showcase */
.hero-logo-wrap {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 12px 32px rgba(167, 139, 250, 0.4));
  animation: heroLogoFloat 4s ease-in-out infinite alternate;
}

.hero-main-logo {
  width: 88px;
  height: 88px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-main-logo:hover {
  transform: scale(1.1) rotate(5deg);
}

@keyframes heroLogoFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 15px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-purple);
  margin-bottom: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Big "Boxes & Lines" Title */
.hero-title {
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 45%, var(--accent-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(167, 139, 250, 0.3));
}

.hero-motto {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Player Name Input Card */
.player-name-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  text-align: left;
  backdrop-filter: blur(16px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.player-name-card.shake-input {
  animation: shakeCard 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: var(--accent-red) !important;
  box-shadow: 0 0 24px rgba(248, 113, 113, 0.4) !important;
}

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

.name-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.req-star {
  color: var(--accent-pink);
}

.name-req-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.player-name-card.shake-input .name-req-hint {
  opacity: 1;
}

.name-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px 6px 12px;
  transition: border-color 0.2s ease;
}

.name-input-wrapper:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.2);
}

.input-avatar-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.name-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-weight: 600;
}

.name-input-wrapper input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.random-name-btn {
  font-size: 1.2rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease;
}

.random-name-btn:hover {
  transform: rotate(25deg) scale(1.15);
}

/* Invite Banner */
.invite-banner {
  width: 100%;
  max-width: 580px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(244, 114, 182, 0.15));
  border: 1.5px solid var(--accent-purple);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: slideInDown 0.4s ease;
}

.invite-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent-purple);
  color: #0d1220;
  padding: 3px 10px;
  border-radius: 999px;
}

.invite-banner strong {
  font-family: var(--font-mono);
  color: var(--accent-yellow);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

.btn-pulse {
  animation: pulseBtn 2s infinite ease-in-out;
}

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 0 25px rgba(244, 114, 182, 0.6); }
}

/* ── Home Screen Button Blocks ───────────────────────── */
.main-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  margin-bottom: 28px;
}

.menu-action-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-card);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-glow-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Host Button Styling */
.host-btn .btn-glow-layer {
  background: radial-gradient(circle at top right, rgba(167, 139, 250, 0.18), transparent 70%);
}

.host-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(167, 139, 250, 0.65);
  transform: translateY(-5px);
  box-shadow: 0 16px 42px rgba(167, 139, 250, 0.24), 0 0 0 1px rgba(167, 139, 250, 0.4);
}

.host-btn:hover .btn-glow-layer { opacity: 1; }
.host-btn:hover .btn-icon-box {
  transform: scale(1.1) rotate(6deg);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.15);
}
.host-btn:hover .btn-arrow-circle {
  background: var(--accent-purple);
  color: #070a13;
  transform: translateX(4px);
}

/* Join Button Styling */
.join-btn .btn-glow-layer {
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 70%);
}

.join-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-5px);
  box-shadow: 0 16px 42px rgba(56, 189, 248, 0.2), 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.join-btn:hover .btn-glow-layer { opacity: 1; }
.join-btn:hover .btn-icon-box {
  transform: scale(1.1) rotate(-6deg);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.15);
}
.join-btn:hover .btn-arrow-circle {
  background: var(--accent-blue);
  color: #070a13;
  transform: translateX(4px);
}

.btn-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.menu-emoji { font-size: 1.6rem; }

.btn-text-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-tag {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.host-btn .btn-tag { color: var(--accent-purple); }
.join-btn .btn-tag { color: var(--accent-blue); }

.btn-heading {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.btn-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.btn-arrow-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.btn-arrow-circle svg { width: 18px; height: 18px; }

/* ── Features Text Row & Floating Engine Bar ─────────── */
.features-text-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feature-dot {
  color: var(--text-muted);
  opacity: 0.5;
}

.floating-engine-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.floating-engine-bar strong {
  color: var(--text-primary);
}

.engine-brand {
  color: var(--accent-purple);
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ════════════════════════════════════════════════════════
   2. DEDICATED JOIN SCREEN (Split Left / Right)
   ════════════════════════════════════════════════════════ */
.join-page-wrapper {
  max-width: 980px;
  width: 100%;
  margin: auto;
  padding: 10px 24px 20px;
  display: flex;
  flex-direction: column;
}

.join-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.back-link-btn svg { width: 16px; height: 16px; }

.back-link-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-active);
  transform: translateX(-3px);
}

.join-header-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-blue);
  text-transform: uppercase;
}

.join-split-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: stretch;
}

.join-card-box {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
}

.join-left-card {
  text-align: center;
  align-items: center;
}

.join-card-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.join-header-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.join-emoji { font-size: 1.7rem; }

.join-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.join-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.join-code-input-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  margin-bottom: 18px;
}

.join-code-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

#input-room-code-page {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text-primary);
  outline: none;
  transition: all 0.25s ease;
}

#input-room-code-page:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
  background: rgba(0, 0, 0, 0.7);
}

.btn-submit-join {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.join-footer-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.inline-link-btn {
  color: var(--accent-purple);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.inline-link-btn:hover { color: var(--accent-pink); }

/* ── PINNED 1 VS AI BOT CARD ─────────────────────────── */
.pinned-ai-card {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(56, 189, 248, 0.1));
  border: 1.5px solid rgba(167, 139, 250, 0.45);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pinned-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pinned-ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-badge-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.3);
}

.pinned-ai-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.solo-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--accent-purple);
  color: #070a13;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.pinned-ai-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pinned-diff-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pinned-diff-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.diff-chips-row {
  display: flex;
  gap: 6px;
}

.diff-chip {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.diff-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.diff-chip.active {
  background: rgba(167, 139, 250, 0.25);
  border-color: var(--accent-purple);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.btn-play-solo-ai {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
}

/* Public Lobbies Browser Header */
.public-lobbies-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.public-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.public-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  animation: pulseDot 1.8s infinite ease-in-out;
}

.public-lobbies-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.public-lobby-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: all 0.22s ease;
}

.public-lobby-card:hover {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.public-lobby-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.public-host-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.public-lobby-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.public-host-name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.public-tags-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.grid-tag-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.players-count-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.empty-lobbies-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  gap: 6px;
  color: var(--text-muted);
}

.empty-emoji { font-size: 2rem; margin-bottom: 2px; }

.empty-lobbies-box h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-lobbies-box p {
  font-size: 0.82rem;
  max-width: 260px;
  line-height: 1.4;
  margin-bottom: 8px;
}

/* ════════════════════════════════════════════════════════
   3. LOBBY SCREEN STYLING & BOT CONTROLS
   ════════════════════════════════════════════════════════ */
.lobby-container {
  max-width: 880px;
  width: 100%;
  margin: auto;
  padding: 10px 24px;
}

.lobby-header {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.lobby-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lobby-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-purple);
  text-transform: uppercase;
}

.access-pill-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.access-pill-tag.open {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.room-code-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.room-code-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.room-code-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--text-primary);
  background: linear-gradient(135deg, #ffffff, var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lobby-share-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lobby-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.lobby-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-add-bot {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.3);
  color: var(--accent-purple);
  font-weight: 700;
}

.btn-add-bot:hover {
  background: rgba(167, 139, 250, 0.22);
  border-color: var(--accent-purple);
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent-purple);
}

.section-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Connected Players Grid */
.lobby-players-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.player-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease;
}

.player-slot.is-self {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.08);
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.player-slot-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-slot-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-crown-badge {
  font-size: 0.72rem;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #facc15;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.bot-tag-badge {
  font-size: 0.7rem;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent-blue);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.you-pill-badge {
  font-size: 0.7rem;
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: var(--accent-purple);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.btn-kick-bot {
  font-size: 0.8rem;
  color: var(--accent-red);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  transition: all 0.2s ease;
}

.btn-kick-bot:hover {
  background: rgba(248, 113, 113, 0.25);
}

.slot-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.empty-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Settings Groups in Lobby */
.setting-group-box {
  margin-bottom: 16px;
}

.setting-group-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* Bot Difficulty Selector */
.bot-diff-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.diff-option { cursor: pointer; }
.diff-option input { display: none; }

.diff-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  text-align: center;
}

.diff-icon { font-size: 1rem; }
.diff-name { font-size: 0.82rem; font-weight: 700; }
.diff-desc { font-size: 0.65rem; color: var(--text-muted); }

.diff-option input:checked + .diff-option-card {
  border-color: var(--accent-purple);
  background: rgba(167, 139, 250, 0.14);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.25);
}

/* Room Access Selector */
.access-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.access-option { cursor: pointer; }
.access-option input { display: none; }

.access-option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.access-icon { font-size: 1.3rem; }
.access-text { display: flex; flex-direction: column; }
.access-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.access-desc { font-size: 0.7rem; color: var(--text-muted); }

.access-option input:checked + .access-option-card {
  border-color: var(--accent-purple);
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.2);
}

/* Grid Size Selector */
.grid-size-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.size-chip { cursor: pointer; }
.size-chip input { display: none; }

.size-chip-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.size-chip input:checked + .size-chip-inner {
  border-color: var(--accent-purple);
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}

.chip-title {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.chip-boxes {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-pink);
}

.chip-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Turn Timer Setting */
.timer-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.setting-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.timer-options {
  display: flex;
  gap: 6px;
}

.timer-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.timer-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-active);
}

.timer-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #0d1220;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.35);
}

/* Lobby Footer */
.lobby-footer {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.guest-waiting-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
}

.pulse-loader {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 14px var(--accent-purple);
  animation: pulseDot 1.4s infinite ease-in-out;
}

/* ════════════════════════════════════════════════════════
   4. GAME ARENA SCREEN STYLING & DYNAMIC ANIMATIONS
   ════════════════════════════════════════════════════════ */
#screen-game {
  padding-top: var(--nav-height);
  padding-bottom: 0;
  height: 100vh;
  overflow: hidden;
}

.home-ambient-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.game-arena-layout {
  display: grid;
  grid-template-columns: 280px minmax(320px, 1fr) 300px;
  height: calc(100vh - var(--nav-height));
  width: 100%;
}

/* Game Left Sidebar */
.game-sidebar {
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
  z-index: 10;
}

/* Turn Banner Card */
.turn-banner-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.turn-banner-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.turn-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 14px currentColor;
  animation: pulseAvatar 2s infinite ease-in-out;
}

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

.turn-text-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.turn-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.turn-meta-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.turn-clock-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #facc15;
}

.turn-player-name {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.your-turn-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--accent-emerald);
  color: #070a13;
  padding: 2px 7px;
  border-radius: 999px;
  animation: bounceBadge 0.6s infinite alternate;
}

.spectator-live-tag {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(167, 139, 250, 0.18);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
  padding: 2px 7px;
  border-radius: 999px;
}

/* Double Move Bonus Banner (Timeout Penalty Reward) */
.double-move-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(244, 63, 94, 0.18));
  border: 1.5px solid var(--accent-yellow);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent-yellow);
  animation: pulseDoubleMove 1.4s infinite ease-in-out;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.25);
}

@keyframes pulseDoubleMove {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); filter: brightness(1.15); }
}

@keyframes bounceBadge {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* In-Game Countdown Progress Track */
.turn-timer-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: rgba(255, 255, 255, 0.08);
}

.turn-timer-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #34d399, #facc15, #f87171);
  transition: width 0.1s linear;
}

.turn-timer-progress-bar.urgent {
  background: #f87171;
  box-shadow: 0 0 10px #f87171;
  animation: pulseBar 0.5s infinite alternate;
}

@keyframes pulseBar {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Sidebar Blocks */
.sidebar-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.block-header h3 {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.score-grid-info {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-purple);
}

/* Spectators Block */
.spectators-block {
  max-height: 150px;
  overflow-y: auto;
}

.live-pulse-dot {
  font-size: 0.65rem;
  font-weight: 800;
  color: #f87171;
  animation: pulseDot 1.6s infinite ease-in-out;
}

.spectator-count-badge {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.spectators-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.spectator-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.spectator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.spectators-empty-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Scoreboard List */
.game-scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.score-item.is-turn {
  border-color: var(--border-active);
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.15);
}

.score-avatar-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.score-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-num {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
}

/* Stats Block */
.stats-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

.stat-name { color: var(--text-muted); }
.stat-val { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary); }
.code-val { color: var(--accent-purple); letter-spacing: 0.08em; }

.sidebar-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

/* Center Canvas Viewport */
.canvas-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(167, 139, 250, 0.03) 0%, transparent 70%);
}

#game-canvas {
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-subtle);
  cursor: crosshair;
  touch-action: none;
  background-color: var(--bg-base);
}

/* Right In-Game Party Chat Sidebar */
.game-chat-sidebar {
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  overflow: hidden;
}

.chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-title {
  font-size: 0.88rem;
  font-weight: 800;
}

.chat-live-pill {
  font-size: 0.62rem;
  font-weight: 800;
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 2px 6px;
  border-radius: 999px;
}

.chat-messages-container {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  animation: fadeInMsg 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.chat-msg-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: calc(100% - 30px);
}

.chat-sender-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
}

.chat-sender-name {
  font-weight: 700;
}

.chat-time {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.chat-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px 10px 10px 10px;
  padding: 6px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text-primary);
}

.chat-msg-item.self-msg {
  flex-direction: row-reverse;
}

.chat-msg-item.self-msg .chat-bubble {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.35);
  border-radius: 10px 4px 10px 10px;
}

.chat-system-msg {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}

.chat-quick-chips {
  padding: 6px 10px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.quick-chip-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-chip-btn:hover {
  background: rgba(167, 139, 250, 0.2);
  color: var(--text-primary);
  border-color: var(--accent-purple);
}

.chat-input-form {
  padding: 8px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
}

#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

#chat-input:focus {
  border-color: var(--accent-purple);
}

.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.chat-send-btn:hover {
  transform: scale(1.06);
}

/* Comic Funny Yoink Popups Layer */
.comic-popups-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 36;
}

.comic-yoink-popup {
  position: absolute;
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  color: #070a13;
  background: linear-gradient(135deg, #facc15, #f43f5e);
  padding: 5px 12px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.6), 0 0 12px #facc15;
  transform: translate(-50%, -50%) rotate(-6deg);
  animation: comicBounceIn 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@keyframes comicBounceIn {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.3) rotate(-14deg); }
  35% { opacity: 1; transform: translate(-50%, -80%) scale(1.25) rotate(-6deg); }
  75% { opacity: 1; transform: translate(-50%, -110%) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(0.8) rotate(0deg); }
}

.screen-micro-shake {
  animation: cameraShake 0.16s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

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

.combo-frenzy-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f43f5e, #facc15);
  color: #070a13;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 6px 20px;
  border-radius: 999px;
  border: 2px solid white;
  box-shadow: 0 0 28px rgba(244, 63, 94, 0.7);
  z-index: 38;
  animation: comboPop 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  letter-spacing: 0.05em;
}

@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, -20px) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
}

/* Arena Alert Bar */
.arena-alert-bar {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 19, 34, 0.9);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--accent-purple);
  border-radius: 999px;
  padding: 8px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.35);
  pointer-events: none;
  z-index: 20;
  animation: slideInDown 0.3s ease;
}

/* Floating Score Popups (+1 Point) */
.floating-score-popup {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 35;
  animation: floatScorePop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes floatScorePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30% { opacity: 1; transform: translate(-50%, -80%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}

/* Live Emoji Reactions Layer */
.reactions-floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.floating-reaction {
  position: absolute;
  bottom: 80px;
  font-size: 2.2rem;
  animation: floatReaction 3s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

@keyframes floatReaction {
  0% { opacity: 0; transform: translateY(20px) scale(0.6); }
  15% { opacity: 1; transform: translateY(0) scale(1.2); }
  80% { opacity: 1; transform: translateY(-160px) scale(1); }
  100% { opacity: 0; transform: translateY(-220px) scale(0.8); }
}

/* Emoji Taunt Bar */
.emoji-taunt-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 19, 34, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: var(--shadow-card);
  z-index: 25;
}

.emoji-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}

.emoji-btn-row { display: flex; gap: 4px; }

.emoji-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.05);
  transition: transform 0.15s ease, background 0.15s ease;
}

.emoji-btn:hover {
  transform: scale(1.3) translateY(-3px);
  background: rgba(255, 255, 255, 0.15);
}

/* ════════════════════════════════════════════════════════
   5. RESULTS / GAME OVER SCREEN STYLING
   ════════════════════════════════════════════════════════ */
.results-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.results-header { margin-bottom: 28px; }

.trophy-badge {
  font-size: 4.5rem;
  margin-bottom: 12px;
  animation: bounceTrophy 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 35px rgba(250, 204, 21, 0.5));
}

@keyframes bounceTrophy {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.results-title {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.results-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Podium Stage */
.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  margin-bottom: 32px;
  min-height: 220px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.podium-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 20px currentColor;
}

.podium-name {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.podium-score {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.podium-pillar {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

.podium-1st .podium-pillar {
  height: 140px;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.35), rgba(250, 204, 21, 0.08));
  border: 1.5px solid rgba(250, 204, 21, 0.6);
  color: #facc15;
}

.podium-2nd .podium-pillar {
  height: 100px;
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.25), rgba(203, 213, 225, 0.05));
  border: 1.5px solid rgba(203, 213, 225, 0.4);
  color: #cbd5e1;
}

.podium-3rd .podium-pillar {
  height: 75px;
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.25), rgba(251, 146, 60, 0.05));
  border: 1.5px solid rgba(251, 146, 60, 0.4);
  color: #fb923c;
}

/* Final Leaderboard List */
.final-leaderboard-card {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
  text-align: left;
}

.final-leaderboard-card h3 {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.final-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.final-rank-num {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 24px;
}

.final-player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
}

.final-player-name {
  flex: 1;
  font-weight: 700;
}

.final-boxes-claimed {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
}

.results-actions {
  display: flex;
  gap: 14px;
}

/* ════════════════════════════════════════════════════════
   MODAL & TOAST STYLES
   ════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn 0.25s ease;
}

.modal-dialog {
  background: #0f172a;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

.modal-close-btn {
  font-size: 1.8rem;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close-btn:hover { color: var(--text-primary); }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.rule-card {
  display: flex;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.rule-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #0d1220;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.rule-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.rule-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

/* Toast Notification Stack */
.toast-stack {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
  pointer-events: none;
}

.toast-item {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(14px);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 320px;
}

.toast-item.removing {
  animation: slideOutRight 0.25s ease forwards;
}

/* ── Keyframe Animations ─────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideInDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Responsive Adaptations ─────────────────────────── */
@media (max-width: 1080px) {
  .game-arena-layout { grid-template-columns: 240px 1fr 260px; }
}

@media (max-width: 900px) {
  .join-split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .hero-title { font-size: 2.8rem; }
  .main-buttons-grid { grid-template-columns: 1fr; gap: 14px; }
  .lobby-body { grid-template-columns: 1fr; }
  
  /* Disable heavy GPU-taxing Gaussian blurs on mobile devices */
  .game-sidebar,
  .game-chat-sidebar,
  .global-nav,
  .player-name-card,
  .turn-banner-card,
  .lobby-header,
  .lobby-section,
  .join-card-box,
  .modal-dialog {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #screen-game {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-arena-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--nav-height));
    transform: translateZ(0);
  }
  
  .game-sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 14px;
    gap: 8px;
    background: #0d1222;
  }
  
  .canvas-viewport { 
    padding: 8px; 
    flex: 1; 
    min-height: 320px;
    transform: translateZ(0);
  }

  .game-chat-sidebar {
    height: 340px;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: #0b101e;
  }
}

@media (max-width: 520px) {
  .global-nav { padding: 0 14px; }
  .brand-title { font-size: 1.1rem; }
  .retromafia-library-btn {
    padding: 6px 10px;
    font-size: 0.76rem;
    gap: 6px;
  }
  .retromafia-library-btn .lib-icon { font-size: 0.9rem; }
  .retromafia-library-btn .lib-text { font-size: 0.76rem; }

  .hero-container { padding: 10px 14px 16px; }
  .hero-title { font-size: 2.3rem; }
  .hero-motto { font-size: 1.1rem; }
  .hero-subtitle { font-size: 0.88rem; margin-bottom: 18px; }
  .player-name-card { padding: 12px 14px; margin-bottom: 16px; }
  
  .menu-action-btn { padding: 16px 18px; gap: 14px; border-radius: var(--radius-lg); }
  .btn-icon-box { width: 44px; height: 44px; }
  .btn-heading { font-size: 1.15rem; }
  .btn-desc { font-size: 0.78rem; }

  .features-text-row { font-size: 0.76rem; gap: 6px 10px; margin-bottom: 12px; }
  .floating-engine-bar { font-size: 0.72rem; padding: 8px 14px; width: 100%; border-radius: var(--radius-lg); line-height: 1.35; }

  .join-page-wrapper { padding: 8px 14px 20px; }
  .join-card-box { padding: 20px 16px; border-radius: var(--radius-lg); }
  .pinned-ai-card { padding: 14px 14px; }
  .pinned-diff-selector { flex-direction: column; align-items: flex-start; gap: 6px; }
  .diff-chips-row { width: 100%; justify-content: space-between; }
  .diff-chip { flex: 1; text-align: center; }

  .grid-size-selector, .access-selector, .bot-diff-selector { grid-template-columns: 1fr; }
  .lobby-container { padding: 8px 14px 20px; }
  .lobby-header { padding: 16px 16px; border-radius: var(--radius-lg); }
  .lobby-section { padding: 16px 16px; border-radius: var(--radius-lg); }
  .lobby-share-actions { width: 100%; justify-content: stretch; }
  .lobby-share-actions .btn { flex: 1; font-size: 0.78rem; padding: 10px 8px; }
  .room-code-value { font-size: 1.6rem; }
  #input-room-code-page { font-size: 1.5rem; letter-spacing: 0.15em; padding: 10px; }

  .turn-banner-card { padding: 10px 12px; }
  .turn-avatar { width: 32px; height: 32px; font-size: 0.8rem; }
  .turn-player-name { font-size: 0.95rem; }
  .emoji-taunt-bar { bottom: 10px; padding: 4px 10px; }
  .emoji-btn { width: 30px; height: 30px; font-size: 1rem; }

  .game-chat-sidebar { height: 300px; }

  .podium-stage { gap: 8px; }
  .podium-pillar { font-size: 1.4rem; }
  .podium-1st .podium-pillar { height: 110px; }
  .podium-2nd .podium-pillar { height: 80px; }
  .podium-3rd .podium-pillar { height: 60px; }
}

@media (max-width: 380px) {
  .retromafia-library-btn .lib-text { display: none; }
  .retromafia-library-btn { padding: 6px 8px; }
}

@media (max-width: 360px) {
  .hero-title { font-size: 1.95rem; }
  .hero-motto { font-size: 1rem; }
  .btn-heading { font-size: 1.05rem; }
}
