/* ==========================================================================
   《中药学》第十一版 双语考试复习与 Active Recall 学习平台
   Modern UI System · Floating Glassmorphic Navbar Pill · Herb Bento Grid
   Inspired by Contemporary Editorial Portfolios & National TCM Curricula
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Typography & Google Fonts Import
   -------------------------------------------------------------------------- */
/* Fonts loaded via <link> in HTML head for non-blocking parallel delivery */

/* --------------------------------------------------------------------------
   2. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
  /* Brand Palettes */
  --modern-cinnabar: #8C1D18;
  --modern-cinnabar-dark: #6B1410;
  --modern-cinnabar-light: #FBF0EF;
  --modern-amber: #D97706;
  --modern-amber-gold: #B8860B;
  --modern-amber-light: #FEF3C7;
  --modern-jade: #256B54;
  --modern-jade-light: #EBF5F0;
  --modern-azure: #1E40AF;
  --modern-indigo: #4338CA;

  /* Accent Gradient */
  --accent-gradient: linear-gradient(90deg, #8C1D18 0%, #D97706 100%);
  --accent-gradient-vertical: linear-gradient(180deg, #8C1D18 0%, #D97706 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(140, 29, 24, 0.08) 0%, rgba(217, 119, 6, 0.08) 100%);
  --accent-gold-gradient: linear-gradient(135deg, #D97706 0%, #F59E0B 50%, #B8860B 100%);

  /* Surface & Background (Light Mode) */
  --modern-bg-base: #FAF8F5;
  --modern-bg-surface: #FFFFFF;
  --modern-bg-surface-elevated: #FFFFFF;
  --modern-bg-surface-muted: #F5EFE6;
  --modern-border: rgba(68, 64, 60, 0.14);
  --modern-border-focus: #8C1D18;
  --modern-border-gold: rgba(217, 119, 6, 0.35);

  /* Typography Colors */
  --modern-text-primary: #1C1917;
  --modern-text-secondary: #57534E;
  --modern-text-muted: #57534E;
  --modern-text-inverse: #FFFFFF;

  /* Glassmorphism Pill Specs */
  --glass-pill-bg: rgba(28, 25, 23, 0.85);
  --glass-pill-border: rgba(255, 255, 255, 0.12);
  --glass-pill-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  --glass-pill-text: #F5F5F7;
  --glass-pill-tab-hover: rgba(255, 255, 255, 0.14);
  --glass-pill-tab-active-bg: rgba(255, 255, 255, 0.20);
  --glass-pill-tab-active-border: rgba(255, 255, 255, 0.30);

  /* Card Surfaces & Shadows */
  --bento-card-bg: #FFFFFF;
  --bento-card-border: rgba(68, 64, 60, 0.12);
  --bento-card-hover-border: rgba(140, 29, 24, 0.35);
  --bento-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --bento-card-shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.12);
  --bento-card-radius: 20px;

  /* Thermal Nature Palette (四气) */
  --thermal-cold-bg: #EFF6FF;
  --thermal-cold-text: #1D4ED8;
  --thermal-cold-border: rgba(29, 78, 216, 0.25);

  --thermal-cool-bg: #ECFDF5;
  --thermal-cool-text: #047857;
  --thermal-cool-border: rgba(4, 120, 87, 0.25);

  --thermal-neutral-bg: #F5F5F4;
  --thermal-neutral-text: #57534E;
  --thermal-neutral-border: rgba(87, 83, 78, 0.25);

  --thermal-warm-bg: #FFFBEB;
  --thermal-warm-text: #B45309;
  --thermal-warm-border: rgba(180, 83, 9, 0.25);

  --thermal-hot-bg: #FEF2F2;
  --thermal-hot-text: #B91C1C;
  --thermal-hot-border: rgba(185, 28, 28, 0.30);

  /* Font Families */
  --font-family-display: 'Instrument Serif', 'Noto Serif SC', "Songti SC", "SimSun", serif;
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", 'Sarabun', sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --transition-smooth: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   Theme: Sepia Mode (古籍温润茶纸风)
   -------------------------------------------------------------------------- */
[data-theme="sepia"],
body.sepia-mode {
  --modern-cinnabar: #A15C1E;
  --modern-cinnabar-dark: #7A3E0F;
  --modern-cinnabar-light: #F8EFE3;
  --modern-amber: #B88B35;
  --modern-amber-gold: #8C651F;
  --modern-amber-light: #EFE3C8;
  --modern-jade: #256B54;
  --modern-jade-light: #DFEDE6;

  --accent-gradient: linear-gradient(90deg, #A15C1E 0%, #D97706 100%);
  --accent-gradient-vertical: linear-gradient(180deg, #A15C1E 0%, #D97706 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(161, 92, 30, 0.08) 0%, rgba(217, 119, 6, 0.08) 100%);

  --modern-bg-base: #FBF0D9;
  --modern-bg-surface: #FFFDF8;
  --modern-bg-surface-elevated: #FFFFFF;
  --modern-bg-surface-muted: #F4E7CB;
  --modern-border: rgba(122, 105, 86, 0.18);
  --modern-border-focus: #A15C1E;
  --modern-border-gold: rgba(184, 139, 53, 0.40);

  --modern-text-primary: #2C241B;
  --modern-text-secondary: #7A6956;
  --modern-text-muted: #948572;

  --glass-pill-bg: rgba(44, 36, 27, 0.88);
  --glass-pill-border: rgba(239, 227, 200, 0.20);
  --glass-pill-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --glass-pill-text: #FBF0D9;

  --bento-card-bg: #FFFDF8;
  --bento-card-border: rgba(122, 105, 86, 0.18);
  --bento-card-hover-border: rgba(161, 92, 30, 0.45);
  --bento-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  --bento-card-shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   Theme: Dark Mode (极简黑檀与玄墨金辉)
   -------------------------------------------------------------------------- */
[data-theme="dark"],
body.dark-mode {
  --modern-cinnabar: #E05D52;
  --modern-cinnabar-dark: #B91C1C;
  --modern-cinnabar-light: rgba(224, 93, 82, 0.16);
  --modern-amber: #F59E0B;
  --modern-amber-gold: #FFD60A;
  --modern-amber-light: rgba(245, 158, 11, 0.16);
  --modern-jade: #34D399;
  --modern-jade-light: rgba(52, 211, 153, 0.15);

  --accent-gradient: linear-gradient(90deg, #E05D52 0%, #F59E0B 100%);
  --accent-gradient-vertical: linear-gradient(180deg, #E05D52 0%, #F59E0B 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(224, 93, 82, 0.12) 0%, rgba(245, 158, 11, 0.12) 100%);

  --modern-bg-base: #0A0A0C;
  --modern-bg-surface: #17171A;
  --modern-bg-surface-elevated: #222226;
  --modern-bg-surface-muted: #1F1F24;
  --modern-border: rgba(255, 255, 255, 0.12);
  --modern-border-focus: #E05D52;
  --modern-border-gold: rgba(245, 158, 11, 0.45);

  --modern-text-primary: #F5F5F7;
  --modern-text-secondary: #A1A1A6;
  --modern-text-muted: #71717A;

  --glass-pill-bg: rgba(18, 18, 20, 0.88);
  --glass-pill-border: rgba(255, 255, 255, 0.16);
  --glass-pill-shadow: 0 10px 36px rgba(0, 0, 0, 0.65);
  --glass-pill-text: #F5F5F7;
  --glass-pill-tab-hover: rgba(255, 255, 255, 0.10);
  --glass-pill-tab-active-bg: rgba(255, 255, 255, 0.18);
  --glass-pill-tab-active-border: rgba(255, 255, 255, 0.28);

  --bento-card-bg: #17171A;
  --bento-card-border: rgba(255, 255, 255, 0.10);
  --bento-card-hover-border: rgba(224, 93, 82, 0.50);
  --bento-card-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
  --bento-card-shadow-hover: 0 14px 44px rgba(0, 0, 0, 0.75);

  --thermal-cold-bg: rgba(29, 78, 216, 0.18);
  --thermal-cold-text: #93C5FD;
  --thermal-cold-border: rgba(147, 197, 253, 0.30);

  --thermal-cool-bg: rgba(4, 120, 87, 0.18);
  --thermal-cool-text: #6EE7B7;
  --thermal-cool-border: rgba(110, 231, 183, 0.30);

  --thermal-neutral-bg: rgba(113, 113, 122, 0.18);
  --thermal-neutral-text: #D4D4D8;
  --thermal-neutral-border: rgba(212, 212, 216, 0.25);

  --thermal-warm-bg: rgba(180, 83, 9, 0.20);
  --thermal-warm-text: #FCD34D;
  --thermal-warm-border: rgba(252, 211, 77, 0.35);

  --thermal-hot-bg: rgba(185, 28, 28, 0.22);
  --thermal-hot-text: #FCA5A5;
  --thermal-hot-border: rgba(252, 165, 165, 0.35);
}

/* --------------------------------------------------------------------------
   3. Typography Systems (Instrument Serif + Inter)
   -------------------------------------------------------------------------- */
.font-display {
  font-family: var(--font-family-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  font-feature-settings: "kern", "liga", "dlig";
}

.font-display.italic,
.font-display em,
.font-display i,
em.font-display,
i.font-display {
  font-family: var(--font-family-display);
  font-style: italic;
  letter-spacing: 0.01em;
}

.font-body {
  font-family: var(--font-family-body);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-mono {
  font-family: var(--font-family-mono);
}

/* Heading & Typographic Scale Utilities */
.hero-title {
  font-family: var(--font-family-display);
  font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  line-height: 1.05;
  font-weight: 400;
  color: var(--modern-text-primary);
  letter-spacing: -0.025em;
  margin: 0;
}

.hero-subtitle {
  font-family: var(--font-family-body);
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  line-height: 1.6;
  color: var(--modern-text-secondary);
  font-weight: 400;
}

.section-title {
  font-family: var(--font-family-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.2;
  color: var(--modern-text-primary);
  margin: 0;
}

/* --------------------------------------------------------------------------
   4. Accent Gradient & Glassmorphic Utilities
   -------------------------------------------------------------------------- */
.accent-gradient {
  background: var(--accent-gradient);
}

.accent-gradient-text,
.text-gradient,
.gradient-text {
  color: #8C1D18;
  font-weight: 800;
  display: inline-block;
}

[data-theme="dark"] .accent-gradient-text,
[data-theme="dark"] .text-gradient,
[data-theme="dark"] .gradient-text {
  color: var(--accent-gold, #D97706);
}

.accent-gold-text {
  color: #8C651F;
  font-weight: 800;
  display: inline-block;
}

[data-theme="dark"] .accent-gold-text {
  color: var(--accent-gold, #F59E0B);
}

/* Glassmorphism Specs */
.glass-pill {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-pill-border);
  box-shadow: var(--glass-pill-shadow);
  color: var(--glass-pill-text);
  border-radius: 9999px;
  transition: var(--transition-smooth);
}

.glass-pill-light {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(68, 64, 60, 0.14);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  color: #1C1917;
  border-radius: 9999px;
}

.glass-pill-dark {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(28, 25, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  color: #F5F5F7;
  border-radius: 9999px;
}

.glass-card {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--modern-border);
  box-shadow: var(--bento-card-shadow);
  border-radius: var(--bento-card-radius);
  transition: var(--transition-smooth);
}

[data-theme="dark"] .glass-card,
body.dark-mode .glass-card {
  background: rgba(23, 23, 26, 0.75);
  border-color: rgba(255, 255, 255, 0.10);
}

/* --------------------------------------------------------------------------
   5. Floating Navbar Pill Component (Top-Center Floating Nav Pill)
   -------------------------------------------------------------------------- */
.floating-nav-wrapper {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: none; /* Allows clicks around the pill */
}

.floating-nav-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  height: 54px;
  border-radius: 9999px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-pill-border);
  box-shadow: var(--glass-pill-shadow);
  color: var(--glass-pill-text);
  user-select: none;
  transition: var(--transition-smooth);
}

.floating-nav-pill:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.20);
}

/* Nav Pill Brand / Seal */
.nav-pill-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-pill-seal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  transition: var(--transition-bounce);
}

.nav-pill-brand:hover .nav-pill-seal {
  transform: rotate(6deg) scale(1.08);
}

.nav-pill-title {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-pill-tag {
  font-family: var(--font-family-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(217, 119, 6, 0.25);
  color: #FCD34D;
  letter-spacing: 0.02em;
  border: 1px solid rgba(217, 119, 6, 0.4);
}

/* Nav Pill Subject Switcher Tabs */
.nav-pill-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-pill-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 9999px;
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.78);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.nav-pill-tab:hover {
  color: #FFFFFF;
  background: var(--glass-pill-tab-hover);
}

.nav-pill-tab.active {
  color: #FFFFFF;
  background: var(--glass-pill-tab-active-bg);
  border-color: var(--glass-pill-tab-active-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  font-weight: 600;
}

.nav-pill-tab .tab-icon {
  font-size: 0.95rem;
  opacity: 0.85;
}

/* Nav Pill Actions & Quick Tools */
.nav-pill-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

/* Quick Search Trigger */
.nav-pill-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(245, 245, 247, 0.85);
  font-family: var(--font-family-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-pill-search:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.nav-pill-search .search-kbd {
  font-family: var(--font-family-mono);
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.9);
}

/* Button & Icon Pill Items (Touch target > 44px compliant) */
.nav-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--glass-pill-text);
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-pill-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.nav-pill-btn:active {
  transform: scale(0.95);
}

/* Language & Theme Selectors */
.nav-pill-segmented {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 2px;
  gap: 2px;
}

.nav-pill-seg-btn {
  border: none;
  background: transparent;
  color: rgba(245, 245, 247, 0.7);
  font-family: var(--font-family-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-smooth);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-pill-seg-btn:hover {
  color: #FFFFFF;
}

.nav-pill-seg-btn.active {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   6. Bento Grid Design System for Single Herb Monograph
   -------------------------------------------------------------------------- */
.herb-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Grid Span Helper Classes */
.col-span-12, .span-12 { grid-column: span 12; }
.col-span-8,  .span-8  { grid-column: span 8; }
.col-span-6,  .span-6  { grid-column: span 6; }
.col-span-4,  .span-4  { grid-column: span 4; }
.col-span-3,  .span-3  { grid-column: span 3; }

/* Base Bento Card */
.bento-card {
  position: relative;
  background: var(--bento-card-bg);
  border: 1px solid var(--bento-card-border);
  border-radius: var(--bento-card-radius);
  box-shadow: var(--bento-card-shadow);
  padding: 24px;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.bento-card:hover {
  transform: translateY(-2px);
  border-color: var(--bento-card-hover-border);
  box-shadow: var(--bento-card-shadow-hover);
}

/* Card Header & Label Styling */
.bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}

.bento-badge-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family-body);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--modern-cinnabar);
  background: var(--modern-cinnabar-light);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(140, 29, 24, 0.16);
}

[data-theme="dark"] .bento-badge-category,
body.dark-mode .bento-badge-category {
  color: #F87171;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.bento-title {
  font-family: var(--font-family-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--modern-text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Bento Card 1: .bento-hero (Span 12 or Span 8)
   Hero presentation with subtle watermark character, large calligraphy, pinyin & thai
   -------------------------------------------------------------------------- */
.bento-hero {
  grid-column: span 8;
  min-height: 380px;
  background: linear-gradient(135deg, var(--bento-card-bg) 0%, var(--modern-bg-surface-muted) 100%);
  position: relative;
  padding: 32px;
  justify-content: space-between;
}

.bento-hero.span-12,
.bento-hero.span-full {
  grid-column: span 12;
}

/* Watermark Chinese Calligraphy in Background */
.bento-hero-watermark {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  font-family: var(--font-family-display);
  font-size: clamp(140px, 18vw, 240px);
  font-weight: 900;
  line-height: 1;
  color: var(--modern-cinnabar);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: var(--transition-smooth);
}

.bento-hero:hover .bento-hero-watermark {
  opacity: 0.08;
  transform: translateY(-50%) scale(1.03);
}

[data-theme="dark"] .bento-hero-watermark,
body.dark-mode .bento-hero-watermark {
  opacity: 0.07;
  color: #FFFFFF;
}

[data-theme="dark"] .bento-hero:hover .bento-hero-watermark,
body.dark-mode .bento-hero:hover .bento-hero-watermark {
  opacity: 0.12;
}

/* Hero Content Stack */
.bento-hero-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bento-hero-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.bento-meta-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bento-chapter-tag {
  font-family: var(--font-family-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--modern-cinnabar);
  background: var(--modern-cinnabar-light);
  border: 1px solid rgba(140, 29, 24, 0.2);
  padding: 4px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bento-level-badge {
  font-family: var(--font-family-body);
  font-size: 0.78rem;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--accent-gradient);
  padding: 4px 12px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Calligraphy & Names Presentation */
.bento-hero-title-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.bento-hero-calligraphy {
  font-family: var(--font-family-display);
  font-size: clamp(3rem, 6vw, 4.8rem);
  font-weight: 500;
  line-height: 1;
  color: var(--modern-cinnabar);
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.bento-pinyin-pill {
  font-family: var(--font-family-body);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 400;
  color: var(--modern-amber);
  letter-spacing: 0.02em;
  font-style: normal;
}

.bento-thai-title {
  font-family: var(--font-family-body);
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  font-weight: 600;
  color: var(--modern-text-primary);
  line-height: 1.35;
  margin: 0;
}

.bento-botanical-tag {
  font-family: var(--font-family-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--modern-text-muted);
  letter-spacing: 0.01em;
}

/* Hero Action Bar & Media Showcase */
.bento-hero-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--modern-border);
  flex-wrap: wrap;
}

.bento-quick-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-bento-tool {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 9999px;
  border: 1px solid var(--modern-border);
  background: var(--modern-bg-surface);
  color: var(--modern-text-primary);
  font-family: var(--font-family-body);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-bento-tool:hover {
  background: var(--modern-bg-base);
  border-color: var(--modern-cinnabar);
  color: var(--modern-cinnabar);
  transform: translateY(-2px);
}

.btn-bento-tool.active-star {
  background: #FFFBEB;
  border-color: #F59E0B;
  color: #D97706;
}

/* --------------------------------------------------------------------------
   Bento Card 2: .bento-nature (Span 4)
   Element tags with thermal colors (四气五味与归经)
   -------------------------------------------------------------------------- */
.bento-nature {
  grid-column: span 4;
  background: var(--bento-card-bg);
  justify-content: flex-start;
}

.thermal-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.thermal-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: var(--transition-smooth);
}

/* Thermal Variants */
.thermal-hot {
  background: var(--thermal-hot-bg);
  color: var(--thermal-hot-text);
  border: 1px solid var(--thermal-hot-border);
}

.thermal-warm {
  background: var(--thermal-warm-bg);
  color: var(--thermal-warm-text);
  border: 1px solid var(--thermal-warm-border);
}

.thermal-neutral {
  background: var(--thermal-neutral-bg);
  color: var(--thermal-neutral-text);
  border: 1px solid var(--thermal-neutral-border);
}

.thermal-cool {
  background: var(--thermal-cool-bg);
  color: var(--thermal-cool-text);
  border: 1px solid var(--thermal-cool-border);
}

.thermal-cold {
  background: var(--thermal-cold-bg);
  color: var(--thermal-cold-text);
  border: 1px solid var(--thermal-cold-border);
}

/* Five Flavors & Tropism */
.flavor-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.flavor-chip {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--modern-bg-surface-muted);
  border: 1px solid var(--modern-border);
  color: var(--modern-text-primary);
  font-family: var(--font-family-body);
  font-size: 0.82rem;
  font-weight: 600;
}

.channel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.channel-pill {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--modern-jade-light);
  color: var(--modern-jade);
  border: 1px solid rgba(37, 107, 84, 0.2);
  font-family: var(--font-family-body);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .channel-pill,
body.dark-mode .channel-pill {
  background: rgba(52, 211, 153, 0.15);
  color: #6EE7B7;
  border-color: rgba(52, 211, 153, 0.3);
}

/* --------------------------------------------------------------------------
   Bento Card 3: .bento-efficacy (Span 6 or Span 12)
   Actions with active recall badges & interactive reveal
   -------------------------------------------------------------------------- */
.bento-efficacy {
  grid-column: span 6;
  background: var(--bento-card-bg);
}

.bento-efficacy.span-12,
.bento-efficacy.span-full {
  grid-column: span 12;
}

.efficacy-actions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.efficacy-badge-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--modern-bg-base);
  border: 1px solid var(--modern-border);
  transition: var(--transition-smooth);
}

.efficacy-badge-item:hover {
  border-color: var(--modern-border-focus);
  background: var(--modern-bg-surface);
  transform: translateX(4px);
}

.efficacy-num-seal {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--modern-cinnabar-light);
  color: var(--modern-cinnabar);
  font-family: var(--font-family-display);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.efficacy-text-block {
  flex: 1;
}

.efficacy-zh {
  font-family: var(--font-family-body);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--modern-cinnabar-dark);
  line-height: 1.4;
}

[data-theme="dark"] .efficacy-zh,
body.dark-mode .efficacy-zh {
  color: #F87171;
}

.efficacy-th {
  font-family: var(--font-family-body);
  font-size: 0.9rem;
  color: var(--modern-text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}

/* Active Recall Badge & Interactive Blur Mode */
.recall-trigger-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(217, 119, 6, 0.15);
  color: var(--modern-amber);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(217, 119, 6, 0.3);
  cursor: pointer;
}

.active-recall-blur {
  filter: blur(7px);
  user-select: none;
  cursor: pointer;
  transition: filter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 8px;
  padding: 2px 4px;
}

.active-recall-blur:hover {
  filter: blur(3px);
}

.active-recall-blur.is-revealed,
.active-recall-blur:active {
  filter: none !important;
  user-select: text;
}

/* --------------------------------------------------------------------------
   Bento Card 4: .bento-indications (Span 6 or Span 12)
   Formulas and syndrome matches (临床主治与方剂)
   -------------------------------------------------------------------------- */
.bento-indications {
  grid-column: span 6;
  background: var(--bento-card-bg);
}

.bento-indications.span-12,
.bento-indications.span-full {
  grid-column: span 12;
}

.indications-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.syndrome-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--modern-border);
  background: var(--modern-bg-base);
}

.syndrome-header {
  font-family: var(--font-family-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--modern-text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.formula-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.formula-chip {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--modern-bg-surface);
  border: 1px solid var(--modern-border);
  color: var(--modern-cinnabar);
  font-family: var(--font-family-body);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.formula-chip:hover {
  background: var(--modern-cinnabar-light);
  border-color: var(--modern-cinnabar);
}

/* --------------------------------------------------------------------------
   Bento Card 5: .bento-dosage-caution (Span 6)
   Dosage metrics and precautions (用法用量与禁忌)
   -------------------------------------------------------------------------- */
.bento-dosage-caution {
  grid-column: span 6;
  background: var(--bento-card-bg);
}

.dosage-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dosage-stat-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--modern-bg-surface-muted);
  border: 1px solid var(--modern-border);
}

.dosage-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--modern-text-muted);
  margin-bottom: 4px;
}

.dosage-stat-value {
  font-family: var(--font-family-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--modern-text-primary);
}

.caution-alert-box {
  padding: 14px;
  border-radius: 12px;
  background: #FEF2F2;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #991B1B;
}

[data-theme="dark"] .caution-alert-box,
body.dark-mode .caution-alert-box {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.caution-alert-title {
  font-family: var(--font-family-body);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.caution-alert-text {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Bento Card 6: .bento-exam (Span 6)
   High-yield exam callout with gold accents (国家规划教材核心考点)
   -------------------------------------------------------------------------- */
.bento-exam {
  grid-column: span 6;
  background: linear-gradient(145deg, var(--bento-card-bg) 0%, #FFFDF5 100%);
  border: 1px solid var(--modern-border-gold);
  position: relative;
  overflow: hidden;
}

.bento-exam::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

[data-theme="dark"] .bento-exam,
body.dark-mode .bento-exam {
  background: linear-gradient(145deg, #1A1A1E 0%, #201D17 100%);
  border-color: rgba(245, 158, 11, 0.4);
}

.exam-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.18) 0%, rgba(184, 134, 11, 0.25) 100%);
  border: 1px solid rgba(217, 119, 6, 0.45);
  color: #B45309;
  font-family: var(--font-family-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .exam-pill-badge,
body.dark-mode .exam-pill-badge {
  color: #FCD34D;
  border-color: rgba(252, 211, 77, 0.4);
}

.exam-points-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-point-highlight {
  position: relative;
  padding: 10px 14px 10px 18px;
  border-radius: 8px;
  background: rgba(254, 243, 199, 0.5);
  border-left: 3px solid #D97706;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--modern-text-primary);
}

[data-theme="dark"] .exam-point-highlight,
body.dark-mode .exam-point-highlight {
  background: rgba(245, 158, 11, 0.10);
  border-left-color: #F59E0B;
}

/* --------------------------------------------------------------------------
   Bento Card 7: .bento-compare (Span 12)
   Comparison tags & Paired Herb Differentiation (药对与鉴别)
   -------------------------------------------------------------------------- */
.bento-compare {
  grid-column: span 12;
  background: var(--bento-card-bg);
}

.compare-grid-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.compare-col-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--modern-bg-base);
  border: 1px solid var(--modern-border);
}

.compare-col-header {
  font-family: var(--font-family-body);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compare-tag-common {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(37, 107, 84, 0.12);
  color: var(--modern-jade);
  font-size: 0.78rem;
  font-weight: 600;
}

.compare-tag-diff {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(140, 29, 24, 0.12);
  color: var(--modern-cinnabar);
  font-size: 0.78rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   7. Micro-interactions, Gradient Borders & Touch Targets (>44px)
   -------------------------------------------------------------------------- */
/* Gradient Border Rings */
.border-gradient-ring {
  position: relative;
  background-clip: padding-box;
}

.border-gradient-ring::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--accent-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.border-gradient-ring:hover::after {
  opacity: 1;
}

/* Touch Targets Compliance (WCAG 2.5.5 / 2.5.8 >= 44x44px) */
.touch-target,
.btn-touch {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Smooth Hover Transforms */
.hover-lift {
  transition: var(--transition-smooth);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.hover-scale {
  transition: var(--transition-smooth);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* Focus Visible Rings for Keyboard Accessibility */
:focus-visible {
  outline: 2px solid var(--modern-cinnabar);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   8. Responsive Design & Breakpoints
   -------------------------------------------------------------------------- */
/* Tablet Breakpoint (768px to 1024px) */
@media (max-width: 1024px) {
  .herb-bento-grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
  }

  .bento-hero {
    grid-column: span 12;
  }

  .bento-nature {
    grid-column: span 12;
  }

  .bento-efficacy {
    grid-column: span 6;
  }

  .bento-indications {
    grid-column: span 6;
  }

  .bento-dosage-caution {
    grid-column: span 6;
  }

  .bento-exam {
    grid-column: span 6;
  }

  .bento-compare {
    grid-column: span 12;
  }

  .compare-grid-layout {
    grid-template-columns: 1fr;
  }

  .floating-nav-pill {
    height: 50px;
    padding: 4px 8px 4px 12px;
  }

  .nav-pill-title {
    font-size: 1.02rem;
  }

  .nav-pill-tab {
    height: 36px;
    padding: 0 10px;
    font-size: 0.8rem;
  }
}

/* Mobile Breakpoint (< 768px) */
@media (max-width: 768px) {
  .floating-nav-wrapper {
    top: 12px;
    width: calc(100vw - 20px);
    max-width: none;
  }

  .floating-nav-pill {
    width: 100%;
    justify-content: space-between;
    height: 48px;
    padding: 4px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .floating-nav-pill::-webkit-scrollbar {
    display: none;
  }

  .nav-pill-brand {
    padding-right: 6px;
  }

  .nav-pill-title {
    display: none; /* Icon-only on narrow screens */
  }

  .nav-pill-tag {
    display: none;
  }

  .nav-pill-tab {
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .nav-pill-tab .tab-text {
    display: none; /* Icon-first tabs on mobile */
  }

  .nav-pill-search .search-kbd {
    display: none;
  }

  .herb-bento-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bento-card {
    grid-column: span 1 !important;
    padding: 18px;
    border-radius: 16px;
  }

  .bento-hero {
    min-height: auto;
    padding: 20px;
  }

  .bento-hero-calligraphy {
    font-size: 2.75rem;
  }

  .bento-hero-watermark {
    font-size: 110px;
    right: 2%;
  }

  .dosage-stat-grid {
    grid-template-columns: 1fr;
  }

  /* Touch target accessibility floor (WCAG 2.5.5 >= 44x44px) */
  .font-size-btn,
  .palette-btn,
  .reading-focus-btn,
  .tools-sheet-close-btn,
  .pill-btn,
  .quiz-pill-btn,
  .herb-nav-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  *:not(.no-motion-freeze) {
    transform: none !important;
    filter: none !important;
  }
}

/* Print Optimization */
@media print {
  .floating-nav-wrapper {
    display: none !important;
  }

  .bento-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #CCCCCC !important;
  }

  .active-recall-blur {
    filter: none !important;
  }
}

/* --------------------------------------------------------------------------
   Herb View Mode Switcher Bar & Jump Button Styling
   -------------------------------------------------------------------------- */
.herb-view-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--modern-bg-surface, #ffffff);
  border: 1px solid var(--modern-border, rgba(68, 64, 60, 0.14));
  border-radius: 16px;
  padding: 10px 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

body.dark-mode .herb-view-mode-bar {
  background: #1C1917;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.sepia-mode .herb-view-mode-bar {
  background: #FAF6ED;
  border-color: #E2D9C5;
}

.herb-view-mode-toggle {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 9999px;
  gap: 4px;
}

body.dark-mode .herb-view-mode-toggle {
  background: rgba(255, 255, 255, 0.08);
}

.herb-view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--modern-text-secondary, #57534E);
  font-family: var(--font-body, inherit);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 44px;
}

body.dark-mode .herb-view-mode-btn {
  color: rgba(255, 255, 255, 0.7);
}

.herb-view-mode-btn:hover {
  color: var(--modern-cinnabar, #8C1D18);
}

body.dark-mode .herb-view-mode-btn:hover {
  color: #ffffff;
}

.herb-view-mode-btn.active {
  background: var(--accent-gradient, linear-gradient(90deg, #8C1D18 0%, #D97706 100%)) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.herb-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.herb-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--modern-bg-surface-muted, #F5EFE6);
  border: 1px solid var(--modern-border, rgba(68, 64, 60, 0.14));
  color: var(--modern-text-primary, #1C1917);
  font-family: var(--font-body, inherit);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
}

body.dark-mode .herb-action-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #F5F5F7;
}

body.sepia-mode .herb-action-pill {
  background: #F3EBD8;
  border-color: #DDD2BC;
}

.herb-action-pill:hover {
  background: #ffffff;
  border-color: var(--modern-cinnabar, #8C1D18);
  color: var(--modern-cinnabar, #8C1D18);
  transform: translateY(-1px);
}

body.dark-mode .herb-action-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #E05D52;
  color: #ffffff;
}

/* Card jump button inside card grid */
.btn-card-reader-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 4px;
}

.btn-card-reader-jump:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(1.1);
}

/* =========================================================================
   CUSTOM FLASHCARD STUDIO STYLES (สตูดิโอสร้างแฟลชการ์ดกำหนดเอง)
   ========================================================================= */

.custom-fc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.custom-fc-modal-container {
  background: #0d0c0a !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  border-radius: 16px;
  width: min(1200px, 96vw);
  height: 92vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.25);
  overflow: hidden;
  color: #f5f5f4 !important;
}

.custom-fc-modal-header {
  padding: 16px 24px;
  background: linear-gradient(180deg, #1c1916 0%, #12100e 100%) !important;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25) !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-fc-modal-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fbbf24 !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.custom-fc-modal-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #f5f5f4 !important;
  font-family: var(--font-serif-zh, serif);
}

.custom-fc-btn-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #a8a29e;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: all 0.15s ease;
}

.custom-fc-btn-close:hover {
  background: rgba(220, 38, 38, 0.25);
  color: #f87171;
  border-color: #f87171;
}

.custom-fc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  min-height: 0;
}

@media (max-width: 920px) {
  .custom-fc-modal-body {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px;
  }
}

.custom-fc-col-left,
.custom-fc-col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.studio-section-card {
  background: #161412 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px;
  padding: 16px;
  color: #f5f5f4 !important;
  transition: border-color 0.2s ease;
}

.studio-section-card:hover {
  border-color: rgba(212, 175, 55, 0.35) !important;
}

.studio-section-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f5f5f4 !important;
  margin-top: 0;
  margin-bottom: 12px;
}

.studio-form-group {
  margin-bottom: 12px;
}

.studio-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a8a29e !important;
  margin-bottom: 4px;
}

.studio-label .req {
  color: #f87171;
}

.studio-input {
  width: 100%;
  padding: 9px 12px;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 8px;
  color: #f5f5f4 !important;
  font-size: 0.88rem;
  box-sizing: border-box;
}

.studio-input:focus {
  outline: none;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.studio-presets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.studio-presets-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.preset-pill-btn {
  text-align: left;
  padding: 8px 12px;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px;
  color: #d6d3d1 !important;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill-btn:hover {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  transform: translateX(2px);
}

.studio-face-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.face-tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  width: fit-content;
}

.front-tag {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.back-tag {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.face-hint {
  font-size: 0.74rem;
  color: #a8a29e !important;
  margin-top: 2px;
}

.studio-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 500px) {
  .studio-fields-grid {
    grid-template-columns: 1fr;
  }
}

.field-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #d6d3d1 !important;
  transition: all 0.12s ease;
  user-select: none;
}

.field-toggle-label:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff !important;
}

.field-toggle-label.checked {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  font-weight: 600;
}

.field-toggle-label input[type="checkbox"] {
  accent-color: #f59e0b;
}

.field-icon {
  font-size: 0.95rem;
}

/* Cropper Controls & Pills */
.cropper-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.focal-btn,
.zoom-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #a8a29e !important;
  transition: all 0.15s ease;
}

.focal-btn:hover,
.zoom-btn:hover {
  border-color: #f59e0b !important;
  color: #fff !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

.focal-btn.active,
.zoom-btn.active {
  background: rgba(245, 158, 11, 0.22) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Right Column: Live Preview & Herb Selector */
.preview-card-box {
  background: #110f0d !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  position: sticky;
  top: 0;
  z-index: 5;
}

.preview-card-box .studio-section-heading {
  color: #fbbf24 !important;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.preview-toggle-btns {
  display: flex;
  gap: 6px;
}

.preview-tab-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: #1c1916 !important;
  color: #a8a29e !important;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.preview-tab-btn:hover {
  border-color: #f59e0b !important;
  color: #fff !important;
}

.preview-tab-btn.active {
  background: #f59e0b !important;
  color: #000 !important;
  font-weight: 700;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.preview-flip-action-btn {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f5f5f4 !important;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preview-flip-action-btn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}

.live-preview-card-wrap {
  min-height: 380px;
  max-height: 480px;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 25%, #1d1a16 0%, #0a0908 100%) !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  border-radius: 14px;
  padding: 18px;
  box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.85), 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #f5f5f4 !important;
}

.live-preview-card-wrap::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(212, 175, 55, 0.22);
  border-radius: 10px;
  pointer-events: none;
}

.live-preview-card-inner {
  width: 100%;
  height: 100%;
}

.live-card-face-render {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-render-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-render-titles {
  text-align: center;
  padding: 4px 0;
}

/* Ensure text inside live preview card is crisp and high contrast */
.live-preview-card-wrap .card-render-name-zh {
  color: #fbbf24 !important;
}

.live-preview-card-wrap .card-render-pinyin {
  color: #d6d3d1 !important;
}

.live-preview-card-wrap .card-render-name-th {
  color: #f5f5f4 !important;
}

.live-preview-card-wrap .eff-zh {
  color: #fff !important;
}

.live-preview-card-wrap .eff-th {
  color: #a8a29e !important;
}

.live-preview-card-wrap .ind-zh {
  color: #e7e5e4 !important;
}

.live-preview-card-wrap .exam-zh {
  color: #fef08a !important;
}

.live-preview-card-wrap .card-render-box {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e7e5e4 !important;
}

.card-render-img-wrap {
  text-align: center;
  margin: 6px auto;
  position: relative;
  transition: transform 0.2s ease;
}

.card-render-img-wrap:hover {
  transform: scale(1.02);
}

.fc-zoom-hint-chip {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  pointer-events: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.card-render-img-wrap:hover .fc-zoom-hint-chip {
  transform: scale(1.05);
  background: rgba(245, 158, 11, 0.35);
  color: #fff;
}

/* Herb Scope Box */
.herbs-selection-box {
  background: #161412 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.herbs-sel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.herbs-count-pill {
  font-size: 0.78rem;
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.studio-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.studio-select-small {
  padding: 6px 8px;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 6px;
  color: #f5f5f4 !important;
  font-size: 0.78rem;
  flex: 1;
}

.studio-starred-checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #fbbf24 !important;
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.1) !important;
}

.studio-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.studio-search-input {
  flex: 1;
  padding: 6px 10px;
  background: #1c1916 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 6px;
  color: #f5f5f4 !important;
  font-size: 0.8rem;
}

.studio-btn-tiny {
  padding: 6px 8px;
  background: #25221e !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #a8a29e !important;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.studio-btn-tiny:hover {
  background: #332e29 !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.3);
}

.studio-herbs-checklist {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px;
  background: #100f0d !important;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.herb-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.12s ease;
  border: 1px solid transparent;
  color: #d6d3d1 !important;
}

.herb-item-row:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

.herb-item-row.selected {
  background: rgba(245, 158, 11, 0.12) !important;
}

.herb-item-row.preview-active {
  background: rgba(245, 158, 11, 0.22) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.herb-item-zh {
  font-weight: 700;
  color: #f5f5f4 !important;
  min-width: 50px;
}

.herb-item-py {
  color: #a8a29e !important;
  font-style: italic;
  font-size: 0.75rem;
  min-width: 70px;
}

.herb-item-th {
  color: #a8a29e !important;
  font-size: 0.78rem;
  flex: 1;
}

.herb-item-lvl {
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #d6d3d1;
}

.herb-item-lvl.master {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* Modal Footer */
.custom-fc-modal-footer {
  padding: 14px 24px;
  background: linear-gradient(180deg, #181512 0%, #0d0c0a 100%) !important;
  border-top: 1px solid rgba(212, 175, 55, 0.25) !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #a8a29e !important;
}

.footer-summary-text {
  font-size: 0.82rem;
  color: #a8a29e !important;
  display: flex;
  gap: 8px;
}

.footer-summary-text strong {
  color: #fbbf24 !important;
}

.footer-btn-group {
  display: flex;
  gap: 10px;
}

.footer-btn-group .btn-secondary {
  background: #25221e !important;
  color: #d6d3d1 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.footer-btn-group .btn-secondary:hover {
  background: #332e29 !important;
  color: #fff !important;
}

.footer-btn-group .btn-primary {
  background: linear-gradient(135deg, #881337 0%, #b91c1c 100%) !important;
  color: #fff !important;
  border: 1px solid #f43f5e !important;
  padding: 8px 22px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.15s ease;
}

.footer-btn-group .btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}
/* Custom Decks Grid on Flashcards Tab */
.custom-decks-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-card, #1c1917);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-lg, 16px);
}

.custom-decks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.custom-decks-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-open-studio {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

.btn-open-studio:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.custom-decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.custom-deck-card {
  background: var(--bg-main, #141210);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s ease;
}

.custom-deck-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.deck-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.deck-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.deck-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.deck-card-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  white-space: nowrap;
}

.deck-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.deck-card-tag {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.deck-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-deck-play {
  flex: 1;
  padding: 6px 12px;
  background: var(--primary, #059669);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-deck-play:hover {
  filter: brightness(1.1);
}

.btn-deck-action {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-deck-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-deck-delete:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border-color: #f87171;
}

/* Active Custom Deck Playing Banner */
.custom-deck-playing-banner {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.2), rgba(180, 83, 9, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cd-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cd-banner-tag {
  background: var(--accent-gold, #f59e0b);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
}

.cd-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.cd-banner-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-exit-custom-deck {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-exit-custom-deck:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================================================
   BLACK CLOVER x TCM CINEMATIC DESIGN SYSTEM (Hallmark & Impeccable)
   Inspired by https://bclover.jp/en/
   Obsidian Grit Canvas, Gilded Hairlines, Fraunces Serif, Watermark Typography
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;0,9..144,900;1,9..144,400;1,9..144,700&display=swap');

:root {
  --bc-obsidian-0: #070709;
  --bc-obsidian-1: #0D0D11;
  --bc-obsidian-2: #14141A;
  --bc-obsidian-card: #121217;
  --bc-gold: #D4AF37;
  --bc-gold-glow: rgba(212, 175, 55, 0.35);
  --bc-gold-border: rgba(212, 175, 55, 0.24);
  --bc-crimson: #C40002;
  --bc-crimson-glow: rgba(196, 0, 2, 0.35);
  --bc-jade: #10B981;
  --bc-font-cinematic: 'Fraunces', 'Noto Serif SC', serif;
}

/* Cinematic Watermark Section Titles */
.bc-area-title-wrap {
  position: relative;
  overflow: hidden;
  padding: 32px 0 20px;
  text-align: center;
}

.bc-area-title-deco {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--bc-font-cinematic);
  font-size: clamp(3.5rem, 8vw, 7.5rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: rgba(212, 175, 55, 0.04);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Dark mode Obsidian canvas with subtle stardust grit */
[data-theme="dark"] body {
  background-color: var(--bc-obsidian-0);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.05) 0%, transparent 60%),
    radial-gradient(circle at 10% 30%, rgba(196, 0, 2, 0.03) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* Gilded Hairline Card Borders with Subtle Glow */
[data-theme="dark"] .herb-card,
[data-theme="dark"] .flashcard-card,
[data-theme="dark"] .bento-card,
[data-theme="dark"] .pulse-card,
[data-theme="dark"] .tongue-card,
[data-theme="dark"] .adm-table-card {
  border: 1px solid var(--bc-gold-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] .herb-card:hover,
[data-theme="dark"] .pulse-card:hover {
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
  transform: translateY(-3px);
}

/* Epithet Imperial Seal Ribbon on Herb Cards */
.herb-epithet-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, rgba(196, 0, 2, 0.15) 0%, rgba(212, 175, 55, 0.1) 100%);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding: 6px 12px;
  margin: 4px -14px 10px;
}

.epithet-seal-icon {
  background: #C40002;
  color: #fff;
  font-family: var(--font-serif-zh, serif);
  font-weight: 900;
  font-size: 0.72rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.epithet-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.epithet-zh {
  font-size: 0.85rem;
  color: var(--accent-gold);
  font-weight: 800;
}

.epithet-th {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Centered & Full-Card Scaling Flashcards */
.custom-card-face-content {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.custom-card-face-content.minimal-mode {
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  padding: 30px 20px !important;
}

.custom-card-face-content.minimal-mode .fc-name-zh {
  font-size: clamp(3.2rem, 7vw, 5rem) !important;
  line-height: 1.1;
}

.custom-card-face-content.rich-mode {
  justify-content: center !important;
  align-items: center !important;
}

/* Specimen Clickable Zoom Chip */
.fc-specimen-wrap {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.fc-specimen-wrap:hover {
  transform: scale(1.03);
}

.fc-zoom-chip {
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fc-specimen-wrap:hover .fc-zoom-chip {
  background: rgba(212, 175, 55, 0.9) !important;
  color: #000 !important;
  font-weight: 700;
}

/* Studio Image Crop Controls */
.crop-pill {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.crop-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.crop-pill.active {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Profile Preset Avatars */
.preset-avatar-btn {
  padding: 5px 10px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-avatar-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

/* ==========================================================================
   BLACK CLOVER x IMPERIAL SCHOLAR UNIFIED THEME EXTENSION
   松烟黑檀 x 研学暗金 全学科与测验体验系统
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Header Auxiliary Tools Floating Pill & Glass Dropdown Sheet
   -------------------------------------------------------------------------- */
.header-tools-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-tools-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.header-tools-pill-btn:hover {
  border-color: var(--modern-border-gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.header-tools-wrapper.open .header-tools-pill-btn {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.tools-pill-icon {
  font-size: 0.95rem;
}

.tools-pill-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.header-tools-wrapper.open .tools-pill-chevron {
  transform: rotate(180deg);
}

.header-tools-dropdown-sheet {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  padding: 16px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: sheetFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.header-tools-wrapper.open .header-tools-dropdown-sheet {
  display: block;
}

@keyframes sheetFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

[data-theme="dark"] .header-tools-dropdown-sheet {
  background: #17171A;
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.tools-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

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

.tools-sheet-close-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
}

.tools-sheet-close-btn:hover {
  background: var(--bg-sidebar);
  color: var(--text-main);
}

.tools-dropdown-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
  gap: 10px;
}

.tools-dropdown-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tools-dropdown-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tools-dropdown-section .reading-font-sizer {
  border: none;
  padding-right: 0;
}

.tools-dropdown-section .reading-palette-selector {
  display: flex;
  gap: 4px;
}

.tools-dropdown-section .reading-focus-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.tools-dropdown-section .active-recall-toggle-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.tools-dropdown-section.tools-music-section {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 4px;
}

.tools-dropdown-section.tools-music-section .tools-dropdown-label {
  margin-bottom: 2px;
}

.tools-dropdown-section.tools-music-section .music-hub-btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   2. Basic Theory 10 Chapters (中医基础理论 研学系统)
   -------------------------------------------------------------------------- */
.zj-chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.zj-chapter-card:hover {
  border-color: var(--modern-border-gold);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .zj-chapter-card {
  background: #17171A;
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .zj-chapter-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.zj-chapter-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(140, 29, 24, 0.05) 0%, rgba(217, 119, 6, 0.04) 100%);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: background 0.2s ease;
}

.zj-chapter-header:hover {
  background: linear-gradient(135deg, rgba(140, 29, 24, 0.09) 0%, rgba(217, 119, 6, 0.07) 100%);
}

[data-theme="dark"] .zj-chapter-header {
  background: linear-gradient(135deg, rgba(224, 93, 82, 0.08) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.zj-ch-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zj-ch-title-zh {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-family-display);
  letter-spacing: -0.01em;
}

.zj-ch-title-th {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary);
}

[data-theme="dark"] .zj-ch-title-th {
  color: #F87171;
}

.zj-ch-meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

[data-theme="dark"] .zj-ch-meta-badge {
  background: #222226;
  border-color: rgba(255, 255, 255, 0.12);
  color: #D6D3D1;
}

.zj-chapter-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: max-height 0.3s ease;
}

.zj-chapter-body.collapsed {
  display: none;
}

.zj-section-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 18px;
  transition: all 0.2s ease;
}

.zj-section-card:hover {
  border-color: var(--modern-border-gold);
  border-left-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .zj-section-card {
  background: #1F1F24;
  border-color: rgba(255, 255, 255, 0.08);
  border-left-color: var(--modern-cinnabar);
}

.zj-subtab-btn {
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.zj-subtab-btn:hover {
  border-color: var(--modern-border-gold);
  color: var(--text-main);
}

.zj-subtab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .zj-subtab-btn.active {
  background: var(--modern-cinnabar);
  border-color: var(--modern-cinnabar);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   3. Diagnostics Subject Styling (中医诊断学 辨证与诊法)
   -------------------------------------------------------------------------- */
.reader-chapter-section {
  margin-bottom: 32px;
}

.reader-chapter-banner {
  background: linear-gradient(135deg, rgba(140, 29, 24, 0.07) 0%, rgba(217, 119, 6, 0.05) 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .reader-chapter-banner {
  background: linear-gradient(135deg, rgba(224, 93, 82, 0.1) 0%, rgba(245, 158, 11, 0.06) 100%);
  border-color: rgba(245, 158, 11, 0.25);
}

.reader-chapter-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid rgba(140, 29, 24, 0.2);
  margin-bottom: 8px;
}

[data-theme="dark"] .reader-chapter-badge {
  background: rgba(224, 93, 82, 0.18);
  color: #FCA5A5;
  border-color: rgba(224, 93, 82, 0.35);
}

.reader-chapter-title-zh {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  font-family: var(--font-family-display);
  margin: 0 0 4px;
}

.reader-chapter-title-th {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

[data-theme="dark"] .reader-chapter-title-th {
  color: #F87171;
}

.reader-chapter-overview {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  margin-top: 10px;
}

.reader-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.reader-card:hover {
  border-color: var(--modern-border-gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] .reader-card {
  background: #17171A;
  border-color: rgba(255, 255, 255, 0.09);
}

[data-theme="dark"] .reader-card:hover {
  border-color: rgba(245, 158, 11, 0.32);
}

.reader-section-title-zh {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  font-family: var(--font-family-display);
  margin: 0 0 2px;
}

[data-theme="dark"] .reader-section-title-zh {
  color: #FCA5A5;
}

.reader-section-title-th {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.key-point-block {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
}

.key-point-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.point-num-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

[data-theme="dark"] .point-num-tag {
  background: #222226;
  border-color: rgba(255, 255, 255, 0.12);
  color: #F87171;
}

.point-content {
  flex: 1;
}

.point-zh {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 4px;
}

.point-th {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.point-exam-box {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(120, 53, 15, 0.06);
  border: 1px solid rgba(120, 53, 15, 0.2);
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--accent-gold-dark, #78350F);
  font-weight: 600;
}

[data-theme="dark"] .point-exam-box {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
  color: #FCD34D;
}

/* 28 Pulses & Tongue Cards */
.pulse-card,
.tongue-card,
.syndrome-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pulse-card:hover,
.tongue-card:hover,
.syndrome-card:hover {
  border-color: var(--modern-border-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .pulse-card,
[data-theme="dark"] .tongue-card,
[data-theme="dark"] .syndrome-card {
  background: #17171A;
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .pulse-card:hover,
[data-theme="dark"] .tongue-card:hover,
[data-theme="dark"] .syndrome-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   4. Universal Quiz Polish across All 3 Subjects
   -------------------------------------------------------------------------- */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.25s ease;
}

[data-theme="dark"] .quiz-card {
  background: #17171A;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}

.quiz-pill-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-pill-btn:hover {
  border-color: var(--modern-border-gold);
  color: var(--text-main);
}

.quiz-pill-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

[data-theme="dark"] .quiz-pill-btn.active {
  background: rgba(224, 93, 82, 0.2);
  border-color: var(--modern-cinnabar);
  color: #FCA5A5;
}

.quiz-question-box {
  margin: 18px 0 22px;
  padding: 16px 20px;
  background: var(--bg-sidebar);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .quiz-question-box {
  background: #1F1F24;
  border-color: rgba(255, 255, 255, 0.08);
}

.quiz-question-zh {
  font-family: var(--font-family-display);
}

.quiz-opt-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.95rem;
  text-align: left;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 52px;
}

.quiz-opt-btn:hover:not([disabled]) {
  border-color: var(--modern-border-gold);
  background: var(--bg-sidebar);
  transform: translateY(-1px);
}

.quiz-opt-btn.correct,
.quiz-opt-btn.opt-correct {
  background: rgba(37, 107, 84, 0.08) !important;
  border-color: #256B54 !important;
  color: #1C1917 !important;
}

[data-theme="dark"] .quiz-opt-btn.correct,
[data-theme="dark"] .quiz-opt-btn.opt-correct {
  background: rgba(52, 211, 153, 0.14) !important;
  border-color: #34D399 !important;
  color: #F5F5F7 !important;
}

.quiz-opt-btn.incorrect,
.quiz-opt-btn.opt-wrong {
  background: rgba(185, 28, 28, 0.08) !important;
  border-color: #B91C1C !important;
  color: #1C1917 !important;
}

[data-theme="dark"] .quiz-opt-btn.incorrect,
[data-theme="dark"] .quiz-opt-btn.opt-wrong {
  background: rgba(220, 38, 38, 0.16) !important;
  border-color: #EF4444 !important;
  color: #F5F5F7 !important;
}

.quiz-hotkey-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  margin-top: 16px;
  background: var(--bg-sidebar);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

[data-theme="dark"] .quiz-hotkey-bar {
  background: #1F1F24;
  border-color: rgba(255, 255, 255, 0.07);
}

.hk-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hk-chip kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  font-family: var(--font-family-mono);
  font-size: 0.74rem;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .hk-chip kbd {
  background: #2A2A30;
  border-color: rgba(255, 255, 255, 0.15);
  color: #F5F5F7;
}

/* --------------------------------------------------------------------------
   5. Quiz Jump Matrix & Keyboard Shortcuts Modals
   -------------------------------------------------------------------------- */
.quiz-jump-modal-dialog,
.quiz-shortcuts-dialog {
  max-width: 580px;
  width: 90%;
  background: var(--bg-card);
  border: 1px solid var(--modern-border-gold);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 24px;
  position: relative;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="dark"] .quiz-jump-modal-dialog,
[data-theme="dark"] .quiz-shortcuts-dialog {
  background: #17171A;
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

.quiz-jump-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 8px 4px;
  margin: 16px 0;
}

.quiz-jump-tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--bg-sidebar);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-jump-tile:hover {
  border-color: var(--modern-border-gold);
  transform: translateY(-1px);
}

.quiz-jump-tile.current {
  border: 2px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 900;
}

.quiz-jump-tile.correct {
  background: #256B54;
  color: #FFFFFF;
  border-color: #256B54;
}

.quiz-jump-tile.incorrect {
  background: #B91C1C;
  color: #FFFFFF;
  border-color: #B91C1C;
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
}

[data-theme="dark"] .shortcut-row {
  background: #1F1F24;
  border-color: rgba(255, 255, 255, 0.08);
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shortcut-keys kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-family: var(--font-family-mono);
  font-size: 0.82rem;
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .shortcut-keys kbd {
  background: #2A2A30;
  border-color: rgba(255, 255, 255, 0.15);
  color: #F5F5F7;
}

.shortcut-desc {
  color: var(--text-muted);
  font-weight: 500;
}
