/* ==========================================================
   JELAJAH KATA - Style System (Pure Static CSS)
   Aesthetic: Modern, Premium, Clean, Playful, Educatif, Elegan
   Strictly NO living creatures. Pure educational geometry & typography.
   ========================================================== */

:root {
  /* Color Palette - Light Mode (Default: Crisp Pure White & Blues) */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-muted: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-surface: #ffffff;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --cyan: #0284c7;
  --cyan-light: #e0f2fe;
  --cyan-border: #7dd3fc;
  
  --accent-green: #10b981;
  --accent-green-light: #ecfdf5;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fffbeb;
  --accent-red: #ef4444;
  --accent-red-light: #fef2f2;
  
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg-body: #090d16;
  --bg-card: #131b2e;
  --bg-card-muted: #1e293b;
  --bg-card-hover: #273549;
  --bg-surface: #0f172a;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: #1e3a8a;
  
  --cyan: #38bdf8;
  --cyan-light: rgba(56, 189, 248, 0.15);
  --cyan-border: #0369a1;
  
  --accent-green: #34d399;
  --accent-green-light: rgba(16, 185, 129, 0.15);
  --accent-gold: #fbbf24;
  --accent-gold-light: rgba(245, 158, 11, 0.15);
  --accent-red: #f87171;
  --accent-red-light: rgba(239, 68, 68, 0.15);
  
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --border-subtle: #1e293b;
  --border-strong: #334155;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  touch-action: manipulation;
}

/* ==========================================================
   APP CONTAINER & LAYOUT
   ========================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 80px 16px; /* space for mobile bottom nav */
}

@media (min-width: 1024px) {
  .app-container {
    padding: 0 24px 40px 24px;
  }
}

/* ==========================================================
   SPLASH SCREEN
   ========================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 50%, #e0f2fe 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

[data-theme="dark"] .splash-screen {
  background: linear-gradient(135deg, #090d16 0%, #131b2e 50%, #0f172a 100%);
}

.splash-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: splashZoom 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.splash-logo-box {
  width: 280px;
  max-width: 80vw;
  margin-bottom: 24px;
}

.splash-floating-letters {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.splash-letter {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  animation: floatLetter 1.8s ease-in-out infinite alternate;
}

.splash-letter:nth-child(2) {
  background: var(--cyan);
  animation-delay: 0.2s;
}

.splash-letter:nth-child(3) {
  background: #3b82f6;
  animation-delay: 0.4s;
}

.splash-letter:nth-child(4) {
  background: #0284c7;
  animation-delay: 0.6s;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes splashZoom {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes floatLetter {
  0% { transform: translateY(0px) rotate(-3deg); }
  100% { transform: translateY(-10px) rotate(4deg); }
}

/* ==========================================================
   HEADER / TOP BAR
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
  margin-bottom: 24px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] .site-header {
  background: rgba(19, 27, 46, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

/* Header Live Quick Badges */
.header-stats-group {
  display: none;
  align-items: center;
  gap: 12px;
}

@media (min-width: 768px) {
  .header-stats-group {
    display: flex;
  }
}

.header-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.header-stat-pill.star {
  color: #b45309;
  background: var(--accent-gold-light);
  border-color: #fde68a;
}
[data-theme="dark"] .header-stat-pill.star {
  color: #fbbf24;
  border-color: #78350f;
}

.header-stat-pill.xp {
  color: #0369a1;
  background: var(--cyan-light);
  border-color: #bae6fd;
}
[data-theme="dark"] .header-stat-pill.xp {
  color: #38bdf8;
  border-color: #075985;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 17px;
  transition: all 0.2s ease;
}

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

.icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================================
   DESKTOP NAVIGATION (TABS)
   ========================================================== */
.desktop-nav {
  display: none;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.nav-tab-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-muted);
}

.nav-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ==========================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================== */
.mobile-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 1000;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(19, 27, 46, 0.96);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.mobile-nav-btn .nav-icon {
  font-size: 19px;
  line-height: 1;
}

.mobile-nav-btn.active {
  color: var(--primary);
}

.mobile-nav-btn.active .nav-icon {
  transform: translateY(-2px);
}

/* ==========================================================
   VIEW CONTAINER & VIEW SWITCHING
   ========================================================== */
.view-section {
  display: none;
  width: 100%;
  animation: fadeInView 0.3s ease forwards;
}

.view-section.active {
  display: block;
}

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

/* ==========================================================
   DASHBOARD HERO SECTION
   ========================================================== */
.dashboard-hero-card {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

[data-theme="dark"] .dashboard-hero-card {
  background: linear-gradient(135deg, #131b2e 0%, #0f2444 100%);
  border-color: #1e3a8a;
}

.hero-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 900px) {
  .hero-layout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.hero-text-content {
  flex: 1;
  max-width: 580px;
}

.hero-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--cyan-light);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cyan);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 34px;
  font-weight: 900;
  color: #1e3a8a;
  line-height: 1.15;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

[data-theme="dark"] .hero-title {
  color: #93c5fd;
}

.hero-title .highlight {
  color: var(--cyan);
}

.hero-tagline {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.hero-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Hero Decorative Graphic (Letters, Puzzle, Books - Strictly NO Living Creatures) */
.hero-visual-box {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 180px;
  padding: 10px;
}

.hero-visual-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.hero-tile {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

.hero-tile:hover {
  transform: translateY(-4px) rotate(3deg);
}

.tile-blue {
  background: var(--primary);
  color: #ffffff;
}

.tile-cyan {
  background: var(--cyan);
  color: #ffffff;
}

.tile-gold {
  background: var(--accent-gold);
  color: #ffffff;
}

.tile-green {
  background: var(--accent-green);
  color: #ffffff;
}

.tile-silver {
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: var(--primary);
}

[data-theme="dark"] .tile-silver {
  background: #1e293b;
  border-color: #334155;
  color: #38bdf8;
}

/* ==========================================================
   BUTTONS SYSTEM
   ========================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--primary);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--bg-card-muted);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-outline-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--accent-red);
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  background: var(--accent-red-light);
}

/* ==========================================================
   STATISTICS DASHBOARD GRID
   ========================================================== */
.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (min-width: 768px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon-star {
  background: var(--accent-gold-light);
  color: #b45309;
}
[data-theme="dark"] .stat-icon-star {
  color: #fbbf24;
}

.stat-icon-xp {
  background: var(--cyan-light);
  color: #0369a1;
}
[data-theme="dark"] .stat-icon-xp {
  color: #38bdf8;
}

.stat-icon-trophy {
  background: #fef3c7;
  color: #d97706;
}
[data-theme="dark"] .stat-icon-trophy {
  background: rgba(217, 119, 6, 0.2);
  color: #f59e0b;
}

.stat-icon-book {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================
   PROGRESS OVERVIEW SECTION
   ========================================================== */
.dashboard-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.progress-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-title-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.progress-counter-badge {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.progress-bar-track {
  width: 100%;
  height: 14px;
  background: var(--bg-card-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #2563eb 100%);
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-footer-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================
   QUICK ACCESS ("LANJUTKAN PETUALANGAN")
   ========================================================== */
.quick-access-box {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-muted) 100%);
  border: 1.5px dashed var(--cyan-border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .quick-access-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.quick-access-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-access-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--cyan);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.quick-access-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.quick-access-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ==========================================================
   THEMES CARDS GRID (HALAMAN PILIH TEMA & DASHBOARD)
   ========================================================== */
.themes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1080px) {
  .themes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.theme-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cyan-border);
}

.theme-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.theme-icon-box {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: var(--primary-light);
}

.theme-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.theme-number-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-card-muted);
  color: var(--text-secondary);
}

.theme-title {
  font-size: 19px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 8px;
}

.theme-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  flex: 1;
}

.theme-card-metrics {
  background: var(--bg-card-muted);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-col {
  display: flex;
  flex-direction: column;
}

.metric-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.theme-stars-row {
  display: flex;
  gap: 2px;
  font-size: 14px;
}

.theme-star-icon {
  color: #e2e8f0;
}
.theme-star-icon.active {
  color: #f59e0b;
}

.theme-action-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 800;
}

/* ==========================================================
   GAME SCREEN
   ========================================================== */
.game-container {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.game-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.game-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.game-back-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-muted);
}

.game-title-group {
  text-align: center;
}

.game-theme-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cyan);
  text-transform: uppercase;
}

.game-brand-sub {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-main);
}

.game-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #fef3c7;
  color: #d97706;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  animation: pulseStreak 1.5s infinite;
}

[data-theme="dark"] .game-streak-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

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

.game-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.game-progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-card-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 24px;
}

.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4 0%, #2563eb 100%);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* Question Area Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  text-align: center;
}

.question-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 16px;
}

.question-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 20px;
}

/* Reading Passage for Tema 5 */
.reading-passage-box {
  background: var(--bg-card-muted);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 18px 20px;
  text-align: left;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.reading-passage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Answer Options Grid */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .answers-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  transition: all 0.2s ease;
  min-height: 60px;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.answer-prefix {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-card-muted);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.answer-text {
  flex: 1;
}

/* Answer Selected & Feedback States */
.answer-btn.correct {
  background: var(--accent-green-light) !important;
  border-color: var(--accent-green) !important;
  color: #065f46 !important;
  animation: correctBounce 0.4s ease;
}

[data-theme="dark"] .answer-btn.correct {
  color: #34d399 !important;
}

.answer-btn.correct .answer-prefix {
  background: var(--accent-green);
  color: #ffffff;
}

.answer-btn.wrong {
  background: var(--accent-red-light) !important;
  border-color: var(--accent-red) !important;
  color: #991b1b !important;
  animation: wrongShake 0.4s ease;
}

[data-theme="dark"] .answer-btn.wrong {
  color: #f87171 !important;
}

.answer-btn.wrong .answer-prefix {
  background: var(--accent-red);
  color: #ffffff;
}

.answer-btn:disabled {
  cursor: default;
}

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

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================================
   TEMA 3: SUSUN KATA (INTERACTIVE LETTER PUZZLE TILES)
   ========================================================== */
.susun-kata-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.letter-slots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 64px;
  padding: 8px;
  width: 100%;
}

.letter-slot {
  width: 56px;
  height: 60px;
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.letter-slot.filled {
  border-style: solid;
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.letter-bank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
}

.letter-tile-btn {
  width: 56px;
  height: 60px;
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.letter-tile-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: var(--shadow-md);
}

.letter-tile-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.susun-kata-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

/* Feedback Box (Shown after selecting an answer) */
.feedback-box {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  box-shadow: var(--shadow-lg);
  margin-top: 20px;
  animation: fadeInFeedback 0.3s ease forwards;
}

.feedback-box.active {
  display: block;
}

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

.feedback-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.feedback-msg-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feedback-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.feedback-icon.correct {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.feedback-icon.wrong {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.feedback-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.feedback-sub {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ==========================================================
   RESULT SCREEN (TEMA SELESAI)
   ========================================================== */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 640px;
  margin: 0 auto 32px auto;
}

.result-celebration-title {
  font-size: 28px;
  font-weight: 900;
  color: #1e3a8a;
  margin-bottom: 8px;
}

[data-theme="dark"] .result-celebration-title {
  color: #93c5fd;
}

.result-theme-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.result-stars-box {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 36px;
  margin-bottom: 12px;
}

.result-praise-text {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.result-new-record-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: #fef3c7;
  color: #b45309;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 20px;
  animation: pulseStreak 1.5s infinite;
}

.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

@media (min-width: 480px) {
  .result-metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.result-metric-item {
  background: var(--bg-card-muted);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.result-metric-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
}

.result-metric-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.result-actions-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

@media (min-width: 500px) {
  .result-actions-row {
    flex-direction: row;
  }
}

/* ==========================================================
   ACHIEVEMENTS (PRESTASI) SCREEN
   ========================================================== */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

@media (min-width: 640px) {
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.2s ease;
  position: relative;
}

.achievement-card.locked {
  opacity: 0.65;
  filter: grayscale(0.8);
}

.achievement-card.unlocked {
  border-color: var(--cyan-border);
  box-shadow: var(--shadow-md);
}

.achievement-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.achievement-card.unlocked .achievement-icon {
  background: #fef3c7;
  color: #b45309;
}

.achievement-info {
  flex: 1;
}

.achievement-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.achievement-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.achievement-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.achievement-card.unlocked .achievement-status {
  color: var(--accent-green);
}

.achievement-card.locked .achievement-status {
  color: var(--text-muted);
}

/* ==========================================================
   PROGRESS SCREEN
   ========================================================== */
.progress-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.progress-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.theme-progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.theme-progress-item:last-child {
  border-bottom: none;
}

/* ==========================================================
   SETTINGS (PENGATURAN) SCREEN
   ========================================================== */
.settings-list {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 28px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label-group {
  display: flex;
  flex-direction: column;
}

.settings-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.settings-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Switch Toggle UI */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-strong);
  transition: 0.3s;
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

input:checked + .switch-slider {
  background-color: var(--primary);
}

input:checked + .switch-slider:before {
  transform: translateX(24px);
}

/* Range Slider UI */
.range-slider {
  -webkit-appearance: none;
  width: 140px;
  height: 8px;
  border-radius: 4px;
  background: var(--border-strong);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

/* ==========================================================
   MODALS (ACHIEVEMENT POPUP & RESET CONFIRMATION)
   ========================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: modalPopup 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPopup {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Confetti particle canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10001;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
