/*
 * DomoLearn / Academia — professional dark-tech design system
 *
 * KEY CSS VARIABLES (use these in markup / other agents):
 *   --bg-base, --bg-elevated, --surface, --surface-2  layered dark navy surfaces
 *   --border, --border-strong                         subtle card edges
 *   --accent (--teal alias), --accent-dim, --accent-glow   electric cyan-blue
 *   --amber, --amber-dim, --amber-glow                streaks / challenge accents
 *   --ink, --ink-soft, --muted, --white               text hierarchy
 *   --radius (16), --radius-sm (12), --radius-pill
 *   --header-h, --nav-h, --safe-b, --safe-t
 *   --shadow, --shadow-glow, --font-display, --font-body, --ease
 *
 * UTILITY / COMPONENT CLASSES for screen markup:
 *   .hero-card          large featured course / promo surface (image-friendly)
 *   .hero-card-media    optional media/overlay zone inside hero-card
 *   .streak-pill        compact flame + streak count chip (header or inline)
 *   .module-card        standard learning module / continue card
 *   .module-card.is-active | .is-locked | .is-done
 *   .progress-ring      circular meta ring (set --ring-pct: 0-100)
 *   .progress-track / .progress-fill   horizontal bars (existing)
 *   .badge-pill         generic high-contrast pill (.badge-pill--accent|amber|ok|muted)
 *   .sticky-cta         sticky bottom action bar above nav (pinned with flex when content is short)
 *   .lesson-step-head / .lesson-footer-sticky   lesson step chrome
 *   .mod-progress-card  per-module progress row (progress screen)
 *   .egress-panel / .comp-card   egress profile panels
 *   .glossary-list / .glossary-search   glossary list polish
 *   .bottom-nav .nav-item.is-active   active tab + glow dot (::after)
 *   .filter-pills / .filter-pill      horizontal category chips
 *   .stat-tile          mini metric cell (profile / course stats)
 *   .challenge-card     amber-accented weekly challenge surface
 *   .status-pill        live status chip (simulator / sensors)
 *   .terminal-log       monospace UART / live log panel
 *   .brand-mark         square house logo mark
 */

/* —— Tokens: dark tech (default) —— */
:root,
[data-theme="dark"] {
  --bg-base: #0a0f18;
  --bg-elevated: #0b1f33;
  --surface: #121c2c;
  --surface-2: #172334;
  --surface-3: #1c2a3d;
  --border: rgba(130, 170, 210, 0.12);
  --border-strong: rgba(130, 170, 210, 0.22);

  --accent: #38bdf8;
  --accent-rich: #1bb6a4;
  --accent-dim: rgba(56, 189, 248, 0.16);
  --accent-glow: rgba(56, 189, 248, 0.42);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.16);
  --amber-glow: rgba(245, 158, 11, 0.4);

  /* Legacy aliases used across screens */
  --navy: #0b1f33;
  --navy-2: #123049;
  --navy-3: #1a3a55;
  --sand: #121c2c;
  --sand-2: #243344;
  --teal: #38bdf8;
  --teal-dim: rgba(56, 189, 248, 0.16);
  --teal-glow: rgba(56, 189, 248, 0.42);
  --ink: #f0f5fa;
  --ink-soft: #a8b8c8;
  --muted: #7a8fa3;
  --white: #172334;
  --bg: #0a0f18;

  --danger: #f07178;
  --warn: #f59e0b;
  --ok: #34d399;
  --info: #38bdf8;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --header-h: 56px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.22);
  --font-display: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  --font-body: system-ui, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ring-pct: 75;
}

/* —— Tokens: light (toggle) —— */
[data-theme="light"] {
  --bg-base: #e8eef2;
  --bg-elevated: #0b1f33;
  --surface: #ffffff;
  --surface-2: #f3f7f9;
  --surface-3: #ffffff;
  --border: rgba(11, 31, 51, 0.08);
  --border-strong: rgba(11, 31, 51, 0.14);

  --accent: #0e9f90;
  --accent-rich: #1bb6a4;
  --accent-dim: rgba(27, 182, 164, 0.16);
  --accent-glow: rgba(27, 182, 164, 0.35);
  --amber: #c4892a;
  --amber-dim: rgba(196, 137, 42, 0.15);
  --amber-glow: rgba(196, 137, 42, 0.35);

  --navy: #0b1f33;
  --navy-2: #123049;
  --navy-3: #1a3a55;
  --sand: #e8eef2;
  --sand-2: #d5dee6;
  --teal: #1bb6a4;
  --teal-dim: rgba(27, 182, 164, 0.18);
  --teal-glow: rgba(27, 182, 164, 0.35);
  --ink: #0b1f33;
  --ink-soft: #3a5166;
  --muted: #6b8094;
  --white: #ffffff;
  --bg: #e8eef2;

  --danger: #c44b4b;
  --warn: #c4892a;
  --ok: #1a9b6c;
  --info: #2a7ab0;

  --shadow: 0 8px 28px rgba(11, 31, 51, 0.12);
  --shadow-glow: 0 0 20px rgba(27, 182, 164, 0.25);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-base);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
}

button, input, textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* —— App chrome —— */
.app {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background:
    radial-gradient(110% 70% at 100% -8%, rgba(56, 189, 248, 0.14), transparent 55%),
    radial-gradient(80% 50% at -15% 35%, rgba(27, 182, 164, 0.1), transparent 50%),
    linear-gradient(165deg, #0a0f18 0%, #0b1f33 48%, #0e2438 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="light"] .app {
  background:
    radial-gradient(120% 80% at 100% -10%, rgba(27, 182, 164, 0.22), transparent 55%),
    radial-gradient(90% 60% at -20% 40%, rgba(26, 58, 85, 0.9), transparent 50%),
    linear-gradient(165deg, var(--navy) 0%, var(--navy-2) 45%, #0e273c 100%);
}

.app::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image:
    linear-gradient(rgba(232, 238, 242, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 238, 242, 0.45) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
}

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 12px 10px;
  color: var(--ink);
}

.brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background:
    linear-gradient(145deg, rgba(56, 189, 248, 0.18), rgba(27, 182, 164, 0.08));
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.12);
}

.brand-mark svg {
  display: block;
}

.header-titles {
  flex: 1;
  min-width: 0;
}

.header-eyebrow {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  opacity: 0.95;
}

.header-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

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

.btn-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(232, 238, 242, 0.05);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s;
}

.btn-icon:active {
  transform: scale(0.94);
  background: var(--accent-dim);
  border-color: rgba(56, 189, 248, 0.35);
}

.header-back[hidden],
.header-action[hidden] {
  display: none;
}

.app-header:has(.header-back:not([hidden])) .brand-mark {
  display: none;
}

.app-main {
  position: relative;
  z-index: 10;
  flex: 1;
  min-height: 0;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

[data-theme="light"] .app-main {
  background: var(--sand);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}

.screen-stack {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition:
    opacity 0.28s var(--ease),
    transform 0.32s var(--ease);
}

.screen.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 2;
}

.screen.is-exit {
  opacity: 0;
  transform: translateX(-10px);
  z-index: 1;
}

/* —— Bottom nav (active glow + dot) —— */
.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 8px var(--safe-b);
  background: rgba(10, 15, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-strong);
}

[data-theme="light"] .bottom-nav {
  background: rgba(11, 31, 51, 0.94);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(232, 238, 242, 0.45);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
  transition: color 0.2s, text-shadow 0.2s;
}

.nav-item svg {
  transition: filter 0.2s, transform 0.2s;
}

.nav-item.is-active {
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent-glow);
}

.nav-item.is-active svg {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-item.is-active::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 2px var(--accent-glow);
}

.nav-item:active {
  background: rgba(232, 238, 242, 0.06);
}

/* —— Typography & surfaces —— */
.h-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--ink);
}

.h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}

.h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}

.lede {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.section {
  margin-bottom: 22px;
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-label h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

/* —— DomoLearn utility components —— */
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.streak-pill .streak-icon,
.streak-pill [data-icon="flame"] {
  color: var(--amber);
  filter: drop-shadow(0 0 6px var(--amber-glow));
}

.hero-card {
  position: relative;
  margin: 0 0 18px;
  padding: 18px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    linear-gradient(155deg, var(--surface-2) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  color: var(--ink);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-card-media {
  position: relative;
  margin: -6px -6px 14px;
  min-height: 120px;
  border-radius: calc(var(--radius) - 4px);
  background:
    radial-gradient(circle at 70% 30%, rgba(56, 189, 248, 0.2), transparent 55%),
    linear-gradient(135deg, #0e1a28, #152a40);
  border: 1px solid var(--border);
  overflow: hidden;
}

.module-card {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s var(--ease), border-color 0.2s;
}

.module-card + .module-card {
  margin-top: 10px;
}

.module-card:active {
  transform: scale(0.985);
}

.module-card.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2), var(--shadow);
}

.module-card.is-locked {
  opacity: 0.55;
}

.module-card.is-done {
  border-color: rgba(245, 158, 11, 0.35);
}

.progress-ring {
  --ring-size: 52px;
  --ring-stroke: 3.5px;
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  border-radius: 50%;
  background:
    conic-gradient(
      var(--accent) calc(var(--ring-pct) * 1%),
      rgba(130, 170, 210, 0.15) 0
    );
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: var(--ring-stroke);
  border-radius: 50%;
  background: var(--surface-2);
}

.progress-ring > * {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--accent);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(232, 238, 242, 0.06);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.badge-pill--accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.28);
}

.badge-pill--amber {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-pill--ok {
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.28);
}

.badge-pill--muted {
  background: rgba(122, 143, 163, 0.12);
  color: var(--muted);
}

.sticky-cta {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-top: auto;
  margin-left: -4px;
  margin-right: -4px;
  padding-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(10, 15, 24, 0.88);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}

.sticky-cta .btn-primary {
  flex: 1;
}

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin: 0 -4px 8px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.is-active,
.filter-pill[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #061018;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.stat-tile {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stat-tile .stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.challenge-card {
  padding: 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(245, 158, 11, 0.12), transparent 55%),
    var(--surface);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: var(--ink);
}

.challenge-card .btn-amber {
  background: var(--amber);
  color: #1a1205;
  box-shadow: 0 6px 18px var(--amber-glow);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent);
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.status-pill--amber {
  background: var(--amber-dim);
  color: var(--amber);
}

.status-pill--ok {
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
}

.terminal-log {
  border-radius: var(--radius-sm);
  background: #070b12;
  border: 1px solid var(--border);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: #9fb3c8;
  overflow: auto;
  max-height: 160px;
}

/* —— Home hero (existing) —— */
.hero {
  position: relative;
  margin: -2px -4px 18px;
  padding: 22px 18px 20px;
  border-radius: var(--radius);
  background:
    radial-gradient(100% 80% at 100% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(135deg, #0e1a28 0%, #152a40 55%, #0f3a42 100%);
  color: var(--ink);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  animation: pulse-glow 3.2s ease-in-out infinite;
}

.hero-brand {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

.hero h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.hero p {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  color: rgba(232, 238, 242, 0.82);
  font-size: 0.9rem;
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(232, 238, 242, 0.08);
  border: 1px solid var(--border);
  color: rgba(240, 245, 250, 0.9);
  font-size: 0.75rem;
  font-weight: 600;
}

.chip-teal {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.28);
}

[data-theme="light"] .chip {
  color: var(--sand);
  background: rgba(232, 238, 242, 0.1);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #061018;
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-primary:hover {
  background: #5cc8fa;
}

[data-theme="light"] .btn-primary {
  background: var(--teal);
  color: #0b1f33;
  box-shadow: 0 6px 18px rgba(27, 182, 164, 0.35);
}

[data-theme="light"] .btn-primary:hover {
  background: #22c9b5;
}

.btn-ghost {
  background: rgba(232, 238, 242, 0.06);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(232, 238, 242, 0.1);
}

[data-theme="light"] .btn-ghost {
  background: rgba(11, 31, 51, 0.06);
  border-color: transparent;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.btn-amber {
  background: var(--amber);
  color: #1a1205;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--amber-glow);
}

/* —— Progress bar —— */
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(130, 170, 210, 0.12);
  overflow: hidden;
}

[data-theme="light"] .progress-track {
  background: var(--sand-2);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--accent));
  transition: width 0.55s var(--ease);
  box-shadow: 0 0 12px var(--accent-glow);
}

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

.progress-pct {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

/* —— Cards / lists —— */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-card {
  display: block;
  padding: 14px 14px 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s var(--ease), border-color 0.2s;
  position: relative;
  overflow: hidden;
  color: var(--ink);
}

.list-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.45;
}

.list-card.is-done::before {
  opacity: 1;
  background: var(--amber);
}

.list-card:active {
  transform: scale(0.985);
}

.list-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.list-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-idle {
  background: rgba(232, 238, 242, 0.08);
  color: var(--ink-soft);
}

.badge-progress {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-done {
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
}

.badge-locked {
  background: var(--amber-dim);
  color: var(--amber);
}

[data-theme="light"] .badge-idle {
  background: rgba(11, 31, 51, 0.08);
  color: var(--ink-soft);
}

[data-theme="light"] .badge-progress {
  background: var(--teal-dim);
  color: #0f7d70;
}

/* —— Course catalog —— */
.catalog-hero {
  margin: -2px -4px 18px;
  padding: 22px 18px 18px;
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(145deg, #0e1a28, #152a40);
  color: #e8eef2;
  border: 1px solid var(--border);
}

.catalog-hero h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.15;
  color: #fff;
}

.catalog-hero p:last-child {
  margin: 0;
  color: rgba(232, 238, 242, 0.82);
  font-size: 0.92rem;
  line-height: 1.45;
}

.course-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}

.course-card + .course-card,
.course-card + .is-locked {
  margin-top: 10px;
}

.course-card:active:not(.is-locked) {
  transform: scale(0.985);
}

.course-card.is-locked {
  cursor: default;
  opacity: 0.72;
}

.course-card.is-active-course {
  outline: none;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25), var(--shadow);
}

.course-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.course-card-top > div {
  flex: 1;
  min-width: 0;
}

.course-card-top h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}

.course-accent {
  width: 6px;
  align-self: stretch;
  border-radius: 999px;
  flex-shrink: 0;
}

.course-tagline {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.course-cta {
  color: var(--accent);
  font-weight: 700;
}

.list-card .goal {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

/* —— Module / lesson —— */
.module-intro {
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.module-intro p { margin: 0 0 0.6em; }
.module-intro p:last-child { margin-bottom: 0; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.lesson-item + .lesson-item {
  margin-top: 8px;
}

.lesson-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.lesson-item.is-done .lesson-num {
  background: var(--accent);
  color: #061018;
  border-color: transparent;
}

.lesson-body {
  flex: 1;
  min-width: 0;
}

.lesson-body strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--ink);
}

.lesson-check {
  color: var(--ok);
  font-size: 1.1rem;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 36px 18px;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  margin-bottom: 6px;
}

.preparing {
  padding: 28px 16px;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(232, 238, 242, 0.03);
  border: 1px dashed var(--border-strong);
  color: var(--ink-soft);
}

.preparing strong {
  display: block;
  font-family: var(--font-display);
  color: var(--ink);
  margin-bottom: 6px;
}

/* —— Content blocks —— */
.block {
  margin-bottom: 16px;
}

.block-heading h2,
.block-heading h3 {
  font-family: var(--font-display);
  margin: 8px 0 4px;
  color: var(--ink);
}

.block-text {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.block-text p { margin: 0 0 0.75em; }
.block-text p:last-child { margin-bottom: 0; }
.block-text ul, .block-text ol { margin: 0 0 0.75em; padding-left: 1.2em; }
.block-text code {
  font-size: 0.88em;
  background: rgba(232, 238, 242, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: var(--accent);
}

[data-theme="light"] .block-text code {
  background: rgba(11, 31, 51, 0.06);
  color: var(--navy);
}

.block-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 0.75em;
}

.block-text th,
.block-text td {
  border: 1px solid var(--border-strong);
  padding: 6px 8px;
  text-align: left;
}

.callout {
  border-radius: var(--radius);
  padding: 14px 14px 14px 16px;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.callout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.callout-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  color: #0a0f18;
  background: var(--accent);
}

.callout-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  margin: 0;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
}

.callout-body {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.callout-body p { margin: 0 0 0.5em; }
.callout-body p:last-child { margin-bottom: 0; }

.callout-why {
  border-left-color: var(--accent-rich);
  background: linear-gradient(90deg, rgba(27, 182, 164, 0.16), var(--surface) 48%);
}
.callout-why .callout-badge {
  background: var(--accent-rich);
  color: #0a0f18;
}

.callout-rd {
  border-left-color: var(--warn);
  background: linear-gradient(90deg, var(--amber-dim), var(--surface) 48%);
}
.callout-rd .callout-badge {
  background: var(--amber);
  color: #0a0f18;
}

.callout-error {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(240, 113, 120, 0.14), var(--surface) 48%);
}
.callout-error .callout-badge {
  background: var(--danger);
  color: #0a0f18;
}

.callout-info {
  border-left-color: var(--info);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), var(--surface) 48%);
}
.callout-info .callout-badge {
  background: var(--info);
  color: #0a0f18;
}

.diagram {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px;
  overflow: hidden;
}

.diagram-frame {
  border-radius: 10px;
  background:
    radial-gradient(circle at 80% 20%, var(--accent-dim), transparent 50%),
    #070b12;
  padding: 12px;
  color: #e8eef2;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: diagram-pulse 4s ease-in-out infinite;
  border: 1px solid var(--border);
}

.diagram-frame svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.diagram-caption {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.diagram-placeholder {
  text-align: center;
  color: rgba(232, 238, 242, 0.7);
  font-size: 0.85rem;
  padding: 20px;
}

.practice {
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-elevated);
  color: #e8eef2;
  border: 1px solid var(--border);
}

.practice-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.practice-body {
  font-size: 0.9rem;
  color: rgba(232, 238, 242, 0.9);
}

.practice-body p { margin: 0 0 0.5em; }
.practice-body p:last-child { margin-bottom: 0; }

/* Quiz */
.quiz {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
}

.quiz-q {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--ink);
}

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

.quiz-opt {
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
}

.quiz-opt:active:not(:disabled) {
  transform: scale(0.98);
}

.quiz-opt:disabled {
  cursor: default;
}

.quiz-opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.quiz-opt.is-correct {
  border-color: var(--ok);
  background: rgba(52, 211, 153, 0.12);
}

.quiz-opt.is-wrong {
  border-color: var(--danger);
  background: rgba(240, 113, 120, 0.12);
}

.quiz-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  background: rgba(232, 238, 242, 0.05);
  color: var(--ink-soft);
}

.quiz-feedback.is-ok {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

.quiz-feedback.is-bad {
  background: rgba(240, 113, 120, 0.12);
  color: #fca5a5;
}

[data-theme="light"] .quiz-opt {
  background: #f7fafc;
  border-color: var(--sand-2);
}

[data-theme="light"] .quiz-feedback.is-ok {
  color: #0f6b4a;
}

[data-theme="light"] .quiz-feedback.is-bad {
  color: #8a3030;
}

/* Clarifications */
.clarifications {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
}

.clarifications label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.clarifications textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--ink);
  margin-bottom: 10px;
}

.clarifications textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Decision tree */
.decision {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
}

.decision-title {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--ink);
}

.decision-q {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

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

.decision-result {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--ink);
  font-weight: 600;
}

.decision-restart {
  margin-top: 10px;
}

/* Lesson step header + sticky footer */
.lesson-step-head {
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.lesson-step-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.lesson-mod-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-mod-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  flex-shrink: 0;
}

.lesson-step-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.lesson-step-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.lesson-step-sub {
  margin: 0 0 12px;
  font-size: 0.85rem;
}

.lesson-step-track {
  height: 5px;
}

.lesson-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lesson-footer-nav .btn {
  width: 100%;
}

.screen.has-sticky-footer {
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
}

.lesson-footer-sticky {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b));
  z-index: 15;
  flex-shrink: 0;
  margin-top: auto;
  margin-left: -16px;
  margin-right: -16px;
  padding-top: 20px;
  padding: 12px 16px 10px;
  border-top: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(10, 15, 24, 0), rgba(10, 15, 24, 0.92) 28%, rgba(10, 15, 24, 0.96));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.35);
}

.sticky-cta__btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 52px;
}

.sticky-cta__label {
  font-weight: 700;
}

.sticky-cta__meta {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Progress / profile */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-grid-premium .stat {
  position: relative;
  overflow: hidden;
  padding: 14px 14px 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.stat-accent {
  background:
    radial-gradient(120% 90% at 100% 0%, var(--accent-dim), transparent 55%),
    var(--surface);
  border-color: rgba(56, 189, 248, 0.28);
}

.stat-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-dim);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}

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

.stat-mini-track {
  margin-top: 10px;
  height: 5px;
}

.mod-progress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mod-progress-card {
  display: block;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s var(--ease), border-color 0.2s;
}

.mod-progress-card:active {
  transform: scale(0.985);
}

.mod-progress-card.is-done {
  border-color: rgba(52, 211, 153, 0.35);
}

.mod-progress-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.mod-progress-num {
  display: inline-block;
  margin-bottom: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.mod-progress-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.mod-progress-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mod-progress-track {
  flex: 1;
  height: 8px;
}

.mod-progress-pct {
  flex-shrink: 0;
  min-width: 2.4em;
  text-align: right;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.mod-progress-meta {
  margin: 8px 0 0;
  font-size: 0.8rem;
}

.profile-hero {
  padding: 18px;
  border-radius: var(--radius);
  background:
    radial-gradient(100% 80% at 100% 0%, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(145deg, #0e1a28, #152a40);
  color: #e8eef2;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.profile-hero-premium {
  padding: 20px 18px 18px;
  background:
    radial-gradient(110% 80% at 100% -10%, rgba(56, 189, 248, 0.22), transparent 50%),
    radial-gradient(80% 60% at 0% 100%, rgba(27, 182, 164, 0.12), transparent 45%),
    linear-gradient(145deg, #0e1a28 0%, #152a40 55%, #123a42 100%);
  box-shadow: var(--shadow);
  border-color: rgba(56, 189, 248, 0.22);
}

.profile-kicker {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.profile-hero h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #ffffff;
}

.pwa-panel .pwa-status {
  margin: 0 0 12px;
  line-height: 1.45;
}

.pwa-panel .pwa-ios-hint {
  margin: 12px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.profile-hero p {
  margin: 0;
  color: rgba(232, 238, 242, 0.85);
  font-size: 0.9rem;
}

.egress-panel {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.egress-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.egress-panel-badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.egress-can .egress-panel-badge {
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
}

.egress-cannot .egress-panel-badge {
  background: rgba(240, 113, 120, 0.14);
  color: var(--danger);
}

.egress-panel-count {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.can-list,
.cannot-list,
.comp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.egress-panel .can-list li,
.egress-panel .cannot-list li {
  margin-bottom: 8px;
  background: var(--surface-2);
  border-color: transparent;
}

.egress-panel .can-list li:last-child,
.egress-panel .cannot-list li:last-child {
  margin-bottom: 0;
}

.can-list li,
.cannot-list li,
.comp-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.can-list li::before {
  content: "✓";
  position: absolute;
  left: 12px;
  color: var(--ok);
  font-weight: 700;
}

.cannot-list li::before {
  content: "–";
  position: absolute;
  left: 14px;
  color: var(--danger);
  font-weight: 700;
}

.comp-list li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.comp-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comp-card {
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, var(--accent-dim), transparent 42%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.comp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.comp-card-mod {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.comp-card-level {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.comp-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.glossary-head {
  margin-bottom: 12px;
}

.glossary-toolbar {
  margin-bottom: 14px;
}

.glossary-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.glossary-search:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.glossary-letter {
  margin: 10px 0 2px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.glossary-letter:first-child {
  margin-top: 0;
}

.glossary-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 0;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}

.glossary-item-mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-dim);
}

.glossary-item-body {
  min-width: 0;
  flex: 1;
}

.glossary-item-term {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.glossary-item-def {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.glossary-item dt {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.glossary-item dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.glossary-empty {
  margin: 8px 0 0;
  padding: 16px;
  text-align: center;
}

.recommend {
  display: block;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-dim), var(--surface));
  border: 1px solid rgba(56, 189, 248, 0.28);
  margin-bottom: 16px;
}

.recommend-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}

.recommend strong {
  display: block;
  font-family: var(--font-display);
  color: var(--ink);
  margin-bottom: 2px;
}

.recommend span {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.badge-full {
  color: var(--accent);
}

/* Toast & boot */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(12px);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}

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

.boot-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg-base);
  transition: opacity 0.35s var(--ease);
}

.boot-overlay.is-done {
  opacity: 0;
  pointer-events: none;
}

.boot-card {
  text-align: center;
  color: var(--ink);
}

.boot-pulse {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(56, 189, 248, 0.22);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.boot-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
}

.boot-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Motions */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes diagram-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50% { box-shadow: inset 0 0 40px rgba(56, 189, 248, 0.18); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 481px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .progress-fill,
  .toast,
  .boot-overlay,
  .btn,
  .list-card,
  .module-card,
  .glossary-sheet-backdrop,
  .glossary-sheet {
    transition: none !important;
  }
  .hero::after,
  .diagram-frame,
  .boot-pulse {
    animation: none !important;
  }
}

/* —— Glossary term links & definition sheet —— */
.glossary-term {
  display: inline;
  margin: 0;
  padding: 0.35em 0.12em;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  position: relative;
}

.glossary-term::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 50%;
  height: 44px;
  transform: translateY(-50%);
}

.glossary-term:hover,
.glossary-term:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
  outline: none;
}

.glossary-term:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-dim);
  border-radius: 3px;
}

.glossary-sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 10, 16, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.glossary-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.glossary-sheet {
  width: 100%;
  max-height: min(72vh, 420px);
  overflow: auto;
  padding: 10px 18px calc(16px + var(--safe-b));
  border-radius: var(--radius) var(--radius) 0 0;
  background:
    linear-gradient(180deg, var(--accent-dim), transparent 48px),
    var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  transform: translateY(100%);
  transition: transform 0.28s var(--ease);
}

[data-theme="light"] .glossary-sheet {
  background:
    linear-gradient(180deg, rgba(27, 182, 164, 0.1), transparent 48px),
    var(--white);
  box-shadow: 0 -12px 40px rgba(11, 31, 51, 0.22);
}

.glossary-sheet-backdrop.is-open .glossary-sheet {
  transform: translateY(0);
}

.glossary-sheet-handle {
  width: 40px;
  height: 4px;
  margin: 4px auto 12px;
  border-radius: 999px;
  background: var(--sand-2);
}

.glossary-sheet-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.glossary-sheet-title {
  flex: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.glossary-sheet-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -6px -8px 0 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.glossary-sheet-close:hover,
.glossary-sheet-close:focus-visible {
  background: var(--accent-dim);
  color: var(--accent);
  outline: none;
}

.glossary-sheet-def {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.glossary-sheet-footer {
  padding-top: 4px;
}

.glossary-sheet-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.glossary-sheet-link:hover,
.glossary-sheet-link:focus-visible {
  color: #7dd3fc;
  outline: none;
}

[data-theme="light"] .glossary-sheet-link:hover,
[data-theme="light"] .glossary-sheet-link:focus-visible {
  color: #0f7d70;
}

[data-theme="light"] .glossary-sheet-close {
  background: var(--sand);
  color: var(--navy);
  border: none;
}

[data-theme="light"] .glossary-sheet-title {
  color: var(--navy);
}
