/* =====================================================
   Makin Cerdas Makin Sukses v3.0 — Tactile Modern Game UI
   Inspired by Duolingo, Kahoot, Nintendo & Supercell UI
   Zero generic AI dark-glassmorphism!
   ===================================================== */

:root {
  --bg-page: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 52%, #f0fdf4 100%);
  --bg-pattern: radial-gradient(rgba(14, 165, 233, 0.14) 1.5px, transparent 1.5px);
  --topbar-bg: #ffffff;
  --topbar-border: #cbd5e1;

  --card-bg: #ffffff;
  --card-border: #cbd5e1;
  --card-shadow: #cbd5e1;
  --panel-soft: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Tactile Game Palette */
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --success: #22c55e;
  --success-dark: #15803d;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --danger: #ef4444;
  --danger-dark: #b91c1c;
  --purple: #8b5cf6;
  --purple-dark: #6d28d9;
  --pink: #ec4899;
  --pink-dark: #be185d;

  /* Kahoot-style Option Colors */
  --opt-a: #ef4444; --opt-a-dark: #b91c1c;
  --opt-b: #3b82f6; --opt-b-dark: #1d4ed8;
  --opt-c: #f59e0b; --opt-c-dark: #b45309;
  --opt-d: #10b981; --opt-d-dark: #047857;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-display: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

/* ====== WORLD 1: SD — Taman Langit Ceria (Fredoka + Quicksand) ====== */
html[data-grade="SD"] {
  --bg-page: linear-gradient(180deg, #7dd3fc 0%, #e0f2fe 50%, #fef9c3 100%);
  --bg-pattern: radial-gradient(rgba(255, 255, 255, 0.55) 2px, transparent 2px);
  --topbar-bg: #ffffff;
  --topbar-border: #7dd3fc;
  --card-border: #93c5fd;
  --card-shadow: #60a5fa;
  --primary: #0ea5e9;
  --primary-dark: #0369a1;
  --hero-bg: linear-gradient(135deg, #0284c7 0%, #0ea5e9 55%, #38bdf8 100%);
  --hero-shadow: #075985;
  --font-display: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Quicksand', system-ui, sans-serif;
  --btn-text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

/* ====== WORLD 2: SMP — Akademi Petualang (Rubik + Poppins) ====== */
html[data-grade="SMP"] {
  --bg-page: linear-gradient(180deg, #e0e7ff 0%, #eef2ff 55%, #ecfeff 100%);
  --bg-pattern: radial-gradient(rgba(99, 102, 241, 0.14) 1.5px, transparent 1.5px);
  --topbar-bg: #ffffff;
  --topbar-border: #c7d2fe;
  --card-border: #c7d2fe;
  --card-shadow: #a5b4fc;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --hero-bg: linear-gradient(135deg, #4338ca 0%, #6366f1 60%, #06b6d4 100%);
  --hero-shadow: #312e81;
  --font-display: 'Rubik', system-ui, sans-serif;
  --font-body: 'Poppins', system-ui, sans-serif;
  --btn-text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* ====== WORLD 3: SMA — Arena Juara (Chakra Petch + Rajdhani) ====== */
html[data-grade="SMA"] {
  --bg-page: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 55%, #fff7ed 100%);
  --bg-pattern: linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  --topbar-bg: #ffffff;
  --topbar-border: #cbd5e1;
  --card-border: #cbd5e1;
  --card-shadow: #94a3b8;
  --primary: #ea580c;
  --primary-dark: #9a3412;
  --hero-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 62%, #c2410c 100%);
  --hero-shadow: #020617;
  --font-display: 'Chakra Petch', system-ui, sans-serif;
  --font-body: 'Rajdhani', system-ui, sans-serif;
  --btn-text-shadow: none;
}

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

html, body {
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--bg-pattern);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* Canvases */
#bg-canvas,
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#bg-canvas { z-index: 1; }
#fx-canvas { z-index: 900; }

/* =====================================================
   TOP NAVIGATION HUD BAR
   ===================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.65rem 1.4rem;
  background: var(--topbar-bg);
  border-bottom: 3px solid var(--topbar-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover { transform: scale(1.03); }

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  border: 2px solid #d97706;
  box-shadow: 0 4px 0 #b45309;
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.15;
  color: var(--text-primary);
  font-weight: 700;
}

.brand-text small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* Tactile 3D Grade Switcher */
.grade-pill-group {
  display: inline-flex;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 4px;
  gap: 4px;
}

.grade-pill {
  border: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.42rem 1.05rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  transition: all 0.16s ease;
}

.grade-icon-slot { display: inline-flex; align-items: center; }

.grade-pill:hover:not(.active) {
  background: #e2e8f0;
  color: var(--text-primary);
}

.grade-pill.active[data-grade="SD"] {
  background: #22c55e;
  color: #fff;
  border-color: #16a34a;
  box-shadow: 0 4px 0 #15803d;
  transform: translateY(-1px);
}

.grade-pill.active[data-grade="SMP"] {
  background: #4f46e5;
  color: #fff;
  border-color: #4338ca;
  box-shadow: 0 4px 0 #312e81;
  transform: translateY(-1px);
}

.grade-pill.active[data-grade="SMA"] {
  background: #ea580c;
  color: #fff;
  border-color: #c2410c;
  box-shadow: 0 4px 0 #9a3412;
  transform: translateY(-1px);
}

/* Topbar Right Game Buttons */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.icon-btn {
  position: relative;
  min-width: 42px;
  height: 42px;
  padding: 0 0.6rem;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 4px 0 #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.icon-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #cbd5e1;
}

.icon-btn.playing {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
  box-shadow: 0 4px 0 #16a34a;
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.eq-bars i {
  display: block;
  width: 3px;
  background: #16a34a;
  border-radius: 2px;
  animation: eqBounce 0.65s ease-in-out infinite alternate;
}
.eq-bars i:nth-child(2) { animation-delay: 0.18s; }
.eq-bars i:nth-child(3) { animation-delay: 0.36s; }

@keyframes eqBounce {
  from { height: 4px; }
  to { height: 14px; }
}

.notif-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  animation: pulseDot 1.4s infinite;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.9rem 0.3rem 0.38rem;
  border-radius: 16px;
  border: 2px solid #fbbf24;
  background: #fefce8;
  box-shadow: 0 4px 0 #eab308;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.profile-chip:hover { transform: translateY(-1px); }
.profile-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #eab308; }

.avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: #fde047;
  border: 2px solid #eab308;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.profile-chip-info { text-align: left; line-height: 1.15; }
.chip-name { display: block; font-weight: 800; font-size: 0.84rem; color: #0f172a; }
.chip-level { display: block; font-size: 0.72rem; color: #b45309; font-weight: 800; }

/* =====================================================
   MAIN VIEWPORT & GAME LOBBY HERO
   ===================================================== */
.app-root {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.4rem 1.25rem 3.5rem;
}

.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 1.85rem 2rem;
  background: var(--hero-bg);
  color: #ffffff;
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 0 var(--hero-shadow), 0 18px 34px rgba(15, 23, 42, 0.18);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
  animation: slideUpFade 0.4s ease-out;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.22);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.1vw, 2.45rem);
  line-height: 1.15;
  margin-bottom: 0.65rem;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.hero-title .gradient-word {
  color: #fde047;
}

.hero-desc {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.96rem;
  line-height: 1.5;
  max-width: 560px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.curriculum-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.curr-pill {
  font-size: 0.73rem;
  font-weight: 800;
  padding: 0.24rem 0.7rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.24);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

/* Player Trophy Card in Lobby */
.hero-stats-card {
  background: #ffffff;
  color: var(--text-primary);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  padding: 1.2rem;
  box-shadow: 0 7px 0 rgba(15, 23, 42, 0.22);
}

.stats-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.95rem;
}

.hero-avatar-big {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  border: 3px solid #d97706;
  box-shadow: 0 4px 0 #b45309;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  animation: mascotBounce 2.6s ease-in-out infinite;
}

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-4deg); }
}

.stats-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: #0f172a;
}

.stats-rank {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 800;
}

.xp-bar-wrap { margin-bottom: 0.95rem; }

.xp-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 800;
}

.xp-bar-track {
  height: 14px;
  border-radius: var(--radius-pill);
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  overflow: hidden;
  padding: 1px;
}

.xp-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  transition: width 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mini-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.mini-stat {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.55rem 0.45rem;
  text-align: center;
}

.mini-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #0f172a;
}

.mini-stat span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* Section Heading */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-head p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* =====================================================
   COLLECTIBLE ARCADE GAME TILES
   ===================================================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.game-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  box-shadow: 0 8px 0 var(--card-shadow), 0 12px 24px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  animation: slideUpFade 0.42s ease-out backwards;
}

.game-card.featured-tka {
  border-color: #f59e0b;
  box-shadow: 0 8px 0 #d97706, 0 14px 28px rgba(245, 158, 11, 0.2);
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 13px 0 var(--card-shadow), 0 18px 30px rgba(15, 23, 42, 0.14);
}

.game-card.featured-tka:hover {
  box-shadow: 0 13px 0 #d97706, 0 20px 32px rgba(245, 158, 11, 0.26);
}

.game-card:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--card-shadow);
}

/* Illustrated Game Banner Header */
.game-card-banner {
  position: relative;
  height: 108px;
  padding: 1rem 1.2rem;
  background: var(--card-bg-banner, linear-gradient(135deg, #0ea5e9, #3b82f6));
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.game-card-banner::before {
  content: '';
  position: absolute;
  top: -24px;
  right: -24px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.game-card-banner::after {
  content: '';
  position: absolute;
  bottom: -32px;
  left: 38%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.game-icon-box {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.24);
  border: 2.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-card:hover .game-icon-box {
  transform: rotate(-8deg) scale(1.1);
}

.game-tag {
  position: relative;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
}

.game-card-body {
  padding: 1.15rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.game-card h3 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  color: #0f172a;
}

.game-card p {
  color: var(--text-secondary);
  font-size: 0.89rem;
  line-height: 1.48;
  flex: 1;
  font-weight: 600;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.8rem;
  margin-top: 0.25rem;
  border-top: 2px dashed #e2e8f0;
  font-size: 0.82rem;
}

.best-score {
  color: #b45309;
  font-weight: 800;
  background: #fef3c7;
  padding: 0.24rem 0.65rem;
  border-radius: 9px;
}

.play-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border-radius: 12px;
  background: #22c55e;
  color: #fff;
  box-shadow: 0 3px 0 #15803d;
  transition: transform 0.15s;
}

.game-card:hover .play-cta { transform: scale(1.06); }

/* =====================================================
   TACTILE 3D PUSH BUTTONS (Duolingo / Nintendo Style)
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  padding: 0.72rem 1.35rem;
  border-radius: 16px;
  border: 2px solid transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) !important;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
  box-shadow: 0 5px 0 var(--primary-dark);
  text-shadow: var(--btn-text-shadow, none);
}

.btn-secondary {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 5px 0 #94a3b8;
}

.btn-success {
  background: #22c55e;
  color: #fff;
  border-color: #16a34a;
  box-shadow: 0 5px 0 #15803d;
  text-shadow: var(--btn-text-shadow, none);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 5px 0 #b91c1c;
  text-shadow: var(--btn-text-shadow, none);
}

.btn-amber {
  background: #facc15;
  color: #422006;
  border-color: #eab308;
  box-shadow: 0 5px 0 #ca8a04;
}

/* Tabular numbers so scores, timers, XP never jitter */
.chip-level,
.xp-bar-labels,
.mini-stat strong,
.best-score {
  font-variant-numeric: tabular-nums;
}

.btn-sm {
  padding: 0.48rem 0.95rem;
  font-size: 0.86rem;
  border-radius: 13px;
}

/* =====================================================
   MODALS (Crisp Game Dialog Boxes)
   ===================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1rem;
  animation: fadeIn 0.18s ease;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 590px;
  max-height: 88vh;
  overflow-y: auto;
  background: #ffffff;
  color: var(--text-primary);
  border: 3px solid #cbd5e1;
  border-radius: 26px;
  padding: 1.55rem;
  box-shadow: 0 10px 0 #94a3b8, 0 24px 50px rgba(15, 23, 42, 0.35);
  animation: popIn 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
  font-size: 1rem;
}
.modal-close:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* Music Studio Modal */
.music-track-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

.music-track-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.78rem 1rem;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.16s;
}

.music-track-card:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.music-track-card.active {
  border-color: #22c55e;
  background: #f0fdf4;
  box-shadow: 0 3px 0 #86efac;
}

.music-custom-box {
  padding: 1rem;
  border-radius: 16px;
  border: 2px dashed #94a3b8;
  background: #f8fafc;
  margin-bottom: 0.6rem;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.85rem 0;
}

.volume-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

/* Avatar Picker & Badges */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.55rem;
  margin: 0.6rem 0 1.1rem;
}

.avatar-option {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 1.6rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.avatar-option.selected {
  border-color: var(--primary);
  background: #e0f2fe;
  box-shadow: 0 3px 0 var(--primary);
  transform: scale(1.06);
}

.text-input {
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 700;
  outline: none;
}

.text-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.badge-item {
  border-radius: 16px;
  padding: 0.78rem;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  text-align: center;
}

.badge-item.unlocked {
  border-color: #f59e0b;
  background: #fefce8;
  box-shadow: 0 4px 0 #fde047;
}

.badge-item.locked {
  opacity: 0.52;
  filter: grayscale(0.85);
}

.badge-item .b-icon { font-size: 1.85rem; display: block; margin-bottom: 0.25rem; }
.badge-item strong { display: block; font-size: 0.82rem; margin-bottom: 0.15rem; color: #0f172a; }
.badge-item small { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

/* Quests */
.quest-list { display: flex; flex-direction: column; gap: 0.75rem; }

.quest-row {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.quest-row.done {
  border-color: #22c55e;
  background: #f0fdf4;
}

.quest-bar {
  height: 9px;
  border-radius: 99px;
  background: #e2e8f0;
  margin-top: 0.45rem;
  overflow: hidden;
  width: 220px;
  max-width: 100%;
}

.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #0ea5e9);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  border: 2px solid #fbbf24;
  color: #fff;
  padding: 0.78rem 1.2rem;
  border-radius: 16px;
  box-shadow: 0 6px 0 #334155, 0 12px 28px rgba(15, 23, 42, 0.28);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.fade-out { opacity: 0; transform: translateY(10px); transition: all 0.28s ease; }

/* Keyframes */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.anim-shake { animation: shake 0.36s ease; }
.hidden { display: none !important; }

/* Lobby Footer & Info Cards */
.lobby-footer {
  margin-top: 2.2rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
}

.info-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.98rem;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.info-card p {
  font-size: 0.86rem;
  color: #475569;
  line-height: 1.48;
  font-weight: 600;
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 0.65rem 1rem; }
  .topbar-center { order: 3; width: 100%; display: flex; justify-content: center; }
  .hero-banner { grid-template-columns: 1fr; padding: 1.4rem; }
}
