:root {
  --bg-dark: #090d16;
  --bg-panel: #111827;
  --bg-card: #162033;
  --bg-card-hover: #1e2b45;
  --bg-code: #0b101b;
  --border: #263554;
  --border-light: #33476e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --accent: #f59e0b;
  --accent-glow: rgba(245, 158, 11, 0.2);
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
}
.bg-glow-1 {
  top: -150px;
  left: -100px;
  background: var(--primary);
}
.bg-glow-2 {
  bottom: -150px;
  right: -100px;
  background: var(--accent);
}

/* TOPBAR */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(17, 24, 39, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

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

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent), #ea580c);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.brand h1 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-center {
  flex: 1;
  max-width: 340px;
  margin: 0 20px;
}

.progress-wrapper {
  width: 100%;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-code);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-pill strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}
.stat-label-short {
  display: none;
}

.mobile-progress-line {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bg-code);
}
.mobile-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--emerald));
  transition: width 0.35s ease;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.65);
  backdrop-filter: blur(3px);
  z-index: 85;
}
.sidebar-backdrop.show {
  display: block;
}

.mobile-bottom-nav {
  display: none;
}

.timer-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.btn-xs {
  background: var(--primary);
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-xs:hover {
  opacity: 0.9;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* LAYOUT */
.layout {
  display: flex;
  padding-top: 64px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 295px;
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 64px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 90;
}

.sidebar-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 8px;
  padding: 0 8px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
}

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

.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--bg-code);
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.nav-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: transparent;
  flex-shrink: 0;
}

.nav-item.completed .nav-check {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #090d16;
  font-weight: 800;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cheat-tip {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #fde68a;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 295px;
  padding: 32px 40px 80px;
  max-width: 1220px;
}

.page-header {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

.btn-complete {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-complete:hover {
  border-color: var(--emerald);
}
.btn-complete.done {
  background: var(--emerald-bg);
  border-color: var(--emerald);
  color: #34d399;
}

/* CARDS & GRIDS */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.card p {
  color: #e2e8f0;
  font-size: 0.94rem;
  margin-bottom: 10px;
}

.card ul, .card ol {
  padding-left: 20px;
  color: #e2e8f0;
  font-size: 0.94rem;
  margin-bottom: 10px;
}

.card li {
  margin-bottom: 6px;
}
.card li strong {
  color: #ffffff;
}

/* CALLOUTS */
.callout {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  border-left: 4px solid var(--primary);
  background: rgba(30, 58, 138, 0.28);
  color: #f8fafc;
  font-size: 0.93rem;
  line-height: 1.6;
}
.callout-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #93c5fd;
}

.callout.warn {
  border-left-color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
}
.callout.warn .callout-title {
  color: #fcd34d;
}

.callout.danger {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}
.callout.danger .callout-title {
  color: #fca5a5;
}

.callout.success {
  border-left-color: var(--emerald);
  background: var(--emerald-bg);
}
.callout.success .callout-title {
  color: #6ee7b7;
}

/* FORMULA BOX */
.formula-box {
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #e2e8f0;
  overflow-x: auto;
}
.formula-box .hl {
  color: #38bdf8;
  font-weight: 700;
}
.formula-box .hl-warn {
  color: #fbbf24;
  font-weight: 700;
}
.formula-box .hl-ok {
  color: #34d399;
  font-weight: 700;
}

code {
  font-family: var(--font-mono);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.86em;
  font-weight: 600;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  background: var(--bg-panel);
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-code);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: var(--text-muted);
}

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

/* BUTTONS & FILTERS */
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn-secondary {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}
.btn-accent {
  background: var(--accent);
  color: #090d16;
}
.btn-emerald {
  background: var(--emerald);
  color: #090d16;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.search-input, .select-input {
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-family: var(--font-sans);
}
.search-input {
  flex: 1;
  min-width: 200px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* FLASHCARDS — REDESIGN MOBILE-FIRST & ERGONOMIQUE */
.fc-seg-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.fc-seg-btn {
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.fc-seg-btn:hover {
  border-color: var(--border-light);
  color: var(--text-main);
}

.fc-seg-btn.active-essential {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.13);
  color: #fff;
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.15);
}

.fc-seg-btn.active-extra {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.12);
  color: #fff;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.14);
}

.fc-seg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.92rem;
}

.fc-seg-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-code);
  color: #fde68a;
  flex-shrink: 0;
}

.fc-seg-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.fc-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.fc-search-compact {
  flex: 1;
  min-width: 0;
}

.fc-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fc-tool-btn {
  padding: 8px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.fc-tool-btn.active-filter {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
}

.fc-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 720px;
  margin: 6px auto 24px;
  width: 100%;
}

.fc-progress-row {
  width: 100%;
  margin-bottom: 10px;
}

.fc-counter-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.fc-status-tag {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
}
.fc-status-tag.mastered {
  background: var(--emerald-bg);
  color: #34d399;
}
.fc-status-tag.review {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}
.fc-status-tag.new {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.fc-mini-prog-bg {
  width: 100%;
  height: 5px;
  background: var(--bg-code);
  border-radius: 99px;
  overflow: hidden;
}

.fc-mini-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--emerald));
  border-radius: 99px;
  transition: width 0.25s ease;
}

@keyframes fcFlipIn {
  0% {
    opacity: 0.25;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fc-card-container {
  width: 100%;
  cursor: pointer;
  margin-bottom: 12px;
  touch-action: pan-y;
}

.fc-card-inner {
  width: 100%;
  transform: none !important;
}

.fc-face {
  width: 100%;
  min-height: 250px;
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow);
  animation: fcFlipIn 0.18s ease-out;
  transform: none !important;
}

.fc-front {
  background: linear-gradient(145deg, #162033, #0f172a);
  border: 2px solid var(--border-light);
}

.fc-back {
  display: none;
  background: #101c2e;
  border: 2px solid var(--primary);
}

.fc-card-container.flipped .fc-front {
  display: none;
}

.fc-card-container.flipped .fc-back {
  display: flex;
}

.fc-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fc-cat-badge {
  background: rgba(59, 130, 246, 0.22);
  color: #bae6fd;
  padding: 4px 10px;
  border-radius: 99px;
}

.fc-page-badge {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  padding: 4px 10px;
  border-radius: 99px;
  font-family: var(--font-mono);
}

.fc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0;
}

.fc-q-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-align: center;
  margin-bottom: 10px;
}

.fc-term {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  line-height: 1.38;
}

.fc-back-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #7dd3fc;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(125, 211, 252, 0.25);
  line-height: 1.35;
}

.fc-def {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.98rem;
  color: #ffffff;
  line-height: 1.62;
  text-align: left;
}

.fc-def-single {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.02rem;
  color: #ffffff;
  line-height: 1.65;
}

.fc-def-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-left: 3.5px solid #38bdf8;
  border-radius: 9px;
  padding: 10px 13px;
  color: #f8fafc;
  font-size: 0.95rem;
  line-height: 1.58;
}

.fc-def-item.is-pro {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  border-left: 4px solid #10b981;
  color: #ecfdf5;
}

.fc-def-item.is-con {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
  color: #fef2f2;
}

.fc-def-item.is-formula {
  background: #090d16;
  border: 1px solid #38bdf8;
  border-radius: 9px;
  padding: 11px 14px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: #7dd3fc;
  text-align: center;
}

.fc-key-label {
  color: #7dd3fc;
  font-weight: 800;
}

.fc-item-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 4px;
}

.fc-item-badge.pro {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

.fc-item-badge.con {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.fc-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.fc-dock {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fc-dock-eval {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.fc-eval-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
}

.fc-dock-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.fc-nav-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 8px;
  font-size: 0.83rem;
}

.fc-grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.fc-mini-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}
.fc-mini-card.mastered {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.05);
}
.fc-mini-card.review {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.05);
}
.fc-mini-title {
  font-weight: 800;
  color: #ffffff;
  font-size: 1.04rem;
  line-height: 1.35;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.fc-mini-def {
  font-size: 0.94rem;
  color: #f8fafc;
}

/* TRUE / FALSE (VRAI / FAUX) */
.vf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.vf-card.answered-correct {
  border-color: var(--emerald);
}
.vf-card.answered-wrong {
  border-color: var(--danger);
}

.vf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.vf-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
  padding: 3px 9px;
  border-radius: 6px;
}

.vf-statement {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 14px;
}

.vf-actions {
  display: flex;
  gap: 10px;
}

.vf-btn {
  flex: 1;
  max-width: 160px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}
.vf-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}
.vf-btn.correct-choice {
  background: var(--emerald-bg);
  border-color: var(--emerald);
  color: #34d399;
}
.vf-btn.wrong-choice {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #fca5a5;
}

.vf-explanation {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: none;
}
.vf-explanation.show {
  display: block;
}
.vf-explanation.ok {
  background: var(--emerald-bg);
  border-left: 4px solid var(--emerald);
  color: #d1fae5;
}
.vf-explanation.ko {
  background: var(--danger-bg);
  border-left: 4px solid var(--danger);
  color: #fee2e2;
}

/* SIMULATORS & CANVAS */
.sim-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  margin: 18px 0;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.canvas-wrap {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

canvas {
  max-width: 100%;
  height: auto;
}

/* SCHEMA LABELING QUIZ */
.schema-quiz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.schema-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* PROS / CONS TAGS */
.pro-tag {
  color: #34d399;
  font-weight: 600;
}
.con-tag {
  color: #f87171;
  font-weight: 600;
}

@media (max-width: 960px) {
  .icon-btn {
    display: flex;
    flex-shrink: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    background: rgba(15, 23, 42, 0.97);
    width: min(300px, 85vw);
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.65);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px calc(88px + env(safe-area-inset-bottom, 0px));
    width: 100%;
  }
  .topbar-center {
    display: none;
  }
  .mobile-progress-line {
    display: block;
  }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 98;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.45);
  }
  .mob-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-btn.active {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.14);
  }
  .mob-nav-icon {
    font-size: 1.12rem;
    line-height: 1;
  }
  .mob-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }
  .topbar {
    height: 56px;
    padding: 0 10px;
    gap: 6px;
  }
  .layout {
    padding-top: 56px;
  }
  .sidebar {
    top: 56px;
  }
  .topbar-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .brand {
    min-width: 0;
    gap: 6px;
  }
  .brand-badge {
    display: none;
  }
  .brand h1 {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    gap: 5px;
    flex-shrink: 0;
  }
  .stat-label-full {
    display: none;
  }
  .stat-label-short {
    display: inline;
  }
  .stat-pill {
    padding: 4px 7px;
    font-size: 0.74rem;
    gap: 4px;
  }
  .timer-widget {
    padding: 4px 7px;
    gap: 5px;
    font-size: 0.76rem;
  }
  .timer-icon, #timer-reset {
    display: none;
  }
  .main-content {
    padding: 16px 12px calc(86px + env(safe-area-inset-bottom, 0px));
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  .page-title {
    font-size: 1.35rem;
  }
  .page-subtitle {
    font-size: 0.86rem;
  }
  .btn-complete {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }
  .grid-2, .grid-3, .fc-grid-list, .sim-controls {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card {
    padding: 15px 14px;
    margin-bottom: 14px;
  }
  .card h3 {
    font-size: 1.02rem;
    line-height: 1.35;
  }
  .formula-box {
    padding: 11px 12px;
    font-size: 0.84rem;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .search-input, .select-input {
    width: 100%;
    min-width: 0;
    font-size: 16px; /* Empêche le zoom auto iOS */
    padding: 10px 12px;
  }
  .chip-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: 14px !important;
    scrollbar-width: none;
  }
  .chip-group::-webkit-scrollbar {
    display: none;
  }
  .chip {
    flex-shrink: 0;
    padding: 7px 13px;
    font-size: 0.78rem;
  }
  /* Flashcards 3D optimisées mobile */
  .fc-seg-switch {
    gap: 6px;
    margin-bottom: 10px;
  }
  .fc-seg-btn {
    padding: 9px 10px;
    border-radius: 10px;
  }
  .fc-seg-top {
    font-size: 0.78rem;
  }
  .fc-seg-pill {
    font-size: 0.68rem;
    padding: 1px 6px;
  }
  .fc-seg-sub {
    display: none;
  }
  .fc-toolbar {
    gap: 6px;
    margin-bottom: 8px;
  }
  .fc-search-compact {
    padding: 8px 10px;
    font-size: 16px;
  }
  .fc-tool-btn {
    padding: 9px 9px;
    font-size: 0.75rem;
  }
  .fc-stage {
    margin: 2px 0 16px;
  }
  .fc-card-container {
    margin-bottom: 10px;
  }
  .fc-face {
    min-height: 215px;
    padding: 16px 15px;
    border-radius: 14px;
    gap: 10px;
  }
  .fc-top-meta {
    font-size: 0.68rem;
    gap: 6px;
  }
  .fc-term {
    font-size: 1.16rem;
    line-height: 1.35;
  }
  .fc-def {
    font-size: 0.91rem;
    line-height: 1.52;
  }
  .fc-def-center {
    font-size: 0.96rem;
  }
  .fc-hint {
    font-size: 0.7rem;
  }
  .fc-eval-btn {
    padding: 12px 10px;
    font-size: 0.9rem;
  }
  .fc-dock-nav {
    gap: 6px;
  }
  .fc-nav-btn {
    padding: 10px 4px;
    font-size: 0.76rem;
  }
  /* Vrai / Faux optimisés mobile */
  .vf-card {
    padding: 14px;
  }
  .vf-statement {
    font-size: 0.94rem;
    line-height: 1.5;
  }
  .vf-actions {
    gap: 8px;
  }
  .vf-btn {
    max-width: none;
    padding: 12px 14px;
    font-size: 0.92rem;
  }
  /* Quiz schémas empilés proprement sur mobile */
  .schema-quiz-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .schema-quiz-row > div:last-child {
    flex-direction: column;
    align-items: stretch !important;
    width: 100%;
  }
  /* Tableaux scrollables fluides sur mobile */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    margin: 10px -4px;
  }
  th, td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  .sim-panel {
    padding: 14px 12px;
  }
  .canvas-wrap {
    padding: 8px 6px;
  }
}
