/* ==========================================================================
   ITU AI Readiness Hackathon — KSA: Interactive Artifact Design System
   Matches client-plan-design-system.md & ITU AI for Good Official Branding
   Standardized 100% on IBM Plex Sans Arabic / IBM Plex Sans
   Bilingual Layout Engine (RTL & LTR) with Segmented Pill Theme Switcher
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@100;200;300;400;500;600;700&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --- 1. Color Tokens & Theme Configuration --- */
:root {
  /* ITU Brand & Theme Tokens */
  --brand: #0072ce;            /* ITU UN Blue */
  --brand-deep: #004b87;       /* ITU Deep Navy */
  --ok: #00843d;               /* Saudi Green & Success Accent */
  --warn: #d97706;             /* Warning Amber */
  --danger: #dc2626;           /* Risk / Gap Coral Red */
  --info: #0284c7;             /* Info Sky Blue */

  /* Neutral Spectrum (Light Mode) */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #64748b;
  --ink-fade: rgba(15, 23, 42, 0.45);
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.18);
  --border-focus: rgba(0, 114, 206, 0.45);

  /* Computed color-mix values */
  --brand-tint: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-wash: color-mix(in srgb, var(--brand) 6%, var(--surface));
  --brand-glow: color-mix(in srgb, var(--brand) 25%, transparent);
  --ok-tint: color-mix(in srgb, var(--ok) 12%, transparent);
  --ok-wash: color-mix(in srgb, var(--ok) 6%, var(--surface));
  --warn-tint: color-mix(in srgb, var(--warn) 12%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 12%, transparent);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(0, 114, 206, 0.18);

  /* Unified Font System */
  --font-arabic: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --font-latin: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-main: var(--font-arabic);
  --font-mono: 'JetBrains Mono', monospace;

  --sb-width: 320px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides — Calm Deep Navy & Slate Palette */
[data-theme="dark"] {
  --brand: #38bdf8;
  --brand-deep: #0284c7;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;

  --bg: #0b132b;
  --bg-subtle: #111d3d;
  --surface: #172242;
  --surface-raised: #1e2c56;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --ink-fade: rgba(248, 250, 252, 0.40);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-focus: rgba(56, 189, 248, 0.45);

  --brand-tint: color-mix(in srgb, var(--brand) 16%, transparent);
  --brand-wash: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --brand-glow: 0 0 25px rgba(56, 189, 248, 0.20);
  --ok-tint: color-mix(in srgb, var(--ok) 16%, transparent);
  --ok-wash: color-mix(in srgb, var(--ok) 10%, var(--surface));
  --warn-tint: color-mix(in srgb, var(--warn) 16%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 16%, transparent);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.20);
}

/* LTR Specific Font & Alignment */
html[dir="ltr"] {
  --font-main: var(--font-latin);
}

/* --- 2. Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  direction: rtl;
  text-align: right;
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

html[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

button, input, select, textarea {
  font-family: var(--font-main);
}

/* --- 3. Progress Bar --- */
#prog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  z-index: 1000;
}

#prog i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ok), var(--brand), var(--brand-deep));
  box-shadow: 0 0 10px var(--brand);
  transition: width 100ms linear;
}

/* --- 4. Main App Layout --- */
.app {
  display: flex;
  min-height: 100vh;
}

/* --- 5. Sticky Sidebar (.sb) --- */
.sb {
  position: sticky;
  top: 0;
  width: var(--sb-width);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 900;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), background-color var(--transition-normal);
}

html[dir="ltr"] .sb {
  border-left: none;
  border-right: 1px solid var(--border);
}

.sb-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sb-logos {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start;
}

.sb-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.sb-logo-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.sb-title-wrap h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.sb-title-wrap p {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.2rem;
  font-weight: 400;
}

/* Sidebar Countdown Chip */
.sb-chip-cd {
  background: var(--brand-wash);
  border: 1px solid var(--brand-tint);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sb-chip-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sb-chip-label::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulseDot 2s infinite ease-in-out;
}

.sb-chip-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  direction: ltr;
  text-align: right;
}

html[dir="ltr"] .sb-chip-val {
  text-align: left;
}

/* Sidebar Navigation */
.sb-nav {
  padding: 1rem 0.75rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sb-nav-section-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 0.6rem 0.75rem 0.3rem;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-right: 3px solid transparent;
}

html[dir="ltr"] .nav-link {
  border-right: none;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--brand);
}

.nav-link.active {
  background: var(--brand-wash);
  color: var(--brand);
  border-right-color: var(--brand);
  font-weight: 600;
}

html[dir="ltr"] .nav-link.active {
  border-right-color: transparent;
  border-left-color: var(--brand);
}

.nav-link .nav-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-left: 0.5rem;
}

html[dir="ltr"] .nav-link .nav-num {
  margin-left: 0;
  margin-right: 0.5rem;
}

/* Sidebar Footer Controls */
.sb-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.btn-ctrl {
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.btn-ctrl:hover {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand-tint);
}

/* --- 6. Main Content Area (.main) --- */
.main {
  flex-grow: 1;
  min-width: 0;
  padding: 2rem 3.5rem 3.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Top Header Bar Controls (Pill Theme Switcher, Language & Social) */
.top-bar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.top-controls-left, .top-controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Segmented Pill Theme Switcher */
.pill-switch {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.pill-seg {
  background: transparent;
  border: none;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-seg:hover {
  color: var(--ink);
}

.pill-seg.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Bilingual Pill Button */
.pill-lang-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pill-lang-btn:hover {
  background: var(--brand-wash);
  border-color: var(--brand-tint);
}

/* Social Icon Buttons */
.social-icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.social-icon-btn:hover {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand-tint);
  transform: translateY(-1px);
}

/* Mobile Bar Header */
.mob-bar {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  z-index: 800;
}

.mob-toggle {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 850;
}

/* --- 7. Hero Section --- */
.hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--brand-wash) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.hero::after {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
  pointer-events: none;
}

.hero-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.hero-badge {
  background: var(--brand);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hero-badge.ksa {
  background: var(--ok);
}

.hero-badge.outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.hero h1 {
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 0.65rem;
}

.hero p.hero-sub {
  font-size: 1.02rem;
  color: var(--ink-secondary);
  max-width: 850px;
  line-height: 1.7;
  margin-bottom: 1.75rem;
}

/* Big Hero Countdown Box */
.cd-hero-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.cd-hero-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cd-hero-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cd-hero-subtitle {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.cd-digits-grid {
  display: flex;
  gap: 0.75rem;
  direction: ltr;
}

.cd-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 65px;
}

.cd-num {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.cd-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
}

/* --- 8. KPI Tiles Grid (.kpis) --- */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
  margin-bottom: 2.25rem;
}

@media (max-width: 900px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.kpi:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.kpi-val {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.25;
}

.kpi-lbl {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--ink-muted);
  line-height: 1.45;
  font-weight: 400;
}

/* --- 9. Timeline Strip (.wkstrip) --- */
.wkstrip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.wk-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--border);
  min-width: 150px;
  flex-shrink: 0;
  background: var(--bg-subtle);
  transition: all var(--transition-fast);
}

html[dir="ltr"] .wk-item {
  border-right: none;
  border-left: 3px solid var(--border);
}

.wk-item.completed {
  border-right-color: var(--ok);
  background: var(--bg-subtle);
  opacity: 0.70;
}

html[dir="ltr"] .wk-item.completed {
  border-right-color: transparent;
  border-left-color: var(--ok);
}

.wk-item.completed .wk-date {
  text-decoration: line-through;
  color: var(--ok);
}

.wk-item.completed .wk-title {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.wk-item.active {
  border-right-color: var(--ok);
  background: var(--ok-wash);
}

html[dir="ltr"] .wk-item.active {
  border-left-color: var(--ok);
}

.wk-item.critical {
  border-right-color: var(--danger);
  background: var(--danger-tint);
}

html[dir="ltr"] .wk-item.critical {
  border-left-color: var(--danger);
}

.wk-date {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand);
}

.wk-item.active .wk-date {
  color: var(--ok);
}

.wk-item.critical .wk-date {
  color: var(--danger);
}

.wk-item.critical .wk-date {
  color: var(--danger);
}

.wk-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
}

/* --- 10. Phase Section Containers --- */
.section-wrap {
  margin-bottom: 3.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.section-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  color: #ffffff;
  background: var(--brand);
}

.section-head h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
}

/* --- 11. Collapsible Cards (<details class="f">) --- */
details.f {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

details.f:hover {
  border-color: var(--border-focus);
}

details.f[open] {
  border-color: var(--brand-tint);
  box-shadow: var(--shadow-md);
}

details.f summary {
  padding: 1.15rem 1.35rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  user-select: none;
  transition: background-color var(--transition-fast);
}

details.f summary::-webkit-details-marker {
  display: none;
}

details.f summary:hover {
  background: var(--brand-wash);
}

.f-sum-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-grow: 1;
}

.f-tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--brand);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.f-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

.f-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  transition: transform var(--transition-normal), background-color var(--transition-fast);
  flex-shrink: 0;
  font-size: 0.75rem;
}

details.f[open] summary .f-arrow {
  transform: rotate(180deg);
  background: var(--brand-tint);
  color: var(--brand);
}

/* Card Body (.f-body) */
.f-body {
  padding: 1.35rem 1.5rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  color: var(--ink-secondary);
  line-height: 1.85;
}

/* Highlighted Hook */
.hook {
  background: var(--brand-wash);
  border-right: 4px solid var(--brand);
  padding: 0.9rem 1.15rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.96rem;
}

html[dir="ltr"] .hook {
  border-right: none;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Callout Box (.call) */
.call {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

.call.ok {
  background: var(--ok-wash);
  border-color: var(--ok-tint);
  color: var(--ink);
}

.call.warn {
  background: var(--warn-tint);
  border-color: var(--warn);
}

.call.danger {
  background: var(--danger-tint);
  border-color: var(--danger);
}

/* Talk / Prompt Block (.talk) */
.talk {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.25rem 0;
  position: relative;
}

.talk pre, .code-box pre {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  padding: 0.75rem 0;
  color: var(--ink);
}

.talk pre code, .code-box pre code {
  font-family: var(--font-mono);
}

/* Copy Button on Code/Prompt */
.btn-copy {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

html[dir="ltr"] .btn-copy {
  left: auto;
  right: 0.75rem;
}

.btn-copy:hover {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand);
}

/* Reference Card in Card Body */
.f-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

.f-ref a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.f-ref a:hover {
  text-decoration: underline;
}

/* --- 12. ITU Simulation Lab Styles --- */
.sim-meta-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--brand-wash) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.sim-meta-info {
  flex: 1;
  min-width: 300px;
}

.sim-meta-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.4rem;
}

.sim-meta-info p {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  line-height: 1.65;
}

.sim-score-box {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 190px;
  box-shadow: var(--shadow-sm);
}

.sim-score-lbl {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.sim-score-num {
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.15;
  margin: 0.2rem 0;
}

.sim-score-num small {
  font-size: 1rem;
  color: var(--ink-muted);
}

.sim-score-delta {
  font-size: 0.78rem;
  font-weight: 600;
}

/* Presets Bar */
.sim-presets-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sim-presets-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.sim-presets-list {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex: 1;
}

.btn-sim-preset {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sim-preset:hover {
  background: var(--brand-wash);
  color: var(--brand);
  border-color: var(--brand-tint);
}

.btn-sim-reset {
  background: var(--danger-tint);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sim-reset:hover {
  background: var(--danger);
  color: #ffffff;
}

/* 13 Dimensions Grid */
.sim-dims-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2.5rem;
}

.sim-dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition-fast);
}

.sim-dim-card:hover {
  border-color: var(--border-focus);
}

.sim-dim-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-dim-id {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-left: 0.4rem;
}

html[dir="ltr"] .sim-dim-id {
  margin-left: 0;
  margin-right: 0.4rem;
}

.sim-dim-factor {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--brand);
  border: 1px solid var(--border);
}

.sim-dim-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
}

.sim-dim-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.sim-dim-context {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  background: var(--bg-subtle);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-top: 0.2rem;
}

.sim-slider-row {
  margin: 0.5rem 0 0.2rem;
}

.sim-slider {
  width: 100%;
  accent-color: var(--brand);
  cursor: pointer;
}

.sim-dim-causal {
  font-size: 0.74rem;
  color: var(--ink-muted);
  border-top: 1px dashed var(--border);
  padding-top: 0.4rem;
}

/* 6 AI Agents Grid */
.sim-agents-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.sim-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.sim-agent-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
}

.sim-agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.sim-agent-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand);
}

.sim-agent-factor {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-wash);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.sim-agent-desc {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.sim-agent-dims {
  font-size: 0.74rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.sim-agent-dims span {
  background: var(--surface);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-left: 0.2rem;
}

/* --- 13. Reply Guide (Q&A Accordions) --- */
.reply-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.reply-q {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.5rem;
}

.reply-ex {
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  display: inline-block;
  font-weight: 500;
}

.reply-ans {
  font-size: 0.94rem;
  color: var(--ink-secondary);
  line-height: 1.75;
}

/* --- 14. Positioning & Golden Rules --- */
.position-card {
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-glow);
  margin-top: 2.5rem;
}

.position-card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #ffffff;
}

.position-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.position-card li {
  position: relative;
  padding-right: 1.75rem;
  font-size: 0.96rem;
  line-height: 1.65;
}

html[dir="ltr"] .position-card li {
  padding-right: 0;
  padding-left: 1.75rem;
}

.position-card li::before {
  content: '✓';
  position: absolute;
  right: 0;
  top: 0;
  font-weight: 700;
  color: #4ade80;
}

html[dir="ltr"] .position-card li::before {
  right: auto;
  left: 0;
}

/* --- 15. Footer Developer Attribution --- */
.app-footer {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-dev-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.footer-dev-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.footer-dev-lbl {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.footer-dev-name {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

.footer-dev-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.footer-social-link:hover {
  color: var(--brand);
  background: var(--brand-wash);
  border-color: var(--brand-tint);
  transform: translateY(-1px);
}

.footer-itu-meta {
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.footer-official-url {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  direction: ltr;
}

.footer-official-url a {
  color: var(--brand);
  text-decoration: none;
}

.footer-official-url a:hover {
  text-decoration: underline;
}

/* --- 16. Responsive Breakpoints --- */
@media (max-width: 1024px) {
  .main {
    padding: 1.5rem 1.25rem 2.5rem;
  }
  
  .sb {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    transform: translateX(100%);
  }

  html[dir="ltr"] .sb {
    right: auto;
    left: 0;
    transform: translateX(-100%);
  }

  .sb.open {
    transform: translateX(0);
  }

  .mob-bar {
    display: flex;
  }

  .scrim.open {
    display: block;
  }

  .top-bar-controls {
    display: none;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 1.5rem 1.25rem;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .cd-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .cd-digits-grid {
    width: 100%;
    justify-content: space-between;
  }

  .cd-box {
    min-width: 0;
    flex: 1;
    padding: 0.5rem 0.4rem;
  }

  .cd-num {
    font-size: 1.25rem;
  }

  .footer-dev-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Animations */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
/* ==========================================================================
   17. Onboarding Track, Tools Directory & Journey Wizard Styles
   ========================================================================== */

/* --- Restart Button in Top Bar --- */
#btnRestartOnboarding {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--brand);
  padding-block: 0.4rem;
  padding-inline: 0.85rem;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

#btnRestartOnboarding:hover {
  background: var(--brand-wash);
  border-color: var(--brand-tint);
  transform: translateY(-1px);
}

#btnRestartOnboarding svg {
  flex-shrink: 0;
}

/* --- Wizard Modal Backdrop & Dialog --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  animation: fadeIn var(--transition-fast) ease-in-out;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: slideUp var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-opt-card {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding-block: 0.9rem;
  padding-inline: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}

.wizard-opt-card:hover {
  border-color: var(--border-focus);
  background: var(--brand-wash);
  transform: translateY(-1px);
}

.wizard-opt-card.selected {
  border-color: var(--brand);
  background: var(--brand-wash);
  box-shadow: var(--shadow-sm);
}

/* --- Tools Comparison Grid & Cards --- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.tool-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-card.matched {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.matched-badge {
  position: absolute;
  top: -12px;
  inset-inline-start: 16px;
  background: var(--brand);
  color: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  padding-block: 0.2rem;
  padding-inline: 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.platform-chip {
  font-size: 0.72rem;
  padding-block: 0.15rem;
  padding-inline: 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
}

.platform-chip.supported {
  background: var(--ok-wash);
  color: var(--ok);
}

.platform-chip.unsupported {
  background: var(--bg-subtle);
  color: var(--ink-muted);
}

/* --- Journey Step Cards & Track Banner --- */
.journey-step-card {
  transition: all var(--transition-fast);
}

.journey-step-card .chk-step-done {
  accent-color: var(--ok);
}

.journey-step-card.completed summary .f-title {
  text-decoration: line-through;
  opacity: 0.75;
}

.track-progress-wrapper {
  margin-top: 0.75rem;
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.track-progress-fill {
  height: 100%;
  background: var(--ok);
  transition: width var(--transition-normal);
}

/* --- Submission Deliverables Grid --- */
.submission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.submission-deliverable-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

/* --- Mobile Breakpoint Adjustments --- */
@media (max-width: 640px) {
  .modal-dialog {
    max-height: 95vh;
    border-radius: var(--radius-md);
  }

  .tools-grid,
  .submission-grid {
    grid-template-columns: 1fr;
  }
}
