:root {
  /* Premium Dark Theme */
  --bg-color: #0d1117;
  --surface-color: #161b22;
  --surface-highlight: #1f2532;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;

  --gold-primary: #e8c84a;
  --gold-secondary: #f0d878;
  --gold-faint: rgba(232, 200, 74, 0.1);

  --accent-green: #3fb950;
  --accent-red: #ff7b72;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(232, 200, 74, 0.5);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(232, 200, 74, 0.15);

  --navbar-bg: rgba(22, 27, 34, 0.5);
  --body-bg-image: none;
  --btn-primary-bg: linear-gradient(135deg, var(--gold-secondary), var(--gold-primary));
  --btn-primary-color: #000;
  --btn-primary-hover-shadow: 0 8px 25px rgba(232, 200, 74, 0.3);
}

[data-theme="light"] {
  /* Paper & Ink Light Theme (User Custom) */
  --bg-color: #f5f0e8;
  --surface-color: #ede8db;
  --surface-highlight: #d9d3c4;
  --text-primary: #1a1710;
  --text-secondary: #8a8578;

  --gold-primary: #b8924a;
  --gold-secondary: #d4aa6a;
  --gold-faint: rgba(184, 146, 74, 0.1);

  --accent-green: #2a5040;
  --accent-red: #8b2020;

  --border-color: #d9d3c4;
  --border-focus: rgba(184, 146, 74, 0.5);

  --shadow-sm: 0 4px 12px rgba(26, 23, 16, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 23, 16, 0.12);
  --shadow-glow: 0 0 20px rgba(184, 146, 74, 0.2);

  --navbar-bg: rgba(245, 240, 232, 0.92);
  --body-bg-image: radial-gradient(ellipse at 20% 50%, rgba(184, 146, 74, 0.05) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(139, 32, 32, 0.03) 0%, transparent 50%);
  --btn-primary-bg: #1a1710;
  --btn-primary-color: #f5f0e8;
  --btn-primary-hover-shadow: 0 8px 25px rgba(26, 23, 16, 0.2);
}

/* 🌸 Sakura — 樱花粉 (女生/可爱风) */
[data-theme="sakura"] {
  --bg-color: #fef0f5;
  --surface-color: #fce4ec;
  --surface-highlight: #f8bbd0;
  --text-primary: #4a1942;
  --text-secondary: #9c6b8a;

  --gold-primary: #e91e90;
  --gold-secondary: #f06292;
  --gold-faint: rgba(233, 30, 144, 0.08);

  --accent-green: #66bb6a;
  --accent-red: #e53935;

  --border-color: #f3c4d9;
  --border-focus: rgba(233, 30, 144, 0.5);

  --shadow-sm: 0 4px 12px rgba(233, 30, 144, 0.06);
  --shadow-md: 0 8px 24px rgba(233, 30, 144, 0.1);
  --shadow-glow: 0 0 20px rgba(233, 30, 144, 0.15);

  --navbar-bg: rgba(254, 240, 245, 0.92);
  --body-bg-image: radial-gradient(ellipse at 20% 30%, rgba(240, 98, 146, 0.08) 0%, transparent 60%), radial-gradient(ellipse at 80% 70%, rgba(186, 104, 200, 0.06) 0%, transparent 50%);
  --btn-primary-bg: linear-gradient(135deg, #f06292, #e91e90);
  --btn-primary-color: #fff;
  --btn-primary-hover-shadow: 0 8px 25px rgba(233, 30, 144, 0.3);
}

/* 🌊 Ocean — 深海蓝 (男生/科技风) */
[data-theme="ocean"] {
  --bg-color: #0a1929;
  --surface-color: #0d2137;
  --surface-highlight: #12304e;
  --text-primary: #e0f0ff;
  --text-secondary: #7eb8e0;

  --gold-primary: #29b6f6;
  --gold-secondary: #4fc3f7;
  --gold-faint: rgba(41, 182, 246, 0.1);

  --accent-green: #66bb6a;
  --accent-red: #ef5350;

  --border-color: rgba(41, 182, 246, 0.12);
  --border-focus: rgba(41, 182, 246, 0.5);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(41, 182, 246, 0.2);

  --navbar-bg: rgba(10, 25, 41, 0.85);
  --body-bg-image: radial-gradient(ellipse at 30% 80%, rgba(41, 182, 246, 0.05) 0%, transparent 60%), radial-gradient(ellipse at 70% 20%, rgba(0, 230, 180, 0.04) 0%, transparent 50%);
  --btn-primary-bg: linear-gradient(135deg, #4fc3f7, #29b6f6);
  --btn-primary-color: #0a1929;
  --btn-primary-hover-shadow: 0 8px 25px rgba(41, 182, 246, 0.35);
}

/* 🌿 Forest — 森林绿 (自然风) */
[data-theme="forest"] {
  --bg-color: #f1f8e9;
  --surface-color: #e8f5e9;
  --surface-highlight: #c8e6c9;
  --text-primary: #1b3a1b;
  --text-secondary: #5d7a5d;

  --gold-primary: #2e7d32;
  --gold-secondary: #43a047;
  --gold-faint: rgba(46, 125, 50, 0.08);

  --accent-green: #2e7d32;
  --accent-red: #c62828;

  --border-color: #a5d6a7;
  --border-focus: rgba(46, 125, 50, 0.5);

  --shadow-sm: 0 4px 12px rgba(27, 58, 27, 0.06);
  --shadow-md: 0 8px 24px rgba(27, 58, 27, 0.1);
  --shadow-glow: 0 0 20px rgba(46, 125, 50, 0.15);

  --navbar-bg: rgba(241, 248, 233, 0.92);
  --body-bg-image: radial-gradient(ellipse at 25% 60%, rgba(129, 199, 132, 0.08) 0%, transparent 50%), radial-gradient(ellipse at 75% 30%, rgba(174, 213, 129, 0.06) 0%, transparent 50%);
  --btn-primary-bg: linear-gradient(135deg, #43a047, #2e7d32);
  --btn-primary-color: #fff;
  --btn-primary-hover-shadow: 0 8px 25px rgba(46, 125, 50, 0.25);
}

/* 🔮 Galaxy — 星空紫 (炫酷中性) */
[data-theme="galaxy"] {
  --bg-color: #120a2e;
  --surface-color: #1a1040;
  --surface-highlight: #261658;
  --text-primary: #e8dff5;
  --text-secondary: #a98fd8;

  --gold-primary: #b388ff;
  --gold-secondary: #d1a3ff;
  --gold-faint: rgba(179, 136, 255, 0.1);

  --accent-green: #69f0ae;
  --accent-red: #ff5252;

  --border-color: rgba(179, 136, 255, 0.15);
  --border-focus: rgba(179, 136, 255, 0.5);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(179, 136, 255, 0.25);

  --navbar-bg: rgba(18, 10, 46, 0.85);
  --body-bg-image: radial-gradient(ellipse at 20% 40%, rgba(179, 136, 255, 0.06) 0%, transparent 50%), radial-gradient(ellipse at 80% 60%, rgba(105, 240, 174, 0.04) 0%, transparent 50%);
  --btn-primary-bg: linear-gradient(135deg, #d1a3ff, #b388ff);
  --btn-primary-color: #120a2e;
  --btn-primary-hover-shadow: 0 8px 25px rgba(179, 136, 255, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Serif SC', serif;
  background-color: var(--bg-color);
  background-image: var(--body-bg-image);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Base App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Premium Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 48px;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Noto Serif SC', serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--gold-primary);
}

.nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-highlight);
}

.nav-link.active {
  color: var(--gold-primary);
  background: var(--gold-faint);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Noto Serif SC', serif;
  line-height: 1.3;
}

/* Utilities */
.text-gold {
  color: var(--gold-primary);
}

.bg-surface {
  background: var(--surface-color);
}

.blur-backdrop {
  backdrop-filter: blur(8px);
}

/* Premium Buttons */
.btn-core {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  border: none;
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 2px;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-color);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--btn-primary-hover-shadow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  background: var(--gold-faint);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

/* Hamburger Button (hidden on desktop) */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1010;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Nav Overlay (mobile backdrop) */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
    flex-direction: row;
    gap: 0;
  }

  /* When menu is open, raise navbar above the overlay so nav-links panel is not blurred */
  .navbar:has(.nav-links.open),
  .navbar.menu-open {
    z-index: 1001;
  }

  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    flex-direction: column;
    padding: 80px 24px 32px;
    gap: 4px;
    z-index: 1000;
    transition: right 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
  }

  .nav-links.open {
    right: 0;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 15px;
    padding: 12px 16px;
    border-radius: 10px;
    width: 100%;
    text-align: left;
  }

  .nav-link.active {
    background: var(--gold-faint);
  }
}

/* Theme Picker Panel */
.theme-picker-wrap {
  position: relative;
  display: inline-flex;
}

.theme-picker {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  z-index: 2000;
  box-shadow: var(--shadow-md);
  min-width: 180px;
}

.theme-picker.open {
  display: grid;
}

.theme-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.theme-opt:hover {
  background: var(--surface-highlight);
}

.theme-opt.active {
  border-color: var(--gold-primary);
  background: var(--gold-faint);
  color: var(--gold-primary);
}

.theme-opt-icon {
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 768px) {
  .theme-picker {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
    margin-top: 0;
    min-width: auto;
  }
}

/* 🌐 Language & Learning Mode Picker Dropdown */
.lang-picker-wrap {
  position: relative;
  display: inline-flex;
}

.lang-picker {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-md);
  min-width: 270px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lang-picker.open {
  display: flex;
}

.lang-picker-title {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.lang-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lang-opt-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: var(--surface-highlight);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.lang-opt-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.lang-opt-btn.active {
  border-color: var(--gold-primary);
  background: var(--gold-faint);
  color: var(--gold-primary);
}

.lang-mode-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-highlight);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  color: var(--text-primary);
}

.lang-mode-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.lang-mode-item.active {
  border-color: var(--gold-primary);
  background: var(--gold-faint);
  color: var(--gold-primary);
}

@media (max-width: 768px) {
  .lang-picker {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
    margin-top: 0;
    min-width: auto;
  }
}