/* =========================================================
 * style.css — KanaLearn Modern Japanese Aesthetic Stylesheet
 * Desain bersih, tipografi presisi, responsif desktop & mobile
 * ========================================================= */

:root {
  --bg-main: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-subtle: #f1f3f5;
  --bg-tint-red: #fdf2f2;
  --bg-tint-green: #f0fdf4;
  --bg-tint-blue: #f0f7ff;
  --bg-tint-amber: #fffbeb;

  --text-primary: #18191f;
  --text-secondary: #374151;
  --text-muted: #4b5563;
  --text-on-accent: #ffffff;

  --border-subtle: #e5e7eb;
  --border-medium: #c7cbd3;
  --border-focus: #b91c1c;

  --accent-red: #b91c1c;
  --accent-red-hover: #991b1b;
  --accent-indigo: #1e293b;
  --accent-green: #0f766e;
  --accent-amber: #92400e;
  --accent-purple: #4338ca;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05);

  --font-kana: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-sans: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --header-height: 64px;
  --bottom-nav-height: 64px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-main: #0f1115;
  --bg-surface: #171920;
  --bg-card: #1b1e26;
  --bg-card-hover: #222631;
  --bg-subtle: #232732;
  --bg-tint-red: #2a1517;
  --bg-tint-green: #0f2723;
  --bg-tint-blue: #142236;
  --bg-tint-amber: #2b1f0d;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --border-subtle: #292e3b;
  --border-medium: #3b4253;
  --border-focus: #ef4444;

  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --accent-indigo: #cbd5e1;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #818cf8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-kana);
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 2px;
  font-family: var(--font-kana);
}

/* Desktop Nav */
.desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 6px;
  }
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.nav-link.active {
  color: var(--accent-red);
  background: var(--bg-tint-red);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-tint-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  font-size: 0.8rem;
  font-weight: 700;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Main Content Area */
main {
  flex: 1;
  padding-top: 24px;
  padding-bottom: 96px;
}

@media (min-width: 768px) {
  main {
    padding-bottom: 48px;
  }
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Hero Section */
.hero-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-subtle) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero-card {
    padding: 48px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
  }
}

.hero-content {
  max-width: 600px;
}

.hero-headline {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .hero-headline {
    font-size: 2.35rem;
  }
}

.hero-subheadline {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  min-height: 44px;
}

.btn-primary {
  background: var(--accent-red);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-red-hover);
  transform: translateY(-1px);
}

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

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

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.hero-stats-panel {
  background: transparent;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 16px 16px;
  min-width: 260px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .hero-stats-panel {
    margin-top: 0;
    border-top: none;
    border-left: 1px solid var(--border-subtle);
    padding: 24px 24px 24px 32px;
  }
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.progress-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-red);
}

.progress-bar-track {
  position: relative;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent-red), #ea580c);
  border-radius: var(--radius-full);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mini-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mini-stat-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.mini-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.mini-stat-lbl {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Dashboard Section Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 36px;
}

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

.feature-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.feature-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.feature-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.badge-red { background: var(--bg-tint-red); color: var(--accent-red); }
.badge-blue { background: var(--bg-tint-blue); color: var(--accent-purple); }
.badge-green { background: var(--bg-tint-green); color: var(--accent-green); }

.feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

/* Kana Tables & Explorer */
.explorer-controls {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  .explorer-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.script-segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.segment-btn {
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.segment-btn.active {
  background: var(--bg-surface);
  color: var(--accent-red);
  box-shadow: var(--shadow-sm);
}

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

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: var(--transition);
}

.chip:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
}

[data-theme="dark"] .chip.active {
  background: #f1f5f9;
  color: #0f172a;
}

.search-input-wrap {
  position: relative;
  min-width: 220px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
}

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

/* Character Grid */
.kana-section-header {
  margin-top: 24px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kana-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kana-section-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kana-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

@media (min-width: 640px) {
  .kana-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 14px;
  }
}

.kana-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
  min-height: 108px;
}

.kana-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-card);
}

.kana-card.mastered {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, var(--bg-card) 85%, var(--bg-tint-green) 100%);
}

.kana-card.mastered::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kana-glyph {
  font-family: var(--font-kana);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: transform 0.15s ease;
}

.kana-card:hover .kana-glyph {
  transform: scale(1.06);
}

.kana-card.is-yoon .kana-glyph {
  font-size: 2.15rem;
  letter-spacing: -0.05em;
}

.kana-romaji {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.kana-card-audio {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.6;
  transition: var(--transition);
}

.kana-card:hover .kana-card-audio {
  opacity: 1;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Yōon Formula Showcase */
.yoon-formula-banner {
  background: var(--bg-tint-blue);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.yoon-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-kana);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.yoon-eq-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.yoon-eq-sub {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.yoon-eq-op {
  color: var(--text-muted);
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.yoon-tip-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 640px;
}

/* Confusables Section */
.confusable-pair-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.confusable-glyphs {
  display: flex;
  align-items: center;
  gap: 20px;
}

.confusable-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-subtle);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-width: 80px;
}

.confusable-item:hover {
  background: var(--bg-tint-red);
  transform: translateY(-2px);
}

.confusable-glyph {
  font-family: var(--font-kana);
  font-size: 2.8rem;
  line-height: 1;
}

.confusable-romaji {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 4px;
}

.confusable-vs {
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.confusable-notes {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-left: 0;
}

@media (min-width: 640px) {
  .confusable-notes {
    padding-left: 20px;
    border-left: 1px solid var(--border-subtle);
  }
}

/* Special Characters (Sokuon & Choonpu) */
.special-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.special-glyph-box {
  width: 64px;
  height: 64px;
  background: var(--bg-tint-red);
  color: var(--accent-red);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-kana);
  font-size: 2.4rem;
  flex-shrink: 0;
}

.special-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.special-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.special-tip {
  font-size: 0.85rem;
  color: var(--accent-amber);
  background: var(--bg-tint-amber);
  padding: 6px 10px;
  border-radius: 4px;
  display: inline-block;
}

/* Flashcard View */
.flashcard-stage {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard-deck-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.flashcard-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-perspective-container {
  width: 100%;
  height: 340px;
  perspective: 1200px;
  margin-bottom: 24px;
  cursor: pointer;
}

.flashcard-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

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

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.flashcard-front .card-kana-large {
  font-family: var(--font-kana);
  font-size: 6rem;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 16px;
}

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

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-subtle) 100%);
}

.card-romaji-large {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-red);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.card-type-tag {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
}

.card-tip-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 12px;
}

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

.btn-flash-unknown {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  padding: 14px;
  font-weight: 700;
}

.btn-flash-unknown:hover {
  background: var(--bg-tint-red);
  color: var(--accent-red);
  border-color: var(--accent-red);
}

.btn-flash-known {
  flex: 1;
  background: var(--accent-green);
  color: #fff;
  padding: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.btn-flash-known:hover {
  background: #0d635c;
  transform: translateY(-1px);
}

.shortcut-guide {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.kbd-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: monospace;
}

/* Quiz Stage */
.quiz-container {
  max-width: 580px;
  margin: 0 auto;
}

.quiz-setup-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
}

.quiz-mode-select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .quiz-mode-select-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.quiz-mode-option {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 16px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.quiz-mode-option:hover {
  border-color: var(--border-medium);
}

.quiz-mode-option.active {
  border-color: var(--accent-red);
  background: var(--bg-tint-red);
  color: var(--accent-red);
}

.quiz-mode-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.quiz-mode-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quiz-active-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  position: relative;
}

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

.quiz-question-prompt {
  text-align: center;
  margin-bottom: 28px;
}

.prompt-category {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prompt-character {
  font-family: var(--font-kana);
  font-size: 5rem;
  line-height: 1.1;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.prompt-character.romaji-prompt {
  font-family: var(--font-sans);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-indigo);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quiz-option-btn {
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition);
  font-family: var(--font-kana);
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--border-medium);
  background: var(--bg-subtle);
}

.quiz-option-btn.correct {
  border-color: var(--accent-green);
  background: var(--bg-tint-green);
  color: var(--accent-green);
}

.quiz-option-btn.wrong {
  border-color: var(--accent-red);
  background: var(--bg-tint-red);
  color: var(--accent-red);
}

.quiz-typing-box {
  display: flex;
  gap: 8px;
}

.quiz-text-input {
  flex: 1;
  font-size: 1.3rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  text-align: center;
}

.quiz-feedback-banner {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  display: none;
  animation: fadeIn 0.2s ease;
}

.quiz-feedback-banner.show {
  display: block;
}

.quiz-feedback-banner.correct-fb {
  background: var(--bg-tint-green);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.quiz-feedback-banner.wrong-fb {
  background: var(--bg-tint-red);
  color: var(--accent-red);
  border: 1px solid rgba(217, 56, 58, 0.3);
}

/* Modal / Character Detail */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-subtle);
  transition: var(--transition);
}

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

.modal-glyph-hero {
  text-align: center;
  margin-bottom: 20px;
}

.modal-glyph-char {
  font-family: var(--font-kana);
  font-size: 5.5rem;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-romaji-badge {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-red);
}

.modal-action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.modal-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.modal-tip-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-similar-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.similar-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-kana);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.similar-chip:hover {
  background: var(--bg-tint-red);
  border-color: var(--accent-red);
}

/* Stats / Dashboard Metrics */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.stat-metric-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Mobile Bottom Navigation */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px;
  width: 20%;
  min-height: 48px;
  transition: var(--transition);
}

.mobile-nav-item.active {
  color: var(--accent-red);
}

.mobile-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Pulse animation for audio playback */
@keyframes audioPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.is-speaking {
  animation: audioPulse 0.4s infinite ease-in-out;
  color: var(--accent-red) !important;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-surface);
}
