/* =============================================================================
   SILK — SQE Exam Prep App
   Main Stylesheet
   Warm light theme with dark sidebar
   ============================================================================= */

/* =============================================================================
   1. CSS Custom Properties
   ============================================================================= */

:root {
  /* Page backgrounds — warm gallery ivory, not flat white */
  --bg-page: #f9f6f0;
  --bg-card: #fffdf9;
  --bg-card-hover: #f4efe6;
  --bg-sidebar: #16120e;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: rgba(214, 171, 64, 0.13);

  /* Text — deep espresso ink ladder */
  --ink: #181410;
  --ink-2: #46403a;
  --ink-3: #948a7f;
  --ink-4: #c2bab0;
  --ink-sidebar: rgba(255, 252, 245, 0.88);
  --ink-sidebar-muted: rgba(255, 252, 245, 0.44);

  /* Accent: Gold — single hue, richer treatments */
  --gold: #c8993a;
  --gold-dark: #a87c28;
  --gold-deep: #8a6420;
  --gold-light: #f6ead0;
  --gold-pale: #fbf4e4;
  --gold-border: rgba(200, 153, 58, 0.32);
  --gold-grad: linear-gradient(180deg, #d8ab4c 0%, #c8993a 55%, #b88a30 100%);
  --gold-grad-hover: linear-gradient(180deg, #e2b758 0%, #d2a344 55%, #c29438 100%);

  /* Semantic colours */
  --green: #257548;
  --green-light: #e7f4ec;
  --red: #b73529;
  --red-light: #fcebe8;
  --blue: #2b5fad;
  --blue-light: #e8eef8;
  --amber: #cf6f06;
  --amber-light: #fdf2d7;

  /* Borders — hairlines, warm */
  --border: #eae3d7;
  --border-strong: #d5ccbe;
  --hairline: rgba(24, 20, 16, 0.07);

  /* Shadows — warm-tinted, layered key + ambient light */
  --shadow-sm: 0 1px 2px rgba(58, 46, 28, 0.05), 0 1px 4px rgba(58, 46, 28, 0.05);
  --shadow-md: 0 2px 4px rgba(58, 46, 28, 0.05), 0 8px 24px rgba(58, 46, 28, 0.09);
  --shadow-lg: 0 4px 8px rgba(58, 46, 28, 0.06), 0 20px 48px rgba(58, 46, 28, 0.13);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);          /* smooth deceleration */
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);  /* gentle overshoot */

  /* Border radius */
  --r: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Stage colours */
  --stage-trainee: #64748b;
  --stage-associate: #059669;
  --stage-senior: #2563eb;
  --stage-partner: #7c3aed;
  --stage-silk: #c8993a;

  /* ── Legacy aliases (backwards compat for older templates) ── */
  --bg-void: #f9f6f0;
  --bg-base: #f4efe6;
  --bg-surface: #fffdf9;
  --bg-raised: #f4efe6;
  --bg-hover: #ede7db;
  --text-primary: #181410;
  --text-secondary: #46403a;
  --text-muted: #948a7f;
  --gold-bright: #c8993a;
  --gold-dim: #f5e9cc;
  --gold-border: rgba(200, 153, 58, 0.3);
  --crimson: #c0392b;
  --crimson-bright: #e74c3c;
  --green-bright: #2a7a4f;
  --amber-bright: #d97706;
  --blue-bright: #2b5fad;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 16px rgba(26,23,20,0.1);

  /* ── Design tokens (2026-05 polish pass) ─────────────────────────── */
  /* Spacing scale — use these everywhere, nothing else. */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;

  /* Typography scale */
  --font-page-title:    700 2.5rem/1.1   'Cormorant Garamond', 'Instrument Serif', serif;
  --font-section-title: 600 1.8rem/1.2   'Cormorant Garamond', 'Instrument Serif', serif;
  --font-card-title:    500 1.3rem/1.3   'Cormorant Garamond', 'Instrument Serif', serif;
  --font-body:          400 1rem/1.6     'Inter', sans-serif;
  --font-caption:       400 0.875rem/1.5 'Inter', sans-serif;
  --font-mono:          500 0.875rem/1.4 'JetBrains Mono', monospace;

  /* Premium card hover */
  --shadow-gold: 0 8px 28px rgba(200,153,58,0.18);
  --shadow-gold-strong: 0 10px 36px rgba(200,153,58,0.30);
}


/* ── Global polish: page fade-in + warm radial gradient backdrop ─────── */
/* The real body block (background-color + gradients + typography) lives
   further down. This one only carries the page fade-in animation so we
   don't fight with the shorthand `background:` reset that comes later. */
body {
  animation: silk-fade-in 0.15s ease-in;
}
@keyframes silk-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Page heading hierarchy — apply via class or :where() to avoid stomping
   existing :is rules. Templates that need precision keep their inline
   styles; the rest inherit the typography ladder. */
.page-title    { font: var(--font-page-title);    color: var(--text-primary); margin: 0 0 var(--space-3); }
.section-title { font: var(--font-section-title); color: var(--text-primary); margin: 0 0 var(--space-3); }
.card-title    { font: var(--font-card-title);    color: var(--text-primary); margin: 0 0 var(--space-2); }
.caption       { font: var(--font-caption);       color: var(--text-muted); }
.mono          { font: var(--font-mono); }

/* Default card hover lift for any element opting in via .silk-card.
   Existing per-template card classes are unaffected — opt-in only. */
.silk-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.silk-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

/* Three canonical button types — opt-in via .btn-silk-*. */
.btn-silk-primary {
  background: var(--gold-grad);
  color: #fff;
  border: 1px solid rgba(138, 100, 32, 0.65);
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
              0 1px 2px rgba(138, 100, 32, 0.25);
  text-shadow: 0 1px 1px rgba(110, 78, 22, 0.25);
}
.btn-silk-primary:hover  { background: var(--gold-grad-hover); color: #fff; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 14px rgba(178,130,44,0.35); }
.btn-silk-primary:active { transform: translateY(1px) scale(0.99); }
.btn-silk-ghost {
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid var(--gold-border);
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-silk-ghost:hover { background: rgba(200,153,58,0.08); }
.btn-silk-danger {
  background: var(--crimson);
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ── Mobile touch targets — minimum 48×48 ────────────────────────────── */
@media (max-width: 768px) {
  .nav-item,
  .mob-nav-item,
  .btn-primary,
  .btn-ghost,
  .btn-silk-primary,
  .btn-silk-ghost {
    min-height: 48px;
  }
  /* Practice areas grid → single column on phones (Priya P0) */
  .areas-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-3) !important;
  }
}

/* ── Breadcrumb partial styles ──────────────────────────────────────── */
.silk-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  flex-wrap: wrap;
}
.silk-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.silk-breadcrumb a:hover { color: var(--gold-bright); }
.silk-breadcrumb .sep { color: var(--ink-4); }
.silk-breadcrumb .here { color: var(--text-secondary); font-weight: 500; }

/* ── Sidebar active link weight (pill treatment lives in section 3) ── */
.sidebar-nav .nav-item.active .nav-label {
  font-weight: 600;
}

/* ── Verify-email banner (PART 5) ────────────────────────────────────── */
.verify-email-banner {
  margin: var(--space-3) auto var(--space-4);
  max-width: 100%;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, rgba(200,153,58,0.10), rgba(200,153,58,0.04));
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-family: 'Inter', sans-serif;
  color: var(--text-secondary);
}

/* ── SRA disclaimer + global footer (PART 3 legal pass) ──────────────── */
.sra-disclaimer {
  text-align: center;
  padding: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: var(--space-7);
}
.silk-footer {
  padding: var(--space-4) var(--space-3) var(--space-6);
  text-align: center;
  font-family: 'Inter', sans-serif;
}
.silk-footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  font-size: 12px;
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.silk-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.silk-footer-links a:hover { color: var(--gold-bright); }
.silk-footer-sep { color: var(--ink-4); }
.silk-footer-copyright {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Streak counter glow when streak > 7 ───────────────────────────── */
.sidebar-streak.streak-hot .streak-count {
  color: var(--gold-bright);
  text-shadow: 0 0 12px rgba(200,153,58,0.5);
}

/* ── Dashboard hero glow pulse (Priya wanted "Your Next Step" unmissable) ── */
.hero-card.glow {
  border: 2px solid var(--gold-bright) !important;
  box-shadow: 0 0 0 4px rgba(200,153,58,0.10), var(--shadow-gold);
  animation: silk-hero-pulse 3s ease-in-out infinite;
}
@keyframes silk-hero-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(200,153,58,0.10), var(--shadow-gold); }
  50%      { box-shadow: 0 0 0 8px rgba(200,153,58,0.18), var(--shadow-gold-strong); }
}

/* ── Stage promotion full-screen celebration ────────────────────────── */
.stage-celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,7,13,0.92);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: var(--space-5);
  animation: silk-fade-in 0.3s ease-in;
}
.stage-celebration-overlay.visible { display: flex; }
.stage-celebration-title {
  font-family: 'Cormorant Garamond', 'Instrument Serif', serif;
  font-size: 3rem; font-weight: 700;
  color: var(--gold-bright);
  margin: 0 0 var(--space-3);
}
.stage-celebration-sub {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin: 0 0 var(--space-6);
}
/* Pure-CSS confetti — 24 dots fall from above the viewport */
.silk-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.silk-confetti i {
  position: absolute;
  top: -10vh;
  width: 8px; height: 14px;
  background: var(--gold-bright);
  opacity: 0.85;
  animation: silk-confetti-fall 2.4s linear infinite;
}
.silk-confetti i:nth-child(2n)  { background: #d6a84a; width: 6px; height: 10px; }
.silk-confetti i:nth-child(3n)  { background: #f4d378; }
.silk-confetti i:nth-child(4n)  { background: #ffffff; opacity: 0.4; }
@keyframes silk-confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(120vh) rotate(720deg); }
}


/* =============================================================================
   2. Reset & Base
   ============================================================================= */

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

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

body {
  /* Note: do NOT use the shorthand `background:` here — it would reset
     the background-image radial gradients defined further up. Use the
     explicit longhand properties so both colour AND gradient apply. */
  background-color: var(--bg-page);
  background-image:
    radial-gradient(ellipse 60% 45% at 12% -5%,  rgba(212, 168, 67, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 88% 105%, rgba(140, 88, 40, 0.045) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 70% 20%,  rgba(255, 252, 245, 0.65) 0%, transparent 65%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv05', 'cv11', 'ss01';
}

/* Text selection in brand gold */
::selection {
  background: rgba(200, 153, 58, 0.28);
  color: var(--ink);
}

/* Refined thin scrollbars, warm-toned */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2.5px solid var(--bg-page);
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* Respect users who turn motion off */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Headings */
h1, h2, h3, h4 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 600;
  line-height: 1.22;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: 40px; }
h2 { font-size: 32px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }

h5, h6 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

/* Display class */
.display {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 60px;
  font-weight: 700;
  line-height: 1.1;
}

/* Mono class */
.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Links */
a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--gold-dark);
}

/* Paragraphs */
p {
  line-height: 1.7;
}

/* Lists */
ul, ol {
  padding-left: 1.4em;
}

/* Images */
img {
  max-width: 100%;
  display: block;
}

/* HR */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* Code */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--bg-card-hover);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink-2);
}

pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  overflow-x: auto;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}


/* =============================================================================
   3. Sidebar (dark)
   ============================================================================= */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background:
    radial-gradient(ellipse 90% 30% at 50% 0%, rgba(214, 171, 64, 0.07) 0%, transparent 70%),
    linear-gradient(180deg, #1a1510 0%, #16120e 40%, #131008 100%);
  border-right: 1px solid rgba(214, 171, 64, 0.14);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s var(--ease);
}

/* Gold hairline glow along the very top of the rail */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(214, 171, 64, 0.55), transparent);
  pointer-events: none;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* Logo — serif wordmark with gilded sheen */
.sidebar-logo,
.sidebar-logo-section {
  padding: 22px 20px 18px;
  display: block;
  flex-shrink: 0;
}

.sidebar-logo-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-logo .logo-mark,
.sidebar-logo-text {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.30em;
  display: block;
  line-height: 1.15;
  background: linear-gradient(105deg, #e8c878 0%, #c8993a 45%, #e8c878 80%, #b88a30 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold);
}

.sidebar-logo .logo-sub,
.sidebar-logo-tagline {
  font-size: 9.5px;
  color: var(--ink-sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

/* User info */
.sidebar-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0d9a0;
  background: linear-gradient(145deg, rgba(214, 171, 64, 0.28), rgba(214, 171, 64, 0.10));
  border: 1px solid rgba(214, 171, 64, 0.35);
  text-transform: uppercase;
}

.sidebar-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar-user-stage {
  font-size: 11px;
  color: var(--ink-sidebar-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 3px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-sidebar-muted);
  padding: 12px 20px 4px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin: 1px 10px;
  color: var(--ink-sidebar-muted);
  font-size: 13.5px;
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--ink-sidebar);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #e2bb5e;
  box-shadow: inset 0 0 0 1px rgba(214, 171, 64, 0.22);
}

.nav-item.active .nav-icon {
  color: #e2bb5e;
  opacity: 1;
}

.nav-icon {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity 0.16s var(--ease);
}

.nav-item:hover .nav-icon { opacity: 1; }

.nav-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
}

/* Sidebar bottom */
.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-streak {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-sidebar-muted);
  margin-bottom: 12px;
}

.sidebar-streak .streak-num {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-sidebar);
  font-size: 15px;
  font-weight: 600;
}

/* Plan badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}

.plan-scholar {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.plan-free {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-sidebar-muted);
}


/* =============================================================================
   4. Main Content Area
   ============================================================================= */

.main-content {
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
  background: var(--bg-page);
}

/* Page header — dark gilded band shared by every app page.
   Mirrors the dashboard banner so the whole product reads as one room. */
.page-header {
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  padding: 26px 30px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 130% at 88% -20%, rgba(214,171,64,0.16) 0%, transparent 60%),
    linear-gradient(120deg, #1a1510 0%, #16120c 55%, #131008 100%);
  border: 1px solid rgba(214, 171, 64, 0.28);
  box-shadow: 0 14px 38px rgba(30, 22, 8, 0.24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header::before {
  content: '';
  position: absolute;
  right: -150px; top: 50%;
  transform: translateY(-50%);
  width: 380px; height: 380px;
  border-radius: 50%;
  border: 1px solid rgba(214,171,64,0.16);
  box-shadow:
    0 0 0 42px rgba(214,171,64,0.04),
    0 0 0 43px rgba(214,171,64,0.09),
    0 0 0 100px rgba(214,171,64,0.02);
  pointer-events: none;
}

.page-header > * { position: relative; z-index: 1; }

.page-header .page-title,
.page-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 30px;
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.page-header .page-title {
  background: linear-gradient(100deg, #f5e3b5 0%, #e2bb5e 45%, #f0d089 70%, #d8ab4c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #e2bb5e;
}

.page-subtitle,
.page-sub {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.5;
}

.page-header .page-subtitle,
.page-header .page-sub {
  color: rgba(255, 252, 245, 0.58);
  margin: 0;
}


/* =============================================================================
   5. Cards
   ============================================================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card-sm {
  padding: 16px;
}

.card-lg {
  padding: 32px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.card-subtitle {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 2px;
}

.card-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Stat card variant */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.stat-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.stat-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}


/* =============================================================================
   6. Buttons
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), transform 0.12s var(--ease),
              box-shadow 0.18s var(--ease);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn:active { transform: translateY(1px) scale(0.99); }

/* Primary — gold gradient with inner top light, like pressed metal */
.btn-primary {
  background: var(--gold-grad);
  color: #fff;
  border-color: rgba(138, 100, 32, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
              0 1px 2px rgba(138, 100, 32, 0.25);
  text-shadow: 0 1px 1px rgba(110, 78, 22, 0.25);
}

.btn-primary:hover {
  background: var(--gold-grad-hover);
  border-color: rgba(138, 100, 32, 0.65);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3),
              0 4px 14px rgba(178, 130, 44, 0.35);
}

/* Secondary — gold outline / light fill */
.btn-secondary {
  background: var(--gold-pale);
  color: var(--gold-deep);
  border-color: var(--gold-border);
}

.btn-secondary:hover {
  background: var(--gold-light);
  color: var(--gold-deep);
  border-color: var(--gold);
}

/* Ghost — neutral outline */
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

/* Danger */
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}

/* Sizes */
.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
}

/* Disabled */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon-only button */
.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  padding: 6px;
}


/* =============================================================================
   7. Badges / Pills
   ============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-gold {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.badge-green {
  background: var(--green-light);
  color: var(--green);
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

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

.badge-neutral {
  background: var(--bg-card-hover);
  color: var(--ink-3);
}

/* Stage badges */
.stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.stage-trainee {
  background: #f1f5f9;
  color: var(--stage-trainee);
}

.stage-associate {
  background: #ecfdf5;
  color: var(--stage-associate);
}

.stage-senior {
  background: #eff6ff;
  color: var(--stage-senior);
}

.stage-partner {
  background: #f5f3ff;
  color: var(--stage-partner);
}

.stage-silk {
  background: var(--gold-light);
  color: var(--gold-dark);
}


/* =============================================================================
   8. Progress Bars
   ============================================================================= */

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: var(--r-pill);
  transition: width 0.6s ease;
  min-width: 0;
}

.progress-fill.fill-green {
  background: var(--green);
}

.progress-fill.fill-blue {
  background: var(--blue);
}

.progress-fill.fill-red {
  background: var(--red);
}

/* Larger progress variant */
.progress-track-lg {
  height: 10px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.progress-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-3);
}


/* =============================================================================
   9. Forms / Inputs
   ============================================================================= */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-card);
  font-family: 'Inter', system-ui, sans-serif;
  transition: all 0.15s;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}

.form-control::placeholder {
  color: var(--ink-4);
}

.form-control:hover {
  border-color: var(--border-strong);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 153, 58, 0.12);
}

.form-control:disabled {
  background: var(--bg-page);
  color: var(--ink-3);
  cursor: not-allowed;
}

.form-control.error {
  border-color: var(--red);
}

.form-control.error:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9087' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Checkbox and radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.form-check-label {
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}


/* =============================================================================
   10. Flash / Toasts
   ============================================================================= */

.flash-container {
  padding: 0 32px;
  margin-bottom: 16px;
}

.flash {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--r);
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.flash-success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid var(--green);
}

.flash-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid var(--red);
}

.flash-warning {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid var(--amber);
}

.flash-info {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue);
}

.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: inherit;
  opacity: 0.6;
  padding: 0 0 0 12px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.flash-close:hover {
  opacity: 1;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 14px;
  color: #fff;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.3s ease;
  pointer-events: auto;
  max-width: 320px;
  line-height: 1.5;
}

.toast-success {
  background: var(--green);
}

.toast-error {
  background: var(--red);
}

.toast-info {
  background: var(--blue);
}

.toast-warning {
  background: var(--amber);
}


/* =============================================================================
   11. Table
   ============================================================================= */

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  background: var(--bg-page);
  white-space: nowrap;
}

.table td {
  font-size: 14px;
  color: var(--ink-2);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--bg-card-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Table inside a card */
.card .table {
  margin: -24px;
  width: calc(100% + 48px);
}

.card .table th:first-child,
.card .table td:first-child {
  padding-left: 24px;
}

.card .table th:last-child,
.card .table td:last-child {
  padding-right: 24px;
}


/* =============================================================================
   12. Skip link & Accessibility
   ============================================================================= */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--gold);
  color: #fff;
  padding: 8px 16px;
  z-index: 9999;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}


/* =============================================================================
   13. Animations & Keyframes
   ============================================================================= */

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

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-in {
  animation: fadeInUp 0.3s ease;
}

.spinner {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* XP float animation */
.xp-float {
  position: fixed;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  pointer-events: none;
  z-index: 9999;
  animation: xpFloat 1.4s ease forwards;
}

@keyframes xpFloat {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px);
  }
}


/* =============================================================================
   14. Sidebar-collapsed state
   ============================================================================= */

body.sidebar-collapsed .sidebar {
  transform: translateX(-240px);
}

body.sidebar-collapsed .main-content {
  margin-left: 0;
}


/* =============================================================================
   15. Utility Classes
   ============================================================================= */

/* Layout */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-baseline { align-items: baseline; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

/* Gap */
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Margin top */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-28 { margin-top: 28px; }
.mt-32 { margin-top: 32px; }

/* Margin bottom */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-28 { margin-bottom: 28px; }
.mb-32 { margin-bottom: 32px; }

/* Padding */
.p-8  { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Display */
.hidden { display: none !important; }
.block  { display: block; }
.inline { display: inline; }

/* Typography */
.text-xs   { font-size: 11px; }
.text-sm   { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 18px; }

.font-mono  { font-family: 'JetBrains Mono', monospace; }
.font-serif { font-family: 'Instrument Serif', Georgia, serif; }
.font-sans  { font-family: 'Inter', system-ui, sans-serif; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.uppercase  { text-transform: uppercase; letter-spacing: 0.05em; }
.capitalize { text-transform: capitalize; }

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

.whitespace-nowrap { white-space: nowrap; }

.leading-tight   { line-height: 1.25; }
.leading-normal  { line-height: 1.6; }
.leading-relaxed { line-height: 1.7; }

/* Colour utilities */
.text-gold  { color: var(--gold); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-blue  { color: var(--blue); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--ink-3); }
.text-ink2  { color: var(--ink-2); }
.text-ink   { color: var(--ink); }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
  border: none;
}

.divider-vertical {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

/* Border radius */
.rounded      { border-radius: var(--r); }
.rounded-lg   { border-radius: var(--r-lg); }
.rounded-xl   { border-radius: var(--r-xl); }
.rounded-full { border-radius: var(--r-pill); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

/* Position helpers */
.relative { position: relative; }
.absolute { position: absolute; }


/* =============================================================================
   16. Mobile Responsive
   ============================================================================= */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-240px);
    box-shadow: var(--shadow-lg);
  }

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

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .flash-container {
    padding: 0 16px;
  }

  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  h3 { font-size: 22px; }
}

@media (max-width: 600px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .display {
    font-size: 40px;
  }

  .page-title {
    font-size: 24px;
  }

  .card {
    padding: 16px;
  }

  .btn-lg {
    padding: 11px 20px;
    font-size: 14px;
  }

  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
}


/* =============================================================================
   17. Mobile Sidebar Overlay
   ============================================================================= */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.5);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

.sidebar-overlay.visible {
  display: block;
}

/* Mobile nav toggle button */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  color: var(--ink-2);
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.nav-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }
}


/* =============================================================================
   18. Question / Quiz UI
   ============================================================================= */

/* Answer option */
.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease),
              color 0.16s var(--ease), transform 0.16s var(--ease),
              box-shadow 0.16s var(--ease);
  background: var(--bg-card);
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}

.answer-option:hover {
  border-color: var(--gold-border);
  background: var(--gold-pale);
  color: var(--ink);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}

.answer-option.selected {
  border-color: var(--gold);
  background: var(--gold-light);
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 153, 58, 0.14), var(--shadow-sm);
}

.answer-option.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.answer-option.incorrect {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

.answer-option.disabled {
  cursor: default;
  pointer-events: none;
}

.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  transition: all 0.15s;
  color: var(--ink-3);
}

.answer-option.selected .answer-letter {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.answer-option.correct .answer-letter {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.answer-option.incorrect .answer-letter {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

/* Question stem */
.question-stem {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.65;
  margin-bottom: 20px;
}

/* Explanation box */
.explanation-box {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.65;
}

.explanation-box.correct-box {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}

.explanation-box.incorrect-box {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}


/* =============================================================================
   19. Empty States
   ============================================================================= */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-3);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--ink-3);
  max-width: 320px;
  margin: 0 auto 20px;
  line-height: 1.6;
}


/* =============================================================================
   20. Loading States
   ============================================================================= */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg-card-hover) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 22px;
  border-radius: 4px;
  margin-bottom: 12px;
  width: 60%;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--ink-3);
  gap: 10px;
  font-size: 14px;
}


/* =============================================================================
   21. Modals / Dialogs
   ============================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0;
}

.modal-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  color: var(--ink);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--ink-3);
  padding: 4px;
  line-height: 1;
  border-radius: var(--r);
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--ink);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}


/* =============================================================================
   22. Tabs
   ============================================================================= */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--ink-2);
  border-bottom-color: var(--border-strong);
}

.tab-item.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}


/* =============================================================================
   23. Avatar
   ============================================================================= */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* =============================================================================
   24. Tooltips
   ============================================================================= */

[data-tooltip] {
  position: relative;
  cursor: default;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  font-family: 'Inter', system-ui, sans-serif;
}

[data-tooltip]:hover::after {
  opacity: 1;
}


/* =============================================================================
   25. Highlighted text / inline callouts
   ============================================================================= */

.highlight {
  background: var(--gold-light);
  color: var(--gold-dark);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 500;
}

.highlight-green {
  background: var(--green-light);
  color: var(--green);
}

.highlight-red {
  background: var(--red-light);
  color: var(--red);
}

.highlight-blue {
  background: var(--blue-light);
  color: var(--blue);
}

/* =============================================================================
   Mobile Top Bar & Bottom Nav
   ============================================================================= */

.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: linear-gradient(180deg, #1a1510, #16120e);
  border-bottom: 1px solid rgba(214, 171, 64, 0.18);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
}

.mobile-menu-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: all 0.2s;
}

.mobile-topbar-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.28em;
  background: linear-gradient(105deg, #e8c878, #c8993a 50%, #e8c878);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-bright, #c8993a);
}

.mobile-topbar-streak {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-family: 'Inter', sans-serif;
}

/* Bottom navigation for mobile */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 62px;
  background: linear-gradient(180deg, #18130e, #131008);
  border-top: 1px solid rgba(214, 171, 64, 0.18);
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(12px);
}
.mob-nav-item .mob-nav-icon svg { width: 20px; height: 20px; stroke-width: 1.7; }

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.45);
  transition: color 0.15s;
  min-width: 44px;
}
.mob-nav-item.active { color: var(--gold-bright, #c8993a); }
.mob-nav-item:hover { color: rgba(255,255,255,0.8); }
.mob-nav-icon { font-size: 20px; line-height: 1; }
.mob-nav-label { font-size: 10px; font-family: 'Inter', sans-serif; font-weight: 500; }

@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  .mobile-bottom-nav { display: flex; }

  .main-content {
    padding-top: 68px !important;
    padding-bottom: 72px !important;
  }

  /* Sidebar slides in over content */
  .sidebar {
    top: 0;
    z-index: 150;
  }
}

@media (max-width: 600px) {
  /* Tighter cards on small screens */
  .stat-card, .card { padding: 14px; }

  /* Squeeze inline grids */
  .stats-grid,
  .criteria-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Stack any two-col layouts */
  .two-col { grid-template-columns: 1fr !important; }

  /* Smaller headings */
  .page-title { font-size: 22px !important; }
}

/* ── Trial banner ──────────────────────────────────────────────────────────
   Sits above the flash region on every authenticated page. Three states:
   calm for most of the trial, urgent in the last two days, and a firm
   prompt once it has ended and content is locked. */
.trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  background: rgba(200, 153, 58, 0.10);
  border-bottom: 1px solid rgba(200, 153, 58, 0.30);
  color: var(--text-primary, #2a2420);
}
.trial-banner strong { font-weight: 650; }
.trial-banner a {
  flex-shrink: 0;
  font-weight: 650;
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 15px;
  border-radius: 20px;
  border: 1.5px solid currentColor;
  color: inherit;
  transition: background .15s ease;
}
.trial-banner a:hover { background: rgba(0, 0, 0, 0.06); }
.trial-banner.urgent {
  background: rgba(200, 153, 58, 0.20);
  border-bottom-color: rgba(200, 153, 58, 0.55);
}
.trial-banner.ended {
  background: rgba(168, 58, 46, 0.10);
  border-bottom-color: rgba(168, 58, 46, 0.38);
  color: #8c2f26;
}
@media (max-width: 560px) {
  .trial-banner { padding: 10px 16px; font-size: 12.5px; }
  .trial-banner a { font-size: 12px; padding: 4px 12px; }
}
