/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&family=Outfit:wght@400;500;600;700&display=swap');

/* Color Variables and Design System Tokens */
:root {
  /* Light Mode Palette */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-hover: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #ffffff;
  
  --primary: #ff5e83;
  --primary-hover: #e04468;
  --primary-glow: rgba(255, 94, 131, 0.2);
  --secondary: #6366f1;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --border-color: rgba(226, 232, 240, 0.8);
  --border-glass: rgba(255, 255, 255, 0.4);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --font-sans: 'Inter', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  --font-title: 'Outfit', sans-serif;
  
  --sidebar-width: 260px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Palette overrides */
body.theme-dark {
  --bg-primary: #0b0f19;
  --bg-secondary: #131a26;
  --bg-sidebar: #070a10;
  --bg-card: rgba(19, 26, 38, 0.7);
  --bg-hover: #1e293b;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-light: #ffffff;
  
  --primary: #ff7597;
  --primary-hover: #ff9fb6;
  --primary-glow: rgba(255, 117, 151, 0.25);
  --secondary: #818cf8;
  
  --border-color: rgba(30, 41, 59, 0.8);
  --border-glass: rgba(255, 255, 255, 0.05);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Layout Shell */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 100;
  transition: var(--transition);
  flex-shrink: 0;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  font-family: var(--font-title);
  box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.nav-item.active a,
.nav-item a:hover {
  color: var(--text-light);
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active a {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 12px rgba(255, 94, 131, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 40px;
  position: relative;
  background-image: radial-gradient(circle at 10% 20%, rgba(255, 117, 151, 0.03) 0%, rgba(99, 102, 241, 0.02) 90%);
}

/* Decorative Background Elements */
.bg-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
}

.bg-circle-1 {
  width: 400px;
  height: 400px;
  background: rgba(255, 117, 151, 0.06);
  top: -100px;
  right: -50px;
}

.bg-circle-2 {
  width: 500px;
  height: 500px;
  background: rgba(99, 102, 241, 0.04);
  bottom: -150px;
  left: 20%;
}

.main-content-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
}

/* Typography & Titles */
.page-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 2.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 4px;
}

/* Premium Card (Glassmorphism) */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-glass);
  margin-bottom: 32px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-light);
  box-shadow: 0 4px 12px rgba(255, 94, 131, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 94, 131, 0.35);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   MODULE 1: DASHBOARD
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.progress-widget {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
}

.progress-circle-container {
  position: relative;
  width: 70px;
  height: 70px;
}

.progress-circle-svg {
  width: 70px;
  height: 70px;
  transform: rotate(-90deg);
}

.progress-circle-bg {
  fill: none;
  stroke: var(--bg-hover);
  stroke-width: 6;
}

.progress-circle-bar {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 201; /* 2 * PI * r (where r=32) */
  stroke-dashoffset: 201;
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.progress-circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.widget-info h3 {
  font-size: 1.1rem;
  font-family: var(--font-title);
  margin-bottom: 4px;
}

.widget-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Quote and Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, rgba(255, 94, 131, 0.08), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(255, 94, 131, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.welcome-text h2 {
  font-family: var(--font-title);
  font-size: 1.75rem;
  margin-bottom: 12px;
  color: var(--primary);
}

.welcome-text p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.welcome-japanese {
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 2rem;
  color: var(--text-primary);
  opacity: 0.85;
  white-space: nowrap;
}

/* Goal settings */
.goals-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.last-studied-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.last-studied-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.last-studied-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.2rem;
}

/* ==========================================================================
   MODULE 2: KANA CHART
   ========================================================================== */
.kana-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.kana-chart-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
}

.kana-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  aspect-ratio: 1;
  transition: var(--transition);
}

.kana-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 8px 16px rgba(255, 94, 131, 0.1);
}

.kana-card.empty {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
  background: transparent;
  border-style: dashed;
}

.kana-jp {
  font-family: var(--font-jp);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kana-romaji {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ==========================================================================
   MODULE 3: VOCABULARY
   ========================================================================== */
.vocab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.search-bar-container {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon-svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 20px;
  height: 20px;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn.active,
.filter-btn:hover {
  background-color: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
}

.vocab-mode-toggle {
  display: flex;
  background-color: var(--bg-hover);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.vocab-mode-btn {
  padding: 6px 16px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.vocab-mode-btn.active {
  background-color: var(--bg-secondary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* List Mode View */
.vocab-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.vocab-list-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: var(--transition);
}

.vocab-list-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-glow);
}

.vocab-list-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.vocab-japanese-wrapper {
  display: flex;
  flex-direction: column;
}

.vocab-jp-text {
  font-family: var(--font-jp);
  font-size: 1.6rem;
  font-weight: 700;
}

.vocab-romaji-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.vocab-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.vocab-badge.greetings { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.vocab-badge.family_people { background-color: rgba(99, 102, 241, 0.1); color: var(--secondary); }
.vocab-badge.body_parts { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.vocab-badge.food_drinks { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.vocab-badge.daily_items { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.vocab-badge.clothing { background-color: rgba(236, 72, 153, 0.1); color: #ec4899; }
.vocab-badge.places_buildings { background-color: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.vocab-badge.countries_lang { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.vocab-badge.transportation { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.vocab-badge.nature_animals { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.vocab-badge.numbers_time { background-color: rgba(236, 72, 153, 0.1); color: #ec4899; }
.vocab-badge.school_work { background-color: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.vocab-badge.leisure_sports { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.vocab-badge.action_verbs { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }
.vocab-badge.movement_verbs { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }
.vocab-badge.state_verbs { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }
.vocab-badge.i_adjectives { background-color: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.vocab-badge.na_adjectives { background-color: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.vocab-badge.adverbs_conjunctions { background-color: rgba(236, 72, 153, 0.1); color: #ec4899; }
.vocab-badge.other_nouns { background-color: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

.vocab-meaning {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 1rem;
}

.vocab-example {
  background-color: var(--bg-primary);
  padding: 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  border-left: 3px solid var(--primary);
}

.vocab-example-ja {
  font-family: var(--font-jp);
  font-weight: 500;
  margin-bottom: 2px;
}

.vocab-example-en {
  color: var(--text-secondary);
}

.vocab-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Flashcard View */
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 500px;
  margin: 0 auto;
  padding: 20px 0;
}

.flashcard-card-scene {
  width: 100%;
  aspect-ratio: 1.22;
  perspective: 1000px;
}

.flashcard-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard-card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-glass);
}

.card-face.front {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-hover));
  color: var(--text-primary);
}

.card-face.back {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-light);
  transform: rotateY(180deg);
}

.flashcard-front-jp {
  font-family: var(--font-jp);
  font-size: 2.8rem;
  font-weight: 700;
  text-align: center;
}

.flashcard-speak-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.flashcard-back-mean {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.flashcard-back-reading {
  font-size: 1.1rem;
  opacity: 0.9;
  text-align: center;
  margin-bottom: 24px;
}

.flashcard-back-example {
  background: rgba(255, 255, 255, 0.15);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  max-width: 90%;
}

.flashcard-indicator {
  position: absolute;
  bottom: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
}

.card-face.back .flashcard-indicator {
  color: rgba(255, 255, 255, 0.7);
}

.flashcard-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.flashcard-btn-nav {
  flex-grow: 1;
}

.flashcard-progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.flashcard-progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.flashcard-info-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==========================================================================
   MODULE 4: GRAMMAR
   ========================================================================== */
.grammar-list-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.grammar-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.grammar-item-header {
  padding: 24px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.grammar-item-header:hover {
  background-color: var(--bg-hover);
}

.grammar-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.grammar-index {
  background-color: var(--primary);
  color: var(--text-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: var(--font-title);
  flex-shrink: 0;
}

.grammar-title {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 1.25rem;
}

.grammar-collapse-icon {
  transition: var(--transition);
}

.grammar-item-card.expanded .grammar-collapse-icon {
  transform: rotate(180deg);
}

.grammar-item-body {
  display: none;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.grammar-item-card.expanded .grammar-item-body {
  display: block;
}

.grammar-section-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grammar-structure-box {
  background-color: var(--bg-primary);
  border: 1px dashed var(--primary);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--primary);
}

.grammar-explanation {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.grammar-examples-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grammar-example-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--secondary);
}

.grammar-example-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grammar-example-ja {
  font-family: var(--font-jp);
  font-size: 1.2rem;
  font-weight: 500;
}

.grammar-example-en {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Grammar builder sub-box */
.grammar-builder-container {
  margin-top: 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  background-color: var(--bg-primary);
}

.grammar-builder-slots {
  min-height: 50px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 1.5px dashed var(--text-muted);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 16px;
  background: var(--bg-secondary);
  align-items: center;
}

.grammar-builder-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-token {
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-jp);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.builder-token:hover {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.builder-token.selected {
  opacity: 0.4;
  pointer-events: none;
}

.builder-feedback {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
}

.builder-feedback.success { color: var(--success); }
.builder-feedback.error { color: var(--danger); }

/* ==========================================================================
   MODULE 5: PRACTICE / QUIZ
   ========================================================================== */
.quiz-welcome-box {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 0;
}

.quiz-welcome-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.quiz-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
  margin-bottom: 32px;
}

.quiz-selector-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.quiz-selector-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.quiz-selector-card h4 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.quiz-selector-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Active Quiz Container */
.active-quiz-container {
  max-width: 650px;
  margin: 0 auto;
}

.quiz-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.quiz-progress-num {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.quiz-question-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
}

.quiz-question-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
}

.quiz-question-title {
  font-family: var(--font-jp);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-question-sub {
  color: var(--text-secondary);
  font-size: 1rem;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-option-btn {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-option-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
}

.quiz-option-btn.selected {
  border-color: var(--primary);
  background-color: rgba(255, 94, 131, 0.04);
}

.quiz-option-btn.correct {
  border-color: var(--success);
  background-color: rgba(16, 185, 129, 0.05);
  color: var(--success);
  font-weight: 600;
}

.quiz-option-btn.wrong {
  border-color: var(--danger);
  background-color: rgba(239, 68, 68, 0.05);
  color: var(--danger);
}

.option-letter {
  background-color: var(--bg-primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-right: 12px;
  border: 1px solid var(--border-color);
  font-family: var(--font-title);
  font-size: 0.85rem;
}

.quiz-option-btn.correct .option-letter {
  background-color: var(--success);
  color: #fff;
  border-color: var(--success);
}

.quiz-option-btn.wrong .option-letter {
  background-color: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.quiz-action-bar {
  display: flex;
  justify-content: flex-end;
}

/* Quiz Results Screen */
.quiz-results-box {
  text-align: center;
  padding: 40px 20px;
}

.results-score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
  box-shadow: 0 10px 25px rgba(255, 94, 131, 0.3);
}

.results-score-num {
  font-family: var(--font-title);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
}

.results-score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0.9;
}

.results-title {
  font-family: var(--font-title);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.results-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 32px;
}

/* ==========================================================================
   UTILITY & TRANSITIONS
   ========================================================================== */
.hide {
  display: none !important;
}

.ripple-effect {
  animation: pulse 0.3s ease-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 16px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }

  .logo-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .nav-links {
    flex-direction: row;
    gap: 4px;
    width: auto;
    margin: 0;
  }

  .nav-item a {
    padding: 8px 12px;
    font-size: 0.85rem;
    gap: 8px;
  }
  
  .nav-item a span {
    display: none; /* Hide text on smaller tablets */
  }

  .sidebar-footer {
    display: none; /* Hide footer/theme toggle on mobile sidebar header */
  }

  /* Insert a mobile theme toggle somewhere or make it float */
  .main-content {
    padding: 24px 16px;
    height: calc(100vh - 72px);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .goals-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  /* Bottom navigation bar for mobile */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    top: auto;
    height: 64px;
    padding: 0;
    justify-content: center;
    background-color: var(--bg-sidebar);
  }
  
  .logo-section {
    display: none;
  }
  
  .nav-links {
    width: 100%;
    justify-content: space-around;
    align-items: center;
    height: 100%;
  }
  
  .nav-item {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    height: 100%;
  }
  
  .nav-item a {
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 0;
    gap: 4px;
  }
  
  .nav-item a svg {
    width: 20px;
    height: 20px;
  }

  .nav-item a span {
    display: block;
    font-size: 0.65rem;
  }
  
  .main-content {
    height: calc(100vh - 64px);
    padding: 16px 12px;
    padding-bottom: 80px; /* buffer for bottom bar */
  }

  .page-title {
    font-size: 1.75rem;
  }
  
  .glass-card {
    padding: 20px;
  }
  
  .kana-chart-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  
  .kana-card {
    padding: 8px;
  }
  
  .kana-jp {
    font-size: 1.5rem;
  }
  
  .kana-romaji {
    font-size: 0.7rem;
    margin-top: 2px;
  }
}

/* ==========================================================================
   MODULE 6: VOCAB CONSOLIDATION PAGE STYLES
   ========================================================================== */
.consolidation-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.consolidation-table th,
.consolidation-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.consolidation-table th {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.consolidation-table tbody tr {
  transition: var(--transition);
}

.consolidation-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.consolidation-table td.clickable-jp {
  font-family: var(--font-jp);
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
}

.consolidation-table td.clickable-jp:hover {
  color: var(--secondary);
  text-decoration: underline;
  transform: scale(1.02);
}

.font-sm {
  font-size: 0.85rem;
}

/* Adjectives Split View */
.adjectives-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.adj-column {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.adj-header {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid;
}

.adj-header.i-type {
  color: var(--primary);
  border-color: var(--primary);
}

.adj-header.na-type {
  color: var(--secondary);
  border-color: var(--secondary);
}

/* Counters Grid View */
.counters-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.counter-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.counter-header {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
  padding-left: 8px;
}

.counter-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.subtab-btn {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Table Responsive Wrap */
@media (max-width: 900px) {
  .adjectives-split-container {
    grid-template-columns: 1fr;
  }
}

/* Conjugations Grid in List Card */
.vocab-conjugations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  background-color: var(--bg-hover);
  border-radius: 6px;
  border: 1px dashed var(--border-color);
}

.conj-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.conj-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.72rem;
  background-color: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.conj-val {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.conj-val:hover {
  opacity: 0.8;
}

/* Conjugations in Flashcard Back Face */
.flashcard-back-conjugations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  width: 100%;
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  box-sizing: border-box;
}

.fc-conj-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fc-conj-label {
  opacity: 0.85;
  font-weight: 500;
  font-size: 0.75rem;
}

.fc-conj-val {
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline dotted;
}

.fc-conj-val:hover {
  opacity: 0.8;
}
