/* ==========================================================================
   NAHWU SPATIAL OS - UNIFIED DESIGN SYSTEM (PURE VANILLA CSS)
   Mempertahankan desain asli Modul 1 - Modul 4 secara utuh
   ========================================================================== */
:root {
  /* Core Palette */
  --bg-base: #1e293b;          /* Deep Slate Blue */
  --bg-surface: #0f172a;       /* Darker / Abyssal Slate */
  --bg-card: #334155;          /* Elevated Slate */
  --bg-card-hover: #475569;
  --bg-glass: rgba(15, 23, 42, 0.85);

  --nav-teal: #06b6d4;         /* Teal - Komponen Navigasi */
  --zone-teal: #06b6d4;        /* Alias Modul 2 */
  --nav-teal-glow: rgba(6, 182, 212, 0.25);
  --zone-teal-glow: rgba(6, 182, 212, 0.28);
  --prog-mint: #10b981;        /* Mint - Indikator Progres */
  --accent-coral: #f43f5e;     /* Neon Coral - Aksen Interaktif/Anomali */
  --accent-amber: #f59e0b;     /* Amber - Jazm / Warning */

  /* Color-Coded Syntax Layer (I'rab Status) */
  --irab-rafa: #10b981;        /* Emerald Green */
  --irab-rafa-bg: rgba(16, 185, 129, 0.16);
  --irab-rafa-glow: rgba(16, 185, 129, 0.25);
  --irab-nasab: #06b6d4;       /* Cyan Blue */
  --irab-nasab-bg: rgba(6, 182, 212, 0.16);
  --irab-nasab-glow: rgba(14, 165, 233, 0.25);
  --irab-jarr: #a855f7;        /* Amethyst Purple */
  --irab-jarr-bg: rgba(168, 85, 247, 0.16);
  --irab-jarr-glow: rgba(168, 85, 247, 0.25);
  --irab-jazm: #f59e0b;        /* Amber Orange */
  --irab-jazm-bg: rgba(245, 158, 11, 0.16);
  --irab-jazm-glow: rgba(245, 158, 11, 0.25);
  --irab-mabni: #ec4899;       /* Rose Pink (Mabni / Non-inflected) */
  --irab-mabni-bg: rgba(236, 72, 153, 0.16);

  /* X-Ray Layer Colors */
  --xray-stem: #38bdf8;        /* Layer 1: Word Root / Stem */
  --xray-lafzhi: #10b981;      /* Layer 2: Declinable Inflection Mark */
  --xray-taqdiri: #c084fc;     /* Layer 3: Taqdiriyyah / Mahalliyyah */

  /* Typography & Borders */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(6, 182, 212, 0.6);

  /* Font Stacks */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-arabic: 'Traditional Arabic', 'Scheherazade New', 'Amiri', 'Geeza Pro', 'Arial', sans-serif;

  /* Fluid Spacing & Layout */
  --radius-sm: 0.5rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.25rem;
  --bottom-nav-h: 4.5rem;
  --sidebar-w: 17.75rem;
  --quiz-progress: 0%;
  --transition-fast: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET & BASE STYLES (MOBILE-FIRST, ZERO OVERFLOW)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav-h) + 1.5rem);
  display: flex;
  flex-direction: column;
}

/* High-Legibility Arabic Typography (Anti-Collision Harakat) */
.ar-text {
  font-family: var(--font-arabic);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 2.4;
  letter-spacing: 0;
  font-weight: 700;
  display: inline-block;
  word-break: keep-all;
}

.ar-display {
  font-size: clamp(2.35rem, 6vw, 3.85rem);
  line-height: 2.55;
}

.ar-xl {
  font-size: clamp(1.85rem, 4.5vw, 2.8rem);
  line-height: 2.5;
}

.ar-lg {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 2.4;
}

.ar-md {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 2.3;
}

/* ==========================================================================
   APP SHELL & CATEGORIZED NAVIGATION HUB (BOTTOM BAR -> LEFT SIDEBAR)
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 2400px;
  margin: 0 auto;
  flex: 1;
}

.nav-hub {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border-top: 2px solid var(--nav-teal);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 0.35rem;
}

.nav-brand, .nav-footer, .nav-category-title, .nav-sub-desc {
  display: none;
}

.nav-scroll-area {
  width: 100%;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-scroll-area::-webkit-scrollbar {
  display: none;
}

.nav-category-group {
  display: contents;
}

.nav-links {
  display: flex;
  width: 100%;
  justify-content: space-around;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
}

.nav-item {
  flex: 1 0 auto;
  min-width: 60px;
  display: flex;
  justify-content: center;
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.38rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  width: 100%;
  position: relative;
  text-align: center;
}

.nav-link:hover, .nav-link:focus-visible {
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.14);
}

.nav-link.active {
  color: var(--nav-teal);
  background: var(--nav-teal-glow);
  font-weight: 700;
}

.nav-icon {
  font-size: 1.2rem;
  margin-bottom: 0.12rem;
  line-height: 1;
}

.nav-label-full {
  display: none;
}

.nav-label-short {
  font-size: clamp(0.58rem, 1.8vw, 0.74rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-badge {
  position: absolute;
  top: 0.12rem;
  right: 8%;
  background: var(--accent-coral);
  color: #fff;
  font-size: 0.54rem;
  font-weight: 800;
  padding: 0.04rem 0.32rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.nav-badge.badge-new {
  background: var(--prog-mint);
  color: #052e16;
}

/* Mobile Category Quick-Bar (Tampil di <1024px untuk kejelasan kategori) */
.mobile-category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  align-items: center;
}

.mobile-cat-pill {
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  transition: var(--transition-fast);
}

.mobile-cat-pill.active {
  background: var(--nav-teal-glow);
  border-color: var(--nav-teal);
  color: var(--nav-teal);
}

/* ==========================================================================
   MAIN WORKSPACE & TOP HEADER
   ========================================================================== */
.workspace {
  flex: 1;
  padding: clamp(0.85rem, 2.4vw, 1.9rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.2vw, 1.55rem);
  width: 100%;
}

.top-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--nav-teal);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 2.2vw, 1.45rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.header-title-group h1,
.header-title h1 {
  font-size: clamp(1.12rem, 2.4vw, 1.6rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-title-group p,
.header-title p {
  font-size: clamp(0.78rem, 1.5vw, 0.94rem);
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.Coral-pill {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-coral);
  color: #fda4af;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-coral);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-coral);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* Shared Semantic I'rab Legend Pills */
.syntax-legend, .state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.legend-chip, .legend-pill, .state-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.legend-dot, .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-rafa, .pill-rafa { background: var(--irab-rafa-bg); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.5); }
.chip-nasab, .pill-nasab { background: var(--irab-nasab-bg); color: #67e8f9; border-color: rgba(6, 182, 212, 0.5); }
.chip-jarr, .pill-jarr { background: var(--irab-jarr-bg); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.5); }
.chip-jazm, .pill-jazm { background: var(--irab-jazm-bg); color: #fcd34d; border-color: rgba(245, 158, 11, 0.5); }
.chip-mabni, .pill-mabni { background: var(--irab-mabni-bg); color: #f9a8d4; border-color: rgba(236, 72, 153, 0.5); }

/* ==========================================================================
   MODUL 1: TOPOLOGY MAP & BLOOM TRACKER
   ========================================================================== */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: clamp(0.8rem, 1.4vw, 0.92rem);
}

.crumb-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: inherit;
  font-weight: 600;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crumb-btn:hover { border-color: var(--nav-teal); color: var(--nav-teal); }
.crumb-btn.active-crumb { background: var(--nav-teal-glow); border-color: var(--nav-teal); color: var(--nav-teal); cursor: default; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  align-items: start;
}

.map-stage {
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.75rem);
  position: relative;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
}

.zoom-viewport {
  width: 100%;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.32s ease;
  transform-origin: center center;
}
.zoom-viewport.zoom-out-fade { transform: scale(1.12); opacity: 0; pointer-events: none; }
.zoom-viewport.zoom-in-ready { transform: scale(0.92); opacity: 0; }

.kalimah-hub {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(30, 41, 59, 0.75);
  border: 1px dashed var(--nav-teal);
  border-radius: var(--radius-md);
}

.kalimah-hub-title {
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  color: var(--nav-teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.topology-continents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  width: 100%;
}

.continent-node {
  background: rgba(51, 65, 85, 0.65);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--nav-teal);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.continent-node:hover, .continent-node:focus-visible {
  transform: translateY(-4px);
  background: rgba(71, 85, 105, 0.78);
  border-color: var(--nav-teal);
  box-shadow: 0 12px 28px -8px rgba(6, 182, 212, 0.25);
}

.node-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.node-code {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.6);
  color: var(--nav-teal);
  border: 1px solid rgba(6, 182, 212, 0.3);
  display: inline-block;
}
.node-title-id { font-size: clamp(1.05rem, 1.8vw, 1.25rem); font-weight: 800; color: var(--text-primary); margin-top: 0.25rem; }
.node-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.55; }
.node-syntax-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.node-action-hint { display: flex; align-items: center; justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); font-size: 0.78rem; font-weight: 700; color: var(--accent-coral); }

.zoomed-continent-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--nav-teal);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.back-map-btn {
  background: var(--accent-coral);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.back-map-btn:hover { filter: brightness(1.12); transform: translateX(-2px); }

.subnode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 1rem;
}

.subnode-card {
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid var(--border-subtle);
  border-left: 5px solid var(--nav-teal);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}
.subnode-card:hover { transform: translateY(-3px); background: rgba(51, 65, 85, 0.9); }

.syntax-rafa { border-left-color: var(--irab-rafa) !important; border-top-color: var(--irab-rafa) !important; }
.syntax-nasab { border-left-color: var(--irab-nasab) !important; border-top-color: var(--irab-nasab) !important; }
.syntax-jarr { border-left-color: var(--irab-jarr) !important; border-top-color: var(--irab-jarr) !important; }
.syntax-jazm { border-left-color: var(--irab-jazm) !important; border-top-color: var(--irab-jazm) !important; }
.syntax-mabni { border-left-color: var(--irab-mabni) !important; border-top-color: var(--irab-mabni) !important; }

.leaf-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.leaf-pill { font-size: 0.73rem; background: rgba(15, 23, 42, 0.75); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 0.2rem 0.55rem; border-radius: var(--radius-sm); }

.node-inspector {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.inspector-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.75rem; }
.example-box { background: rgba(30, 41, 59, 0.7); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; }

.study-btn {
  background: var(--prog-mint);
  color: #052e16;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.study-btn:hover { filter: brightness(1.1); }

.tracker-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.85rem; }
.panel-header h2 { font-size: clamp(1rem, 1.8vw, 1.2rem); font-weight: 800; color: var(--text-primary); }

.mastery-overview { display: flex; align-items: center; gap: 1.15rem; background: rgba(30, 41, 59, 0.6); padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); flex-wrap: wrap; }
.radial-gauge {
  --percentage: 68;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: conic-gradient(var(--prog-mint) calc(var(--percentage) * 1%), rgba(255, 255, 255, 0.08) 0);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.radial-gauge::before { content: ""; position: absolute; inset: 9px; background: var(--bg-surface); border-radius: 50%; }
.radial-value { position: relative; font-size: 1.1rem; font-weight: 800; color: var(--prog-mint); }
.mastery-meta { flex: 1; min-width: 150px; }
.mastery-meta h3 { font-size: 0.95rem; color: var(--text-primary); margin-bottom: 0.2rem; }
.mastery-meta p { font-size: 0.78rem; color: var(--text-secondary); }

.proficiency-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.tier-card { background: rgba(30, 41, 59, 0.55); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.65rem 0.5rem; text-align: center; cursor: pointer; transition: var(--transition-smooth); color: var(--text-primary); }
.tier-card:hover { border-color: var(--prog-mint); }
.tier-card.active-tier { background: rgba(16, 185, 129, 0.14); border-color: var(--prog-mint); }
.tier-name { font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); display: block; }
.tier-pct { font-size: 0.95rem; font-weight: 800; color: var(--prog-mint); margin-top: 0.15rem; display: block; }

.bloom-list { display: flex; flex-direction: column; gap: 0.75rem; }
.bloom-item { display: flex; flex-direction: column; gap: 0.3rem; }
.bloom-label-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; }
.bloom-code { font-weight: 800; color: var(--nav-teal); margin-right: 0.35rem; }
.bloom-name { color: var(--text-primary); font-weight: 600; }
.bloom-pct { font-weight: 700; color: var(--prog-mint); }
.progress-track { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--nav-teal), var(--prog-mint)); border-radius: 999px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

/* ==========================================================================
   MODUL 2: AL-'AMIL ENGINE & X-RAY I'RAB VIEWER
   ========================================================================== */
.target-selector-bar { background: rgba(15, 23, 42, 0.7); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.85rem 1.1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.selector-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--zone-teal); }
.target-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; justify-content: flex-end; }
.target-tab { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: var(--transition-fast); display: inline-flex; align-items: center; gap: 0.45rem; }
.target-tab:hover { border-color: var(--zone-teal); color: var(--text-primary); }
.target-tab.active-tab { background: var(--zone-teal-glow); border-color: var(--zone-teal); color: var(--text-primary); }

.studio-grid { display: grid; grid-template-columns: 1fr; gap: clamp(1rem, 2.2vw, 1.5rem); align-items: stretch; }
.amil-dock { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2vw, 1.4rem); display: flex; flex-direction: column; gap: 1rem; }
.dock-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.65rem; }
.dock-header h2 { font-size: 0.98rem; font-weight: 800; color: var(--zone-teal); }
.dock-hint { font-size: 0.74rem; color: var(--text-muted); }

.particles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 0.75rem; }
.amil-particle { background: rgba(51, 65, 85, 0.75); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.75rem; cursor: grab; user-select: none; transition: var(--transition-fast); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.25rem; }
.amil-particle:active { cursor: grabbing; transform: scale(0.96); }
.amil-particle:hover, .amil-particle:focus-visible { transform: translateY(-3px); background: rgba(71, 85, 105, 0.9); }
.amil-particle.particle-jarr { border-top: 4px solid var(--irab-jarr); }
.amil-particle.particle-nasab { border-top: 4px solid var(--irab-nasab); }
.amil-particle.particle-jazm { border-top: 4px solid var(--irab-jazm); }
.amil-particle.particle-rafa { border-top: 4px solid var(--irab-rafa); }
.amil-particle.selected-particle { box-shadow: 0 0 0 2px var(--zone-teal), 0 8px 20px rgba(6, 182, 212, 0.35); background: rgba(6, 182, 212, 0.16); }
.amil-particle.disabled-particle { opacity: 0.35; cursor: not-allowed; filter: grayscale(0.6); }
.particle-type-tag { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.12rem 0.45rem; border-radius: 999px; background: rgba(15, 23, 42, 0.7); }

.reaction-workbench { background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 100%); border: 1.5px solid var(--zone-teal); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.75rem); display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem; position: relative; overflow: hidden; }
.workbench-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.status-banner { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 700; padding: 0.35rem 0.85rem; border-radius: 999px; background: var(--irab-rafa-glow); border: 1px solid var(--irab-rafa); color: #6ee7b7; transition: var(--transition-smooth); }
.reset-btn { background: rgba(244, 63, 94, 0.16); color: #fda4af; border: 1px solid var(--accent-coral); padding: 0.4rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: var(--transition-fast); }
.reset-btn:hover { background: var(--accent-coral); color: #fff; }

.syntactic-stage { direction: rtl; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: clamp(0.75rem, 2.5vw, 1.5rem); padding: clamp(1.25rem, 3vw, 2.25rem) 1rem; background: rgba(15, 23, 42, 0.65); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.amil-dropzone { min-width: clamp(120px, 22vw, 175px); min-height: 112px; border: 2px dashed var(--zone-teal); border-radius: var(--radius-md); background: rgba(6, 182, 212, 0.07); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.75rem 1rem; transition: var(--transition-smooth); text-align: center; }
.amil-dropzone.drag-over { background: rgba(6, 182, 212, 0.25); transform: scale(1.05); box-shadow: 0 0 25px var(--zone-teal); }
.amil-dropzone.occupied { border-style: solid; background: rgba(15, 23, 42, 0.9); }

.energy-conduit { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; }
.conduit-beam { width: 64px; height: 6px; background: rgba(255, 255, 255, 0.12); border-radius: 999px; position: relative; overflow: hidden; }
.conduit-beam::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--active-energy-color, var(--zone-teal)), transparent); transform: translateX(100%); }
.energy-conduit.firing .conduit-beam::after { animation: energyTransferRTL 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes energyTransferRTL { 0% { transform: translateX(100%); } 50% { transform: translateX(0%); box-shadow: 0 0 16px var(--active-energy-color, var(--zone-teal)); } 100% { transform: translateX(-100%); } }
.conduit-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.35rem; direction: ltr; font-weight: 700; text-transform: uppercase; }

.mamul-card { background: rgba(30, 41, 59, 0.92); border: 2px solid var(--irab-rafa); border-radius: var(--radius-md); padding: 0.85rem 1.35rem; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: var(--transition-smooth); cursor: pointer; }
.mamul-card.energy-hit { animation: mamulShockwave 0.6s ease-out; }
@keyframes mamulShockwave { 0% { transform: scale(1); } 35% { transform: scale(1.09); box-shadow: 0 0 32px var(--active-energy-color, var(--zone-teal)); } 100% { transform: scale(1); } }
.word-anatomy { display: inline-flex; align-items: baseline; direction: rtl; padding: 0.15rem 0.35rem; border-radius: var(--radius-sm); }
.stem-part { color: var(--text-primary); transition: color 0.3s ease; }
.harakat-part { color: var(--irab-rafa); padding: 0 0.12rem; border-radius: 0.35rem; transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1); display: inline-block; }
.harakat-part.morphing { transform: scale(1.45) translateY(-4px); background: rgba(255, 255, 255, 0.14); }
.mamul-caption { direction: ltr; font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; display: flex; align-items: center; gap: 0.4rem; }

.xray-triggers { direction: ltr; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.xray-chip-btn { background: rgba(15, 23, 42, 0.8); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: var(--transition-fast); display: inline-flex; align-items: center; gap: 0.35rem; }
.xray-chip-btn:hover, .xray-chip-btn.active-xray { border-color: var(--zone-teal); color: var(--text-primary); background: var(--zone-teal-glow); }

.xray-panel { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2.2vw, 1.5rem); display: flex; flex-direction: column; gap: 1.15rem; }
.xray-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.85rem; }
.xray-title-group { display: flex; align-items: center; gap: 0.65rem; }
.xray-badge { background: rgba(6, 182, 212, 0.18); border: 1px solid var(--zone-teal); color: var(--zone-teal); font-size: 0.7rem; font-weight: 800; padding: 0.2rem 0.55rem; border-radius: var(--radius-sm); letter-spacing: 0.06em; }
.xray-layers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
.xray-layer-card { background: rgba(30, 41, 59, 0.72); border: 1px solid var(--border-subtle); border-top: 4px solid var(--zone-teal); border-radius: var(--radius-md); padding: 1.1rem; display: flex; flex-direction: column; justify-content: space-between; gap: 0.75rem; transition: var(--transition-smooth); }
.xray-layer-card.layer-stem { border-top-color: var(--xray-stem); }
.xray-layer-card.layer-lafzhi { border-top-color: var(--xray-lafzhi); }
.xray-layer-card.layer-taqdiri { border-top-color: var(--xray-taqdiri); }
.xray-layer-card.expanded-focus { transform: translateY(-4px); background: rgba(51, 65, 85, 0.88); box-shadow: 0 12px 28px -8px rgba(6, 182, 212, 0.3); }
.layer-tag { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }
.layer-title { font-size: 1rem; font-weight: 800; color: var(--text-primary); margin-top: 0.15rem; }
.layer-arabic-box { background: rgba(15, 23, 42, 0.75); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; text-align: center; }
.layer-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55; }
.irab-formula-bar { background: rgba(30, 41, 59, 0.9); border-left: 4px solid var(--zone-teal); border-radius: var(--radius-sm); padding: 0.85rem 1.1rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }

/* ==========================================================================
   MODUL 3: QUIZ MASTERY (BLOOM C1-C6)
   ========================================================================== */
.tier-selector-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 0.85rem; }
.tier-card-btn { background: var(--bg-surface); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem 1.15rem; text-align: left; cursor: pointer; transition: var(--transition-smooth); display: flex; flex-direction: column; justify-content: space-between; gap: 0.5rem; color: var(--text-primary); }
.tier-card-btn:hover { border-color: var(--nav-teal); transform: translateY(-2px); }
.tier-card-btn.active-tier { background: rgba(6, 182, 212, 0.14); border-color: var(--nav-teal); box-shadow: 0 8px 24px -8px rgba(6, 182, 212, 0.35); }
.tier-top-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.tier-badge { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(15, 23, 42, 0.8); color: var(--nav-teal); border: 1px solid var(--nav-teal); }
.tier-title { font-size: 1.02rem; font-weight: 800; }
.tier-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; }

.bloom-stepper { display: flex; flex-wrap: wrap; gap: 0.5rem; background: rgba(15, 23, 42, 0.65); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.75rem 1rem; align-items: center; justify-content: space-between; }
.bloom-pills-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.bloom-step-btn { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-subtle); padding: 0.38rem 0.75rem; border-radius: var(--radius-sm); font-size: 0.76rem; font-weight: 700; cursor: pointer; transition: var(--transition-smooth); display: inline-flex; align-items: center; gap: 0.35rem; }
.bloom-step-btn:hover { border-color: var(--nav-teal); color: var(--text-primary); }
.bloom-step-btn.current-q { background: var(--nav-teal); color: #042f2e; border-color: var(--nav-teal); font-weight: 800; }
.bloom-step-btn.solved-q { border-color: var(--prog-mint); color: #6ee7b7; background: rgba(16, 185, 129, 0.14); }

.exam-layout-grid { display: grid; grid-template-columns: 1fr; gap: clamp(1rem, 2.2vw, 1.5rem); align-items: start; }
.question-stage { background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.75rem); display: flex; flex-direction: column; gap: 1.25rem; }
.q-meta-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.85rem; }
.q-bloom-tag { background: var(--nav-teal-glow); border: 1px solid var(--nav-teal); color: #67e8f9; font-size: 0.74rem; font-weight: 800; padding: 0.25rem 0.7rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.q-mechanic-tag { font-size: 0.76rem; color: var(--text-muted); font-weight: 700; }
.q-prompt-title { font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 800; color: var(--text-primary); line-height: 1.5; }

.sentence-showcase { background: rgba(15, 23, 42, 0.75); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1.25rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.fragments-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0.85rem; }
.fragment-card { background: rgba(51, 65, 85, 0.65); border: 2px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem; cursor: pointer; transition: var(--transition-smooth); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem; color: var(--text-primary); }
.fragment-card:hover { transform: translateY(-3px); border-color: var(--nav-teal); background: rgba(71, 85, 105, 0.8); }
.fragment-card.frag-rafa { border-top: 4px solid var(--irab-rafa); }
.fragment-card.frag-nasab { border-top: 4px solid var(--irab-nasab); }
.fragment-card.frag-jarr { border-top: 4px solid var(--irab-jarr); }
.fragment-card.frag-jazm { border-top: 4px solid var(--irab-jazm); }
.fragment-card.frag-mabni { border-top: 4px solid var(--irab-mabni); }
.fragment-card.correct-choice { border-color: var(--prog-mint) !important; background: rgba(16, 185, 129, 0.2); box-shadow: 0 0 20px rgba(16, 185, 129, 0.35); }
.fragment-card.wrong-choice { border-color: var(--accent-coral) !important; background: rgba(244, 63, 94, 0.2); }

.dnd-workspace { display: flex; flex-direction: column; gap: 1.15rem; }
.tags-palette { background: rgba(15, 23, 42, 0.78); border: 1px dashed var(--nav-teal); border-radius: var(--radius-md); padding: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: center; }
.irab-draggable-tag { background: var(--bg-card); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.45rem 0.85rem; font-size: 0.8rem; font-weight: 700; cursor: grab; user-select: none; transition: var(--transition-smooth); display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-primary); }
.irab-draggable-tag:hover { transform: translateY(-2px); border-color: var(--nav-teal); }
.irab-draggable-tag.selected-tag { box-shadow: 0 0 0 2px var(--nav-teal), 0 6px 16px rgba(6, 182, 212, 0.4); background: var(--nav-teal-glow); }
.tag-rafa { border-left: 4px solid var(--irab-rafa); }
.tag-nasab { border-left: 4px solid var(--irab-nasab); }
.tag-jarr { border-left: 4px solid var(--irab-jarr); }
.tag-jazm { border-left: 4px solid var(--irab-jazm); }

.rtl-sentence-slots { direction: rtl; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.85rem; padding: 1.15rem; background: rgba(15, 23, 42, 0.65); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.word-slot-card { background: rgba(30, 41, 59, 0.92); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.75rem 1rem; min-width: clamp(120px, 22vw, 165px); display: flex; flex-direction: column; align-items: center; gap: 0.55rem; }
.slot-drop-target { direction: ltr; width: 100%; min-height: 40px; border: 1.5px dashed var(--nav-teal); border-radius: var(--radius-sm); background: rgba(6, 182, 212, 0.08); display: flex; align-items: center; justify-content: center; padding: 0.35rem 0.5rem; font-size: 0.74rem; font-weight: 700; color: var(--text-secondary); text-align: center; cursor: pointer; transition: var(--transition-smooth); }
.slot-drop-target.drag-over { background: var(--nav-teal-glow); transform: scale(1.04); }
.slot-drop-target.filled { border-style: solid; background: rgba(51, 65, 85, 0.9); color: var(--text-primary); }
.verify-dnd-btn { align-self: center; background: var(--nav-teal); color: #042f2e; border: none; padding: 0.65rem 1.5rem; border-radius: var(--radius-sm); font-weight: 800; font-size: 0.88rem; cursor: pointer; transition: var(--transition-smooth); }
.verify-dnd-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

.debug-canvas { background: rgba(15, 23, 42, 0.82); border: 1.5px solid rgba(244, 63, 94, 0.45); border-radius: var(--radius-md); padding: 1.35rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.debug-instruction { font-size: 0.8rem; color: #fda4af; font-weight: 700; display: inline-flex; align-items: center; gap: 0.4rem; }
.debug-words-row { direction: rtl; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.debug-word-token { background: rgba(51, 65, 85, 0.75); border: 2px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.5rem 1.1rem; cursor: pointer; transition: var(--transition-smooth); display: flex; flex-direction: column; align-items: center; color: var(--text-primary); }
.debug-word-token:hover { border-color: var(--accent-coral); transform: translateY(-3px); background: rgba(244, 63, 94, 0.15); }
.debug-word-token.repaired-token { border-color: var(--prog-mint) !important; background: rgba(16, 185, 129, 0.22); box-shadow: 0 0 20px rgba(16, 185, 129, 0.35); }
.debug-word-token.safe-clicked { border-color: var(--accent-amber); background: rgba(245, 158, 11, 0.15); }

.repair-modal-backdrop, .parsing-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.86); backdrop-filter: blur(8px); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 1rem; }
.repair-modal-backdrop.open, .parsing-modal-backdrop.open { display: flex; }
.repair-modal-box, .parsing-modal-box { background: var(--bg-surface); border: 1.5px solid var(--nav-teal); border-radius: var(--radius-lg); max-width: 600px; width: 100%; padding: clamp(1.1rem, 2.5vw, 1.65rem); display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.75rem; }
.close-modal-btn { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); border-radius: var(--radius-sm); padding: 0.3rem 0.65rem; cursor: pointer; font-weight: 700; }
.repair-options-list, .arguments-list { display: flex; flex-direction: column; gap: 0.65rem; }
.repair-option-btn, .argument-option-btn { background: rgba(51, 65, 85, 0.72); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.85rem 1rem; cursor: pointer; transition: var(--transition-smooth); display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--text-primary); text-align: left; }
.repair-option-btn:hover, .argument-option-btn:hover { border-color: var(--nav-teal); background: rgba(6, 182, 212, 0.15); }

.remedial-drawer { background: rgba(15, 23, 42, 0.9); border-left: 4px solid var(--nav-teal); border-radius: var(--radius-md); padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.remedial-drawer.remedial-success { border-left-color: var(--prog-mint); background: rgba(16, 185, 129, 0.1); }
.remedial-drawer.remedial-error { border-left-color: var(--accent-coral); background: rgba(244, 63, 94, 0.1); }
.stage-footer-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border-subtle); }

.action-btn { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-subtle); padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: var(--transition-smooth); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.action-btn:hover { border-color: var(--nav-teal); color: var(--nav-teal); }
.action-btn.primary-next { background: var(--prog-mint); color: #052e16; border-color: var(--prog-mint); font-weight: 800; }

.analytics-panel { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2.2vw, 1.5rem); display: flex; flex-direction: column; gap: 1.15rem; }
.score-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.kpi-box { background: rgba(30, 41, 59, 0.7); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.85rem; text-align: center; }
.kpi-val { font-size: 1.45rem; font-weight: 800; color: var(--nav-teal); display: block; }
.kpi-lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.css-progress-wrapper { display: flex; flex-direction: column; gap: 0.4rem; }
.css-progress-track { width: 100%; height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.css-progress-fill { height: 100%; width: var(--quiz-progress, 0%); background: linear-gradient(90deg, var(--nav-teal), var(--prog-mint)); border-radius: 999px; transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1); }

/* ==========================================================================
   MODUL 4: TEXT DISSECTOR & INVERSION LAB
   ========================================================================== */
.dissector-section { background: radial-gradient(circle at 50% 15%, #1e293b 0%, #0f172a 100%); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.75rem); display: flex; flex-direction: column; gap: 1.25rem; }
.section-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.85rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.9rem; }
.passage-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.passage-btn { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-subtle); padding: 0.45rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: var(--transition-smooth); }
.passage-btn:hover { border-color: var(--nav-teal); color: var(--text-primary); }
.passage-btn.active-passage { background: var(--nav-teal-glow); border-color: var(--nav-teal); color: var(--nav-teal); }

.toolbar-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ctrl-btn { background: rgba(51, 65, 85, 0.8); color: var(--text-primary); border: 1px solid var(--border-subtle); padding: 0.42rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: var(--transition-smooth); }
.ctrl-btn:hover { border-color: var(--nav-teal); color: var(--nav-teal); }

.custom-input-box { background: rgba(15, 23, 42, 0.85); border: 1.5px dashed var(--nav-teal); border-radius: var(--radius-md); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.custom-textarea { width: 100%; background: rgba(30, 41, 59, 0.9); border: 1px solid var(--border-subtle); color: var(--text-primary); padding: 0.85rem; border-radius: var(--radius-sm); font-family: var(--font-arabic); font-size: 1.25rem; direction: rtl; resize: vertical; }
.custom-textarea:focus { outline: none; border-color: var(--nav-teal); box-shadow: 0 0 10px var(--nav-teal-glow); }

.turats-canvas { direction: rtl; background: rgba(15, 23, 42, 0.75); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: clamp(1.25rem, 3vw, 2rem) 1rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: clamp(0.65rem, 1.8vw, 1.15rem); }
.turats-token { background: rgba(51, 65, 85, 0.65); border: 2px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.65rem 1.1rem; min-width: clamp(95px, 16vw, 140px); cursor: pointer; transition: var(--transition-smooth); display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 0.35rem; text-align: center; color: var(--text-primary); }
.turats-token:hover { transform: translateY(-4px); border-color: var(--nav-teal); background: rgba(71, 85, 105, 0.85); }
.turats-token.solved-rafa { border-color: var(--irab-rafa); background: var(--irab-rafa-bg); }
.turats-token.solved-nasab { border-color: var(--irab-nasab); background: var(--irab-nasab-bg); }
.turats-token.solved-jarr { border-color: var(--irab-jarr); background: var(--irab-jarr-bg); }
.turats-token.solved-jazm { border-color: var(--irab-jazm); background: var(--irab-jazm-bg); }
.turats-token.solved-mabni { border-color: var(--irab-mabni); background: var(--irab-mabni-bg); }
.turats-token.chain-amil-source { box-shadow: 0 0 0 3px var(--nav-teal), 0 0 24px rgba(6, 182, 212, 0.55); transform: translateY(-5px) scale(1.03); z-index: 2; }
.turats-token.chain-mamul-target { box-shadow: 0 0 0 3px var(--prog-mint), 0 0 24px rgba(16, 185, 129, 0.5); transform: translateY(-5px); z-index: 2; }

.chain-connector-badge { direction: ltr; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.15rem 0.45rem; border-radius: 999px; background: rgba(15, 23, 42, 0.85); color: var(--text-muted); border: 1px solid var(--border-subtle); max-width: 100%; }
.turats-token.chain-amil-source .chain-connector-badge { background: var(--nav-teal); color: #042f2e; border-color: var(--nav-teal); }
.turats-token.chain-mamul-target .chain-connector-badge { background: var(--prog-mint); color: #052e16; border-color: var(--prog-mint); }

.chain-status-bar { background: rgba(15, 23, 42, 0.85); border-left: 4px solid var(--nav-teal); border-radius: var(--radius-sm); padding: 0.85rem 1.1rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; font-size: 0.84rem; }

.inversion-lab { background: var(--bg-surface); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.75rem); display: flex; flex-direction: column; gap: 1.25rem; }
.inversion-controls-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
.swap-action-btn { background: var(--nav-teal); color: #042f2e; border: none; padding: 0.55rem 1.15rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 800; cursor: pointer; transition: var(--transition-smooth); display: inline-flex; align-items: center; gap: 0.45rem; }
.swap-action-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

.inversion-stage { direction: rtl; display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 1rem; padding: 1.35rem 1rem; background: rgba(30, 41, 59, 0.7); border: 1px dashed var(--nav-teal); border-radius: var(--radius-md); transition: var(--transition-smooth); }
.inversion-stage.swapped-order { flex-direction: row-reverse; border-color: var(--accent-coral); background: rgba(244, 63, 94, 0.08); }
.inversion-card { flex: 1 1 240px; max-width: 380px; background: rgba(15, 23, 42, 0.9); border: 2px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem 1.25rem; cursor: grab; user-select: none; transition: var(--transition-smooth); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; }
.inversion-card:hover { border-color: var(--nav-teal); transform: translateY(-3px); }

.inversion-diagnostic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.diag-card { background: rgba(30, 41, 59, 0.75); border: 1px solid var(--border-subtle); border-top: 3px solid var(--nav-teal); border-radius: var(--radius-md); padding: 1rem; display: flex; flex-direction: column; gap: 0.45rem; }

.custom-modal-form { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.5rem; }
.custom-modal-input { width: 100%; background: rgba(15, 23, 42, 0.9); border: 1px solid var(--border-subtle); color: var(--text-primary); padding: 0.65rem; border-radius: var(--radius-sm); font-size: 0.95rem; }
.custom-modal-input:focus { outline: none; border-color: var(--nav-teal); }

/* ==========================================================================
   MODUL 5 & 6: PUSTAKA KAMUS, ALFIYAH, KORPUS & LAB NLP
   ========================================================================== */
.surface-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.4vw, 1.65rem);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.search-input-field {
  flex: 1 1 240px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.search-input-field:focus { outline: none; border-color: var(--nav-teal); }

.cards-responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.glossary-item-card {
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--nav-teal);
  border-radius: var(--radius-md);
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
}

.alfiyah-verse-card {
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--prog-mint);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Shared Suite Footer */
.suite-footer {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.suite-footer-links { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.footer-pill-link {
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  transition: var(--transition-smooth);
}
.footer-pill-link:hover, .footer-pill-link.active-footer { border-color: var(--nav-teal); color: var(--nav-teal); }

/* Toast Feedback */
.nahwu-toast {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--prog-mint);
  color: var(--text-primary);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  z-index: 3000;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: var(--transition-fast);
}
.nahwu-toast.visible { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (TABLET, DESKTOP, 4K ULTRA-WIDE)
   ========================================================================== */
@media (min-width: 768px) {
  .node-inspector { grid-template-columns: 1.2fr 1fr; align-items: center; }
}

@media (min-width: 900px) {
  .studio-grid { grid-template-columns: minmax(280px, 1fr) minmax(0, 1.65fr); }
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
    padding-left: var(--sidebar-w);
  }

  .mobile-category-strip {
    display: none;
  }

  .nav-hub {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--sidebar-w);
    height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    padding: 1.25rem 0.9rem;
    border-top: none;
    border-right: 2px solid var(--nav-teal);
  }

  .nav-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-brand-title { font-size: 1.12rem; font-weight: 800; color: var(--nav-teal); letter-spacing: -0.02em; }
  .nav-brand-sub { font-size: 0.74rem; color: var(--text-muted); }

  .nav-scroll-area {
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 0.85rem;
    padding: 0.75rem 0;
  }

  .nav-category-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .nav-category-title {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.5rem;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .nav-item { flex: none; min-width: 0; }

  .nav-link {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.65rem 0.78rem;
    gap: 0.72rem;
    text-align: left;
  }

  .nav-icon { margin-bottom: 0; font-size: 1.2rem; flex-shrink: 0; }
  .nav-label-short { display: none; }
  .nav-label-full { display: block; font-size: 0.84rem; line-height: 1.25; }
  .nav-sub-desc { display: block; font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }

  .nav-badge { position: static; margin-left: auto; flex-shrink: 0; }

  .nav-footer {
    display: block;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.74rem;
    color: var(--text-muted);
  }

  .dashboard-grid { grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr); }
  .exam-layout-grid { grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr); }
}

@media (min-width: 1600px) {
  :root { --sidebar-w: 19.5rem; }
  .dashboard-grid { grid-template-columns: minmax(0, 2.2fr) minmax(380px, 1fr); }
  .studio-grid { grid-template-columns: minmax(340px, 1fr) minmax(0, 2fr); }
  .exam-layout-grid { grid-template-columns: minmax(0, 2.25fr) minmax(380px, 1fr); }
}
