/* Theme: "Mint + Gold" (day, default) and "Mint Night" (night), picked by Daniel on his phone 2026-10-13.
   Gold ties the app to the black-and-gold logo. Variable names (--glass etc.) are from the earlier
   Aurora pass; the surfaces are now solid so they read crisply on phones. */
:root,
:root[data-theme="light"] {
  --bg: #f1f8f5;
  --bg-2: #ffffff;
  --bg-3: #e9f3ef;
  --line: #dcebe4;
  --text: #15302a;
  --muted: #5f7a72;
  --accent: #a87a12;        /* gold, readable as text */
  --accent-2: #876119;
  --gold: #a87a12;
  --blue: #0f8a6c;
  --good: #0f9d7a;
  --warn: #d9821c;
  --bad: #d6453d;
  --on-accent: #ffffff;
  --hi: #a87a12;
  --btn: #0f6e58;
  --btn-text: #ffffff;
  --bar-1: #0f9d7a;
  --bar-2: #e0bb62;
  --glass: #ffffff;
  --glass-strong: #ffffff;
  --glass-border: #dcebe4;
  --glass-shadow: 0 4px 14px rgba(15, 80, 60, .06);
  --nav-bg: #ffffff;
  --hero-bg: #0f5e4c;
  --hero-border: #0f5e4c;
  --hero-text: #ffffff;
  --hero-muted: #cfe9e0;
  --hero-hi: #f0d48a;
  --hero-btn: linear-gradient(180deg, #ecd08a, #c99a3e);
  --hero-btn-text: #1a1408;
  --bg-grad: #f1f8f5;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(15, 60, 45, .14);
  --font: "Outfit", ui-rounded, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f1f1b;
  --bg-2: #1a2e29;
  --bg-3: rgba(255, 255, 255, .06);
  --line: #26403a;
  --text: #eaf6f1;
  --muted: #9dbab1;
  --accent: #ffcf6b;
  --accent-2: #f0b54a;
  --gold: #ffcf6b;
  --blue: #3ddc97;
  --good: #3ddc97;
  --warn: #ffb547;
  --bad: #ff7a6b;
  --on-accent: #0f1f1b;
  --hi: #ffcf6b;
  --btn: #3ddc97;
  --btn-text: #0b2a20;
  --bar-1: #3ddc97;
  --bar-2: #ffcf6b;
  --glass: #172b26;
  --glass-strong: #1d342e;
  --glass-border: #26403a;
  --glass-shadow: none;
  --nav-bg: rgba(15, 31, 27, .96);
  --hero-bg: linear-gradient(160deg, #134a3b, #172b26 65%);
  --hero-border: #23604e;
  --hero-text: #eaf6f1;
  --hero-muted: #b5d6cb;
  --hero-hi: #ffcf6b;
  --hero-btn: linear-gradient(180deg, #ecd08a, #c99a3e);
  --hero-btn-text: #1a1408;
  --bg-grad: radial-gradient(circle at 0% 0%, rgba(61, 220, 151, .14) 0, transparent 45%), #0f1f1b;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100vw; }
body {
  font-family: var(--font);
  background: var(--bg-grad);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  color: var(--on-accent);
  font-weight: 800;
  font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 18px; }
.brand-tag { color: var(--muted); font-size: 12px; margin-left: 6px; }

.stats { display: flex; align-items: center; gap: 16px; }
.stat {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.stat-icon { font-size: 14px; }
.stat-label { color: var(--muted); font-size: 12px; }

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 22px 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Main content */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}

h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { line-height: 1.55; color: var(--text); }
.muted { color: var(--muted); }

/* Hero */
.hero {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 16%, transparent),
    color-mix(in srgb, var(--gold) 8%, transparent));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.hero h1 { font-size: 26px; }
.hero p { color: var(--muted); }

/* Cards */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .05s ease, opacity .2s ease;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.disabled, .btn[disabled] {
  background: var(--bg-3);
  color: var(--muted);
  cursor: not-allowed;
}

/* Unit grid */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.unit-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color .15s ease, transform .1s ease;
}
.unit-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.unit-card.locked { opacity: .55; cursor: not-allowed; }
.unit-card.locked:hover { transform: none; border-color: var(--line); }
.unit-num {
  display: inline-block;
  background: var(--bg-3);
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.unit-card h3 { margin-bottom: 6px; }
.unit-card .desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
.unit-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-bar {
  flex: 1;
  background: var(--bg-3);
  border-radius: 8px;
  overflow: hidden;
  height: 6px;
}
.progress-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  height: 100%;
  transition: width .3s ease;
}
.progress-text { font-size: 12px; color: var(--muted); }

/* Lesson list */
.lesson-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.lesson-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color .15s ease;
}
.lesson-item:hover { border-color: var(--accent); }
.lesson-item.locked { opacity: .5; cursor: not-allowed; }
.lesson-item.completed { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lesson-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  border: 2px solid var(--line);
  color: var(--muted);
}
.lesson-item.completed .lesson-icon {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.lesson-meta { flex: 1; }
.lesson-title { font-weight: 600; }
.lesson-sub { color: var(--muted); font-size: 13px; }

/* Lesson view */
.lesson-stage {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  min-height: 300px;
}
.step-progress {
  display: flex; gap: 4px; margin-bottom: 20px;
}
.step-dot {
  flex: 1; height: 5px; background: var(--bg-3); border-radius: 3px;
}
.step-dot.done { background: var(--accent); }
.step-dot.current { background: var(--blue); }

.step-tag {
  display: inline-block;
  background: var(--bg-3);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.step-tag.activity { color: var(--gold); }
.step-tag.check { color: var(--accent); }
.step-tag.reflect { color: var(--warn); }
.step-tag.story { color: var(--accent-2); }

.step-body { font-size: 16px; line-height: 1.7; }
.step-image, .step-video { margin: 0 0 16px; }
.step-image img { display: block; width: 100%; max-width: 520px; margin: 0 auto; height: auto; border-radius: 16px; }
.step-video video { display: block; width: 100%; border-radius: 16px; background: #0f5e4c; aspect-ratio: 16 / 9; }
.step-body p { margin: 0 0 12px; }
.step-body ul { padding-left: 20px; line-height: 1.7; }
.step-body li { margin-bottom: 4px; }
.step-body strong { color: var(--gold); }
.step-body em { color: var(--accent); font-style: normal; font-weight: 600; }
.callout {
  background: var(--bg-3);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 8px;
  margin: 14px 0;
}
.callout.warn { border-left-color: var(--warn); }
.callout.gold { border-left-color: var(--gold); }

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choice {
  background: var(--bg-3);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
  color: var(--text);
  transition: all .15s ease;
}
.choice:hover { border-color: var(--blue); }
.choice.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.choice[disabled] { cursor: default; }

.input-row { display: flex; gap: 8px; margin-top: 12px; }
.text-input {
  flex: 1;
  background: var(--bg-3);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
}
.text-input:focus { outline: none; border-color: var(--blue); }
textarea.text-input { min-height: 100px; resize: vertical; }

.feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
.feedback.show { display: block; }
.feedback.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }
.feedback.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }

.lesson-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* Tools / Widgets */
.widget {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.widget h2 { margin-bottom: 6px; }
.widget .desc { color: var(--muted); margin-bottom: 18px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }

.result-box {
  background: var(--bg-3);
  border-radius: 12px;
  padding: 18px;
  margin-top: 14px;
}
.result-big {
  font-size: 32px;
  font-weight: 800;
  color: var(--gold);
}
.result-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.result-row:last-child { border-bottom: none; }

table.simple-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}
.simple-table th, .simple-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.simple-table th { color: var(--muted); font-weight: 600; }

/* Confetti / completion */
.complete-banner {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 24%, transparent),
    color-mix(in srgb, var(--gold) 16%, transparent));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.complete-banner h2 { color: var(--accent); }

/* ============== Badges ============== */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.badge {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 12px;
  text-align: center;
  position: relative;
  transition: all .15s ease;
}
.badge.locked {
  opacity: 0.35;
  filter: grayscale(80%);
}
.badge.earned {
  border-color: var(--gold);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--gold) 12%, transparent),
    color-mix(in srgb, var(--gold) 4%, transparent));
  box-shadow: 0 0 24px color-mix(in srgb, var(--gold) 12%, transparent);
}
.badge-icon {
  font-size: 38px;
  margin-bottom: 6px;
  display: block;
}
.badge-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text);
}
.badge-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.badge.earned .badge-name {
  color: var(--gold);
}

/* Level bar */
.level-card {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 18%, transparent),
    color-mix(in srgb, var(--gold) 12%, transparent));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
}
.level-name {
  font-weight: 800;
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 4px;
}
.level-next {
  color: var(--muted);
  font-size: 13px;
}
.level-bar {
  margin-top: 10px;
  background: var(--bg-3);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}
.level-fill {
  background: linear-gradient(90deg, var(--gold), var(--accent));
  height: 100%;
  transition: width .5s ease;
}

/* Badge popup (when earned) */
.badge-popup {
  position: fixed;
  top: 100px;
  right: 24px;
  background: linear-gradient(135deg, var(--gold), var(--accent-2));
  color: var(--on-accent);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--gold) 40%, transparent);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  animation: slideIn .4s ease, slideOut .4s ease 4s forwards;
  max-width: 320px;
}
.badge-popup .pop-icon { font-size: 32px; }
.badge-popup .pop-meta { font-size: 13px; font-weight: 600; }
.badge-popup .pop-title { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .5px; }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* Celebration banner */
.celebrate {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 24%, transparent),
    color-mix(in srgb, var(--gold) 18%, transparent));
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  animation: pulse 2s ease infinite;
}
.celebrate-emoji {
  font-size: 64px;
  display: block;
  margin-bottom: 8px;
  animation: bounce 1.2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  50% { box-shadow: 0 0 36px color-mix(in srgb, var(--gold) 25%, transparent); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Onboarding modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal-card h1 { margin-bottom: 12px; }

/* Parent dashboard */
.parent-section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.parent-section h3 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.qa-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 6%, transparent);
  font-size: 14px;
}
.qa-row:last-child { border-bottom: none; }
.qa-q { color: var(--muted); }
.qa-a { color: var(--text); white-space: pre-wrap; }
.qa-correct { color: var(--good); }
.qa-wrong { color: var(--bad); }

.parent-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.summary-stat {
  background: var(--bg-3);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.summary-stat .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
}
.summary-stat .lbl {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Encouragement banner */
.cheer {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 14px 0;
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; }
  .brand-tag { display: none; }
  .stats { width: 100%; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
  .stat { padding: 5px 8px; font-size: 11px; }
  .stat-label { display: none; }
  .ghost-btn { padding: 5px 10px; font-size: 12px; }
  .qa-row { grid-template-columns: 1fr; gap: 4px; }

  /* Tabs fit all 6 on phone width */
  .tabs { padding: 8px 8px 0; gap: 2px; }
  .tab { padding: 10px 8px; font-size: 12px; }

  /* Main padding tighter */
  main { padding: 18px 14px 60px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }

  /* Lesson stage tighter */
  .lesson-stage { padding: 18px 16px; }
  .step-body { font-size: 15px; }

  /* Hero tighter */
  .hero { padding: 18px; }
  .hero h1 { font-size: 20px; }

  /* Grids stack to 1 column for very small screens */
  .card-row, .next-grid, .phases-grid, .numbers-strip, .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Phone / native app fit ===== */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
button, a, .tab { -webkit-tap-highlight-color: transparent; }

/* Keep content clear of the notch, clock and battery */
.topbar {
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-left: calc(22px + env(safe-area-inset-left));
  padding-right: calc(22px + env(safe-area-inset-right));
}
main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* Tabs scroll inside their own row instead of pushing the page sideways */
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; white-space: nowrap; }

/* Long words and wide content never widen the page */
main, .card, .hero { min-width: 0; overflow-wrap: anywhere; }
img, video, canvas, svg, table, pre { max-width: 100%; }
input, select, textarea { font-size: 16px; }

@media (max-width: 640px) {
  .topbar {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .tabs { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
  main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

/* Welcome intake */
.welcome-card { width: 100%; box-sizing: border-box; max-height: calc(100vh - 40px); overflow-y: auto; }
.welcome-card .choices { margin-top: 16px; }
.choice.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.welcome-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.welcome-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.welcome-dots span.on { background: var(--accent); }
.welcome-actions { margin-top: 16px; display: flex; justify-content: center; }
.welcome-skip {
  margin-top: 14px; background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; text-decoration: underline;
}

/* Home goal card */
.goal-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* Teach-back on lesson complete */
.teachback {
  margin: 24px auto 0; max-width: 520px; text-align: left;
  background: var(--bg-2); border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 18px 20px;
}
.teachback.done { border-color: var(--good); }
.teachback-tag { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.teachback-lead { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.teachback-prompt { font-size: 17px; font-weight: 600; margin: 0 0 14px; line-height: 1.4; }
.teachback-done { color: var(--good); font-weight: 700; }

/* Parent dinner-table card */
.dinner-card {
  margin-top: 18px; background: var(--bg-2); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 18px 20px;
}
.dinner-tag { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.dinner-q { font-size: 18px; font-weight: 700; margin: 0; line-height: 1.4; }

/* Parent tab: family overview */
.family-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.family-kid {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; color: var(--text); font: inherit;
}
.family-kid.viewing { border-color: var(--accent); }
.family-kid.family-add { border-style: dashed; }
.family-name { font-weight: 700; font-size: 16px; }
.family-here { font-size: 11px; font-weight: 600; color: var(--accent); margin-left: 4px; }
.family-stats { font-size: 13px; }
.family-last { font-size: 12px; color: var(--muted); }

/* ===== My Money World ===== */
.world-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; margin-bottom: 16px; }
.world-stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.world-stat .num { font-size: 22px; font-weight: 800; }
.world-stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.world-report { border-color: var(--gold); }
.world-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.world-line:last-child { border-bottom: none; }
.world-line span:last-child { font-weight: 700; white-space: nowrap; }
.world-net { font-weight: 800; border-top: 1px solid var(--line); }
.world-event { padding: 8px 10px; margin: 8px 0; border-radius: 10px; background: var(--bg-3); font-size: 14px; }
.world-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.world-btns .btn { padding: 10px 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: default; }
.owned-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.owned-row:last-child { border-bottom: none; }
.owned-emoji { font-size: 28px; }
.owned-meta { flex: 1; min-width: 0; }
.kind-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 4px; vertical-align: middle; white-space: nowrap;
  background: var(--bg-3); color: var(--muted); }
.kind-chip.active   { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); }
.kind-chip.passive,
.kind-chip.residual { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.kind-chip.bill     { color: var(--bad);  background: color-mix(in srgb, var(--bad) 13%, transparent); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shop-item { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.shop-item.locked { opacity: .6; }
.shop-item .btn { margin-top: auto; }
.shop-top { display: flex; justify-content: space-between; align-items: center; }
.shop-emoji { font-size: 32px; }
.shop-name { font-weight: 700; font-size: 16px; }
.shop-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.shop-lock { margin-top: auto; font-size: 12px; color: var(--muted); }

/* Decide step */
.decide-outcome, .decide-why { margin-top: 16px; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-3); }
.decide-outcome { border-color: var(--gold); }
.decide-tag { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.decide-outcome p, .decide-why p { margin: 6px 0; }
.decide-fx { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.decide-fx span { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.decide-note { font-size: 13px; margin-top: 10px !important; }
.decide-why details { margin-top: 10px; }
.decide-why summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.decide-other { margin-top: 10px; font-size: 14px; }
.decide-other strong { display: block; }
.choice.decide-choice[disabled]:not(.picked) { opacity: .55; }

/* Money World tour + teasers */
.tour-shade { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.55); }
.tour-box { position: absolute; left: 50%; transform: translateX(-50%); z-index: 60;
  width: calc(100% - 32px); max-width: 460px; box-sizing: border-box; background: var(--bg-2); border: 2px solid var(--accent);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tour-box.center { position: fixed; top: 50% !important; transform: translate(-50%, -50%); }
.tour-box.below::before, .tour-box.above::after { content: ""; position: absolute; left: 50%; margin-left: -9px;
  border: 9px solid transparent; }
.tour-box.below::before { top: -20px; border-bottom-color: var(--accent); }
.tour-box.above::after { bottom: -20px; border-top-color: var(--accent); }
.tour-text { font-size: 16px; line-height: 1.5; }
.tour-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; }
.tour-row .welcome-skip { margin: 0 8px 0 0; }
.tour-hl { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); position: relative; z-index: 56; background: var(--bg); box-shadow: 0 0 0 4px var(--bg); }
.decide-teaser { margin: 12px 0 0; font-size: 14px; color: var(--gold); }
.decide-chip { color: var(--gold); font-weight: 700; }
.missed-list { border-color: var(--gold); }
.missed-list .btn { padding: 10px 14px; font-size: 14px; white-space: nowrap; }
.missed-card { text-align: left; max-width: 560px; padding: 24px 20px; }
.missed-card .welcome-actions { text-align: center; }


/* =====================================================================
   Aurora Glass layer (2026-10-13). Glowing background + frosted cards.
   Sits last so it restyles the components above without touching JS.
   ===================================================================== */
body { background: var(--bg); position: relative; }
button, input, select, textarea { font-family: inherit; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bg-grad); pointer-events: none; }

h1, h2, h3 { font-weight: 800; letter-spacing: -.3px; }
h1 { letter-spacing: -.6px; }

/* Shared frosted-glass surface */
.topbar, .tabs,
.card, .hero, .level-card, .widget, .parent-section, .lesson-stage,
.unit-card, .lesson-item, .badge, .shop-item, .world-stat, .family-kid,
.teachback, .dinner-card, .celebrate, .complete-banner, .stat, .ghost-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
}
.card, .hero, .level-card, .widget, .parent-section, .lesson-stage,
.unit-card, .lesson-item, .shop-item, .teachback, .dinner-card, .celebrate, .complete-banner {
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

/* Top bar + tabs */
.topbar { border-width: 0 0 1px; }
.logo { background: #0d0f14; border-radius: 10px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.logo svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 800; letter-spacing: -.3px; }
.stat { border-radius: 999px; font-weight: 700; }
.ghost-btn { border-radius: 999px; color: var(--text); font-weight: 600; }
.ghost-btn:hover { background: var(--glass-strong); border-color: var(--glass-border); }
.tabs { border-width: 0 0 1px; padding-bottom: 10px; gap: 6px; }
.tab { border-radius: 999px; border: 1px solid transparent; padding: 9px 16px; color: var(--muted); }
.tab:hover { color: var(--text); background: var(--glass); }
.tab.active { background: var(--btn); color: var(--btn-text); border-bottom-color: transparent; }

/* Hero + level */
.hero h1 { font-size: 30px; }
.hero p { color: var(--muted); }
.level-name { color: var(--text); font-weight: 800; }
.level-bar, .progress-bar { background: var(--bg-3); border-radius: 999px; height: 10px; }
.level-fill, .progress-fill { background: linear-gradient(90deg, var(--bar-1), var(--bar-2)); border-radius: 999px; }

/* Buttons */
.btn { background: var(--btn); color: var(--btn-text); border-radius: 999px; padding: 13px 24px; font-weight: 700; }
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--glass); color: var(--text); border: 1px solid var(--glass-border); }
.btn.disabled, .btn[disabled] { background: var(--bg-3); color: var(--muted); }

/* Curriculum */
.unit-card:hover, .lesson-item:hover { border-color: var(--glass-border); background: var(--glass-strong); transform: translateY(-2px); }
.unit-card.locked:hover { background: var(--glass); border-color: var(--glass-border); }
.unit-num { background: transparent; border: 1px solid var(--hi); color: var(--hi); border-radius: 999px; }
.lesson-item { border-radius: 18px; }
.lesson-item.completed { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.lesson-icon { background: var(--bg-3); border: 1px solid var(--line); }
.lesson-item.completed .lesson-icon { background: var(--good); border-color: var(--good); color: #fff; }

/* Lesson view */
.step-dot { height: 6px; border-radius: 999px; background: var(--bg-3); }
.step-dot.done { background: var(--text); }
.step-dot.current { background: var(--hi); }
.step-tag, .step-tag.activity, .step-tag.check, .step-tag.reflect, .step-tag.story {
  background: transparent; border: 1px solid currentColor; border-radius: 999px; color: var(--hi);
}
.step-tag.activity { color: var(--good); }
.step-tag.reflect { color: var(--warn); }
.step-body strong { color: var(--hi); }
.step-body em { color: var(--blue); }
.callout { background: var(--bg-3); border-left: 4px solid var(--hi); border-radius: 0 14px 14px 0; }
.choice { background: var(--glass); border: 1px solid var(--glass-border); border-radius: 16px; }
.choice:hover { border-color: var(--hi); }
.choice.correct { background: color-mix(in srgb, var(--good) 22%, transparent); border-color: var(--good); }
.choice.wrong { background: color-mix(in srgb, var(--bad) 18%, transparent); border-color: var(--bad); }
.choice.picked { border-color: var(--hi); background: color-mix(in srgb, var(--hi) 16%, transparent); }
.text-input { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; }
.text-input:focus { border-color: var(--hi); }
.feedback { border-radius: 14px; }
.lesson-controls { border-top-color: var(--line); }

/* Badges + celebration */
.badge { border-radius: 20px; }
.badge.earned { background: var(--glass-strong); border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--bar-2) 30%, transparent); }
.badge.earned .badge-name { color: var(--text); }
.celebrate { border: 1px solid var(--glass-border); }
.complete-banner h2 { color: var(--text); }
.badge-popup { background: var(--btn); color: var(--btn-text); border-radius: 18px; box-shadow: var(--shadow); }
.cheer { background: color-mix(in srgb, var(--good) 14%, transparent); border-left-color: var(--good); color: var(--good); border-radius: 0 12px 12px 0; }

/* Popups stay solid so text is easy to read */
.modal-card, .tour-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tour-box { border: 2px solid var(--hi); }
.tour-box.below::before { border-bottom-color: var(--hi); }
.tour-box.above::after { border-top-color: var(--hi); }
.tour-hl { outline-color: var(--hi); background: var(--bg); }
.welcome-dots span.on { background: var(--hi); }

/* Parent + world details */
.summary-stat, .result-box, .world-event, .decide-outcome, .decide-why { background: var(--bg-3); border-radius: 16px; }
.decide-outcome, .world-report, .missed-list { border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.decide-tag, .teachback-tag, .dinner-tag { color: var(--hi); }
.teachback { border: 1px solid var(--hi); }
.dinner-card { border-left: 4px solid var(--hi); }
.family-kid { border-radius: 18px; }
.family-kid.viewing { border-color: var(--hi); }
.decide-fx span { background: var(--glass); border-color: var(--glass-border); }

@media (max-width: 640px) {
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
  .tab { padding: 8px 12px; }
  .hero h1 { font-size: 24px; }
}

/* =====================================================================
   App layout on phones (2026-10-13). Bigger screens keep the website
   layout above. Phones get: compact top bar (logo, stats, "me" circle),
   tabs along the bottom, more solid cards, full-screen lessons.
   ===================================================================== */
.tab-ic { margin-right: 6px; }
.tab-short { display: none; }
.me-btn { display: none; }

.me-sheet { position: fixed; inset: 0; z-index: 80; }
.me-sheet[hidden] { display: none; }
.me-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .2s ease; }
.me-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  background: var(--bg-2); color: var(--text); border-radius: 26px 26px 0 0; box-shadow: var(--shadow);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .2s ease; }
.me-sheet.open .me-shade { opacity: 1; }
.me-sheet.open .me-panel { transform: none; }
.me-grab { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
.me-who { display: flex; align-items: center; gap: 12px; padding: 0 4px 14px; border-bottom: 1px solid var(--line); }
.me-who b { display: block; font-size: 18px; }
.me-who small { color: var(--muted); font-size: 13px; }
.me-avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--btn); color: var(--btn-text); font-weight: 800; font-size: 18px; }
.me-item { display: block; width: 100%; text-align: left; padding: 15px 6px; font-size: 16px; font-weight: 600;
  background: none; border: none; border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; }
.me-item.me-close { border-bottom: none; text-align: center; color: var(--muted); }

@media (max-width: 640px) {

  /* Compact top bar: logo · streak · XP · lessons · me */
  .topbar { flex-direction: row; align-items: center; gap: 8px; }
  .brand-name { display: none; }
  .logo { width: 34px; height: 34px; }
  .stats { width: auto; flex: 1; flex-wrap: nowrap; gap: 6px; }
  .stats .ghost-btn { display: none !important; }
  .stat { padding: 6px 10px; font-size: 13px; font-weight: 700; }
  .me-btn { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; flex: 0 0 38px;
    width: 38px; height: 38px; border-radius: 50%; background: var(--btn); color: var(--btn-text);
    border: none; font-weight: 800; font-size: 16px; cursor: pointer; }

  /* Tabs along the bottom, like an app */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow: visible;
    background: var(--nav-bg); border: none; border-top: 1px solid var(--line); }
  .tabs .tab-extra { display: none; }
  .tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
    font-size: 11px; font-weight: 600; color: var(--muted); background: transparent; border: none; border-radius: 0; }
  .tab:hover { background: transparent; }
  .tab .tab-ic { margin: 0; font-size: 20px; line-height: 1; width: 48px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 999px; }
  .tab.active { background: transparent; color: var(--text); }
  .tab.active .tab-ic { background: var(--btn); }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

  .hero .btn { width: 100%; justify-content: center; }

  /* Full-screen lessons: no bottom tabs, Next button pinned to the bottom */
  body.in-lesson .tabs { display: none; }
  body.in-lesson main { padding-bottom: 24px; }
  .lesson-controls { position: sticky; bottom: 0; z-index: 5; margin: 20px -16px -18px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--nav-bg); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}

/* Today's lesson: deep green card with a gold button (every screen size) */
.hero {
  --text: var(--hero-text); --muted: var(--hero-muted); --hi: var(--hero-hi); --gold: var(--hero-hi);
  --btn: var(--hero-btn); --btn-text: var(--hero-btn-text);
  background: var(--hero-bg); color: var(--hero-text); border: 1px solid var(--hero-border);
  box-shadow: 0 10px 28px rgba(15, 80, 60, .22);
}

/* Parent tab: My Business safety rules (shown once Unit 2 Day 5 is done) */
.safety-card { border-left-color: var(--warn); }
.safety-card .dinner-tag { color: var(--warn); }
.safety-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
/* Kid-facing safety rules inside lessons */
.callout.safety { border-left: 4px solid var(--warn); font-size: 1.05em; }
.callout.safety ul { margin: 8px 0 0; padding-left: 20px; }
/* "📌 Remember" reference notes at the end of business missions (reminders.js) */
.callout.remind { border-left: 4px solid var(--good); margin-top: 14px; }
.callout.remind ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* ===== My Business: Sales Log, money ladder, founder meeting (business.js) ===== */
.biz-card { border: 2px solid color-mix(in srgb, var(--gold) 45%, var(--line)); }
.biz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.biz-head h2 { margin: 0; }
.biz-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 10px; }
.biz-stats > div { background: var(--bg-3); border-radius: 10px; padding: 10px 6px; text-align: center; }
.biz-num { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.biz-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }
.biz-ladder { margin: 8px 0 0; }
.biz-ladder-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.biz-nudge { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.biz-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.biz-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.biz-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.biz-form-row { display: flex; gap: 10px; }
.biz-form .biz-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.biz-modal { text-align: left; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 26px 22px; }
.biz-modal h2 { margin-top: 0; }
.biz-week { background: var(--bg-3); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.biz-sale { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.biz-sale > div:first-child { flex: 1; min-width: 0; }
.biz-sale-what { font-weight: 700; overflow-wrap: anywhere; }
.biz-sale-amt { font-weight: 800; color: var(--gold); text-align: right; }
.stall-card { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.stall-card .dinner-tag { color: var(--warn); }
@media (max-width: 560px) {
  .biz-stats { grid-template-columns: repeat(2, 1fr); }
  .biz-form-row { flex-direction: column; }
}

/* Founder Tools pop-up (every tool opens on its own, like the Weekly Founder Meeting) */
body.tool-open { overflow: hidden; }
.tool-modal { position: relative; text-align: left; max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 0; -webkit-overflow-scrolling: touch; }
.tool-modal .tool-stage > .card { margin: 0; border: 0; box-shadow: none; background: transparent; }
.tool-close { position: sticky; top: 0; float: right; z-index: 2; margin: 10px 10px -46px 0; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }
.tool-modal h2:first-child, .tool-modal .tool-stage > .card > h2:first-child { padding-right: 44px; }
@media (max-width: 640px) {
  .tool-backdrop { padding: 0; align-items: stretch; }
  .tool-modal { max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
