/* ==========================================================================
   HSK AUSSPRACHE-TRAINER: NEO-CHINESE CYBER-ZEN EDITION (4K ATMOSPHERIC UI)
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-chinese: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-label: 'Hanken Grotesk', 'Inter', sans-serif;

  /* Theme Colors - Light Mode (Serene Dawn Jade & Silk Parchment) */
  --bg-app: #f4f6f9;
  --bg-header: rgba(255, 255, 255, 0.78);
  --bg-subnav: rgba(255, 255, 255, 0.65);
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-hover: rgba(255, 255, 255, 0.94);
  --bg-card-solid: #ffffff;
  --bg-secondary: rgba(241, 245, 249, 0.75);
  --bg-tertiary: rgba(226, 232, 240, 0.8);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --border-color: rgba(226, 232, 240, 0.85);
  --border-glass: rgba(255, 255, 255, 0.85);
  --border-focus: #c0392b;

  /* Accents */
  --color-primary: #9e2016;
  --color-primary-hover: #c0392b;
  --color-primary-bg: rgba(192, 57, 43, 0.08);

  --color-emerald: #059669;
  --color-emerald-vibrant: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.35);
  --color-emerald-bg: rgba(236, 253, 245, 0.85);
  --color-emerald-border: #10b981;

  --color-amber: #d97706;
  --color-amber-bg: rgba(254, 243, 199, 0.85);
  --color-rose: #dc2626;
  --color-rose-bg: rgba(254, 242, 242, 0.85);
  --color-indigo: #4f46e5;
  --color-indigo-bg: rgba(238, 242, 255, 0.85);

  --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px -6px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08), inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-glow-green: 0 0 28px rgba(16, 185, 129, 0.35), 0 8px 24px -4px rgba(16, 185, 129, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  --blur-card: blur(28px) saturate(180%);
}

body.dark-mode {
  /* Theme Colors - Dark Mode (Cyber-Zen Deep Obsidian & Luminous Jade) */
  --bg-app: #07090e;
  --bg-header: rgba(10, 14, 26, 0.76);
  --bg-subnav: rgba(12, 17, 32, 0.65);
  --bg-card: rgba(14, 20, 36, 0.72);
  --bg-card-hover: rgba(19, 28, 48, 0.85);
  --bg-card-solid: #0e1626;
  --bg-secondary: rgba(22, 32, 54, 0.65);
  --bg-tertiary: rgba(30, 43, 72, 0.75);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-color: rgba(51, 65, 85, 0.55);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-focus: #ff897d;

  --color-primary: #ff897d;
  --color-primary-hover: #ffdad5;
  --color-primary-bg: rgba(255, 137, 125, 0.12);

  --color-emerald: #34d399;
  --color-emerald-vibrant: #10b981;
  --color-emerald-glow: rgba(52, 211, 153, 0.35);
  --color-emerald-bg: rgba(16, 185, 129, 0.15);
  --color-emerald-border: #34d399;

  --color-amber: #fbbf24;
  --color-amber-bg: rgba(245, 158, 11, 0.15);
  --color-rose: #f87171;
  --color-rose-bg: rgba(239, 68, 68, 0.15);
  --color-indigo: #818cf8;
  --color-indigo-bg: rgba(99, 102, 241, 0.15);

  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 18px 48px -6px rgba(0, 0, 0, 0.75);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.55), inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
  --shadow-glow-green: 0 0 32px rgba(52, 211, 153, 0.4), 0 10px 30px -4px rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ==========================================================================
   ATMOSPHERIC 4K BACKGROUND LAYER & DYNAMIC AMBIENT GLOW
   ========================================================================== */
.ambient-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ambient-wallpaper {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  transition: background-image 0.8s ease-in-out, opacity 0.8s ease;
  transform: scale(1.02);
}

body.light-mode .ambient-wallpaper {
  background-image: url('/static/img/bg_light.jpg');
  opacity: 0.88;
}

body.dark-mode .ambient-wallpaper {
  background-image: url('/static/img/bg_dark.jpg');
  opacity: 0.82;
}

.ambient-gradient-overlay {
  position: absolute;
  inset: 0;
  transition: background 0.6s ease;
}

body.light-mode .ambient-gradient-overlay {
  background: radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.55) 0%, rgba(244, 246, 249, 0.85) 65%, rgba(238, 242, 246, 0.97) 100%);
}

body.dark-mode .ambient-gradient-overlay {
  background: radial-gradient(circle at 50% 15%, rgba(7, 9, 14, 0.45) 0%, rgba(8, 13, 24, 0.82) 65%, rgba(5, 8, 18, 0.96) 100%);
}

/* Luminous Ambient Floating Orbs */
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  pointer-events: none;
  opacity: 0.45;
  animation: floatOrb 25s infinite alternate ease-in-out;
}

body.dark-mode .ambient-orb {
  opacity: 0.35;
  mix-blend-mode: screen;
}

.ambient-orb-1 {
  top: 5%;
  left: 10%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
  animation-duration: 22s;
}

.ambient-orb-2 {
  top: 35%;
  right: 8%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.3) 0%, transparent 70%);
  animation-duration: 28s;
  animation-delay: -7s;
}

.ambient-orb-3 {
  bottom: 8%;
  left: 30%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
  animation-duration: 32s;
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(60px, -40px, 0) scale(1.12); }
  100% { transform: translate3d(-50px, 50px, 0) scale(0.95); }
}

.ambient-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ==========================================================================
   HEADER & DUAL-TIER NAVIGATION (GLASSMORPHIC)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 4px 10px rgba(158, 32, 22, 0.25));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-logo {
  transform: scale(1.08) rotate(-3deg);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-emerald);
  background: var(--color-emerald-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* View Switcher Tabs (Segmented Capsule) */
.view-switch-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 4px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.15);
}

.mode-btn.active {
  background: linear-gradient(135deg, #9e2016, #c0392b);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(158, 32, 22, 0.38);
  font-weight: 700;
}

body.dark-mode .mode-btn.active {
  background: linear-gradient(135deg, #ff897d, #e11d48);
  color: #07090e;
  box-shadow: 0 4px 16px rgba(255, 137, 125, 0.35);
}

/* Sub-Navigation Bar for Levels */
.level-subnav-bar {
  background: var(--bg-subnav);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.5rem 1.5rem;
  position: sticky;
  top: 61px;
  z-index: 90;
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.level-subnav-container {
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.level-subnav-container::-webkit-scrollbar {
  display: none;
}

.level-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 2px 0;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

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

.tab-btn.active {
  background: var(--color-primary-bg);
  border-color: rgba(158, 32, 22, 0.35);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(158, 32, 22, 0.15);
}

.tab-btn .badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  transition: all 0.2s;
}

.tab-btn.active .badge {
  background: var(--color-primary);
  color: #ffffff;
}

body.dark-mode .tab-btn.active .badge {
  background: var(--color-primary);
  color: #07090e;
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1.05rem;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   MAIN LAYOUT & BENTO-GRID DASHBOARD
   ========================================================================== */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

.overview-section {
  margin-bottom: 2rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
}

.bento-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.85rem;
  box-shadow: var(--shadow-glass);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.12), inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
}

.bento-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-hero-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.hero-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.hero-tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 12px var(--color-primary);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

.stat-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.hero-progress-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hero-progress-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-emerald);
  letter-spacing: -0.02em;
}

.hero-progress-sub {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Animated Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.55);
}

/* Mini Stat Blocks */
.bento-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-top: 1rem;
}

.mini-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mini-stat-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.mini-stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.mini-stat-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-mastered .mini-stat-num { color: var(--color-emerald); }
.stat-practice .mini-stat-num { color: var(--color-amber); }
.stat-untested .mini-stat-num { color: var(--text-dim); }

/* Bento Radial Gauge */
.bento-radial {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.bento-radial-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.bento-radial-title {
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.bento-badge-live {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid rgba(158, 32, 22, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.bento-gauge-wrapper {
  position: relative;
  width: 136px;
  height: 136px;
  margin: 0.5rem 0;
}

.bento-gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.bento-gauge-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 9;
}

.bento-gauge-fill {
  fill: none;
  stroke: var(--color-emerald);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 8px var(--color-emerald-glow));
}

.bento-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bento-gauge-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -0.03em;
}

.bento-gauge-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

/* Toolbar: Filter chips & Search */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  transform: translateY(-1px);
}

.chip.active {
  background: linear-gradient(135deg, #9e2016, #c0392b);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(158, 32, 22, 0.35);
  font-weight: 700;
}

.chip.chip-mastered.active {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.6;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 9px 38px 9px 40px;
  border-radius: var(--radius-full);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.clear-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  display: none;
}

.search-box input:not(:placeholder-shown) ~ .clear-search-btn {
  display: block;
}

/* ==========================================================================
   VOCABULARY CARD GRID (LIST VIEW)
   ========================================================================== */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* Individual Vocab Card (Floating Glass Tablet) */
.vocab-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  box-shadow: var(--shadow-glass);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.vocab-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.12), inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
  border-color: rgba(158, 32, 22, 0.35);
}

/* 🟢 OVER 90% MASTERED GREEN HIGHLIGHT (EMERALD AURORA) */
.vocab-card.mastered {
  border: 1.5px solid var(--color-emerald-border) !important;
  background: var(--color-emerald-bg) !important;
  box-shadow: var(--shadow-glow-green) !important;
}

.vocab-card.mastered::before {
  content: "✓ >90%";
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 12px 4px 10px;
  border-bottom-left-radius: 10px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.45);
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.level-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 2px 9px;
  border-radius: var(--radius-full);
}

.card-score-slot {
  display: flex;
  align-items: center;
}

/* Card Hero: Prominent Hanzi & Pinyin */
.card-hero {
  text-align: center;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.card-hero .hanzi-text {
  font-family: var(--font-chinese);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  letter-spacing: 0.04em;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vocab-card:hover .card-hero .hanzi-text {
  transform: scale(1.08);
}

.card-hero .pinyin-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.03em;
}

.card-meaning-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-main);
}

.meaning-de { display: inline; }
.meaning-en { display: inline; color: var(--text-muted); font-size: 0.825rem; }

.pos-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 1px 7px;
  border-radius: 4px;
}

/* Card Beispielsatz Box */
.card-example {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

.card-example .ex-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  overflow: hidden;
  flex: 1;
}

.card-example .ex-hz {
  font-family: var(--font-chinese);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-example .ex-de {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-ex-audio {
  border: none;
  background: var(--bg-card);
  color: var(--color-primary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-ex-audio:hover {
  transform: scale(1.15);
  background: var(--color-primary-bg);
}

/* Card Footer: Action Buttons */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}

.btn-audio {
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.btn-audio.playing {
  background: var(--color-primary);
  color: #ffffff;
  animation: pulse-audio 1s infinite alternate;
}

.btn-mic {
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-mic:hover {
  background: var(--color-emerald-bg);
  color: var(--color-emerald);
  border-color: var(--color-emerald);
  transform: translateY(-1px);
}

.btn-mic.recording {
  background: var(--color-rose);
  color: #ffffff;
  border-color: var(--color-rose);
  animation: pulse-recording 1.2s infinite;
}

.btn-stroke-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 12px;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-stroke-card:hover {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-discard {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-discard:hover {
  background: var(--color-rose-bg);
  color: var(--color-rose);
  border-color: var(--color-rose);
  transform: translateY(-1px);
}

.btn-discard.discarded {
  background: var(--color-rose-bg);
  color: var(--color-rose);
  border-color: var(--color-rose);
  font-weight: 700;
}

/* Score Badge on Card */
.score-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.score-badge.score-green {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.45);
}

.score-badge.score-blue {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.score-badge.score-amber {
  background: var(--color-amber-bg);
  color: var(--color-amber);
}

.score-badge.score-red {
  background: var(--color-rose-bg);
  color: var(--color-rose);
}

.score-badge.score-none {
  background: transparent;
  color: var(--text-dim);
  font-weight: 500;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding: 1rem;
}

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

/* ==========================================================================
   SUPERCHINESE FOCUS STUDIO (CYBER-ZEN & LIUBAI EDITION)
   ========================================================================== */
.training-workspace {
  max-width: 1180px;
  margin: 1.5rem auto 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.train-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 0.5rem;
}

.train-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  padding: 7px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.training-counter {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.train-meta-dot { color: var(--text-dim); }

.training-level-tag {
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.train-actions-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-subtle {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.btn-subtle:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 2-Column Split Studio Grid */
.train-split-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.75rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .train-split-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Character Stage */
.train-col-character {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 3rem 2.25rem 2.25rem;
  box-shadow: var(--shadow-glass);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Tianzige Guide Watermark */
.tianzige-guide {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  border: 1px dashed var(--border-color);
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

.tianzige-guide::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  border-top: 1px dashed var(--border-color);
}

.tianzige-guide::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  border-left: 1px dashed var(--border-color);
}

.train-char-hero {
  position: relative;
  z-index: 2;
  margin-bottom: 2rem;
}

.train-hanzi {
  font-family: var(--font-chinese);
  font-size: 7rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text-main);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 24px rgba(16, 185, 129, 0.18));
}

.train-hanzi:hover {
  transform: scale(1.06);
}

.train-pinyin {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.train-meaning-pill {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 8px 24px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

/* Example Sentence Box */
.train-example-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.6rem;
  margin-top: 1.25rem;
  text-align: left;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.example-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.example-box-badge {
  font-size: 0.775rem;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid rgba(158, 32, 22, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-audio-sentence {
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.btn-audio-sentence:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.train-example-hz {
  font-family: var(--font-chinese);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.train-example-py {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.train-example-de {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Right Column: Analysis Hub */
.train-col-analysis {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-glass);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.score-card-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.score-circle-wrapper {
  position: relative;
  width: 154px;
  height: 154px;
  flex-shrink: 0;
}

.score-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-bg-ring {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 12;
}

.score-fill-ring {
  fill: none;
  stroke: var(--color-emerald);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 12px var(--color-emerald-glow));
}

.score-center-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 54px;
}

.score-num {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
}

.score-unit {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 2px;
}

.score-info-column {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.score-hub-title {
  font-size: 0.825rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.train-status-msg {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Neon Waveform Visualizer */
.waveform-container, .modal-wave-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 38px;
  margin-bottom: 1rem;
}

.wave-bar {
  width: 5px;
  height: 6px;
  background: var(--text-dim);
  border-radius: var(--radius-full);
  transition: height 0.1s ease, background-color 0.2s ease;
}

.recording .wave-bar {
  background: linear-gradient(180deg, #f87171, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  animation: wave-dance 0.8s infinite alternate ease-in-out;
}

.recording .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.recording .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.recording .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.recording .wave-bar:nth-child(5) { animation-delay: 0.4s; }
.recording .wave-bar:nth-child(6) { animation-delay: 0.3s; }
.recording .wave-bar:nth-child(7) { animation-delay: 0.2s; }
.recording .wave-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes wave-dance {
  0% { height: 6px; }
  100% { height: 34px; }
}

/* Evaluation Details (SuperChinese Breakdown) */
.train-breakdown {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin: 1.25rem 0;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.breakdown-badge {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.85rem;
}

.breakdown-details .breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.925rem;
  margin-bottom: 0.45rem;
}

.breakdown-details .lbl {
  color: var(--text-muted);
}

.audio-compare-box {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* Floating Action Dock (Apple Capsule Dock) */
.train-dock {
  background: var(--bg-card);
  backdrop-filter: blur(36px) saturate(200%);
  -webkit-backdrop-filter: blur(36px) saturate(200%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 0.85rem 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  max-width: 540px;
  margin: 0.75rem auto 0;
  position: relative;
  z-index: 10;
}

body.dark-mode .train-dock {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-dock-action {
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 700;
  padding: 11px 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.btn-dock-action:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Elevated Circular Microphone Button */
.btn-dock-mic {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.45), 0 0 0 6px rgba(16, 185, 129, 0.18);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-dock-mic:hover {
  transform: scale(1.1);
  box-shadow: 0 14px 40px rgba(16, 185, 129, 0.6), 0 0 0 10px rgba(16, 185, 129, 0.25);
}

.btn-dock-mic .mic-icon {
  font-size: 1.9rem;
  line-height: 1;
}

.btn-dock-mic .mic-label {
  font-size: 0.725rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-train-mic.recording, .btn-dock-mic.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 36px rgba(239, 68, 68, 0.6), 0 0 0 8px rgba(239, 68, 68, 0.25);
  animation: pulse-recording 1.2s infinite;
}

.btn-train-mic.starting, .btn-dock-mic.starting {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.5);
  animation: pulse-starting 0.8s infinite alternate;
}

.train-keyboard-hints {
  font-size: 0.775rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.5rem;
}

kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.75rem;
}

/* ==========================================================================
   ANKI FLASHCARDS (KARTEIKARTEN) 3D MODE
   ========================================================================== */
.cards-container {
  max-width: 700px;
  margin: 0 auto 3rem;
}

.cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.cards-header-left, .cards-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cards-counter {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cards-direction-control {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}

.dir-btn {
  background: transparent;
  border: none;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.dir-btn:hover { color: var(--text-main); }

.dir-btn.active {
  background: var(--bg-card-solid);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

body.dark-mode .dir-btn.active {
  background: var(--bg-card-hover);
}

.cards-progress-bar {
  height: 7px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.cards-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9e2016, #c0392b);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(158, 32, 22, 0.4);
}

body.dark-mode .cards-progress-fill {
  background: linear-gradient(90deg, #ff897d, #e11d48);
}

.cards-options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.toggle-switch-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

.btn-card-filter-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-card-filter-chip:hover {
  border-color: var(--color-rose);
  color: var(--color-rose);
}

.btn-card-filter-chip.active {
  background: var(--color-rose);
  color: #ffffff;
  border-color: var(--color-rose);
}

.cards-stats-mini {
  display: flex;
  gap: 0.5rem;
}

.badge-mini {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.badge-again { background: var(--color-rose-bg); color: var(--color-rose); }
.badge-good { background: var(--color-primary-bg); color: var(--color-primary); }
.badge-easy { background: var(--color-emerald-bg); color: var(--color-emerald); }
.badge-discarded { background: var(--color-rose-bg); color: var(--color-rose); }

/* 3D Flip Flashcard Scene */
.flashcard-scene {
  perspective: 1400px;
  width: 100%;
  min-height: 460px;
  margin-bottom: 1.75rem;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  min-height: 460px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: var(--radius-xl);
}

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

.card-face {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  min-height: 460px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glass);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.flashcard-scene:hover .card-face {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  border-color: rgba(158, 32, 22, 0.4);
}

.card-front { transform: rotateY(0deg); text-align: center; }
.card-back { transform: rotateY(180deg); text-align: center; }

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

.card-hint-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.card-hint-badge.back {
  color: var(--color-emerald);
  background: var(--color-emerald-bg);
}

.btn-card-audio {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-card-audio:hover {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

/* Card Content Styling */
.card-front-content {
  padding: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-prompt-main {
  font-family: var(--font-chinese);
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.15));
}

.card-prompt-main.lang-de {
  font-family: var(--font-sans);
  font-size: 2.85rem;
  font-weight: 800;
  color: var(--color-primary);
}

.card-prompt-sub {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.card-prompt-pos {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-secondary);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Back Face Content */
.card-back-content {
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-back-hanzi {
  font-family: var(--font-chinese);
  font-size: 4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.card-back-pinyin {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.card-back-meaning {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-emerald);
  margin-bottom: 1.25rem;
}

.card-back-example {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 1.35rem;
  width: 100%;
  text-align: left;
}

.back-example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.ex-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-audio-sentence-mini {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 4px;
}

.back-example-hz {
  font-family: var(--font-chinese);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.back-example-py {
  font-size: 0.9rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.back-example-de {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-flip-prompt {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

/* Actions & Anki Rating Buttons */
.cards-action-area {
  margin-top: 1.25rem;
}

.flip-action-bar {
  display: flex;
  gap: 0.85rem;
}

.btn-flip-large {
  flex: 1;
  padding: 16px;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn-flip-discard {
  padding: 14px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--color-rose);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-flip-discard:hover {
  background: var(--color-rose-bg);
  border-color: var(--color-rose);
  transform: translateY(-2px);
}

.anki-rating-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.anki-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 15px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  box-shadow: var(--shadow-glass);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  text-align: left;
}

.anki-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.anki-btn-icon { font-size: 1.6rem; }
.anki-btn-text { display: flex; flex-direction: column; }
.anki-btn-title { font-size: 1.05rem; font-weight: 800; }
.anki-btn-sub { font-size: 0.725rem; color: var(--text-muted); }

.anki-again { border-color: rgba(245, 158, 11, 0.4); }
.anki-again:hover { background: rgba(245, 158, 11, 0.12); border-color: var(--color-amber); }
.anki-again .anki-btn-title { color: var(--color-amber); }

.anki-good { border-color: rgba(59, 130, 246, 0.4); }
.anki-good:hover { background: rgba(59, 130, 246, 0.1); border-color: var(--color-primary); }
.anki-good .anki-btn-title { color: var(--color-primary); }

.anki-easy { border-color: rgba(16, 185, 129, 0.4); }
.anki-easy:hover { background: rgba(16, 185, 129, 0.12); border-color: var(--color-emerald); }
.anki-easy .anki-btn-title { color: var(--color-emerald); }

.anki-discard { border-color: rgba(239, 68, 68, 0.4); }
.anki-discard:hover { background: var(--color-rose-bg); border-color: var(--color-rose); }
.anki-discard .anki-btn-title { color: var(--color-rose); }

.cards-keyboard-hints {
  text-align: center;
  font-size: 0.775rem;
  color: var(--text-dim);
  margin-top: 1.75rem;
}

/* Discarded Words Banner */
.discarded-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.3);
  backdrop-filter: var(--blur-card);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.6rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.discarded-banner-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.discarded-count-badge {
  font-size: 0.75rem;
  background: var(--color-rose);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.discarded-banner-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 620px;
}

.discarded-banner-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ==========================================================================
   VIEW 4: HANZI STROKE ORDER & WRITING STUDIO (KALLIGRAPHIE)
   ========================================================================== */
.stroke-container {
  max-width: 740px;
  margin: 1.5rem auto 4rem;
  padding: 0 1rem;
}

.stroke-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stroke-header-left, .stroke-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stroke-counter {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stroke-main-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-glass);
  text-align: center;
  position: relative;
}

.stroke-word-info {
  margin-bottom: 1.35rem;
}

.stroke-word-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.stroke-word-hanzi {
  font-family: var(--font-chinese);
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
}

.stroke-word-pinyin {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stroke-word-pos {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

.stroke-word-meaning {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Multi-character Tabs */
.stroke-char-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.char-tab-btn {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.55rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-chinese);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.char-tab-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(158, 32, 22, 0.35);
}

.char-tab-btn.completed {
  border-color: var(--color-emerald);
}

.char-tab-btn.completed::after {
  content: ' ✓';
  color: var(--color-emerald);
  font-weight: 700;
}

.char-tab-btn.active.completed::after {
  color: #ffffff;
}

/* Writer Area */
.stroke-writer-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0;
}

.stroke-meta-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.stroke-badge-info {
  font-size: 0.825rem;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.stroke-badge-status {
  font-size: 0.825rem;
  font-weight: 700;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 4px 14px;
  border-radius: var(--radius-full);
}

.stroke-badge-status.success {
  background: var(--color-emerald-bg);
  color: var(--color-emerald);
}

.stroke-badge-status.mistake {
  background: var(--color-rose-bg);
  color: var(--color-rose);
}

/* Grid Box (米字格 Mǐzìgé) */
.stroke-grid-box {
  width: 320px;
  height: 320px;
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), var(--shadow-lg);
  margin: 0 auto;
  overflow: hidden;
  user-select: none;
  cursor: crosshair;
}

body.dark-mode .stroke-grid-box {
  background: #111a2e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), var(--shadow-lg);
}

.mizige-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.mizige-border { stroke: #ef4444; opacity: 0.35; }
.mizige-line { stroke: #ef4444; opacity: 0.22; }
.mizige-line.diag { opacity: 0.16; }

body.dark-mode .mizige-border { stroke: #f87171; opacity: 0.45; }
body.dark-mode .mizige-line { stroke: #f87171; opacity: 0.28; }
body.dark-mode .mizige-line.diag { opacity: 0.2; }

.hanzi-writer-target {
  position: absolute;
  top: 0; left: 0;
  width: 320px; height: 320px;
}

.stroke-feedback-msg {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.15rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.45;
  transition: all 0.25s ease;
}

.stroke-feedback-msg.success { color: var(--color-emerald); font-weight: 600; }
.stroke-feedback-msg.mistake { color: var(--color-rose); font-weight: 600; }

.stroke-actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 1.35rem 0 1rem;
  flex-wrap: wrap;
}

.stroke-btn {
  padding: 0.75rem 1.35rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}

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

.stroke-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  margin: 1.35rem 0 1.5rem;
}

.stroke-example-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  text-align: left;
  margin-top: 1.5rem;
  border: 1px solid var(--border-glass);
}

.stroke-example-hz {
  font-family: var(--font-chinese);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.stroke-example-py {
  font-size: 0.925rem;
  color: var(--color-primary);
  margin-top: 0.25rem;
  font-weight: 600;
}

.stroke-example-de {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Accordion: 7 Chinese Stroke Rules */
.stroke-rules-accordion {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-top: 1.75rem;
  text-align: left;
  overflow: hidden;
}

.stroke-rules-summary {
  padding: 0.95rem 1.25rem;
  font-weight: 600;
  font-size: 0.925rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  color: var(--text-main);
  transition: background-color 0.2s;
}

.stroke-rules-summary:hover {
  background: var(--bg-tertiary);
}

.accordion-arrow {
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.stroke-rules-accordion[open] .accordion-arrow {
  transform: rotate(180deg);
}

.stroke-rules-content {
  padding: 1.15rem 1.35rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.rule-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 2px;
}

.rule-item strong {
  font-size: 0.925rem;
  color: var(--text-main);
}

.rule-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.stroke-keyboard-hints {
  text-align: center;
  font-size: 0.775rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
}

/* ==========================================================================
   MODALS: SUPERCHINESE EVALUATION & NETWORK SHARING
   ========================================================================== */
.eval-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.eval-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.eval-modal-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-enter {
  from { transform: scale(0.92) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--text-main); }

.eval-modal-word { margin-bottom: 1.25rem; }

.eval-hanzi {
  font-family: var(--font-chinese);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.eval-pinyin {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}

.eval-meaning {
  font-size: 1.05rem;
  color: var(--text-muted);
}

.modal-example-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  width: 100%;
  text-align: left;
}

.modal-meter-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-status-text {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  min-height: 1.4rem;
}

.modal-result-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.25rem;
  width: 100%;
  text-align: left;
}

.result-headline {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.85rem;
}

.res-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.modal-audio-compare {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: center;
}

.btn-audio-small {
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-audio-small:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-audio-small:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
}

.btn-mic-action {
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 26px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.45);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-mic-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.55);
}

.btn-mic-action.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
  animation: pulse-recording 1.2s infinite;
}

/* Settings Modal */
.settings-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

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

.modal-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
}

.setting-row {
  margin-bottom: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.setting-row label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.setting-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.button-segmented {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.seg-btn.active {
  background: var(--bg-card-solid);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

body.dark-mode .seg-btn.active {
  background: var(--bg-card-hover);
}

/* Network Sharing Modal */
.network-card {
  text-align: center;
  max-width: 460px;
}

.network-instruction {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.network-url-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.35rem;
  text-align: left;
}

.network-url-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-emerald);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.network-url-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.network-url {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  user-select: all;
  word-break: break-all;
}

.network-mic-note {
  background: var(--color-emerald-bg);
  border: 1px dashed var(--color-emerald-border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
  margin-top: 1.35rem;
  text-align: left;
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.mic-note-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--color-emerald);
  margin-bottom: 4px;
}

.qr-code-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.qr-code-box {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: inline-flex;
}

.qr-code-box img {
  display: block;
  border-radius: 4px;
}

.qr-hint {
  font-size: 0.825rem;
  color: var(--text-dim);
}

/* General Buttons */
.btn {
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, #9e2016, #c0392b);
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #c0392b, #9e2016);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(158, 32, 22, 0.35);
}

body.dark-mode .btn-primary {
  background: linear-gradient(135deg, #ff897d, #e11d48);
  color: #07090e;
}

.btn-secondary {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
}

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

.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--color-rose);
  color: var(--color-rose);
  box-shadow: none;
}

.btn-outline-danger:hover {
  background: var(--color-rose-bg);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 0.8rem;
}

/* Animations */
@keyframes pulse-audio {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

@keyframes pulse-recording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-starting {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.04); opacity: 1; }
}

/* Confetti & Spinner */
.confetti-canvas {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

.loading-spinner {
  grid-column: 1 / -1;
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-container { flex-direction: column; align-items: stretch; }
  .view-switch-group { justify-content: center; overflow-x: auto; }
  .level-tabs { overflow-x: auto; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .train-hanzi { font-size: 4.5rem; }
  .cards-header { flex-direction: column; align-items: stretch; }
  .cards-direction-control { width: 100%; justify-content: center; }
  .flashcard-scene, .flashcard, .card-face { min-height: 420px; }
  .card-prompt-main { font-size: 4rem; }
  .anki-rating-bar { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .flip-action-bar { flex-direction: column; }
  .stroke-grid-box, .hanzi-writer-target { width: 280px; height: 280px; }
  .stroke-actions-toolbar { flex-direction: column; width: 100%; }
  .stroke-actions-toolbar .stroke-btn { width: 100%; justify-content: center; }
  .train-dock { padding: 0.6rem 1.25rem; gap: 0.85rem; width: 92%; }
  .btn-dock-mic { width: 76px; height: 76px; }
}
