/**
 * Liberty Budget × Duolingo Design System
 * 
 * Unifies the dignified Liberty Navy (#162238) and Warm Gold (#C5A059)
 * with Duolingo's tactile 3D bevels, 2px borders, bouncy micro-interactions,
 * and high-contrast game counters.
 */

:root {
  /* Core Liberty Palette */
  --dl-navy: #162238;
  --dl-navy-deep: #0e1726;
  --dl-navy-light: #1e304f;
  --dl-navy-soft: #e8edf5;

  --dl-gold: #c5a059;
  --dl-gold-deep: #967432;
  --dl-gold-bright: #d4af37;
  --dl-gold-soft: #faf3e3;

  --dl-patina: #1e8275;
  --dl-patina-deep: #156157;
  --dl-patina-soft: #e6f4f1;

  --dl-coral: #e58a2e;
  --dl-coral-deep: #c2410c;
  --dl-coral-soft: #fdf0e2;

  /* Dignified success color replaces neon green */
  --dl-green: #1e8275;
  --dl-green-deep: #156157;
  --dl-green-soft: #e6f4f1;

  --dl-orange: #e06d00;
  --dl-orange-deep: #b35600;
  --dl-orange-soft: #fff3d9;

  --dl-red: #c92a2a;
  --dl-red-deep: #9e1c1c;
  --dl-red-soft: #fee2e2;

  --dl-blue: #23527c;
  --dl-blue-deep: #163857;
  --dl-blue-soft: #eaf1f8;

  --dl-parchment: #f7f6f2;
  --dl-surface: #ffffff;
  --dl-border: #e5e2d9;
  --dl-border-depth: #ddd9ce;

  --dl-ink: #121826;
  --dl-muted: #5a6578;
  --dl-faint: #8f9bb3;

  /* Typography */
  --dl-font-display: 'Fraunces', Georgia, serif;
  --dl-font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --dl-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Tactile 3D Buttons (Duolingo Tactile Feel in Liberty Palette)
   ========================================================================== */
.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--dl-font-heading);
  font-weight: 800;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  text-decoration: none !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  line-height: 1;
}

.dl-btn-gold,
.dl-btn-green,
.dl-btn-primary {
  background-color: var(--dl-gold);
  border-color: var(--dl-gold-deep);
  color: var(--dl-navy-deep) !important;
  box-shadow: 0 4px 0 0 var(--dl-gold-deep);
}
.dl-btn-gold:hover,
.dl-btn-green:hover,
.dl-btn-primary:hover {
  background-color: #d4af37;
  color: var(--dl-navy-deep) !important;
}
.dl-btn-gold:active,
.dl-btn-green:active,
.dl-btn-primary:active {
  box-shadow: 0 1px 0 0 var(--dl-gold-deep);
}

/* Navy (Dignified / Action) */
.dl-btn-navy {
  background-color: var(--dl-navy);
  border-color: var(--dl-navy);
  color: #ffffff;
  box-shadow: 0 4px 0 0 var(--dl-navy-deep);
}
.dl-btn-navy:active {
  box-shadow: 0 1px 0 0 var(--dl-navy-deep);
}

/* Outline / Surface */
.dl-btn-outline {
  background-color: #ffffff;
  border-color: var(--dl-border);
  color: var(--dl-ink);
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
}
.dl-btn-outline:active {
  box-shadow: 0 1px 0 0 var(--dl-border-depth);
}

/* Disabled */
.dl-btn:disabled, .dl-btn.is-disabled {
  background-color: #e5e5e5 !important;
  border-color: #e5e5e5 !important;
  color: #a3a3a3 !important;
  box-shadow: 0 4px 0 0 #cccccc !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* ==========================================================================
   Chunky 3D Cards
   ========================================================================== */
.dl-card {
  background: #ffffff;
  border: 2px solid var(--dl-border);
  border-radius: 20px;
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.dl-card-pressable {
  cursor: pointer;
}
.dl-card-pressable:hover {
  border-color: var(--dl-gold);
}
.dl-card-pressable:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 0 var(--dl-border-depth);
}

/* ==========================================================================
   Top HUD Bar (Streak, Freedom XP, Level)
   ========================================================================== */
.dl-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.2rem;
  background: rgba(247, 246, 242, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--dl-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.dl-hud-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--dl-font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.dl-hud-stat:hover {
  background: rgba(22, 34, 56, 0.05);
}
.dl-hud-stat:active {
  transform: scale(0.96);
}

.dl-hud-streak { color: var(--dl-orange); }
.dl-hud-gems { color: var(--dl-blue); }
.dl-hud-hearts { color: var(--dl-red); }
.dl-hud-level { color: var(--dl-navy); }

/* ==========================================================================
   Animated Nodes & Micro-Interactions
   ========================================================================== */
@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.dl-float-bob {
  animation: floatBob 2.2s ease-in-out infinite;
}

@keyframes ringPulse {
  0% { box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(197, 160, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(197, 160, 89, 0); }
}
.dl-ring-pulse {
  animation: ringPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes nodePop {
  0% { transform: scale(0.7); opacity: 0; }
  75% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.dl-node-pop {
  animation: nodePop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

@keyframes barGrow {
  from { width: 0; }
}
.dl-bar-grow {
  animation: barGrow 0.75s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* ==========================================================================
   Serpentine Path Trail Styles
   ========================================================================== */
.dl-path-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
  display: flex;
  flex-direction: column;
}

.dl-unit-banner {
  border-radius: 18px;
  padding: 1rem 1.25rem;
  color: #ffffff;
  margin-bottom: 2rem;
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dl-unit-banner-navy {
  background: var(--dl-navy);
  box-shadow: 0 4px 0 0 var(--dl-navy-deep);
}
.dl-unit-banner-patina {
  background: var(--dl-patina);
  box-shadow: 0 4px 0 0 var(--dl-patina-deep);
}
.dl-unit-banner-gold {
  background: var(--dl-gold);
  box-shadow: 0 4px 0 0 var(--dl-gold-deep);
}

.dl-node-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2.25rem;
}

.dl-node-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.12s ease;
  user-select: none;
}
.dl-node-btn:hover {
  filter: brightness(1.08);
}
.dl-node-btn:active {
  transform: translateY(3px) !important;
}

.dl-node-btn.is-completed {
  background: var(--dl-gold);
  box-shadow: 0 5px 0 0 var(--dl-gold-deep);
  color: #ffffff;
}
.dl-node-btn.is-completed:active {
  box-shadow: 0 2px 0 0 var(--dl-gold-deep);
}

.dl-node-btn.is-current {
  background: var(--dl-gold);
  box-shadow: 0 5px 0 0 var(--dl-gold-deep);
  color: #162238;
}
.dl-node-btn.is-current:active {
  box-shadow: 0 2px 0 0 var(--dl-gold-deep);
}

.dl-node-btn.is-locked {
  background: #e5e5e5;
  box-shadow: 0 5px 0 0 #c8c8c8;
  color: #afafaf;
  cursor: not-allowed;
}

.dl-node-bubble {
  position: absolute;
  top: -46px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dl-node-bubble-pill {
  background: #ffffff;
  border: 2px solid var(--dl-green);
  color: var(--dl-green);
  font-family: var(--dl-font-heading);
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(21, 97, 87, 0.25);
  white-space: nowrap;
}
.dl-node-bubble-arrow {
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-bottom: 2px solid var(--dl-green);
  border-right: 2px solid var(--dl-green);
  transform: translateY(-6px) rotate(45deg);
  border-radius: 2px;
}

.dl-node-label {
  margin-top: 0.55rem;
  max-width: 120px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--dl-ink);
  line-height: 1.25;
}
.dl-node-label.is-locked {
  color: var(--dl-faint);
}

/* ==========================================================================
   Donut Pacing Ring & Chunky Envelopes
   ========================================================================== */
.dl-pacing-ring-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: 20px;
  background: #ffffff;
  border: 2px solid var(--dl-border);
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  margin-bottom: 1.25rem;
}

.dl-ring-svg {
  width: 130px;
  height: 130px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.dl-envelope-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #ffffff;
  border: 2px solid var(--dl-border);
  border-radius: 18px;
  box-shadow: 0 3px 0 0 var(--dl-border-depth);
  margin-bottom: 0.75rem;
  transition: transform 0.1s ease;
}
.dl-envelope-row:hover {
  border-color: #cbd5e1;
}

.dl-envelope-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.25rem;
}

.dl-progress-track {
  height: 12px;
  background: #f0f0ee;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.4rem 0 0.25rem;
}

.dl-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

/* ==========================================================================
   Sidebar Quests & Badges
   ========================================================================== */
.dl-badge-gold {
  background: #FAF3DE !important;
  color: #8A6A00 !important;
  border: 1.5px solid #E2CA85 !important;
  font-weight: 800 !important;
  border-radius: 999px !important;
  padding: 3px 10px !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.04em;
}

.dl-badge-teal {
  background: #E6F5F3 !important;
  color: #156157 !important;
  border: 1.5px solid #9FD5CD !important;
  font-weight: 800 !important;
  border-radius: 999px !important;
  padding: 3px 10px !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.04em;
}

.dl-xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFF8E1;
  border: 1.5px solid #FFD54F;
  color: #B78103;
  font-family: var(--dl-font-heading);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.dl-quest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: #ffffff;
  border: 2px solid #EFEFEF;
  border-radius: 14px;
  box-shadow: 0 3px 0 0 #E2E2E2;
  margin-bottom: 0.65rem;
  transition: transform 0.08s ease;
}
.dl-quest-row:hover {
  transform: translateY(-1px);
  border-color: #E2CA85;
}

/* ==========================================================================
   Blog & Article System (Duo-Liberty Style)
   ========================================================================== */
.dl-blog-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.dl-blog-card {
  background: #ffffff;
  border: 2px solid var(--dl-border);
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  border-radius: 20px;
  padding: 1.4rem;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none !important;
  color: var(--dl-ink);
}
.dl-blog-card:hover {
  transform: translateY(-3px);
  border-color: var(--dl-gold);
  box-shadow: 0 7px 0 0 var(--dl-gold-deep);
  color: var(--dl-navy);
}

.dl-article-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}

.dl-article-card {
  background: #ffffff;
  border: 2px solid var(--dl-border);
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  border-radius: 24px;
  padding: 2.25rem 2.5rem;
  line-height: 1.7;
  color: #2D3748;
}

.dl-article-card h1, .dl-article-card h2, .dl-article-card h3 {
  font-family: var(--dl-font-heading);
  font-weight: 800;
  color: var(--dl-navy);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.dl-article-card p {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

.dl-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.dl-stat-card {
  background: #FAF6EB;
  border: 2px solid #ECD8A5;
  border-radius: 16px;
  box-shadow: 0 3px 0 0 #DFC588;
  padding: 1rem 1.15rem;
}

.dl-stat-card .number {
  font-family: var(--dl-font-heading);
  font-weight: 900;
  font-size: 1.75rem;
  color: #8A6A00;
  line-height: 1.1;
}

.dl-callout-box {
  background: #FAF6EB;
  border-left: 5px solid var(--dl-gold);
  border-radius: 0 16px 16px 0;
  padding: 1.1rem 1.35rem;
  margin: 1.5rem 0;
}

/* ==========================================================================
   Patina Button Variant
   ========================================================================== */
.dl-btn-teal {
  background-color: var(--dl-patina);
  border-color: var(--dl-patina-deep);
  color: #ffffff;
  box-shadow: 0 4px 0 0 var(--dl-patina-deep);
}
.dl-btn-teal:hover {
  color: #ffffff !important;
  filter: brightness(1.06);
}
.dl-btn-teal:active {
  box-shadow: 0 1px 0 0 var(--dl-patina-deep);
}

/* ==========================================================================
   Node START Bubble Text (Gold, Liberty Palette)
   ========================================================================== */
.dl-node-bubble-text {
  background: #ffffff;
  border: 2px solid var(--dl-gold);
  color: var(--dl-gold-deep);
  font-family: var(--dl-font-heading);
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(150, 116, 50, 0.25);
  white-space: nowrap;
}

/* ==========================================================================
   Month Navigator (Budget Workspace)
   ========================================================================== */
.dl-month-bar {
  gap: 0.5rem;
}
.dl-month-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px solid var(--dl-border);
  background: #ffffff;
  color: var(--dl-navy);
  box-shadow: 0 3px 0 0 var(--dl-border-depth);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease;
}
.dl-month-btn:hover {
  border-color: var(--dl-gold);
}
.dl-month-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 var(--dl-border-depth);
}
.dl-month-input {
  border: 2px solid var(--dl-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 0 0 var(--dl-border-depth);
  color: var(--dl-navy);
  max-width: 170px;
}

/* ==========================================================================
   Envelope Cards (Budget Workspace)
   ========================================================================== */
.dl-envelope-card {
  background: #ffffff;
  border: 2px solid var(--dl-border);
  border-radius: 18px;
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  padding: 1rem 1.15rem;
}
.dl-envelope-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}

/* ==========================================================================
   Transaction Rows (Activity Ledger)
   ========================================================================== */
.dl-tx-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--dl-border);
}
.dl-tx-row:last-child {
  border-bottom: none;
}
.dl-tx-day {
  font-family: var(--dl-font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dl-muted);
  padding: 0.85rem 0.5rem 0.25rem;
  border-bottom: 1px solid var(--dl-border);
}
.dl-tx-day:first-child { padding-top: 0.5rem; }
body[data-theme="dark"] .dl-tx-day { color: #94a3b8; border-color: #334155; }
.dl-tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* ==========================================================================
   Filter Pills
   ========================================================================== */
.dl-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 2px solid var(--dl-border);
  background: #ffffff;
  color: var(--dl-muted);
  font-family: var(--dl-font-heading);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 0 0 var(--dl-border-depth);
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease;
}
.dl-filter-pill:hover {
  border-color: var(--dl-gold);
}
.dl-filter-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 var(--dl-border-depth);
}
.dl-filter-pill.is-active {
  background: var(--dl-navy);
  border-color: var(--dl-navy);
  color: #ffffff;
  box-shadow: 0 3px 0 0 var(--dl-navy-deep);
}

/* ==========================================================================
   Safe-Spend Donut Ring
   ========================================================================== */
.dl-donut-wrap {
  position: relative;
}
.dl-donut-svg {
  display: block;
}
.dl-donut-fill {
  transition: stroke-dasharray 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   Quiz Option Buttons (Lesson Sheet & Landing Hero Quiz)
   ========================================================================== */
.dl-quiz-opt-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 2px solid var(--dl-border);
  box-shadow: 0 4px 0 0 var(--dl-border-depth);
  background: #ffffff;
  font-family: var(--dl-font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dl-ink);
  cursor: pointer;
  transition: all 0.12s ease;
}
.dl-quiz-opt-btn:hover {
  background: #fafafa;
}
.dl-quiz-opt-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 0 var(--dl-border-depth);
}
.dl-quiz-opt-btn.is-selected {
  border-color: var(--dl-blue);
  background: var(--dl-blue-soft);
  color: var(--dl-blue-deep);
  box-shadow: 0 4px 0 0 var(--dl-blue-deep);
}
.dl-quiz-opt-btn.is-correct {
  border-color: var(--dl-green) !important;
  background: var(--dl-green-soft) !important;
  color: var(--dl-green-deep) !important;
  box-shadow: 0 4px 0 0 var(--dl-green-deep) !important;
}
.dl-quiz-opt-btn.is-incorrect {
  border-color: var(--dl-red) !important;
  background: var(--dl-red-soft) !important;
  color: var(--dl-red-deep) !important;
  box-shadow: 0 4px 0 0 var(--dl-red-deep) !important;
}

.dl-opt-number {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid currentColor;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 900;
  flex-shrink: 0;
}


/* ==========================================================================
   Lesson Sheet v2 (teach cards, one quiz, completion)
   Bottom sheet on phones, centered modal on desktop.
   ========================================================================== */
.dl-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 38, 0.6);
  z-index: 2500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.dl-sheet-backdrop[hidden] { display: none; }

.dl-sheet {
  background: var(--dl-surface, #ffffff);
  width: 100%;
  max-width: 480px;
  height: 88vh;
  max-height: 700px;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(14, 23, 38, 0.3);
  animation: dlSheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dlSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (min-width: 1024px) {
  .dl-sheet-backdrop { align-items: center; }
  .dl-sheet {
    border-radius: 24px;
    height: auto;
    min-height: 480px;
    max-height: 86vh;
  }
}

.dl-sheet-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  flex: 0 0 auto;
}
.dl-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--dl-faint, #8f9bb3);
  border: 2px solid var(--dl-border, #e5e2d9);
  border-bottom-width: 3px;
  background: var(--dl-surface, #ffffff);
  cursor: pointer;
  flex: 0 0 auto;
}
.dl-sheet-close svg { width: 15px; height: 15px; }
.dl-sheet-prog {
  flex: 1;
  height: 13px;
  border-radius: 999px;
  background: #efeee9;
  overflow: hidden;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.06);
}
.dl-sheet-prog i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--dl-gold);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  transition: width 0.35s ease;
}

.dl-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 20px 16px;
}
.dl-sheet-eyebrow {
  font-family: var(--dl-font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dl-gold-deep);
}
.dl-sheet-title {
  font-family: var(--dl-font-heading);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--dl-navy);
  margin: 6px 0 12px;
}
.dl-sheet-note { font-size: 14px; color: var(--dl-muted); line-height: 1.5; }
.dl-sheet-count {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--dl-faint);
  margin: 8px 0 0;
}

.dl-teach-card {
  background: var(--dl-parchment);
  border: 2px solid var(--dl-border);
  border-radius: 18px;
  padding: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--dl-ink);
  box-shadow: 0 4px 0 var(--dl-border-depth);
}
.dl-pager-dots { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.dl-pager-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--dl-border-depth); }
.dl-pager-dots i.on { background: var(--dl-gold); width: 20px; border-radius: 999px; }

.dl-sheet-foot { flex: 0 0 auto; padding: 14px 16px 20px; }
.dl-sheet-primary {
  display: block;
  width: 100%;
  text-align: center;
  border-radius: 14px;
  font-family: var(--dl-font-heading);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 18px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.08s ease, border-bottom-width 0.08s ease;
}
.dl-sheet-primary:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-sheet-primary.is-gold {
  background: var(--dl-gold);
  color: var(--dl-navy-deep);
  border-color: #b08d46;
  border-bottom: 4px solid var(--dl-gold-deep);
}
.dl-sheet-primary.is-gold:hover { background: var(--dl-gold-bright); }
.dl-sheet-primary.is-teal {
  background: var(--dl-patina);
  color: #ffffff;
  border-color: var(--dl-patina-deep);
  border-bottom: 4px solid var(--dl-patina-deep);
}
.dl-sheet-primary.is-outline {
  background: var(--dl-surface, #ffffff);
  color: var(--dl-patina);
  border-color: var(--dl-border);
  border-bottom: 4px solid var(--dl-border-depth);
}
.dl-sheet-primary:disabled {
  background: #e5e5e5 !important;
  border-color: #e5e5e5 !important;
  color: #a3a3a3 !important;
  border-bottom: 4px solid #cccccc !important;
  cursor: not-allowed;
  transform: none;
}

.dl-quiz-prompt {
  font-family: var(--dl-font-heading);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--dl-navy);
  margin: 8px 0 18px;
}
.dl-quiz-options { display: flex; flex-direction: column; }
.dl-quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px 15px;
  font-family: var(--dl-font-body);
  font-weight: 700;
  font-size: 14px;
  color: var(--dl-ink);
  margin-bottom: 11px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.dl-quiz-opt:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-quiz-opt .num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--dl-border);
  display: grid;
  place-items: center;
  font-family: var(--dl-font-heading);
  font-size: 12px;
  font-weight: 800;
  color: var(--dl-muted);
}
.dl-quiz-opt.is-sel { border-color: var(--dl-gold); background: var(--dl-gold-soft); }
.dl-quiz-opt.is-sel .num { border-color: var(--dl-gold); color: var(--dl-gold-deep); }
.dl-quiz-opt.is-right { border-color: var(--dl-patina); background: var(--dl-patina-soft); }
.dl-quiz-opt.is-right .num { border-color: var(--dl-patina); color: var(--dl-patina); }
.dl-quiz-opt.is-wrong { border-color: var(--dl-red); background: var(--dl-red-soft); }
.dl-quiz-opt.is-wrong .num { border-color: var(--dl-red); color: var(--dl-red); }
.dl-quiz-opt:disabled { cursor: default; }

.dl-feedback { border-radius: 18px; padding: 16px; border: 2px solid transparent; margin-top: 4px; }
.dl-feedback h5 {
  font-family: var(--dl-font-heading);
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.dl-feedback h5 svg { width: 18px; height: 18px; }
.dl-feedback p { font-size: 13px; line-height: 1.5; margin: 5px 0 0; }
.dl-feedback .dl-sheet-primary { margin-top: 12px; }
.dl-feedback.ok { background: var(--dl-patina-soft); border-color: #9fd5cd; }
.dl-feedback.ok h5 { color: var(--dl-patina); }
.dl-feedback.ok p { color: #0f5a50; }
.dl-feedback.miss { background: var(--dl-red-soft); border-color: #f3c1c1; }
.dl-feedback.miss h5 { color: var(--dl-red); }
.dl-feedback.miss p { color: #7c2222; }
.dl-feedback.note { background: var(--dl-gold-soft); border-color: #ecd8a5; }
.dl-feedback.note p { color: var(--dl-gold-deep); margin: 0; }

.dl-done-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6px; }
.dl-done-hero h4 {
  font-family: var(--dl-font-heading);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--dl-navy);
  margin: 10px 0 0;
}
.dl-done-hero .sub { color: var(--dl-muted); font-size: 13.5px; margin-top: 5px; max-width: 280px; line-height: 1.5; }
.dl-done-note {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dl-gold-deep);
  background: var(--dl-gold-soft);
  border: 2px solid #ecd8a5;
  border-radius: 12px;
  padding: 9px 14px;
}
.dl-stat-row { display: flex; gap: 12px; margin-top: 18px; width: 100%; }
.dl-stat-card {
  flex: 1;
  border: 2px solid var(--dl-border);
  border-radius: 16px;
  padding: 12px 8px;
  background: var(--dl-surface, #ffffff);
  box-shadow: 0 4px 0 var(--dl-border-depth);
}
.dl-stat-card .lab {
  font-family: var(--dl-font-heading);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dl-muted);
}
.dl-stat-card .val {
  font-family: var(--dl-font-heading);
  font-size: 19px;
  font-weight: 900;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dl-stat-card .val svg { width: 17px; height: 17px; }
.dl-stat-card.gold { border-color: #ecd8a5; box-shadow: 0 4px 0 #ecd8a5; }
.dl-stat-card.gold .val { color: var(--dl-gold-deep); }
.dl-stat-card.coral { border-color: #f2cfae; box-shadow: 0 4px 0 #f2cfae; }
.dl-stat-card.coral .val { color: var(--dl-coral); }

.dl-unlock-card {
  width: 100%;
  margin-top: 14px;
  background: var(--dl-navy);
  color: #ffffff;
  border-radius: 16px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 0 var(--dl-navy-deep);
  text-align: left;
}
.dl-unlock-card .ui {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.16);
  border: 2px solid rgba(212, 175, 55, 0.4);
  display: grid;
  place-items: center;
  color: var(--dl-gold-bright);
}
.dl-unlock-card .ui svg { width: 19px; height: 19px; }
.dl-unlock-card .ul {
  font-family: var(--dl-font-heading);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dl-gold-bright);
}
.dl-unlock-card .un { font-family: var(--dl-font-heading); font-size: 13.5px; font-weight: 800; margin-top: 1px; }

@keyframes dlWiggle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(5deg) translateY(-3px); }
}
.dl-libby-wiggle { animation: dlWiggle 1.6s ease-in-out infinite; }

body[data-theme="dark"] .dl-sheet { background: #1f2937; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55); }
body[data-theme="dark"] .dl-sheet-close { background: #1f2937; border-color: #475569; color: #94a3b8; }
body[data-theme="dark"] .dl-sheet-prog { background: #334155; }
body[data-theme="dark"] .dl-sheet-title,
body[data-theme="dark"] .dl-quiz-prompt,
body[data-theme="dark"] .dl-done-hero h4 { color: #e8edf5; }
body[data-theme="dark"] .dl-teach-card { background: #162238; border-color: #334155; color: #e2e8f0; box-shadow: 0 4px 0 #0e1726; }
body[data-theme="dark"] .dl-quiz-opt { background: #1f2937; border-color: #475569; color: #e2e8f0; }
body[data-theme="dark"] .dl-quiz-opt .num { border-color: #475569; color: #94a3b8; }
body[data-theme="dark"] .dl-quiz-opt.is-sel { background: rgba(197, 160, 89, 0.16); border-color: var(--dl-gold); }
body[data-theme="dark"] .dl-quiz-opt.is-right { background: rgba(30, 130, 117, 0.2); border-color: var(--dl-patina); }
body[data-theme="dark"] .dl-quiz-opt.is-wrong { background: rgba(201, 42, 42, 0.18); border-color: var(--dl-red); }
body[data-theme="dark"] .dl-stat-card { background: #162238; border-color: #334155; box-shadow: 0 4px 0 #0e1726; }
body[data-theme="dark"] .dl-stat-card.gold { border-color: rgba(197, 160, 89, 0.5); box-shadow: 0 4px 0 rgba(197, 160, 89, 0.3); }
body[data-theme="dark"] .dl-stat-card.coral { border-color: rgba(229, 138, 46, 0.5); box-shadow: 0 4px 0 rgba(229, 138, 46, 0.3); }
body[data-theme="dark"] .dl-feedback.ok { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-feedback.ok p { color: #9fd5cd; }
body[data-theme="dark"] .dl-feedback.miss { background: rgba(201, 42, 42, 0.16); }
body[data-theme="dark"] .dl-feedback.miss p { color: #f3b7b7; }
body[data-theme="dark"] .dl-sheet-primary.is-outline { background: #1f2937; border-color: #475569; }

@media (prefers-reduced-motion: reduce) {
  .dl-sheet { animation: none; }
  .dl-libby-wiggle { animation: none; }
  .dl-sheet-prog i { transition: none; }
}

/* ==========================================================================
   Lesson Sheet v3 — the lesson engine (intro, exercises, sims, quiz, done)
   ========================================================================== */

/* phase transition: slide-fade */
@keyframes dlPhaseIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
.dl-phase { animation: dlPhaseIn 0.18s ease-out; }

/* ported engine keyframes */
@keyframes dlStampIn {
  0% { transform: scale(3) rotate(-24deg); opacity: 0; }
  55% { transform: scale(0.92) rotate(-13deg); opacity: 1; }
  75% { transform: scale(1.06) rotate(-13deg); }
  100% { transform: scale(1) rotate(-13deg); opacity: 1; }
}
.dl-stamp { animation: dlStampIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes dlHardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.dl-shake { animation: dlHardShake 0.4s ease; }

@keyframes dlRiseFade {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.dl-rise { animation: dlRiseFade 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes dlSceneIn {
  0% { transform: scale(0.6) translateY(26px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.dl-scene { animation: dlSceneIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes dlCoinFall {
  0% { transform: translateY(-46px) scale(0.7); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.dl-coin { animation: dlCoinFall 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes dlDrawLine { from { stroke-dashoffset: var(--len, 600); } to { stroke-dashoffset: 0; } }
.dl-draw { stroke-dasharray: var(--len, 600); animation: dlDrawLine 1.6s ease-out both; }

@keyframes dlBobSlow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.dl-bob { animation: dlBobSlow 2.4s ease-in-out infinite; }

.dl-pop { animation: nodePop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }

/* unit tone: progress bar + kind chip take the unit color */
.dl-sheet.tone-navy .dl-sheet-prog i { background: var(--dl-navy); }
.dl-sheet.tone-teal .dl-sheet-prog i { background: var(--dl-patina); }
.dl-sheet.tone-coral .dl-sheet-prog i { background: var(--dl-coral); }
.dl-sheet.tone-navy .dl-kind-chip { background: var(--dl-navy); }
.dl-sheet.tone-teal .dl-kind-chip { background: var(--dl-patina); }
.dl-sheet.tone-coral .dl-kind-chip { background: var(--dl-coral); }

/* sound toggle */
.dl-sheet-sound {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--dl-faint, #8f9bb3);
  border: 2px solid var(--dl-border, #e5e2d9);
  border-bottom-width: 3px;
  background: var(--dl-surface, #ffffff);
  cursor: pointer;
  flex: 0 0 auto;
}
.dl-sheet-sound svg { width: 16px; height: 16px; }
.dl-sheet-sound .ico-off { display: none; }
.dl-sheet-sound.is-muted .ico-on { display: none; }
.dl-sheet-sound.is-muted .ico-off { display: block; }
.dl-sheet-sound.is-muted { color: var(--dl-faint); opacity: 0.7; }

/* extra primary tones */
.dl-sheet-primary.is-navy {
  background: var(--dl-navy);
  color: #ffffff;
  border-color: var(--dl-navy);
  border-bottom: 4px solid var(--dl-navy-deep);
}
.dl-sheet-primary.is-navy:hover { background: var(--dl-navy-light); }
.dl-sheet-primary.is-red {
  background: var(--dl-red);
  color: #ffffff;
  border-color: var(--dl-red-deep);
  border-bottom: 4px solid var(--dl-red-deep);
}
.dl-sheet-primary.is-red:hover { filter: brightness(1.06); }
.dl-sheet-primary.is-coral {
  background: var(--dl-coral);
  color: #ffffff;
  border-color: var(--dl-coral-deep);
  border-bottom: 4px solid var(--dl-coral-deep);
}
.dl-sheet-primary.is-coral:hover { filter: brightness(1.06); }
.dl-btn-block { display: block; width: 100%; margin-top: 14px; }
.dl-quiet-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  padding: 6px;
  font-family: var(--dl-font-heading);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dl-faint);
  cursor: pointer;
}
.dl-quiet-link:hover { color: var(--dl-muted); }

/* confetti canvas */
.dl-confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 4000;
}

/* characters */
.dl-char { display: inline-block; line-height: 0; }
.dl-char svg { display: block; }
.dl-intro-char { display: flex; justify-content: center; margin: 10px 0 0; }
.dl-intro-icon { display: inline-grid; place-items: center; width: 104px; height: 104px; color: var(--dl-gold); }
.dl-intro-icon svg { width: 100%; height: 100%; }

/* intro */
.dl-kind-chip {
  display: block;
  width: fit-content;
  margin: 16px auto 0;
  padding: 5px 12px;
  border-radius: 10px;
  background: var(--dl-gold);
  color: #ffffff;
  font-family: var(--dl-font-heading);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.dl-kind-chip.is-gold { background: var(--dl-gold); }
.dl-sheet-title.is-center { text-align: center; }
.dl-unit-line {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--dl-muted);
  margin: 2px 0 0;
}
.dl-hook {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dl-ink);
  max-width: 320px;
  margin: 14px auto 0;
}

/* story */
.dl-story-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 14px; }
.dl-story-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--dl-border-depth); transition: width 0.2s ease; }
.dl-story-dots i.on { width: 22px; background: var(--dl-gold); }
.dl-story-dots i.past { background: var(--dl-patina); }
.dl-story-scene { display: flex; flex-direction: column; align-items: center; }
.dl-bubble {
  position: relative;
  width: 100%;
  margin-top: 14px;
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 14px 16px;
}
.dl-bubble::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 13px;
  height: 13px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--dl-surface, #ffffff);
  border-left: 2px solid var(--dl-border);
  border-top: 2px solid var(--dl-border);
  border-radius: 3px 0 0 0;
}
.dl-bubble .txt { text-align: center; font-size: 14.5px; font-weight: 700; line-height: 1.5; color: var(--dl-ink); margin: 0; }
.dl-bubble .punch { text-align: center; font-size: 15.5px; font-weight: 900; color: var(--dl-patina); margin: 8px 0 0; }

/* myth autopsy */
.dl-myth-card {
  position: relative;
  margin-top: 10px;
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 20px 18px;
  text-align: center;
}
.dl-myth-card .claim { font-size: 18px; font-weight: 900; line-height: 1.4; color: var(--dl-ink); margin: 0; }
.dl-myth-stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.dl-myth-stamp {
  color: var(--dl-red);
  font-family: var(--dl-font-heading);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.dl-myth-stamp::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 58px;
  border: 5px solid var(--dl-red);
  border-radius: 12px;
  background: rgba(201, 42, 42, 0.06);
}
.dl-myth-stamp { transform: rotate(-13deg); }
.dl-truth {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  background: var(--dl-patina-soft);
  border: 2px solid var(--dl-patina);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px;
}
.dl-truth .tic { flex: 0 0 auto; width: 22px; height: 22px; color: var(--dl-patina-deep); }
.dl-truth .tic svg { width: 100%; height: 100%; }
.dl-truth p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; color: var(--dl-ink); }

/* branch decisions */
.dl-branch-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--dl-font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dl-faint);
  margin-bottom: 10px;
}
.dl-branch-top .sc { color: var(--dl-patina); }
.dl-branch-scene {
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.45;
  color: var(--dl-ink);
}
.dl-branch-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.dl-branch-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 13px 15px;
  font-family: var(--dl-font-body);
  font-weight: 700;
  font-size: 14px;
  color: var(--dl-ink);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.dl-branch-choice:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-branch-choice .mk { flex: 0 0 auto; width: 19px; height: 19px; }
.dl-branch-choice .mk svg { width: 100%; height: 100%; }
.dl-branch-choice.is-good { border-color: var(--dl-patina); background: var(--dl-patina-soft); color: var(--dl-patina-deep); }
.dl-branch-choice.is-bad { border-color: var(--dl-red); background: var(--dl-red-soft); color: var(--dl-red-deep); }
.dl-branch-choice:disabled { cursor: default; opacity: 0.85; }
.dl-branch-result {
  margin-top: 14px;
  border: 2px solid transparent;
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 13px 15px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dl-ink);
}
.dl-branch-result.is-good { background: var(--dl-patina-soft); border-color: var(--dl-patina); }
.dl-branch-result.is-bad { background: var(--dl-red-soft); border-color: var(--dl-red); }
.dl-branch-result b { text-transform: uppercase; letter-spacing: 0.04em; }

/* sort game */
.dl-sort-hint { text-align: center; font-size: 13.5px; font-weight: 700; color: var(--dl-muted); }
.dl-sort-stage { min-height: 96px; display: grid; place-items: center; margin-top: 14px; }
.dl-sort-card {
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 13px 22px;
  font-size: 18px;
  font-weight: 900;
  color: var(--dl-ink);
  text-align: center;
}
.dl-sort-card.is-good { border-color: var(--dl-patina); background: var(--dl-patina-soft); color: var(--dl-patina-deep); }
.dl-sort-card.is-bad { border-color: var(--dl-red); background: var(--dl-red-soft); color: var(--dl-red-deep); }
.dl-sort-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.dl-sort-bucket {
  border-radius: 16px;
  padding: 15px 10px;
  font-family: var(--dl-font-heading);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, border-bottom-width 0.08s ease;
}
.dl-sort-bucket:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-sort-bucket.is-navy { background: var(--dl-navy); border-color: var(--dl-navy); border-bottom: 4px solid var(--dl-navy-deep); color: #ffffff; }
.dl-sort-bucket.is-coral { background: var(--dl-coral); border-color: var(--dl-coral-deep); border-bottom: 4px solid var(--dl-coral-deep); color: #ffffff; }
.dl-sort-bucket:disabled { opacity: 0.75; cursor: default; }
.dl-sort-summary { text-align: center; }
.dl-sort-summary .ico { display: inline-grid; place-items: center; width: 44px; height: 44px; color: var(--dl-gold); }
.dl-sort-summary .ico svg { width: 100%; height: 100%; }
.dl-sort-summary p { margin: 6px 0 0; font-size: 16px; font-weight: 900; color: var(--dl-ink); }

/* sims */
.dl-sim-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 10px;
  background: var(--dl-navy);
  color: #ffffff;
  font-family: var(--dl-font-heading);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.dl-sim-prompt { font-size: 14.5px; font-weight: 700; line-height: 1.5; color: var(--dl-ink); margin: 6px 0 14px; }
.dl-sim-card {
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 16px;
}
.dl-sim-card.is-center { text-align: center; }
.dl-sim-chart svg { width: 100%; height: auto; display: block; }
.dl-sim-chart .axis { stroke: var(--dl-border); stroke-width: 3; stroke-linecap: round; }
.dl-sim-chart .curve { fill: none; stroke: var(--dl-patina); stroke-width: 5; stroke-linecap: round; }
.dl-sim-chart .dot { fill: var(--dl-patina); stroke: #ffffff; stroke-width: 3; }
.dl-sim-figures { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 8px; }
.dl-sim-figures .is-right { text-align: right; }
.dl-sim-figures .lab,
.dl-sim-grid3 .lab,
.dl-sim-versus .lab {
  font-family: var(--dl-font-heading);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dl-muted);
}
.dl-sim-figures .big { font-family: var(--dl-font-heading); font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dl-sim-figures .mid, .dl-sim-grid3 .mid { font-family: var(--dl-font-heading); font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--dl-ink); }
.dl-sim-figures .verdict { font-size: 12.5px; font-weight: 800; padding-bottom: 4px; }
.is-patina { color: var(--dl-patina); }
.is-blue { color: var(--dl-blue); }
.is-red { color: var(--dl-red); }
.is-coral { color: var(--dl-coral); }
.dl-sim-scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--dl-muted);
  margin: 14px 0 2px;
}
.dl-sim-scale .now { color: var(--dl-patina); font-size: 14px; }
.dl-sim-slider { width: 100%; height: 34px; accent-color: var(--dl-patina); }
.dl-sim-note {
  margin: 12px 0 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dl-ink);
  background: var(--dl-parchment);
  border: 2px solid var(--dl-border);
}
.dl-sim-note.is-patina-bg { background: var(--dl-patina-soft); border-color: #9fd5cd; }
.dl-sim-note.is-blue-bg { background: var(--dl-blue-soft); border-color: #bdd3e6; }
.dl-sim-note.is-coral-bg { background: var(--dl-coral-soft); border-color: #f2cfae; }
.dl-sim-note.is-navy-bg { background: var(--dl-navy-soft); border-color: #c3cede; }
.dl-sim-ages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dl-sim-age {
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  background: var(--dl-surface, #ffffff);
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.dl-sim-age:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-sim-age.is-active { border-color: var(--dl-blue); background: var(--dl-blue-soft); transform: scale(1.04); }
.dl-sim-age .a { display: block; font-family: var(--dl-font-heading); font-size: 19px; font-weight: 900; color: var(--dl-ink); }
.dl-sim-age .m { display: block; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.dl-sim-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; text-align: center; }
.dl-sim-car { display: inline-grid; place-items: center; width: 92px; height: 92px; color: var(--dl-coral); transition: filter 0.5s ease; }
.dl-sim-car svg { width: 100%; height: 100%; }
.dl-sim-carstate {
  margin: 6px 0 0;
  font-family: var(--dl-font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dl-muted);
}
.dl-sim-bars { display: flex; align-items: flex-end; justify-content: center; gap: 7px; height: 120px; }
.dl-sim-bars i {
  width: 42px;
  border-radius: 12px 12px 0 0;
  background: var(--dl-border);
  transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.dl-sim-bars i.on { background: var(--dl-blue); }
.dl-sim-bartotal { text-align: center; font-family: var(--dl-font-heading); font-size: 26px; font-weight: 900; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.dl-sim-barsub { text-align: center; font-family: var(--dl-font-heading); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dl-muted); margin: 2px 0 0; }
.dl-sim-versus { display: flex; align-items: center; justify-content: space-around; gap: 8px; }
.dl-sim-versus .side { text-align: center; }
.dl-sim-versus .ico { display: inline-grid; place-items: center; width: 42px; height: 42px; }
.dl-sim-versus .ico svg { width: 100%; height: 100%; }
.dl-sim-versus .vs { font-family: var(--dl-font-heading); font-size: 22px; font-weight: 900; color: var(--dl-faint); }
.dl-sim-versus .big { font-family: var(--dl-font-heading); font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; margin-top: 2px; }
.dl-sim-banner {
  margin: 12px 0 0;
  border-radius: 12px;
  padding: 9px;
  text-align: center;
  font-family: var(--dl-font-heading);
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
}
.dl-sim-banner.is-blue { background: var(--dl-blue); }
.dl-sim-banner.is-patina { background: var(--dl-patina); }
.dl-sim-portfolio { font-family: var(--dl-font-heading); font-size: 36px; font-weight: 900; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.dl-sim-portfolio-cap { font-family: var(--dl-font-heading); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dl-muted); margin: 2px 0 0; }
.dl-sim-trend { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-top: 8px; }
.dl-sim-trend svg { width: 100%; height: 100%; }
.dl-sim-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.dl-sim-debts { display: flex; align-items: flex-end; justify-content: center; gap: 14px; min-height: 170px; }
.dl-sim-debts .col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dl-sim-debts .amt { font-size: 11px; font-weight: 800; color: var(--dl-muted); font-variant-numeric: tabular-nums; }
.dl-sim-debts .col i {
  width: 46px;
  border-radius: 12px 12px 0 0;
  background: var(--dl-coral);
  box-shadow: 0 3px 0 var(--dl-coral-deep);
  transform-origin: bottom;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.dl-sim-debts .nm { max-width: 64px; text-align: center; font-size: 10px; font-weight: 700; line-height: 1.25; color: var(--dl-ink); }
.dl-sim-debts .col.is-cleared .amt, .dl-sim-debts .col.is-cleared .nm { opacity: 0.4; }

/* quiz count line */
.dl-quiz-count {
  font-family: var(--dl-font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dl-faint);
  margin: 4px 0 0;
}

/* mission */
.dl-mission-intro {
  background: var(--dl-blue-soft);
  border: 2px solid #bdd3e6;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dl-blue-deep);
  margin-bottom: 12px;
}
.dl-mission-card {
  background: var(--dl-navy);
  border: 2px solid var(--dl-navy);
  border-bottom-width: 4px;
  border-bottom-color: var(--dl-navy-deep);
  border-radius: 18px;
  padding: 15px;
  color: #ffffff;
}
.dl-mission-card .mc-top { display: flex; align-items: center; gap: 10px; }
.dl-mission-card .mc-chip {
  background: var(--dl-gold);
  border-radius: 8px;
  padding: 3px 9px;
  font-family: var(--dl-font-heading);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dl-navy-deep);
}
.dl-mission-card .mc-xp { font-family: var(--dl-font-heading); font-size: 12px; font-weight: 800; color: var(--dl-gold-bright); font-variant-numeric: tabular-nums; }
.dl-mission-card .mc-task { font-size: 16.5px; font-weight: 900; line-height: 1.4; margin: 10px 0 0; }
.dl-mission-card .mc-why { font-size: 12.5px; font-weight: 700; line-height: 1.5; color: #c3cede; margin: 8px 0 0; }
.dl-mission-steps-lab {
  font-family: var(--dl-font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dl-faint);
  margin: 14px 0 8px;
}
.dl-mission-steps { display: flex; flex-direction: column; gap: 9px; }
.dl-mission-step {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: var(--dl-surface, #ffffff);
  border: 2px solid var(--dl-border);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 11px 13px;
  font-family: var(--dl-font-body);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--dl-ink);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.dl-mission-step:active { transform: translateY(2px); border-bottom-width: 2px; }
.dl-mission-step .tick {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 2px solid var(--dl-border);
  background: var(--dl-surface, #ffffff);
  display: grid;
  place-items: center;
  color: #ffffff;
}
.dl-mission-step .tick svg { width: 15px; height: 15px; }
.dl-mission-step.is-on { border-color: var(--dl-patina); background: var(--dl-patina-soft); color: var(--dl-patina-deep); }
.dl-mission-step.is-on .tick { border-color: var(--dl-patina); background: var(--dl-patina); }
.dl-mission-step.is-on .txt { text-decoration: line-through; opacity: 0.75; }
.dl-mission-outcome { margin-top: 14px; }
.dl-mission-later { text-align: center; font-size: 13.5px; font-weight: 700; color: var(--dl-muted); margin: 0; }
.dl-mission-cheer { text-align: center; }
.dl-mission-cheer .big { font-family: var(--dl-font-heading); font-size: 18px; font-weight: 900; color: var(--dl-patina); margin: 0; }
.dl-mission-cheer p { font-size: 13px; font-weight: 700; color: var(--dl-muted); margin: 4px 0 0; }

/* chest + trophy */
.dl-chest-stage { display: flex; justify-content: center; margin-top: 18px; }
.dl-chest-gift {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  background: var(--dl-gold-soft);
  border: 2px solid #ecd8a5;
  border-bottom-width: 5px;
  border-radius: 28px;
  color: var(--dl-gold-deep);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.dl-chest-gift:active { transform: scale(0.92); }
.dl-chest-gift svg { width: 72px; height: 72px; }
.dl-chest-gift.is-open { color: var(--dl-patina); border-color: var(--dl-patina); background: var(--dl-patina-soft); }
.dl-chest-note { text-align: center; font-size: 15px; font-weight: 900; color: var(--dl-ink); margin: 16px 0 0; }
.dl-chest-reveal { text-align: center; margin-top: 14px; }
.dl-chest-reveal .xp {
  font-family: var(--dl-font-heading);
  font-size: 30px;
  font-weight: 900;
  color: var(--dl-gold-deep);
  font-variant-numeric: tabular-nums;
}
.dl-chest-reveal p { font-size: 13px; font-weight: 700; color: var(--dl-muted); margin: 4px 0 0; }
.dl-trophy-stage { display: flex; justify-content: center; margin-top: 16px; }
.dl-trophy-icon {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: var(--dl-gold-soft);
  border: 2px solid #ecd8a5;
  color: var(--dl-gold);
  animation: nodePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both, ringPulse 2s cubic-bezier(0.4, 0, 0.6, 1) 0.5s infinite;
}
.dl-trophy-icon svg { width: 64px; height: 64px; }
.dl-done-trophy { display: grid; place-items: center; width: 84px; height: 84px; color: var(--dl-gold); }
.dl-done-trophy svg { width: 100%; height: 100%; }

/* dark theme */
body[data-theme="dark"] .dl-sheet-sound { background: #1f2937; border-color: #475569; color: #94a3b8; }
body[data-theme="dark"] .dl-unit-line { color: #94a3b8; }
body[data-theme="dark"] .dl-hook { color: #e2e8f0; }
body[data-theme="dark"] .dl-bubble,
body[data-theme="dark"] .dl-myth-card,
body[data-theme="dark"] .dl-branch-scene,
body[data-theme="dark"] .dl-branch-choice,
body[data-theme="dark"] .dl-sort-card,
body[data-theme="dark"] .dl-sim-card,
body[data-theme="dark"] .dl-sim-age,
body[data-theme="dark"] .dl-mission-step { background: #1f2937; border-color: #475569; box-shadow: none; }
body[data-theme="dark"] .dl-bubble::before { background: #1f2937; border-color: #475569; }
body[data-theme="dark"] .dl-bubble .txt,
body[data-theme="dark"] .dl-myth-card .claim,
body[data-theme="dark"] .dl-branch-scene,
body[data-theme="dark"] .dl-branch-choice,
body[data-theme="dark"] .dl-sort-card,
body[data-theme="dark"] .dl-sim-prompt,
body[data-theme="dark"] .dl-truth p,
body[data-theme="dark"] .dl-branch-result,
body[data-theme="dark"] .dl-sort-summary p,
body[data-theme="dark"] .dl-sim-note,
body[data-theme="dark"] .dl-chest-note,
body[data-theme="dark"] .dl-sim-age .a,
body[data-theme="dark"] .dl-sim-figures .mid,
body[data-theme="dark"] .dl-sim-grid3 .mid,
body[data-theme="dark"] .dl-sim-debts .nm,
body[data-theme="dark"] .dl-mission-step { color: #e2e8f0; }
body[data-theme="dark"] .dl-truth { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-branch-choice.is-good { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-branch-choice.is-bad { background: rgba(201, 42, 42, 0.18); }
body[data-theme="dark"] .dl-branch-result.is-good { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-branch-result.is-bad { background: rgba(201, 42, 42, 0.18); }
body[data-theme="dark"] .dl-sort-card.is-good { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-sort-card.is-bad { background: rgba(201, 42, 42, 0.18); }
body[data-theme="dark"] .dl-sim-age.is-active { background: rgba(35, 82, 124, 0.35); }
body[data-theme="dark"] .dl-sim-note.is-patina-bg { background: rgba(30, 130, 117, 0.2); border-color: #2f6b62; }
body[data-theme="dark"] .dl-sim-note.is-blue-bg { background: rgba(35, 82, 124, 0.3); border-color: #33506e; }
body[data-theme="dark"] .dl-sim-note.is-coral-bg { background: rgba(229, 138, 46, 0.16); border-color: #6e4a25; }
body[data-theme="dark"] .dl-sim-note.is-navy-bg { background: rgba(30, 48, 79, 0.5); border-color: #33415c; }
body[data-theme="dark"] .dl-sim-bars i { background: #475569; }
body[data-theme="dark"] .dl-sim-bars i.on { background: var(--dl-blue); }
body[data-theme="dark"] .dl-mission-intro { background: rgba(35, 82, 124, 0.3); border-color: #33506e; color: #bdd3e6; }
body[data-theme="dark"] .dl-mission-step.is-on { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-chest-gift { background: rgba(197, 160, 89, 0.14); border-color: rgba(197, 160, 89, 0.45); }
body[data-theme="dark"] .dl-chest-gift.is-open { background: rgba(30, 130, 117, 0.2); }
body[data-theme="dark"] .dl-trophy-icon { background: rgba(197, 160, 89, 0.14); border-color: rgba(197, 160, 89, 0.45); }
body[data-theme="dark"] .dl-quiet-link { color: #94a3b8; }

/* --------------------------------------------------------------------------
   Dark theme — page-level duo components (Budget, Activity, Learn rail, blog).
   The app dark theme flips inherited text to #e2e8f0 (main.css), so these
   rules move every light duo surface to the app dark palette (card #1f2937,
   deep #162238/#0f172a, borders #334155/#475569, muted #94a3b8, ink #e8edf5)
   and restate text only where the light theme hardcodes a dark color.
   -------------------------------------------------------------------------- */

/* chunky cards + rows */
body[data-theme="dark"] .dl-card,
body[data-theme="dark"] .dl-pacing-ring-card,
body[data-theme="dark"] .dl-envelope-card,
body[data-theme="dark"] .dl-envelope-row,
body[data-theme="dark"] .dl-quest-row {
  background: #1f2937;
  border-color: #334155;
  box-shadow: 0 4px 0 0 #0f172a;
}
body[data-theme="dark"] .dl-envelope-row { box-shadow: 0 3px 0 0 #0f172a; }
body[data-theme="dark"] .dl-quest-row { border-color: #334155; box-shadow: 0 3px 0 0 #0f172a; }
body[data-theme="dark"] .dl-envelope-row:hover { border-color: #475569; }
body[data-theme="dark"] .dl-quest-row:hover { border-color: rgba(197, 160, 89, 0.55); }
body[data-theme="dark"] .dl-progress-track { background: #334155; }

/* the light-gold welcome card keeps its gold wash in dark; its text must
   stay navy or the inherited light body color goes light-on-gold */
body[data-theme="dark"] .dl-card[style*="dl-gold-soft"],
body[data-theme="dark"] .dl-card[style*="dl-gold-soft"] .text-navy { color: var(--dl-navy-deep); }

/* transaction rows */
body[data-theme="dark"] .dl-tx-row { border-bottom-color: #334155; }

/* month navigator (Budget + Activity) */
body[data-theme="dark"] .dl-month-btn {
  background: #1f2937;
  border-color: #475569;
  color: #e2e8f0;
  box-shadow: 0 3px 0 0 #0f172a;
}
body[data-theme="dark"] .dl-month-btn:hover { border-color: var(--dl-gold); }
body[data-theme="dark"] .dl-month-btn:active { box-shadow: 0 1px 0 0 #0f172a; }
body[data-theme="dark"] .dl-month-input {
  border-color: #475569 !important;
  box-shadow: 0 3px 0 0 #0f172a;
  color: #e8edf5;
  color-scheme: dark; /* native calendar indicator renders light */
}

/* filter pills */
body[data-theme="dark"] .dl-filter-pill {
  background: #1f2937;
  border-color: #475569;
  color: #94a3b8;
  box-shadow: 0 3px 0 0 #0f172a;
}
body[data-theme="dark"] .dl-filter-pill:hover { border-color: var(--dl-gold); color: #cbd5e1; }
body[data-theme="dark"] .dl-filter-pill:active { box-shadow: 0 1px 0 0 #0f172a; }
body[data-theme="dark"] .dl-filter-pill.is-active {
  background: var(--dl-navy-light);
  border-color: #3d5478;
  color: #ffffff;
  box-shadow: 0 3px 0 0 var(--dl-navy-deep);
}

/* safe-spend donut (CSS overrides the SVG presentation attribute) */
body[data-theme="dark"] .dl-donut-bg { stroke: #334155; }

/* buttons: outline + disabled read light-first; the colored tones are fine */
body[data-theme="dark"] .dl-btn-outline {
  background: #1f2937;
  border-color: #475569;
  color: #e2e8f0;
  box-shadow: 0 4px 0 0 #0f172a;
}
body[data-theme="dark"] .dl-btn-outline:active { box-shadow: 0 1px 0 0 #0f172a; }
body[data-theme="dark"] .dl-btn:disabled,
body[data-theme="dark"] .dl-btn.is-disabled {
  background-color: #334155 !important;
  border-color: #334155 !important;
  color: #64748b !important;
  box-shadow: 0 4px 0 0 #1f2937 !important;
}

/* badges + xp pill (these already fight with !important; match, don't escalate) */
body[data-theme="dark"] .dl-badge-gold {
  background: rgba(197, 160, 89, 0.16) !important;
  color: #f3dfac !important;
  border-color: rgba(197, 160, 89, 0.45) !important;
}
body[data-theme="dark"] .dl-badge-teal {
  background: rgba(30, 130, 117, 0.18) !important;
  color: #7fd3c5 !important;
  border-color: rgba(30, 130, 117, 0.5) !important;
}
body[data-theme="dark"] .dl-xp-pill {
  background: rgba(197, 160, 89, 0.16);
  border-color: rgba(197, 160, 89, 0.45);
  color: #f3dfac;
}

/* HUD strip */
body[data-theme="dark"] .dl-hud { background: rgba(15, 23, 42, 0.95); border-bottom-color: #334155; }
body[data-theme="dark"] .dl-hud-stat:hover { background: rgba(255, 255, 255, 0.07); }
body[data-theme="dark"] .dl-hud-level { color: #e8edf5; }

/* duo path nodes (legacy variant) */
body[data-theme="dark"] .dl-node-btn.is-locked { background: #334155; box-shadow: 0 5px 0 0 #1f2937; color: #94a3b8; }
body[data-theme="dark"] .dl-node-label { color: #cbd5e1; }
body[data-theme="dark"] .dl-node-label.is-locked { color: #64748b; }
body[data-theme="dark"] .dl-node-bubble-pill,
body[data-theme="dark"] .dl-node-bubble-arrow { background: #1f2937; }
body[data-theme="dark"] .dl-node-bubble-text { background: #1f2937; color: #e6c887; }

/* blog + article surfaces (public pages, dark only when the app toggles it) */
body[data-theme="dark"] .dl-blog-card { background: #1f2937; border-color: #334155; box-shadow: 0 4px 0 0 #0f172a; color: #e2e8f0; }
body[data-theme="dark"] .dl-blog-card:hover { color: #e6c887; box-shadow: 0 7px 0 0 var(--dl-gold-deep); }
body[data-theme="dark"] .dl-article-card { background: #1f2937; border-color: #334155; box-shadow: 0 4px 0 0 #0f172a; color: #cbd5e1; }
body[data-theme="dark"] .dl-article-card h1,
body[data-theme="dark"] .dl-article-card h2,
body[data-theme="dark"] .dl-article-card h3 { color: #e8edf5; }
body[data-theme="dark"] .dl-stat-card .number { color: #f3dfac; }
body[data-theme="dark"] .dl-stat-card .lab { color: #94a3b8; }
body[data-theme="dark"] .dl-stat-card.gold .val { color: #e6c887; }
body[data-theme="dark"] .dl-callout-box { background: rgba(197, 160, 89, 0.12); }

/* quiz option buttons (landing hero quiz + legacy sheet) */
body[data-theme="dark"] .dl-quiz-opt-btn { background: #1f2937; border-color: #475569; color: #e2e8f0; box-shadow: 0 4px 0 0 #0f172a; }
body[data-theme="dark"] .dl-quiz-opt-btn:hover { background: #243145; }
body[data-theme="dark"] .dl-quiz-opt-btn:active { box-shadow: 0 2px 0 0 #0f172a; }
body[data-theme="dark"] .dl-quiz-opt-btn.is-selected { background: rgba(35, 82, 124, 0.35); border-color: var(--dl-blue); color: #bdd3e6; box-shadow: 0 4px 0 0 var(--dl-blue-deep); }
body[data-theme="dark"] .dl-quiz-opt-btn.is-correct { background: rgba(30, 130, 117, 0.2) !important; color: #7fd3c5 !important; }
body[data-theme="dark"] .dl-quiz-opt-btn.is-incorrect { background: rgba(201, 42, 42, 0.18) !important; color: #f3b7b7 !important; }

/* text-navy / fw-black headings inside duo surfaces: undefined in light
   (they inherit), so dark only needs to guarantee the light inheritance
   survives explicit-color ancestors. Scoped to duo surfaces + the two duo
   ledger pages so public pages keep their own dark handling. */
body[data-theme="dark"] .dl-card .text-navy,
body[data-theme="dark"] .dl-envelope-card .text-navy,
body[data-theme="dark"] .dl-envelope-row .text-navy,
body[data-theme="dark"] .dl-quest-row .text-navy,
body[data-theme="dark"] .dl-month-bar .text-navy,
body[data-theme="dark"] .dl-tx-row .text-navy,
body[data-theme="dark"] .modal-content .text-navy,
body[data-theme="dark"][data-endpoint="budget_view"] .text-navy,
body[data-theme="dark"][data-endpoint="transactions_view"] .text-navy { color: #e8edf5; }

/* modal content using duo classes (target-edit, new-category, tx edit,
   quick-add): main.css already flips .modal-content + .form-control; these
   cover what it does not */
body[data-theme="dark"] .modal-content .input-group-text { background: #162238; border-color: #334155; color: #94a3b8; }
body[data-theme="dark"] .modal-content .btn-close { filter: invert(0.85); }

/* lesson-sheet leftovers the v3 dark block missed */
body[data-theme="dark"] .dl-sim-note { background: #162238; border-color: #334155; }
body[data-theme="dark"] .dl-sheet-note,
body[data-theme="dark"] .dl-sort-hint,
body[data-theme="dark"] .dl-done-hero .sub,
body[data-theme="dark"] .dl-mission-later,
body[data-theme="dark"] .dl-mission-cheer p,
body[data-theme="dark"] .dl-chest-reveal p { color: #94a3b8; }
body[data-theme="dark"] .dl-sheet-eyebrow { color: #d4af37; }
body[data-theme="dark"] .dl-done-note { background: rgba(197, 160, 89, 0.14); border-color: rgba(197, 160, 89, 0.45); color: #e6c887; }
body[data-theme="dark"] .dl-chest-reveal .xp { color: #e6c887; }
body[data-theme="dark"] .dl-sheet-primary:disabled {
  background: #334155 !important;
  border-color: #334155 !important;
  color: #64748b !important;
  border-bottom-color: #1f2937 !important;
}

/* reduced motion: everything settles instantly */
@media (prefers-reduced-motion: reduce) {
  .dl-phase,
  .dl-stamp,
  .dl-shake,
  .dl-rise,
  .dl-scene,
  .dl-coin,
  .dl-bob,
  .dl-pop,
  .dl-trophy-icon { animation: none !important; }
  .dl-draw { animation: none; stroke-dashoffset: 0; }
  .dl-sim-bars i,
  .dl-sim-debts .col i,
  .dl-sim-car { transition: none; }
}
