/* ============================================================
   AI Training Hub — Styles
   Palette: cream + terracotta + forest green
   Aesthetic: warm minimalism, glassmorphism, subtle noise
   ============================================================ */

:root {
  --cream: #faf6ef;
  --cream-2: #f4ede0;
  --paper: #fffdf8;
  --ink: #2a241d;
  --ink-2: #4a4239;
  --ink-3: #7a7065;
  --ink-4: #a59c91;
  --terracotta: #c75a3d;
  --terracotta-2: #a64a31;
  --terracotta-soft: #e8906f;
  --forest: #3e5e3a;
  --forest-2: #2d4629;
  --forest-soft: #88a07f;
  --amber: #d4a341;
  --line: rgba(42, 36, 29, 0.08);
  --line-2: rgba(42, 36, 29, 0.14);
  --glass: rgba(255, 253, 248, 0.72);
  --glass-border: rgba(42, 36, 29, 0.06);
  --shadow-1: 0 1px 2px rgba(42, 36, 29, 0.04), 0 2px 6px rgba(42, 36, 29, 0.05);
  --shadow-2: 0 4px 12px rgba(42, 36, 29, 0.08), 0 12px 32px rgba(42, 36, 29, 0.06);
  --shadow-3: 0 10px 30px rgba(0, 0, 0, 0.18), 0 30px 80px rgba(0, 0, 0, 0.18);
  --danger: #c0392b;
  --danger-2: #962d22;
  --bg-gradient-1: rgba(232, 144, 111, 0.18);
  --bg-gradient-2: rgba(136, 160, 127, 0.15);
  --header-gradient-from: rgba(250, 246, 239, 0.92);
  --header-gradient-to: rgba(250, 246, 239, 0.65);
  --noise-opacity: 0.04;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

/* DARK MODE — same tokens, inverted. Driven by [data-theme="dark"] on
   <html> which is set by app.js before first paint. Every surface is
   defined by a variable so this block is the single source of truth for
   the dark palette. */
[data-theme="dark"] {
  --cream: #14110d;
  --cream-2: #1d1914;
  --paper: #1a1611;
  --ink: #f4ede0;
  --ink-2: #cfc5b6;
  --ink-3: #94897a;
  --ink-4: #6a6155;
  --terracotta: #e8906f;
  --terracotta-2: #d17a59;
  --terracotta-soft: #c75a3d;
  --forest: #88a07f;
  --forest-2: #a3bca1;
  --forest-soft: #3e5e3a;
  --amber: #d4a341;
  --line: rgba(244, 237, 224, 0.08);
  --line-2: rgba(244, 237, 224, 0.16);
  --glass: rgba(26, 22, 17, 0.7);
  --glass-border: rgba(244, 237, 224, 0.08);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 10px 30px rgba(0, 0, 0, 0.6), 0 30px 80px rgba(0, 0, 0, 0.5);
  --bg-gradient-1: rgba(232, 144, 111, 0.10);
  --bg-gradient-2: rgba(136, 160, 127, 0.08);
  --header-gradient-from: rgba(20, 17, 13, 0.92);
  --header-gradient-to: rgba(20, 17, 13, 0.65);
  --noise-opacity: 0.05;
  color-scheme: dark;
}

/* Follow OS preference until the user clicks the toggle (which sets a
   stored value and overrides this). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --cream: #14110d;
    --cream-2: #1d1914;
    --paper: #1a1611;
    --ink: #f4ede0;
    --ink-2: #cfc5b6;
    --ink-3: #94897a;
    --ink-4: #6a6155;
    --terracotta: #e8906f;
    --terracotta-2: #d17a59;
    --terracotta-soft: #c75a3d;
    --forest: #88a07f;
    --forest-2: #a3bca1;
    --forest-soft: #3e5e3a;
    --bg-gradient-1: rgba(232, 144, 111, 0.10);
    --bg-gradient-2: rgba(136, 160, 127, 0.08);
    --header-gradient-from: rgba(20, 17, 13, 0.92);
    --header-gradient-to: rgba(20, 17, 13, 0.65);
    --noise-opacity: 0.05;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
*:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--bg-gradient-1), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, var(--bg-gradient-2), transparent 60%),
    var(--cream);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 250ms ease, color 250ms ease;
}

.noise {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.site-header {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 28px 40px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--header-gradient-from), var(--header-gradient-to));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* Sticky variant: the Level/XP/Streak/Active chips stay visible while
   scrolling, so the gamification loop is always in view. */
.site-header.site-header-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, var(--header-gradient-from), var(--header-gradient-to));
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-2));
  color: var(--cream);
  box-shadow: var(--shadow-1);
}
.brand-title {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
}
.brand-sub {
  margin: 2px 0 0; font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}

/* ============================================================
   HEADER ACTION BUTTONS — theme toggle + settings gear
   ============================================================ */
.header-actions {
  display: flex; gap: 6px; align-items: center;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 150ms;
  box-shadow: var(--shadow-1);
  padding: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn .theme-icon-dark { display: none; }
.icon-btn .theme-icon-light { display: block; }
[data-theme="dark"] .icon-btn .theme-icon-light { display: none; }
[data-theme="dark"] .icon-btn .theme-icon-dark { display: block; }

.stats { display: flex; gap: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  min-width: 72px;
  box-shadow: var(--shadow-1);
}
/* Level card is wider to fit the sub-bar + label. */
.stat.stat-level { min-width: 140px; }
.stat-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 20px; font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Level-to-next-XP sub-bar (P1.4). Makes the level number meaningful
   by showing exactly how far you are from the next promotion. */
.level-xp-track {
  width: 100%;
  height: 4px;
  background: var(--cream-2);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.level-xp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--terracotta), var(--amber));
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.level-xp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.container {
  position: relative; z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 40px 80px;
}

.case-study-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at top left, rgba(187, 104, 71, 0.16), transparent 36%),
    linear-gradient(135deg, var(--paper), var(--cream-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.case-study-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
}
.case-study-callout h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: -0.04em;
  color: var(--ink);
}
.case-study-callout p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--ink-3);
  line-height: 1.55;
}
.case-study-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.case-study-link:hover,
.case-study-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.progress-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-1);
}
.progress-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.progress-card-head h2 {
  margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
}
.progress-pct {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 700; color: var(--terracotta);
  font-variant-numeric: tabular-nums;
}
.progress-bar {
  width: 100%; height: 10px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--terracotta), var(--terracotta-soft));
  border-radius: 999px;
  width: 0%;
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-meta {
  margin: 10px 0 0; font-size: 13px; color: var(--ink-3);
}

.search-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 32px;
}
#search {
  flex: 1 1 280px;
  padding: 10px 16px;
  font: inherit;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  transition: border-color 150ms;
}
#search:focus { border-color: var(--terracotta); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 150ms;
  user-select: none;
}
.chip:hover { border-color: var(--ink-3); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

/* ============================================================
   QUALITY TIER SYSTEM (S/A/B/C) — graded on usefulness + industry weight
   ============================================================ */
:root {
  --tier-s-bg: linear-gradient(135deg, #f5d472 0%, #d4a341 50%, #b8862c 100%);
  --tier-s-text: #2a1f0a;
  --tier-s-shadow: rgba(212, 163, 65, 0.35);
  --tier-a-bg: linear-gradient(135deg, #e8e0d0 0%, #c4b9a8 50%, #9c8e7c 100%);
  --tier-a-text: #2a241d;
  --tier-a-shadow: rgba(156, 142, 124, 0.3);
  --tier-b-bg: linear-gradient(135deg, #d4a37a 0%, #b07a4d 50%, #8a5a35 100%);
  --tier-b-text: #1f1408;
  --tier-b-shadow: rgba(176, 122, 77, 0.3);
  --tier-c-bg: linear-gradient(135deg, #c5b8a8 0%, #9a8d7c 50%, #6e6457 100%);
  --tier-c-text: #faf6ef;
  --tier-c-shadow: rgba(110, 100, 87, 0.3);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 6px var(--tier-s-shadow);
  border: 1px solid rgba(0,0,0,0.08);
  cursor: help;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
.tier-badge:hover { transform: scale(1.08); }
.tier-badge-s { background: var(--tier-s-bg); color: var(--tier-s-text); box-shadow: 0 1px 2px rgba(0,0,0,0.1), 0 2px 8px var(--tier-s-shadow), inset 0 1px 0 rgba(255,255,255,0.4); }
.tier-badge-a { background: var(--tier-a-bg); color: var(--tier-a-text); box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 6px var(--tier-a-shadow), inset 0 1px 0 rgba(255,255,255,0.3); }
.tier-badge-b { background: var(--tier-b-bg); color: var(--tier-b-text); box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 6px var(--tier-b-shadow), inset 0 1px 0 rgba(255,255,255,0.3); }
.tier-badge-c { background: var(--tier-c-bg); color: var(--tier-c-text); box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 6px var(--tier-c-shadow), inset 0 1px 0 rgba(255,255,255,0.2); }

.quality-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 18px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.quality-row-label {
  display: flex; flex-direction: column; gap: 1px;
  margin-right: 4px;
}
.quality-row-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 700; color: var(--ink-2);
}
.quality-row-hint {
  font-size: 11px; color: var(--ink-3);
  font-style: italic;
}
.quality-chips { gap: 8px; }
.quality-chips .chip {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 38px;
  text-align: center;
  padding: 6px 12px;
}
.quality-chips .chip.quality-chip-s { border-color: #d4a341; }
.quality-chips .chip.quality-chip-a { border-color: #9c8e7c; }
.quality-chips .chip.quality-chip-b { border-color: #b07a4d; }
.quality-chips .chip.quality-chip-c { border-color: #6e6457; }
.quality-chips .chip.quality-chip-s.active { background: var(--tier-s-bg); color: var(--tier-s-text); border-color: #b8862c; }
.quality-chips .chip.quality-chip-a.active { background: var(--tier-a-bg); color: var(--tier-a-text); border-color: #9c8e7c; }
.quality-chips .chip.quality-chip-b.active { background: var(--tier-b-bg); color: var(--tier-b-text); border-color: #8a5a35; }
.quality-chips .chip.quality-chip-c.active { background: var(--tier-c-bg); color: var(--tier-c-text); border-color: #6e6457; }

.tier-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
  padding: 18px 20px;
  background: linear-gradient(180deg, var(--cream-2), var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.legend-item {
  display: flex; align-items: flex-start; gap: 12px;
}
.legend-item strong {
  display: block;
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.legend-item p {
  margin: 0;
  font-size: 12px; line-height: 1.45;
  color: var(--ink-3);
}
.legend-item .tier-badge { width: 32px; height: 32px; font-size: 14px; border-radius: 9px; }

.course-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.course-top .course-provider { margin-bottom: 0; }

/* Card left border accent by quality tier */
.course.quality-s { border-left: 3px solid #d4a341; }
.course.quality-a { border-left: 3px solid #9c8e7c; }
.course.quality-b { border-left: 3px solid #b07a4d; }
.course.quality-c { border-left: 3px solid #6e6457; }

@media (max-width: 640px) {
  .case-study-callout {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }
  .case-study-link { width: 100%; }
  .tier-legend { grid-template-columns: 1fr; }
  .quality-row { padding: 12px 14px; }
}

/* ============================================================
   TIER DISTRIBUTION PANEL
   ============================================================ */
.tier-distribution-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-1);
}
.tier-dist-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px;
}
.tier-dist-head h2 {
  margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
}
.tier-dist-hint {
  font-size: 12px; color: var(--ink-3); font-style: italic;
}
.tier-distribution {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.tier-stat {
  background: var(--cream-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--line);
  transition: transform 200ms, box-shadow 200ms;
}
.tier-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.tier-stat-s { border-top: 3px solid #d4a341; }
.tier-stat-a { border-top: 3px solid #9c8e7c; }
.tier-stat-b { border-top: 3px solid #b07a4d; }
.tier-stat-c { border-top: 3px solid #6e6457; }

.tier-stat-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.tier-stat-head .tier-badge { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.tier-stat-count {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.tier-stat-bar {
  width: 100%; height: 6px; background: var(--paper);
  border-radius: 999px; overflow: hidden; margin-bottom: 8px;
  border: 1px solid var(--line);
}
.tier-stat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tier-stat-s .tier-stat-fill { background: linear-gradient(90deg, #f5d472, #d4a341); }
.tier-stat-a .tier-stat-fill { background: linear-gradient(90deg, #c4b9a8, #9c8e7c); }
.tier-stat-b .tier-stat-fill { background: linear-gradient(90deg, #d4a37a, #b07a4d); }
.tier-stat-c .tier-stat-fill { background: linear-gradient(90deg, #9a8d7c, #6e6457); }
.tier-stat-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11px;
}
.tier-stat-pct {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.tier-stat-xp {
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* ============================================================
   TOP PICKS
   ============================================================ */
.top-picks {
  margin-bottom: 32px;
}
.top-picks-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.top-picks-head h2 {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--ink);
}
.top-picks-head h2 .tier-badge {
  width: 32px; height: 32px; font-size: 15px; border-radius: 9px;
}
.top-picks-hint {
  font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}
.top-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.pick-card {
  position: relative;
  background: linear-gradient(180deg, var(--paper) 0%, #fdfaf2 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform 200ms, box-shadow 200ms;
}
.pick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.pick-card.quality-s { border-left: 4px solid #d4a341; }
.pick-card.completed { background: linear-gradient(180deg, var(--paper), var(--cream-2)); }
.pick-image {
  position: relative;
  width: 100%;
  height: 120px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream-2);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: filter 200ms;
}
.pick-card:hover .pick-image { filter: brightness(1.04); }
.pick-image-img {
  max-width: 72px; max-height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.pick-image-fallback {
  width: 72px; height: 72px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
}
.pick-body {
  padding: 16px 20px 18px;
  display: flex; flex-direction: column;
  flex: 1;
}
.pick-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px; gap: 8px;
}
.pick-card-top .course-provider { margin-bottom: 0; }
.pick-card-title {
  margin: 0 0 8px; font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--ink);
}
.pick-card-desc {
  margin: 0 0 14px; font-size: 13px; color: var(--ink-2);
  line-height: 1.5; flex: 1;
}
.pick-card-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pick-card .completed-check {
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--forest); color: var(--cream);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

.tier-section { margin-bottom: 40px; }
.tier-header {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.tier-title {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
}
.tier-section[data-tier="learn"] .tier-title { color: var(--forest-2); }
.tier-section[data-tier="build"] .tier-title { color: var(--terracotta-2); }
.tier-section[data-tier="ship"]  .tier-title { color: var(--ink); }
.tier-desc {
  margin: 0; font-size: 13px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.course {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform 200ms, box-shadow 200ms, border-color 200ms;
  box-shadow: var(--shadow-1);
}
.course:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-2);
}
.course.completed {
  background: linear-gradient(180deg, var(--paper), var(--cream-2));
  border-color: var(--forest-soft);
}
.course.in-progress {
  border-color: var(--terracotta-soft);
}

/* ============================================================
   COURSE IMAGE (brand logo at top of each card)
   ============================================================ */
.course-image {
  position: relative;
  width: 100%;
  height: 96px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream-2);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: filter 200ms, transform 200ms;
}
.course:hover .course-image {
  filter: brightness(1.04);
}
.course-image:hover {
  background-color: var(--paper);
}
.course-image-img {
  max-width: 56px; max-height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08));
}
.course-image-fallback {
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.2);
}
.course-image .tier-badge {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; font-size: 11px; border-radius: 6px;
}
.course-body {
  padding: 14px 18px 16px;
  display: flex; flex-direction: column;
  flex: 1;
}

.course-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.course-title {
  margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35;
  flex: 1;
}
.course-provider {
  display: inline-block;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}
.course-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  flex: 1;
}
.course-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--cream-2);
  color: var(--ink-2);
  border-radius: 4px;
}
.tag.tag-anthropic { background: #d4a341; color: #2a241d; }
.tag.tag-free { background: #e8f0e6; color: var(--forest-2); }

.course-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.course-xp {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all 150ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-terracotta {
  background: var(--terracotta);
  color: var(--cream);
  border-color: var(--terracotta);
}
.btn-terracotta:hover { background: var(--terracotta-2); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--cream-2); }
.btn-link { background: transparent; border: none; color: var(--terracotta); padding: 0; }
.btn-link:hover { text-decoration: underline; }

.btn-open {
  background: var(--terracotta);
  color: var(--cream);
  border-color: var(--terracotta);
  font-weight: 600;
}
.btn-open:hover {
  background: var(--terracotta-2);
  border-color: var(--terracotta-2);
  color: var(--cream);
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-2);
  border-color: var(--danger-2);
}
.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.course-status {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--forest-2);
}
.course-status.in-progress { color: var(--terracotta-2); }
.course-status.not-started { color: var(--ink-4); }

.completed-check {
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--forest);
  color: var(--cream);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.achievements-section { margin-top: 60px; }
.achievements-section h2 {
  font-size: 22px; font-weight: 700; margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.achievement {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: all 200ms;
}
.achievement.unlocked {
  border-color: var(--terracotta-soft);
  background: linear-gradient(180deg, var(--paper), rgba(232, 144, 111, 0.06));
}
.achievement.locked { opacity: 0.5; }
.achievement-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--cream-2);
  border-radius: 10px;
  flex-shrink: 0;
}
.achievement.unlocked .achievement-icon {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-2));
  color: var(--cream);
}
.achievement-text { flex: 1; min-width: 0; }
.achievement-name {
  display: block;
  font-size: 13px; font-weight: 600; line-height: 1.3;
  color: var(--ink);
}
.achievement-desc {
  display: block;
  font-size: 11px; color: var(--ink-3);
  margin-top: 2px;
  line-height: 1.4;
}

/* ============================================================
   P2 — onboarding, continue card, empty states, reveal moments
   ============================================================ */
.continue-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  margin: -12px 0 32px;
  background:
    linear-gradient(135deg, rgba(199, 90, 61, 0.12), rgba(136, 160, 127, 0.10)),
    var(--paper);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--terracotta);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.continue-card[hidden] { display: none !important; }
.continue-kicker {
  display: inline-flex;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--terracotta-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.continue-copy h2 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
.continue-copy p { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; }
.continue-brand {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--continue-color, var(--terracotta)) 18%, var(--paper));
  border: 1px solid var(--line);
  overflow: hidden;
}
.continue-brand img { width: 34px; height: 34px; object-fit: contain; }
.continue-brand span {
  width: 100%; height: 100%; place-items: center;
  background: var(--continue-color, var(--terracotta));
  color: white; font-weight: 800;
}
.continue-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.empty-state {
  margin: 20px 0 40px;
  padding: 42px 24px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.empty-state[hidden] { display: none !important; }
.empty-state-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--cream-2);
  color: var(--terracotta);
  font-size: 28px;
}
.empty-state h2 { margin: 0; font-size: 20px; }
.empty-state p { margin: 8px auto 18px; max-width: 440px; color: var(--ink-3); }

.onboarding-modal {
  position: fixed; inset: 0;
  z-index: 220;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(20, 17, 13, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.onboarding-modal[hidden] { display: none !important; }
.onboarding-card {
  width: min(560px, 100%);
  padding: 30px;
  border-radius: 26px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(232, 144, 111, 0.18), transparent 70%),
    radial-gradient(420px 180px at 90% 20%, rgba(136, 160, 127, 0.16), transparent 70%),
    var(--paper);
  box-shadow: var(--shadow-3);
  animation: settings-pop 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.onboarding-kicker, .achievement-reveal-kicker {
  display: block;
  font-size: 11px;
  color: var(--terracotta-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.onboarding-card h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.05; letter-spacing: -0.04em; }
.onboarding-card p { margin: 14px 0 20px; color: var(--ink-2); line-height: 1.6; }
.onboarding-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.onboarding-steps span {
  padding: 12px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 12px;
}
.onboarding-steps strong {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--cream);
  font-family: var(--font-mono);
}
.onboarding-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.achievement-reveal {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 210;
  width: min(360px, calc(100vw - 48px));
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(212, 163, 65, 0.45);
  background: linear-gradient(135deg, var(--paper), rgba(212, 163, 65, 0.12));
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: all 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.achievement-reveal.show { opacity: 1; transform: translateY(0) scale(1); }
.achievement-reveal-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--amber), var(--terracotta));
  color: white;
  font-size: 26px;
}
.achievement-reveal strong { display: block; font-size: 15px; color: var(--ink); }
.achievement-reveal p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.4; }

.site-footer {
  position: relative; z-index: 1;
  padding: 24px 40px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(250, 246, 239, 0.6));
}

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: all 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .site-header { flex-direction: column; align-items: flex-start; padding: 20px; }
  .stats { width: 100%; flex-wrap: wrap; }
  .container { padding: 24px 20px 60px; }
  .course-grid { grid-template-columns: 1fr; }
  .stat.stat-level { min-width: 120px; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .continue-card { grid-template-columns: 1fr; }
  .continue-brand { display: none; }
  .continue-actions { justify-content: flex-start; }
  .onboarding-steps { grid-template-columns: 1fr; }
  .achievement-reveal { left: 20px; right: 20px; bottom: 84px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   SETTINGS PANEL — slide-in dialog for export/import/reset
   ============================================================ */
.settings-panel {
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(20, 17, 13, 0.55);
  display: grid; place-items: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: settings-fade 150ms ease-out;
}
@keyframes settings-fade { from { opacity: 0; } to { opacity: 1; } }
.settings-panel[hidden] { display: none !important; }
.settings-panel > * {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
  animation: settings-pop 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes settings-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.settings-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.settings-panel-head h2 {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
}
.settings-panel-hint {
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.settings-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.settings-row-text strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.settings-row-text span { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.settings-row-danger .settings-row-text strong { color: var(--danger); }
.settings-row .btn { flex-shrink: 0; }

.settings-reset-confirm {
  margin-top: 12px;
  padding: 14px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.25);
  border-radius: 10px;
}
[data-theme="dark"] .settings-reset-confirm {
  background: rgba(192, 57, 43, 0.15);
  border-color: rgba(192, 57, 43, 0.4);
}
.settings-reset-confirm p {
  margin: 0 0 8px; font-size: 12px; color: var(--ink-2);
}
.settings-reset-confirm code {
  font-family: var(--font-mono); background: var(--cream-2);
  padding: 1px 6px; border-radius: 4px; font-size: 11px;
  border: 1px solid var(--line);
}
.settings-reset-confirm input {
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-family: var(--font-mono);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  margin-bottom: 10px;
}
.settings-reset-confirm input:focus { border-color: var(--danger); }
.settings-reset-actions { display: flex; gap: 8px; justify-content: flex-end; }
