:root {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;

  /* Tarihsel Bilim & Biyoteknoloji Vurgu Paleti (Indigo / Teal / Amber) */
  --indigo: #4f46e5;
  --indigo-dark: #3730a3;
  --indigo-soft: #e0e7ff;
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;
  --amber: #d97706;
  --amber-dark: #b45309;
  --amber-soft: #fef3c7;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;
  --rose: #dc2626;
  --rose-soft: #fee2e2;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 8% 4%, rgba(79, 70, 229, 0.13), transparent 36%),
    radial-gradient(circle at 92% 7%, rgba(13, 148, 136, 0.13), transparent 36%),
    radial-gradient(circle at 52% 100%, rgba(217, 119, 6, 0.09), transparent 45%),
    var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button,
input {
  font-family: inherit;
}

.app-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: 16px 20px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ========================= HEADER ========================= */
.app-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

.btn-back-portal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-back-portal:hover {
  background: var(--indigo-soft);
  border-color: var(--indigo);
  color: var(--indigo-dark);
}

.btn-back-portal svg {
  width: 16px;
  height: 16px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.subtitle {
  margin: 3px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.subtitle-dot {
  color: var(--border-strong);
  font-weight: 800;
}

.meb-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  border: 1px solid rgba(79, 70, 229, 0.24);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--text-muted);
}

.stat-pill strong {
  color: var(--text-main);
  font-weight: 800;
}

.stat-discover .progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.stat-score {
  background: var(--amber-soft);
  border-color: rgba(217, 119, 6, 0.25);
  color: var(--amber-dark);
}

.stat-score strong {
  color: var(--amber-dark);
}

/* ========================= BUTTONS ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-ghost {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--rose-soft);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--rose);
}

.btn-primary {
  background: linear-gradient(135deg, var(--indigo), #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, var(--indigo-dark));
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--indigo);
  color: var(--indigo-dark);
}

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

.btn-soft:hover {
  background: var(--indigo-soft);
  border-color: rgba(79, 70, 229, 0.32);
  color: var(--indigo-dark);
}

.btn-amber-soft {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border-color: rgba(217, 119, 6, 0.35);
}

.btn-amber-soft:hover {
  background: #fde68a;
}

/* ========================= MODE NAV ========================= */
.mode-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.14s ease, background 0.18s ease;
}

.mode-tab:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.mode-tab.is-active {
  border-color: var(--indigo);
  background: linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.12);
}

.mode-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.mode-badge--indigo {
  background: var(--indigo-soft);
  color: var(--indigo-dark);
}

.mode-badge--teal {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.mode-badge--amber {
  background: var(--amber-soft);
  color: var(--amber-dark);
}

.mode-tab.is-active .mode-badge--indigo {
  background: var(--indigo);
  color: #ffffff;
}

.mode-tab.is-active .mode-badge--teal {
  background: var(--teal);
  color: #ffffff;
}

.mode-tab.is-active .mode-badge--amber {
  background: var(--amber);
  color: #ffffff;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-copy strong {
  font-size: 0.93rem;
  font-weight: 800;
  color: var(--text-main);
}

.mode-copy small {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ========================= SHARED CARD ========================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--indigo);
}

.muted-copy {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ========================= TAB 1: TIMELINE ========================= */
.timeline-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--indigo);
  color: var(--indigo-dark);
}

.filter-pill.is-active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
}

.timeline-nav-mini {
  display: flex;
  align-items: center;
  gap: 8px;
}

.milestone-counter {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 48px;
  text-align: center;
}

.timeline-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.milestone-btn {
  position: relative;
  text-align: left;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.16s ease;
}

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

.milestone-btn.is-active {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdfa 100%);
  border-color: var(--indigo);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.14);
}

.milestone-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.milestone-year {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--indigo-dark);
}

.milestone-btn.is-active .milestone-year {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
}

.milestone-seen-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 900;
  color: transparent;
  background: #ffffff;
  flex-shrink: 0;
}

.milestone-btn.is-discovered .milestone-seen-dot {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.milestone-btn-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.milestone-btn-sub {
  font-size: 0.72rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Workspace: Stage + Detail */
.timeline-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(320px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.stage-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-head h2 {
  margin: 2px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.canvas-frame {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 720 / 390;
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.14);
}

.canvas-frame--whatif {
  aspect-ratio: 680 / 295;
}

.canvas-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.control-slider-wrap {
  flex: 1 1 250px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.slider-val-badge {
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--indigo);
  cursor: pointer;
  height: 6px;
}

.control-buttons-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-readout {
  background: linear-gradient(90deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid #dbeafe;
  border-left: 4px solid var(--indigo);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.84rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* Detail Panel */
.detail-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.detail-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.d-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.d-badge--year {
  background: var(--indigo);
  color: #ffffff;
}

.d-badge--scientist {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.d-badge--cat {
  background: var(--amber-soft);
  color: var(--amber-dark);
}

.detail-heading {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
}

.detail-summary {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.58;
}

.detail-keyfact {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--text-main);
}

.detail-keyfact strong {
  color: var(--teal-dark);
}

.section-mini-title {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.impact-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.impact-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.impact-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.impact-label-row strong {
  color: var(--text-main);
  font-weight: 800;
}

.impact-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.impact-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.impact-fill--health { background: linear-gradient(90deg, #0d9488, #14b8a6); }
.impact-fill--agri { background: linear-gradient(90deg, #059669, #34d399); }
.impact-fill--env { background: linear-gradient(90deg, #d97706, #f59e0b); }
.impact-fill--sci { background: linear-gradient(90deg, #4f46e5, #818cf8); }

/* Maarif Inquiry Card */
.inquiry-card {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid rgba(217, 119, 6, 0.32);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.inquiry-badge {
  display: inline-block;
  background: var(--amber);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.inquiry-question {
  margin: 0;
  font-size: 0.87rem;
  font-weight: 700;
  color: #78350f;
  line-height: 1.48;
}

.inquiry-answer {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.83rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ========================= TAB 2: WHAT-IF SIMULATOR ========================= */
.whatif-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
}

.whatif-controls-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-head-block h2 {
  margin: 3px 0 0;
  font-size: 1.12rem;
  font-weight: 800;
}

.preset-bar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 12px;
}

.preset-label {
  font-size: 0.77rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.btn-preset {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 7px 8px;
  font-size: 0.77rem;
  font-weight: 700;
  border-radius: 9px;
}

.btn-preset:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.btn-preset.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.pillar-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pillar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-subtle);
  transition: all 0.16s ease;
}

.pillar-item.is-on {
  background: #ffffff;
  border-color: rgba(13, 148, 136, 0.42);
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.07);
}

.pillar-item.is-off {
  background: #f8fafc;
  border-color: var(--border);
  opacity: 0.82;
}

.pillar-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pillar-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.pillar-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
}

.pillar-era {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
}

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

/* Accessible Toggle Switch */
.switch-btn {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #cbd5e1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease;
  padding: 0;
}

.switch-btn::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.24);
  transition: transform 0.18s ease;
}

.switch-btn[aria-checked="true"] {
  background: var(--teal);
}

.switch-btn[aria-checked="true"]::after {
  transform: translateX(24px);
}

.whatif-results-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.whatif-canvas-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.life-badge {
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.metric-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-item--full {
  grid-column: 1 / -1;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.metric-head strong {
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 800;
}

.metric-track {
  width: 100%;
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.metric-fill--indigo { background: linear-gradient(90deg, #4f46e5, #6366f1); }
.metric-fill--teal { background: linear-gradient(90deg, #0d9488, #14b8a6); }
.metric-fill--emerald { background: linear-gradient(90deg, #059669, #10b981); }
.metric-fill--violet { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.metric-fill--amber { background: linear-gradient(90deg, #d97706, #f59e0b); }

.report-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.report-badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--indigo);
  color: #ffffff;
  font-size: 0.77rem;
  font-weight: 800;
}

.active-count-pill {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--teal-dark);
  background: var(--teal-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.report-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.52;
}

.report-point {
  padding: 8px 11px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--border);
}

.report-point--warn {
  background: #fffbeb;
  border-color: rgba(217, 119, 6, 0.38);
  color: #78350f;
}

.report-point--alert {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.3);
  color: #991b1b;
}

/* ========================= TAB 3: PRACTICE & QUIZ ========================= */
.subtab-bar {
  display: flex;
  justify-content: center;
}

.segmented-switch {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px;
  gap: 5px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.subtab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
}

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

.subtab-btn.is-active {
  background: var(--indigo);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.24);
}

.practice-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.practice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.practice-head h2 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.practice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.match-progress-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.match-feedback {
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.match-feedback.is-ok {
  background: var(--emerald-soft);
  border-color: rgba(5, 150, 105, 0.35);
  color: #065f46;
}

.match-feedback.is-err {
  background: var(--rose-soft);
  border-color: rgba(220, 38, 38, 0.35);
  color: #991b1b;
}

.match-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.match-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-col-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  padding-left: 2px;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-card {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.match-card:hover:not(:disabled) {
  border-color: var(--indigo);
  background: #f8fafc;
}

.match-card.is-selected {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.match-card.is-matched {
  border-color: var(--emerald);
  background: var(--emerald-soft);
  color: #065f46;
  cursor: default;
}

.match-card.is-wrong {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.match-card-title {
  font-weight: 800;
  display: block;
}

.match-card-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.match-card.is-matched .match-card-meta {
  color: #047857;
}

.match-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-soft);
  flex-shrink: 0;
}

.match-card.is-matched .match-tag {
  background: var(--emerald);
  color: #ffffff;
}

.match-complete-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, #eef2ff 100%);
  border: 1.5px solid rgba(5, 150, 105, 0.35);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.match-complete-banner h3 {
  margin: 0;
  color: #065f46;
}

.match-complete-banner p {
  margin: 0;
  max-width: 620px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Quiz */
.quiz-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-topbar h2 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.quiz-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.quiz-pill--correct {
  background: var(--emerald-soft);
  color: #065f46;
}

.quiz-progress-track {
  width: 100%;
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

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

.quiz-topic-tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber-dark);
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.quiz-question {
  margin: 0 0 14px;
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.5;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz-opt {
  text-align: left;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.89rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.45;
  transition: all 0.15s ease;
}

.quiz-opt:hover:not(:disabled) {
  border-color: var(--indigo);
  background: #f5f7ff;
}

.quiz-opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  flex-shrink: 0;
}

.quiz-opt.is-correct {
  border-color: var(--emerald);
  background: var(--emerald-soft);
  color: #065f46;
}

.quiz-opt.is-correct .quiz-opt-letter {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.quiz-opt.is-wrong {
  border-color: var(--rose);
  background: var(--rose-soft);
  color: #991b1b;
}

.quiz-opt.is-wrong .quiz-opt-letter {
  background: var(--rose);
  border-color: var(--rose);
  color: #ffffff;
}

.quiz-explanation {
  margin-top: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  font-size: 0.87rem;
  color: var(--text-main);
  line-height: 1.52;
}

.quiz-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.quiz-summary {
  text-align: center;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.summary-badge {
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.quiz-summary h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.quiz-summary p {
  margin: 0;
  max-width: 600px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 560px;
  margin: 6px 0;
}

.summary-stat {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat-label {
  font-size: 0.76rem;
  color: var(--text-soft);
  font-weight: 700;
}

.summary-stat strong {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--indigo-dark);
}

.summary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ========================= FOOTER ========================= */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 6px 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* ========================= RESPONSIVE ========================= */
@media (max-width: 1060px) {
  .timeline-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-workspace,
  .whatif-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 12px 12px 26px;
  }

  .mode-nav,
  .match-board,
  .quiz-options,
  .metrics-grid,
  .preset-buttons,
  .summary-metrics {
    grid-template-columns: 1fr;
  }

  .brand-copy h1 {
    font-size: 1.08rem;
  }

  .timeline-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .timeline-rail {
    grid-template-columns: 1fr;
  }
}
