:root {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: rgba(79, 70, 229, 0.1);
  --accent: #0ea5e9;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  /* SVOC Role Colors */
  --role-s-color: #2563eb;
  --role-s-bg: rgba(37, 99, 235, 0.1);
  --role-s-border: rgba(37, 99, 235, 0.35);

  --role-v-color: #e11d48;
  --role-v-bg: rgba(225, 29, 72, 0.1);
  --role-v-border: rgba(225, 29, 72, 0.35);

  --role-o-color: #059669;
  --role-o-bg: rgba(5, 150, 105, 0.1);
  --role-o-border: rgba(5, 150, 105, 0.35);

  --role-c-color: #d97706;
  --role-c-bg: rgba(217, 119, 6, 0.12);
  --role-c-border: rgba(217, 119, 6, 0.4);

  --role-m-color: #7c3aed;
  --role-m-bg: rgba(124, 58, 237, 0.1);
  --role-m-border: rgba(124, 58, 237, 0.35);

  --role-conn-color: #db2777;
  --role-conn-bg: rgba(219, 39, 119, 0.1);
  --role-conn-border: rgba(219, 39, 119, 0.35);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

[data-theme="dark"] {
  --bg-app: #0b1120;
  --bg-sidebar: #111827;
  --bg-card: #1e293b;
  --bg-subtle: #0f172a;
  --bg-elevated: #263349;
  --text-main: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-strong: #475569;

  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.18);

  --role-s-color: #60a5fa;
  --role-s-bg: rgba(96, 165, 250, 0.16);
  --role-s-border: rgba(96, 165, 250, 0.45);

  --role-v-color: #fb7185;
  --role-v-bg: rgba(251, 113, 133, 0.16);
  --role-v-border: rgba(251, 113, 133, 0.45);

  --role-o-color: #34d399;
  --role-o-bg: rgba(52, 211, 153, 0.16);
  --role-o-border: rgba(52, 211, 153, 0.45);

  --role-c-color: #fbbf24;
  --role-c-bg: rgba(251, 191, 36, 0.16);
  --role-c-border: rgba(251, 191, 36, 0.45);

  --role-m-color: #a78bfa;
  --role-m-bg: rgba(167, 139, 250, 0.16);
  --role-m-border: rgba(167, 139, 250, 0.45);

  --role-conn-color: #f472b6;
  --role-conn-bg: rgba(244, 114, 182, 0.16);
  --role-conn-border: rgba(244, 114, 182, 0.45);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic UI', 'Meiryo', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* App Layout */
.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow-y: auto;
}

.brand-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* User Progress Mini Card in Sidebar */
.sidebar-stats {
  margin: 14px 16px;
  padding: 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stats-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.level-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.xp-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #0ea5e9);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.stats-bottom-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Main Navigation Buttons */
.nav-section-label {
  padding: 10px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.nav-menu {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

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

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.nav-btn .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

/* Unit List in Sidebar */
.sidebar-units {
  padding: 4px 12px 24px;
  flex: 1;
}

.stage-group {
  margin-bottom: 12px;
}

.stage-group-header {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.unit-nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.unit-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.unit-num-pill {
  font-size: 10.5px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unit-nav-item.completed .unit-num-pill {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.unit-nav-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Main Content Area */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  min-height: 62px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 16px;
}

.svoc-legend-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.legend-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  margin-left: auto;
}

.search-box {
  position: relative;
  min-width: 0;
}

.search-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  width: 190px;
  max-width: 100%;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  width: 220px;
  background: var(--bg-card);
}

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

.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

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

@media (max-width: 1420px) {
  .svoc-legend-bar {
    display: none;
  }
}

/* Content Container */
.content-container {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 28px 80px;
}

/* SVOC Role Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  line-height: 1.4;
}

.role-s, .role-S {
  color: var(--role-s-color);
  background: var(--role-s-bg);
  border-color: var(--role-s-border);
}

.role-v, .role-V {
  color: var(--role-v-color);
  background: var(--role-v-bg);
  border-color: var(--role-v-border);
}

.role-o, .role-O {
  color: var(--role-o-color);
  background: var(--role-o-bg);
  border-color: var(--role-o-border);
}

.role-c, .role-C {
  color: var(--role-c-color);
  background: var(--role-c-bg);
  border-color: var(--role-c-border);
}

.role-m, .role-M {
  color: var(--role-m-color);
  background: var(--role-m-bg);
  border-color: var(--role-m-border);
}

.role-conn, .role-CONN {
  color: var(--role-conn-color);
  background: var(--role-conn-bg);
  border-color: var(--role-conn-border);
}

/* Hero Banner on Dashboard */
.hero-banner {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #0284c7 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-banner h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hero-banner p {
  font-size: 15px;
  opacity: 0.92;
  max-width: 680px;
  margin-bottom: 22px;
}

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

.btn-primary-hero {
  background: #ffffff;
  color: #312e81;
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.btn-primary-hero:hover {
  transform: translateY(-2px);
}

.btn-secondary-hero {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.btn-secondary-hero:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Dashboard KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Stage Section & Unit Cards */
.stage-block {
  margin-bottom: 36px;
}

.stage-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.stage-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.stage-title {
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.stage-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
}

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

.unit-card.completed {
  border-color: rgba(16, 185, 129, 0.45);
}

.unit-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.unit-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-icon:empty {
  display: none;
}

.unit-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.unit-card.completed .unit-status-pill {
  background: var(--success-soft);
  color: var(--success);
}

.unit-card-num {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
}

.unit-card-title {
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.35;
}

.unit-card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  flex: 1;
}

.unit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

/* Lesson View */
.lesson-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.lesson-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.lesson-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.lesson-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 6px;
}

.lesson-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.key-takeaway-box {
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
}

.key-takeaway-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.key-takeaway-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

/* Lesson Mode Tabs */
.lesson-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.lesson-tab-btn {
  flex: 1 1 150px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1.35;
}

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

.lesson-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
}

/* Lesson Sections */
.lesson-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-main);
}

.section-body {
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.8;
}

.section-body p {
  margin-bottom: 14px;
}

.section-body ul, .section-body ol {
  margin: 12px 0 16px 22px;
}

.section-body li {
  margin-bottom: 6px;
}

/* Rich Content Classes inside contentHtml */
.concept-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
}

.concept-box h4 {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.visual-diagram {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 18px 0;
  text-align: center;
  overflow-x: auto;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.compare-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.compare-card.good {
  border-top: 4px solid var(--success);
  background: var(--success-soft);
}

.compare-card.bad {
  border-top: 4px solid var(--danger);
  background: var(--danger-soft);
}

.compare-card h5 {
  font-size: 14.5px;
  font-weight: 800;
  margin-bottom: 8px;
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.grammar-table th {
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 700;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border-color);
}

.grammar-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.grammar-table tr:last-child td {
  border-bottom: none;
}

/* Example Cards with SVOC Breakdown & Audio */
.examples-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.example-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.15s;
}

.example-card:hover {
  border-color: var(--border-strong);
}

.example-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.example-en {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.audio-controls {
  display: flex;
  gap: 6px;
}

.btn-audio {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-audio:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.svoc-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.svoc-token-chip {
  display: inline-flex;
  flex-direction: column;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.svoc-token-word {
  font-size: 15px;
  font-weight: 800;
}

.svoc-token-label {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.9;
  margin-top: 1px;
}

.example-translations {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13.5px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.literal-trans {
  color: var(--primary);
  font-weight: 700;
}

.natural-trans {
  color: var(--text-secondary);
  font-weight: 600;
}

.example-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
}

/* Tip Box */
.tip-box {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning);
  background: var(--warning-soft);
}

.tip-box.warning {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.tip-box.trick {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.tip-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-text {
  font-size: 13.5px;
  color: var(--text-main);
}

/* Word Order Puzzle UI */
.puzzle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.puzzle-ja-prompt {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.puzzle-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.puzzle-answer-zone {
  min-height: 68px;
  background: var(--bg-subtle);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.puzzle-answer-zone.correct {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-soft);
}

.puzzle-answer-zone.wrong {
  border-color: var(--danger);
  border-style: solid;
  background: var(--danger-soft);
}

.puzzle-placeholder {
  color: var(--text-muted);
  font-size: 13.5px;
  user-select: none;
}

.puzzle-bank-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  min-height: 44px;
}

.word-block-btn {
  padding: 9px 15px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.word-block-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.word-block-btn .block-role-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 800;
}

/* Quiz UI */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.quiz-question-text {
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 12px;
}

.quiz-sentence-box {
  background: var(--bg-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.quiz-option-btn {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.quiz-option-btn.selected-correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.quiz-option-btn.selected-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.feedback-panel {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  font-size: 14px;
}

.feedback-panel.correct {
  border-left: 4px solid var(--success);
}

.feedback-panel.wrong {
  border-left: 4px solid var(--danger);
}

/* Action Buttons */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Lesson Footer Navigation */
.lesson-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
}

/* X-Ray Analyzer View */
.xray-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

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

/* Glossary & Reference Tables */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.glossary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.glossary-term {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.glossary-simple {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.glossary-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.glossary-example {
  font-size: 12.5px;
  background: var(--bg-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Dashboard Exercise Breakdown & Unit Progress */
.kpi-progress-bar {
  margin-top: 8px;
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.kpi-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.exercise-breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.breakdown-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
}

.breakdown-total-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.breakdown-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.breakdown-item-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.breakdown-item-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.mini-progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.35s ease;
}

.unit-card-progress-wrap {
  margin-bottom: 12px;
}

.unit-card-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.unit-card-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.unit-mini-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Mental Model Card (Tab 1 top) */
.mental-model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 5px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.mental-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 10px;
}

.mental-model-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.35;
}

.analogy-box {
  background: var(--warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
}

.analogy-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--warning);
  margin-bottom: 5px;
}

.analogy-text {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.7;
}

.mental-model-visual {
  margin: 16px 0 20px;
}

.three-angles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.angle-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  border-top: 4px solid var(--primary);
}

.angle-card:nth-child(1) {
  border-top-color: var(--role-s-color);
}

.angle-card:nth-child(2) {
  border-top-color: var(--role-o-color);
}

.angle-card:nth-child(3) {
  border-top-color: var(--role-m-color);
}

.angle-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.angle-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Nuance & Error Drill UI (Tab 3) */
.tab-section-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.tab-section-banner h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}

.tab-section-banner p {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.nuance-card, .error-card, .flash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.origin-unit-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.origin-unit-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.nuance-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-main);
}

.nuance-situation {
  background: var(--bg-subtle);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 16px;
}

.nuance-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}

.nuance-option-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nuance-option-card:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
  transform: translateY(-2px);
}

.nuance-option-card.selected-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.nuance-option-card.selected-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.nuance-opt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nuance-opt-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nuance-opt-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-secondary);
}

.nuance-opt-expr {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
}

.nuance-opt-core {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Error Drill Specific */
.error-wrong-box {
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 12px;
}

.error-wrong-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 4px;
}

.wrong-strike {
  font-size: 17px;
  font-weight: 800;
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.error-bug-reason {
  background: var(--warning-soft);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-main);
  margin-bottom: 14px;
}

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

/* Flashcard UI (Tab 4) */
.flash-ja-prompt {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.flash-sub-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.flash-controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.flash-hint-box {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 14px;
}

.flash-answer-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 10px;
}

.flash-en-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.flash-en-answer {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.flash-master-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.mastered-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
}

/* Core Maps View */
.coremap-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.coremap-toc-pill {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.coremap-toc-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.coremap-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.coremap-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 0 6px;
}

.coremap-subtitle {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.coremap-summary {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.7;
}

/* Dojo View */
.dojo-setup-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.dojo-setup-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dojo-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dojo-mode-btn {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.dojo-mode-btn:hover {
  border-color: var(--primary);
}

.dojo-mode-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.dojo-status-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

/* Responsive */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -300px;
    width: 290px;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .breakdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .three-angles-grid {
    grid-template-columns: 1fr;
  }
  .svoc-legend-bar {
    display: none;
  }
}

@media (max-width: 680px) {
  .nuance-compare-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .content-container {
    padding: 18px 16px 60px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .breakdown-grid {
    grid-template-columns: 1fr;
  }
  .lesson-tabs {
    flex-direction: column;
  }
  .lesson-tab-btn {
    flex: none;
  }
}
