/* ==========================================================================
   MatFlow — 8. Sınıf LGS Matematik (12 Ünite • 360 Etkileşimli Durak)
   Tam Ekran Kaplayan Mizanpaj • Mac / PC / Tablet Uyumlu • Estetik SVG Geçiş Okları
   ========================================================================== */

:root {
  --topbar-bg: #111827;
  --topbar-border: #1f2937;
  --sidebar-w: clamp(252px, 18.5vw, 300px);
  --sidebar-bg: #0f172a;

  /* Kullanıcı Kuralı: Tamamlanan = Yeşil, Tamamlanmayan = Turuncu */
  --done-green: #16a34a;
  --done-green-light: #22c55e;
  --done-green-soft: #dcfce7;
  --done-green-border: #86efac;

  --todo-orange: #f97316;
  --todo-orange-light: #fb923c;
  --todo-orange-soft: #ffedd5;
  --todo-orange-border: #fdba74;

  --active-blue: #2563eb;
  --active-blue-light: #3b82f6;
  --active-blue-soft: #dbeafe;
  --active-gold: #f59e0b;

  --stage-bg: #eef2f7;
  --card-bg: #ffffff;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-light: #94a3b8;
  --border-subtle: #dbe3ee;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --topbar-h: 48px;
  --workspace-head-h: 38px;
  --road-h: 90px;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-card: 0 12px 32px -8px rgba(15, 23, 42, 0.09), 0 2px 8px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--stage-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   1. ÜST BAR (Mac / PC / Tablet Uyumlu Koyu Üst Menü)
   ========================================================================== */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #ffffff;
  z-index: 60;
  user-select: none;
  gap: 10px;
}

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

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.nartes-logo-mount {
  display: flex;
  align-items: center;
  height: 36px;
}

.nartes-svg-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.10);
  color: #cbd5e1;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  justify-content: center;
}

.topnav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.topnav-btn:hover, .topnav-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

.unit-select-dropdown {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  max-width: 310px;
  min-width: 160px;
  text-overflow: ellipsis;
}

.unit-select-dropdown option {
  background: #111827;
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.top-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
}

.top-pill.lgs-total-pill {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.38);
  color: #fed7aa;
}

.top-pill .dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--done-green-light);
  box-shadow: 0 0 8px var(--done-green-light);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.icon-btn.muted {
  opacity: 0.48;
}

/* ==========================================================================
   2. ANA DÜZEN (Sol Kazanım Paneli + Sağ Tam Ekran Çalışma Alanı)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  width: 100vw;
  position: relative;
  transition: grid-template-columns 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Sol panel kapatıldığında çalışma alanı %100 ekranı kaplar */
body.sidebar-collapsed .app-shell {
  grid-template-columns: 0px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  border-right: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  z-index: 48;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* ==========================================================================
   3. SOL PANEL (Mathigon Tarzı Kapak + Yeşil/Turuncu Kazanım Zinciri)
   ========================================================================== */
.sidebar {
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e293b;
  overflow: hidden;
  user-select: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  z-index: 50;
}

.sidebar-hero {
  position: relative;
  height: clamp(142px, 18vh, 174px);
  background-image: url('../assets/flow/kapak_carpanlar_katlar.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.90) 100%);
}

.hero-top-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
}

.hero-grid-badge {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 40px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  justify-items: center;
  padding: 2px;
  font-size: 8px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.hero-switch-btn {
  background: rgba(15, 23, 42, 0.80);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.18s ease;
}

.hero-switch-btn:hover {
  background: #f97316;
  border-color: #ffffff;
}

.hero-unit-tag {
  position: relative;
  z-index: 2;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #fdba74;
  margin-bottom: 2px;
}

.hero-title {
  position: relative;
  z-index: 2;
  font-size: clamp(17px, 1.3vw, 20px);
  font-weight: 800;
  line-height: 1.18;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.sidebar-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.green {
  background: var(--done-green-light);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.legend-dot.orange {
  background: var(--todo-orange);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.kazanim-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}

.kazanim-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.kazanim-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 22px;
  top: 34px;
  bottom: -14px;
  width: 2.5px;
  background: rgba(249, 115, 22, 0.45);
  z-index: 1;
}

.kazanim-item.status-done:not(:last-child)::after {
  background: var(--done-green-light);
}

.kazanim-item.status-done {
  background: rgba(22, 163, 74, 0.14);
  border-left-color: var(--done-green-light);
}
.kazanim-item.status-done:hover {
  background: rgba(22, 163, 74, 0.24);
}

.kazanim-item.status-todo {
  background: rgba(249, 115, 22, 0.06);
  border-left-color: rgba(249, 115, 22, 0.45);
}
.kazanim-item.status-todo:hover {
  background: rgba(249, 115, 22, 0.14);
}

.kazanim-item.is-current {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.26) 0%, rgba(249, 115, 22, 0.06) 100%);
  border-left-color: #fb923c;
}
.kazanim-item.status-done.is-current {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.28) 0%, rgba(34, 197, 94, 0.06) 100%);
  border-left-color: #4ade80;
}

.kazanim-node {
  position: relative;
  z-index: 2;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.kazanim-item.status-done .kazanim-node {
  background: var(--done-green-light);
  color: #ffffff;
  border: 2px solid #86efac;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.kazanim-item.status-todo .kazanim-node {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border: 2px solid var(--todo-orange);
}

.kazanim-item.is-current .kazanim-node {
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.28);
}

.kazanim-info {
  flex: 1;
  min-width: 0;
}

.kazanim-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.28;
  margin-bottom: 3px;
}

.kazanim-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
}

.kazanim-item.status-done .kazanim-meta { color: #86efac; }
.kazanim-item.status-todo .kazanim-meta { color: #fdba74; }

.kazanim-mini-dots {
  display: flex;
  gap: 3.5px;
}

.kazanim-mini-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--todo-orange);
}
.kazanim-mini-dot.done { background: var(--done-green-light); }
.kazanim-mini-dot.active {
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--todo-orange);
}

.sidebar-footer {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.footer-action {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.footer-action:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   4. SAĞ ÇALIŞMA ALANI (Minimum Kenar Boşluğu • Ekranı Tam Kaplayan Yapı)
   ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.workspace-header {
  height: var(--workspace-head-h);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}

.step-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  min-width: 0;
  overflow: hidden;
}

.crumb-unit {
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.crumb-kaz {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-stop {
  white-space: nowrap;
}

.crumb-sep {
  color: #94a3b8;
}

.crumb-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.crumb-badge.type-concept { background: #e0f2fe; color: #0369a1; }
.crumb-badge.type-video   { background: #fae8ff; color: #a21caf; }
.crumb-badge.type-activity{ background: #fef3c7; color: #b45309; }
.crumb-badge.type-game    { background: #dcfce7; color: #15803d; }
.crumb-badge.type-question{ background: #ede9fe; color: #6d28d9; }

.workspace-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.step-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.step-status-pill.done {
  background: var(--done-green-soft);
  color: var(--done-green);
  border: 1px solid var(--done-green-border);
}

.step-status-pill.todo {
  background: var(--todo-orange-soft);
  color: #c2410c;
  border: 1px solid var(--todo-orange-border);
}

/* ==========================================================================
   5. ORTA SAHNE — EKRANI TAM KAPLAYAN PENCERE VE ESTETİK SVG GEÇİŞ OKLARI
   ========================================================================== */
.stage-viewport {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 2px 10px 8px;
  position: relative;
  min-height: 0;
  min-width: 0;
}

/* Ana Pencere Kartı: Maksimum genişlik/yükseklik sınırı kaldırıldı, sahneyi tam kaplar */
.window-card {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  border: 1.5px solid #cbd5e1;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.window-card.slide-out-left {
  transform: translateX(-48px);
  opacity: 0;
}

.window-card.slide-in-right {
  animation: slideFromRight 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.window-card.slide-in-left {
  animation: slideFromLeft 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideFromRight {
  from { transform: translateX(48px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideFromLeft {
  from { transform: translateX(-48px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   ESTETİK CAM EFEKTLİ (GLASSMORPHIC) SVG GEÇİŞ KAPSÜLLERİ
   ========================================================================== */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 82px;
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.90) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(148, 163, 184, 0.38);
  color: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow:
    0 12px 28px -6px rgba(15, 23, 42, 0.16),
    0 4px 10px -2px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 25;
  overflow: hidden;
  user-select: none;
}

.nav-arrow-prev {
  left: 16px;
}

.nav-arrow-next {
  right: 16px;
}

.nav-arrow-svg {
  width: 24px;
  height: 24px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-arrow-svg .chev-main,
.nav-arrow-svg .chev-back {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

.nav-arrow-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #475569;
  transition: color 0.2s ease;
}

/* Hover & Focus Efektleri */
.nav-arrow:hover:not(:disabled) {
  background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow:
    0 16px 32px -6px rgba(37, 99, 235, 0.42),
    0 0 0 4px rgba(59, 130, 246, 0.18);
}

.nav-arrow:hover:not(:disabled) .nav-arrow-label {
  color: #dbeafe;
}

.nav-arrow-prev:hover:not(:disabled) {
  transform: translateY(-50%) translateX(-2px) scale(1.04);
}
.nav-arrow-prev:hover:not(:disabled) .chev-main {
  transform: translateX(-2px);
}
.nav-arrow-prev:hover:not(:disabled) .chev-back {
  transform: translateX(2px);
  opacity: 0.75;
}

.nav-arrow-next:hover:not(:disabled) {
  transform: translateY(-50%) translateX(2px) scale(1.04);
}
.nav-arrow-next:hover:not(:disabled) .chev-main {
  transform: translateX(2px);
}
.nav-arrow-next:hover:not(:disabled) .chev-back {
  transform: translateX(-2px);
  opacity: 0.75;
}

/* Görev Tamamlandığında Sağ Ok Parlak Yeşil Olur */
.nav-arrow.next-ready {
  background: linear-gradient(145deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  border-color: #86efac;
  box-shadow:
    0 14px 30px -4px rgba(22, 163, 74, 0.48),
    0 0 0 4px rgba(34, 197, 94, 0.22);
  animation: pulseGreenArrow 1.8s infinite;
}

.nav-arrow.next-ready .nav-arrow-label {
  color: #dcfce7;
}

.nav-arrow:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.4);
}

@keyframes pulseGreenArrow {
  0%, 100% {
    box-shadow: 0 12px 26px -4px rgba(22, 163, 74, 0.45), 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  50% {
    box-shadow: 0 12px 26px -4px rgba(22, 163, 74, 0.45), 0 0 0 10px rgba(34, 197, 94, 0);
  }
}

/* Pencere Üst Başlığı */
.window-head {
  padding: clamp(12px, 1.5vh, 18px) clamp(24px, 3vw, 44px);
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.window-title-wrap h1 {
  font-size: clamp(19px, 1.6vw, 25px);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.35px;
  line-height: 1.2;
}

.window-subtitle {
  font-size: clamp(12.5px, 1vw, 14.5px);
  color: var(--ink-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* Pencere Gövdesi: Yanlardaki yüzen oklar için güvenli iç boşluk + tam yükseklik */
.window-body {
  flex: 1;
  min-height: 0;
  padding: clamp(10px, 1.4vh, 18px) clamp(36px, 3.5vw, 56px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(10px, 1.4vh, 16px);
}

/* Pencere Alt Durum ve Otomatik Geçiş Çubuğu */
.window-foot {
  padding: clamp(10px, 1.2vh, 14px) clamp(24px, 3vw, 44px);
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.foot-feedback {
  font-size: clamp(12.5px, 1vw, 14px);
  font-weight: 700;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.foot-feedback.success {
  color: var(--done-green);
}

.foot-feedback.warn {
  color: #d97706;
}

.foot-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-secondary-prev {
  background: #ffffff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
  padding: 9px 15px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.btn-secondary-prev:hover:not(:disabled) {
  border-color: var(--active-blue);
  color: var(--active-blue);
  background: #f8fafc;
  transform: translateX(-1px);
}

.btn-secondary-prev:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-primary-next {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary-next:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.42);
}

.btn-primary-next:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

/* ==========================================================================
   6. İÇERİK BİLEŞENLERİ (Tam Ekranı Dolduran Esnek Grid Yapıları)
   ========================================================================== */
.content-split {
  min-height: min-content;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: clamp(12px, 1.8vw, 22px);
  align-items: start;
}

.lead-text {
  font-size: clamp(13.5px, 1.05vw, 15.5px);
  line-height: 1.55;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.lead-text p + p {
  margin-top: 8px;
}

/* Görsel 3B Nartes+ Sahne Kartı (Sade & Estetik Çerçevesiz Görünüm) */
.flow-visual-box {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.75);
  background: #0f172a;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.10);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 180px;
}

.flow-visual-box img {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 155px;
  max-height: clamp(150px, 24vh, 260px);
  object-fit: cover;
  display: block;
}

.flow-visual-caption {
  position: absolute;
  bottom: 10px;
  left: 12px;
  padding: 5px 12px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

/* Mathigon Tarzı Sayı Çubukları (Number Bars) */
.factor-bars-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.2vw, 12px);
  margin-top: 8px;
}

.bar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.03);
  min-width: 0;
}

.bar-row {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
  min-width: 0;
}

.bar-seg {
  height: 25px;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(10px, 0.88vw, 12.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-total {
  height: 24px;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-caption {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
}

/* Sade ve Estetik Mavi [ ??? ] Boşluk Doldurma Kutusu */
.interactive-sentence-box {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: clamp(10px, 1.4vh, 16px) clamp(14px, 1.8vw, 20px);
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.8;
  color: #0f172a;
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, 0.05);
  flex-shrink: 0;
  width: 100%;
}

.blank-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  height: 31px;
  padding: 0 12px;
  margin: 2px 4px;
  vertical-align: middle;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.22);
  transition: all 0.18s ease;
}

.blank-slot:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.blank-slot.filled-correct {
  background: var(--done-green);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
  cursor: default;
}

.blank-slot.filled-wrong {
  background: #ef4444;
  animation: shake 0.35s ease;
}

/* Sade Seçenek Barı */
.slot-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  align-items: center;
}

.slot-picker-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-right: 4px;
}

.slot-choice-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.slot-choice-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-1px);
}

/* ==========================================================================
   🎬 ANİMASYONLU SAHNE (Sade ve Odaklı)
   ========================================================================== */
.video-stage-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.32fr 0.88fr;
  gap: clamp(14px, 1.8vw, 24px);
  align-items: stretch;
}

.canvas-player {
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  border-radius: 18px;
  padding: clamp(14px, 1.8vh, 22px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  color: #ffffff;
  position: relative;
  border: 1px solid #334155;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.18);
  min-height: 0;
  overflow: hidden;
}

.video-canvas-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow-y: auto;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-video-play {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.32);
  transition: transform 0.15s ease;
}

.btn-video-play:hover {
  transform: translateY(-1px);
}

.video-progress-track {
  flex: 1;
  height: 7px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.video-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #22c55e);
  width: 0%;
  transition: width 0.25s linear;
}

.video-check-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: clamp(18px, 2.2vh, 26px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.06);
  min-height: 0;
  overflow-y: auto;
}

/* ==========================================================================
   🧩 SADE VE ESTETİK ETKİNLİK / OYUN SAHNESİ
   ========================================================================== */
.interactive-board {
  flex: 1;
  min-height: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: clamp(18px, 2.5vh, 32px) clamp(18px, 2.5vw, 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 26px -8px rgba(15, 23, 42, 0.05);
  overflow-y: auto;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}

.num-chip {
  min-width: 76px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 14px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  font-size: clamp(15px, 1.15vw, 17.5px);
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
  transition: all 0.18s ease;
  text-align: center;
}

.num-chip:hover:not(:disabled) {
  border-color: var(--active-blue);
  color: var(--active-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.num-chip.selected {
  background: #eff6ff;
  border-color: var(--active-blue);
  color: var(--active-blue);
}

.num-chip.correct {
  background: var(--done-green-soft);
  border-color: var(--done-green);
  color: var(--done-green);
}

.num-chip.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: shake 0.35s ease;
}

/* ==========================================================================
   ❓ SADE VE ESTETİK SORU & ÇÖZÜM KARTI
   ========================================================================== */
.question-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.2fr 0.85fr;
  gap: clamp(18px, 2.2vw, 30px);
  align-items: stretch;
}

.question-left-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.question-right-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

.option-btn {
  background: #ffffff;
  border: 1.5px solid #dbe3ee;
  border-radius: 14px;
  padding: 12px 16px;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(14px, 1.08vw, 16px);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.03);
  transition: all 0.18s ease;
  text-align: left;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--active-blue);
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.09);
}

.option-letter {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f1f5f9;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  flex-shrink: 0;
}

.option-btn.correct {
  background: var(--done-green-soft);
  border-color: var(--done-green);
  color: #14532d;
}
.option-btn.correct .option-letter {
  background: var(--done-green);
  color: #ffffff;
}

.option-btn.wrong {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}
.option-btn.wrong .option-letter {
  background: #ef4444;
  color: #ffffff;
}

.solution-box {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: clamp(13.5px, 1vw, 15px);
  line-height: 1.6;
  color: #14532d;
}

.solution-box h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #15803d;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   7. ALT KISIM: 30 DURAKLI YOL HARİTASI (Journey Road Bar)
   ========================================================================== */
.journey-bar {
  height: var(--road-h);
  background: #ffffff;
  border-top: 1.5px solid #cbd5e1;
  padding: 6px 14px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.04);
  user-select: none;
  flex-shrink: 0;
}

.journey-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  gap: 10px;
}

.journey-title-wrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.journey-summary {
  white-space: nowrap;
  flex-shrink: 0;
}

.journey-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.road-scroll-btn {
  width: 32px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  transition: all 0.18s ease;
}

.road-scroll-btn:hover {
  background: var(--active-blue);
  color: #ffffff;
  border-color: var(--active-blue);
  transform: scale(1.05);
}

.road-track-viewport {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 4px;
}

.road-track-viewport::-webkit-scrollbar {
  height: 4px;
}
.road-track-viewport::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.road-stops {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 100%;
  justify-content: space-between;
}

.road-stop-item {
  display: flex;
  align-items: center;
  flex: 1;
}

.road-stop-item:first-child {
  flex: 0 0 auto;
}

.road-connector {
  flex: 1;
  min-width: 16px;
  height: 5px;
  background: #fed7aa;
  border-radius: 2px;
  transition: background 0.25s ease;
}

.road-connector.done {
  background: var(--done-green-light);
}

.road-stop-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.stop-circle {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  transition: all 0.22s ease;
  position: relative;
}

.road-stop-btn.status-done .stop-circle {
  background: var(--done-green-light);
  color: #ffffff;
  border: 2px solid #15803d;
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.28);
}

.road-stop-btn.status-todo .stop-circle {
  background: #fff7ed;
  color: #ea580c;
  border: 2.5px solid var(--todo-orange);
}

.road-stop-btn.is-current .stop-circle {
  transform: scale(1.16);
  background: var(--todo-orange);
  color: #ffffff;
  border: 2.5px solid #9a3412;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.28);
}

.road-stop-btn.status-done.is-current .stop-circle {
  background: var(--done-green);
  border-color: #14532d;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
}

.stop-label {
  font-size: 9.5px;
  font-weight: 800;
  color: #64748b;
  white-space: nowrap;
}

.road-stop-btn.is-current .stop-label {
  color: var(--ink);
  font-weight: 900;
}

/* Uyarı Toast Mesajı */
.toast-msg {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 120;
  border: 1.5px solid #f97316;
  max-width: 92vw;
  text-align: center;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal (12 Ünite Kampüs Haritası & Hesaplama Tahtası) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: #ffffff;
  border-radius: 20px;
  width: 96%;
  max-width: 920px;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding: clamp(18px, 2.5vw, 28px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.32);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==========================================================================
   8. 12 LGS ÜNİTESİ KAMPÜS HARİTASI KARTLARI
   ========================================================================== */
.units-grid-modal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.unit-card-item {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.unit-card-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.unit-card-item.unit-done {
  border-color: var(--done-green);
  background: #f0fdf4;
}

.unit-card-item.unit-todo {
  border-color: #fdba74;
}

.unit-card-item.unit-active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
  border-color: var(--active-blue);
}

.unit-card-thumb {
  height: 84px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.unit-card-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,23,42,0.1), rgba(15,23,42,0.75));
}

.unit-card-no {
  position: absolute;
  top: 7px;
  left: 8px;
  z-index: 2;
  background: rgba(15, 23, 42, 0.84);
  color: #fdba74;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.unit-card-status {
  position: absolute;
  top: 7px;
  right: 8px;
  z-index: 2;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.unit-card-status.done { background: var(--done-green); color: #ffffff; }
.unit-card-status.todo { background: var(--todo-orange); color: #ffffff; }

.unit-card-body {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.unit-card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}

.unit-card-sub {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.35;
}

/* ==========================================================================
   9. TABLET, PC, MAC VE KISA EKRAN UYUMLULUK KURALLARI (RESPONSIVE)
   ========================================================================== */

/* Geniş Mac Retina / PC Monitörler (1600px+) */
@media (min-width: 1600px) {
  :root {
    --sidebar-w: 310px;
    --road-h: 108px;
  }
  .window-body {
    padding: 24px 74px;
  }
  .nav-arrow {
    width: 52px;
    height: 92px;
    border-radius: 18px;
  }
  .nav-arrow-svg {
    width: 26px;
    height: 26px;
  }
}

/* Kısa Dikiliğe Sahip Dizüstü / PC Ekranları (ör. 1366x768) */
@media (max-height: 800px) {
  :root {
    --topbar-h: 44px;
    --workspace-head-h: 36px;
    --road-h: 86px;
  }
  .sidebar-hero {
    height: 122px;
    padding: 10px 12px;
  }
  .kazanim-item {
    padding: 8px 12px;
  }
  .window-head {
    padding: 10px 24px;
  }
  .window-body {
    padding: 10px 54px;
    gap: 10px;
  }
  .window-foot {
    padding: 8px 24px;
  }
  .stop-circle {
    width: 28px;
    height: 28px;
    font-size: 11.5px;
  }
}

/* Tablet Yatay ve Küçük Ekranlar (<= 1080px: iPad Air / Pro / Mini) */
@media (max-width: 1080px) {
  :root {
    --sidebar-w: 242px;
    --topbar-h: 46px;
    --workspace-head-h: 36px;
    --road-h: 84px;
  }
  .brand-badge,
  .hide-on-small {
    display: none !important;
  }
  .window-body {
    padding: 10px 40px;
  }
  .nav-arrow {
    width: 36px;
    height: 64px;
  }
  .nav-arrow-prev { left: 8px; }
  .nav-arrow-next { right: 8px; }
}

/* Tablet dikey, küçük tablet ve yatay telefon (<= 950px): sol panel kayar çekmece olur.
   950px, iPhone 14 Pro Max yatay genişliğini (~932px) de kapsar. */
@media (max-width: 950px) {
  .app-shell,
  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 280px;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.45);
    transform: translateX(-100%);
    opacity: 1;
    pointer-events: auto;
    z-index: 100;
  }

  body.sidebar-drawer-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-drawer-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }

  /* 768px tablet dikey ekranda üst barda taşmayı önle */
  #navCoursesBtn,
  .top-pill.lgs-total-pill {
    display: none !important;
  }

  /* Dikey ekranda yüzen oklar yazıyı kapatmasın */
  .nav-arrow {
    display: none !important;
  }

  .content-split,
  .video-stage-wrap,
  .question-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .flow-visual-box img {
    max-height: 190px;
  }

  .window-body {
    padding: 10px 24px;
  }
}

/* ==========================================================================
   9.1 TELEFON DİKEY — SAYFA SAYFA, SIKI VE TAŞMASIZ
   Geniş ekran kurallarına dokunmaz. Yalnızca dar telefon genişliği.
   ========================================================================== */
@media (max-width: 520px) {
  :root {
    --topbar-h: 48px;
    --workspace-head-h: 40px;
    --road-h: 78px;
  }

  html, body {
    height: var(--app-height, 100dvh);
    overflow: hidden;
  }

  .topbar {
    height: calc(var(--topbar-h) + var(--safe-top));
    padding: var(--safe-top) max(10px, var(--safe-right)) 0 max(10px, var(--safe-left));
    gap: 8px;
    flex-wrap: nowrap;
  }

  .topbar-left,
  .topbar-right,
  .topnav,
  .brand,
  .unit-select-dropdown {
    min-width: 0;
  }

  .topbar-left {
    gap: 6px;
    flex-shrink: 0;
  }

  .sidebar-toggle-btn {
    height: 36px;
    width: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
  }

  .toggle-label,
  .brand-badge,
  #navCoursesBtn,
  #navPolypadBtn,
  .hide-on-small,
  .top-pill,
  .lgs-total-pill,
  #btnFullscreen,
  #btnToggleVoice,
  .nav-arrow,
  .crumb-kaz,
  .crumb-sep-kaz,
  .crumb-badge,
  .flow-visual-box,
  .stop-label {
    display: none !important;
  }

  .nartes-logo-mount {
    height: 32px;
  }

  .nartes-svg-logo {
    height: 28px;
    max-width: 112px;
    width: auto;
  }

  .topnav {
    flex: 1 1 auto;
    justify-content: stretch;
  }

  .unit-select-dropdown {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 36px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
  }

  .topbar-right {
    gap: 6px;
    flex-shrink: 0;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .app-shell,
  body.sidebar-collapsed .app-shell,
  .workspace {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: calc(var(--app-height, 100dvh) - var(--topbar-h) - var(--safe-top));
  }

  .sidebar {
    top: calc(var(--topbar-h) + var(--safe-top));
    width: min(300px, calc(100vw - 48px));
    padding-bottom: var(--safe-bottom);
  }

  .workspace-header {
    height: auto;
    min-height: var(--workspace-head-h);
    padding: 8px max(12px, var(--safe-right)) 4px max(12px, var(--safe-left));
    gap: 8px;
    align-items: center;
  }

  .step-crumb {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    padding: 4px 10px;
    gap: 6px;
    font-size: 13px;
  }

  .crumb-unit,
  .crumb-stop {
    font-size: 13px;
  }

  .crumb-badge {
    padding: 2px 8px;
    font-size: 12px;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .step-status-pill {
    padding: 4px 8px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .stage-viewport,
  .window-card,
  .window-head,
  .window-body,
  .window-foot,
  .journey-bar,
  .lead-text,
  .interactive-sentence-box,
  .question-left-col,
  .question-right-col,
  .canvas-player,
  .video-check-panel,
  .interactive-board {
    min-width: 0;
    max-width: 100%;
  }

  .stage-viewport {
    padding: 4px 8px 6px;
  }

  .window-card {
    border-radius: 16px;
  }

  .window-head {
    padding: 14px 14px 8px;
  }

  .window-title-wrap h1 {
    font-size: 20px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .window-subtitle {
    font-size: 14px;
    line-height: 1.4;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .window-body {
    padding: 8px 14px 12px;
    gap: 14px;
    justify-content: flex-start !important;
    overflow-x: auto;
    overflow-y: auto;
  }

  .window-body > * {
    flex: 0 0 auto;
    min-height: min-content;
    width: 100%;
    max-width: 100%;
  }

  .content-split,
  .video-stage-wrap,
  .question-layout,
  .factor-bars-demo {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: min-content !important;
  }

  .content-split > *,
  .video-stage-wrap > *,
  .question-layout > * {
    flex: 0 0 auto;
    min-height: min-content;
    width: 100%;
    max-width: 100%;
  }

  .lead-text {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible;
    font-size: 16px;
    line-height: 1.55;
  }

  .lead-text p {
    display: block;
    margin: 0 0 12px;
    line-height: 1.55;
  }

  .lead-text p:last-child {
    margin-bottom: 0;
  }

  .interactive-sentence-box,
  .option-btn,
  .window-title-wrap h1,
  .foot-feedback,
  .bar-caption,
  .lead-text {
    overflow-wrap: break-word;
  }

  .bar-card,
  .interactive-sentence-box,
  .canvas-player,
  .video-check-panel,
  .interactive-board,
  .solution-box {
    width: 100%;
    box-sizing: border-box;
  }

  .bar-row {
    min-width: 0;
  }

  .bar-seg {
    height: 28px;
    font-size: 13px;
  }

  .bar-total {
    height: 26px;
    font-size: 13px;
  }

  .bar-caption {
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
  }

  .interactive-sentence-box {
    padding: 12px 14px;
    font-size: 16px;
    line-height: 1.7;
  }

  .blank-slot {
    min-width: 64px;
    height: 36px;
    font-size: 15px;
  }

  .slot-choice-btn,
  .option-btn,
  .num-chip,
  .btn-video-play {
    min-height: 44px;
    font-size: 15px;
    touch-action: manipulation;
  }

  .options-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .option-btn {
    padding: 10px 12px;
  }

  .video-canvas-area,
  .canvas-player,
  .interactive-board {
    overflow-x: auto;
  }

  .canvas-player,
  .video-canvas-area {
    height: auto;
    min-height: 0;
    overflow: visible;
    flex: 0 0 auto;
  }

  .window-foot {
    padding: 10px 12px calc(10px + var(--safe-bottom));
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .foot-feedback {
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  .foot-actions {
    width: 100%;
    gap: 8px;
  }

  .btn-secondary-prev,
  .btn-primary-next {
    min-height: 44px;
    height: auto;
    white-space: normal;
    font-size: 15px;
    padding: 8px 12px;
  }

  .btn-secondary-prev {
    flex: 0 1 38%;
    max-width: none;
  }

  .btn-primary-next {
    flex: 1 1 auto;
  }

  .journey-bar {
    height: calc(var(--road-h) + var(--safe-bottom));
    padding: 6px max(8px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(8px, var(--safe-left));
  }

  .journey-top-meta {
    font-size: 12px;
    gap: 8px;
  }

  .journey-title-wrap {
    max-width: 58%;
  }

  .journey-summary {
    font-size: 12px;
  }

  .road-scroll-btn {
    width: 32px;
    height: 36px;
  }

  .stop-circle {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .road-connector {
    min-width: 8px;
  }

  .toast-msg {
    bottom: calc(var(--road-h) + var(--safe-bottom) + 12px);
    max-width: calc(100vw - 24px);
  }

  .auth-gate-overlay {
    overflow-y: auto;
    padding:
      max(16px, var(--safe-top))
      max(16px, var(--safe-right))
      max(16px, var(--safe-bottom))
      max(16px, var(--safe-left));
  }

  .auth-gate-card {
    padding: 22px 16px;
  }

  .auth-gate-title {
    font-size: 18px;
  }
}

/* Telefon yan tutulursa kilit yok; yalnızca taşma olmasın. */
@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  html, body,
  .app-shell,
  .workspace,
  .window-card,
  .window-body,
  .topbar,
  .journey-bar {
    max-width: 100%;
    min-width: 0;
  }

  .topbar,
  .workspace-header,
  .window-head,
  .window-body,
  .window-foot,
  .journey-bar {
    padding-left: max(10px, var(--safe-left));
    padding-right: max(10px, var(--safe-right));
  }

  .lead-text,
  .interactive-sentence-box,
  .option-btn,
  .foot-feedback,
  .window-title-wrap h1 {
    overflow-wrap: anywhere;
  }

  .topnav,
  .unit-select-dropdown,
  .step-crumb,
  .crumb-kaz,
  .journey-title-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .step-crumb {
    overflow: hidden;
  }

  .window-body,
  .video-canvas-area,
  .interactive-board {
    overflow-x: auto;
  }
}

/* ==========================================================================
   10. KATEX MATEMATİKSEL İFADE DİZGİ UYUMU
   ========================================================================== */
.katex {
  font-size: 1.07em !important;
  line-height: 1.25;
  white-space: nowrap;
  text-indent: 0;
}

.katex,
.katex * {
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.katex .katex-mathml {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  width: 1px !important;
  overflow: hidden !important;
  border: 0 !important;
  padding: 0 !important;
}

.video-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 92px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1.5px dashed rgba(253, 224, 71, 0.85);
  background: rgba(15, 23, 42, 0.55);
  color: #fde047;
  text-align: center;
}

.video-slot-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f97316;
  color: #ffffff;
  font-size: 14px;
  flex-shrink: 0;
}

.video-slot-label {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.1px;
}

.option-btn .katex,
.num-chip .katex,
.slot-choice-btn .katex,
.blank-slot .katex {
  font-size: 1.05em !important;
}

/* ==========================================================================
   11. NARTES+ ÖZEL ŞİFRELİ GİRİŞ EKRANI (PRIVATE ACCESS GATE)
   ========================================================================== */
body.auth-locked .topbar,
body.auth-locked .app-shell,
body.auth-locked .modal-backdrop {
  display: none !important;
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, #1e293b 0%, #0f172a 55%, #020617 100%);
}

body:not(.auth-locked) .auth-gate-overlay {
  display: none !important;
}

.auth-gate-card {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-gate-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.auth-logo-img {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.auth-gate-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  color: #fde047;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.auth-gate-title {
  font-size: 21px;
  font-weight: 900;
  color: #f8fafc;
  margin-bottom: 8px;
}

.auth-gate-desc {
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 22px;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-password-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15.5px;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.9);
  border: 1.8px solid rgba(148, 163, 184, 0.32);
  border-radius: 13px;
  outline: none;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-password-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.auth-error-msg {
  font-size: 13px;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 8px 12px;
  border-radius: 10px;
}

.auth-submit-btn {
  width: 100%;
  padding: 13.5px 18px;
  border: none;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #16a34a 0%, #059669 100%);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(22, 163, 74, 0.48);
}
