/* ============================================================
   Balance Wheel Academy — design system
   Tokens extracted verbatim from balance-wheel-church.lovable.app
   ============================================================ */

:root {
  --background: 30 25% 97%;
  --foreground: 20 30% 15%;
  --card: 30 20% 95%;
  --card-foreground: 20 30% 15%;
  --primary: 18 75% 50%;
  --primary-foreground: 30 25% 97%;
  --secondary: 20 40% 22%;
  --secondary-foreground: 30 25% 97%;
  --muted: 25 15% 90%;
  --muted-foreground: 20 20% 40%;
  --accent: 32 85% 55%;
  --accent-foreground: 20 30% 12%;
  --destructive: 0 65% 50%;
  --border: 25 15% 85%;
  --input: 25 15% 88%;
  --ring: 18 75% 50%;
  --radius: .75rem;
  --font-display: 'Fraunces', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-ui: 'Montserrat', system-ui, -apple-system, sans-serif;

  --cashmere: 25 30% 72%;
  --sunset: 12 80% 55%;
  --terracotta: 18 70% 48%;
  --amber: 32 90% 55%;
  --chocolate: 20 50% 25%;
  --peach: 22 75% 85%;
  --coral: 8 75% 55%;
  --cream: 30 30% 95%;
  --burnt: 15 65% 40%;

  --gradient-hero: linear-gradient(135deg, hsl(30 25% 97%) 0%, hsl(28 22% 92%) 50%, hsl(25 20% 90%) 100%);
  --gradient-sunset: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
  --gradient-amber: linear-gradient(135deg, hsl(32 90% 55%) 0%, hsl(22 85% 50%) 100%);
  --gradient-warm: linear-gradient(180deg, hsl(30 25% 97%) 0%, hsl(25 22% 92%) 100%);
  --gradient-earth: linear-gradient(135deg, hsl(20 50% 25%) 0%, hsl(20 45% 35%) 100%);
  --gradient-coral: linear-gradient(135deg, hsl(8 75% 55%) 0%, hsl(22 85% 55%) 50%, hsl(32 90% 55%) 100%);
  --shadow-soft: 0 4px 20px hsl(20 30% 15% / .08);
  --shadow-warm: 0 8px 30px hsl(32 85% 55% / .2);
  --shadow-sunset: 0 8px 30px hsl(var(--primary) / .25);

  --sidebar-background: 30 20% 95%;
  --sidebar-foreground: 20 30% 15%;
  --sidebar-accent: 30 15% 90%;
  --sidebar-border: 25 15% 85%;
}

body.dark {
  /* deep bordeaux / wine */
  --background: 345 52% 7%;
  --foreground: 28 30% 92%;
  --card: 345 42% 11%;
  --card-foreground: 28 30% 92%;
  --primary: 8 78% 58%;
  --primary-foreground: 345 52% 7%;
  --secondary: 345 35% 17%;
  --secondary-foreground: 28 30% 92%;
  --muted: 345 28% 15%;
  --muted-foreground: 22 20% 64%;
  --accent: 28 82% 56%;
  --accent-foreground: 345 52% 7%;
  --destructive: 0 60% 52%;
  --border: 345 30% 19%;
  --input: 345 30% 19%;
  --ring: 8 78% 58%;

  --cashmere: 20 28% 65%;
  --sunset: 12 75% 58%;
  --terracotta: 15 65% 52%;
  --amber: 25 85% 58%;
  --chocolate: 350 35% 15%;
  --peach: 18 70% 80%;
  --coral: 8 70% 58%;
  --cream: 25 25% 88%;
  --burnt: 12 60% 45%;

  --gradient-hero: linear-gradient(135deg, hsl(345 52% 8%) 0%, hsl(345 45% 12%) 50%, hsl(350 40% 14%) 100%);
  --gradient-warm: linear-gradient(180deg, hsl(345 52% 7%) 0%, hsl(348 55% 5%) 100%);
  --shadow-soft: 0 4px 20px hsl(0 0% 0% / .4);

  --sidebar-background: 345 45% 9%;
  --sidebar-foreground: 28 30% 92%;
  --sidebar-accent: 345 32% 15%;
  --sidebar-border: 345 30% 18%;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  background-image: var(--gradient-warm);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.18; color: hsl(var(--foreground)); font-family: var(--font-display); }
h1 { font-size: 2.3rem; font-weight: 600; letter-spacing: -.015em; margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; font-weight: 600; margin: 2rem 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.hero h1 { font-size: 2.6rem; }
p { margin: 0 0 1rem; }
a { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul, ol { padding-left: 1.4rem; margin: 0 0 1rem; }
li { margin-bottom: .4rem; }
blockquote {
  margin: 1.25rem 0; padding: 1rem 1.25rem;
  border-left: 4px solid hsl(var(--accent));
  background: hsl(var(--accent) / .08);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
blockquote .ref { display: block; margin-top: .5rem; font-style: normal; font-weight: 600; font-size: .85rem; color: hsl(var(--muted-foreground)); }

/* ---------- layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 272px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: hsl(var(--sidebar-background));
  border-right: 1px solid hsl(var(--sidebar-border));
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 40;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
}
.brand-logo { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; box-shadow: var(--shadow-soft); }
.brand-title { font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; color: hsl(var(--muted-foreground)); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { padding: .5rem .75rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .8rem; margin-bottom: .15rem;
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--sidebar-foreground));
  font-weight: 600; font-size: .92rem;
  transition: background .15s;
}
.nav-item:hover { background: hsl(var(--sidebar-accent)); text-decoration: none; }
.nav-item.active { background: var(--gradient-sunset); color: hsl(var(--primary-foreground)); box-shadow: var(--shadow-sunset); }
.nav-icon { width: 1.35rem; text-align: center; }
.nav-badge {
  margin-left: auto; font-size: .7rem; font-weight: 700;
  background: hsl(var(--accent) / .2); color: hsl(var(--accent-foreground));
  border-radius: 99px; padding: .1rem .5rem;
}
.nav-item.active .nav-badge { background: hsl(0 0% 100% / .25); color: inherit; }

.sidebar-footer { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid hsl(var(--sidebar-border)); }
.theme-toggle {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .55rem .8rem; border: 1px solid hsl(var(--border));
  background: hsl(var(--card)); color: hsl(var(--foreground));
  border-radius: calc(var(--radius) - 2px); cursor: pointer;
  font-family: inherit; font-size: .88rem; font-weight: 600;
}
.theme-toggle:hover { background: hsl(var(--sidebar-accent)); }
.sidebar-church { display: flex; align-items: center; gap: .5rem; margin-top: .9rem; font-size: .72rem; color: hsl(var(--muted-foreground)); }
.sidebar-church img { width: 26px; height: 26px; border-radius: 50%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 2rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / .8);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; background: none; border: none; font-size: 1.3rem; color: hsl(var(--foreground)); cursor: pointer; }
.topbar-title { font-weight: 700; font-size: 1.02rem; }
.topbar-progress { margin-left: auto; font-size: .82rem; font-weight: 600; color: hsl(var(--muted-foreground)); }

.view { padding: 2rem; max-width: 980px; width: 100%; margin: 0 auto; outline: none; }

.safety-footer {
  margin-top: auto;
  padding: 1.1rem 2rem;
  font-size: .78rem; line-height: 1.55;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .4);
}

.scrim { display: none; position: fixed; inset: 0; background: hsl(20 30% 10% / .5); z-index: 35; }

/* ---------- components ---------- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
}
.card.flat { box-shadow: none; }
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 .6rem; }

.hero {
  background: var(--gradient-hero);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 1.4);
  padding: 2.25rem 2rem;
  margin-bottom: 1.5rem;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -80px; top: -80px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at center, hsl(var(--amber) / .35) 0%, transparent 70%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / .1);
  padding: .25rem .7rem; border-radius: 99px; margin-bottom: .8rem;
}
.hero p.lead { font-size: 1.05rem; max-width: 640px; color: hsl(var(--muted-foreground)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: calc(var(--radius) - 2px);
  border: none; cursor: pointer;
  font-family: inherit; font-size: .92rem; font-weight: 700;
  background: var(--gradient-sunset); color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-sunset);
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; box-shadow: var(--shadow-warm); }
.btn.secondary {
  background: hsl(var(--card)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border)); box-shadow: none;
}
.btn.secondary:hover { background: hsl(var(--muted)); }
.btn.ghost { background: none; box-shadow: none; color: hsl(var(--primary)); padding: .4rem .8rem; }
.btn.danger { background: hsl(var(--destructive)); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.small { padding: .4rem .9rem; font-size: .82rem; }

.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.pill {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .18rem .65rem; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .05em;
}

.progress-track { background: hsl(var(--muted)); border-radius: 99px; height: 9px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--gradient-amber); transition: width .4s; }

.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem; margin: 1.25rem 0;
  border: 1px solid hsl(var(--accent) / .4);
  background: hsl(var(--accent) / .08);
  font-size: .95rem;
}
.callout.info { border-color: hsl(var(--terracotta) / .4); background: hsl(var(--terracotta) / .07); }
.callout strong:first-child { color: hsl(var(--burnt)); }

.kicker { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: hsl(var(--primary)); margin-bottom: .4rem; }

.keypoints { list-style: none; padding: 0; }
.keypoints li {
  padding: .55rem .9rem .55rem 2.2rem; margin-bottom: .5rem;
  background: hsl(var(--muted) / .55); border-radius: calc(var(--radius) - 4px);
  position: relative;
}
.keypoints li::before {
  content: '✓'; position: absolute; left: .8rem; top: .55rem;
  color: hsl(var(--primary)); font-weight: 800;
}

/* module / lesson cards */
.module-card {
  display: flex; gap: 1rem; align-items: flex-start;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-soft); transition: transform .15s, box-shadow .15s;
  color: inherit;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-warm); text-decoration: none; }
.module-icon {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #fff;
}
.lesson-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1rem; border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); margin-bottom: .55rem;
  background: hsl(var(--card)); color: inherit; font-weight: 600; font-size: .95rem;
}
.lesson-row:hover { background: hsl(var(--muted) / .6); text-decoration: none; }
.lesson-row .check { margin-left: auto; font-weight: 800; color: hsl(140 50% 42%); }
.lesson-row .num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  background: hsl(var(--muted)); display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}

/* resources */
.resource-card {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: 1rem 1.1rem; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); background: hsl(var(--card));
  color: inherit; font-size: .9rem;
}
.resource-card:hover { box-shadow: var(--shadow-soft); text-decoration: none; }
.resource-card .r-icon { font-size: 1.3rem; }
.resource-card .r-title { font-weight: 700; }
.resource-card .r-note { color: hsl(var(--muted-foreground)); font-size: .82rem; }

/* ---------- assessment ---------- */

.scale-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.scale-table td { padding: .7rem .9rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: top; }
.scale-num {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: var(--gradient-sunset);
}

.q-card { margin-bottom: 1.1rem; }
.q-text { font-weight: 600; font-size: 1.02rem; margin-bottom: .9rem; }
.q-anchors { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.q-anchor { flex: 1; font-size: .78rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.q-anchor strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.q-anchor.low strong { color: hsl(var(--destructive)); }
.q-anchor.high { text-align: right; }
.q-anchor.high strong { color: hsl(140 50% 38%); }

.likert { display: flex; gap: .5rem; }
.likert label { flex: 1; }
.likert input { position: absolute; opacity: 0; pointer-events: none; }
.likert .likert-btn {
  display: flex; align-items: center; justify-content: center;
  height: 46px; border-radius: calc(var(--radius) - 4px);
  border: 1.5px solid hsl(var(--border));
  background: hsl(var(--background));
  font-weight: 700; cursor: pointer; user-select: none;
  transition: all .12s;
}
.likert .likert-btn:hover { border-color: hsl(var(--primary)); }
.likert input:checked + .likert-btn {
  background: var(--gradient-sunset); color: hsl(var(--primary-foreground));
  border-color: transparent; box-shadow: var(--shadow-sunset);
}
.likert input:focus-visible + .likert-btn { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }

.band { border-radius: calc(var(--radius) - 4px); padding: .9rem 1.1rem; margin-bottom: .7rem; font-size: .92rem; }
.band.low { background: hsl(var(--destructive) / .09); border: 1px solid hsl(var(--destructive) / .3); }
.band.mid { background: hsl(var(--amber) / .12); border: 1px solid hsl(var(--amber) / .4); }
.band.high { background: hsl(140 50% 42% / .1); border: 1px solid hsl(140 50% 42% / .35); }

.score-chip { font-weight: 800; font-size: 1.3rem; }

/* quiz */
.quiz-opt {
  display: block; padding: .7rem 1rem; margin-bottom: .5rem;
  border: 1.5px solid hsl(var(--border)); border-radius: calc(var(--radius) - 4px);
  cursor: pointer; background: hsl(var(--background)); font-size: .95rem;
}
.quiz-opt:hover { border-color: hsl(var(--primary)); }
.quiz-opt.correct { border-color: hsl(140 50% 42%); background: hsl(140 50% 42% / .12); }
.quiz-opt.wrong { border-color: hsl(var(--destructive)); background: hsl(var(--destructive) / .1); }

textarea.journal-input {
  width: 100%; min-height: 110px; resize: vertical;
  font-family: inherit; font-size: .95rem; line-height: 1.6;
  padding: .8rem 1rem; border-radius: calc(var(--radius) - 4px);
  border: 1.5px solid hsl(var(--input)); background: hsl(var(--background));
  color: hsl(var(--foreground));
}
textarea.journal-input:focus { outline: 2px solid hsl(var(--ring)); outline-offset: 1px; }

/* wheel svg */
.wheel-wrap { display: flex; justify-content: center; padding: 1rem 0; }
.wheel-svg .seg { cursor: pointer; transition: opacity .15s, transform .2s; transform-origin: center; }
.wheel-svg .seg:hover { opacity: .82; }
.wheel-svg text { font-family: 'Montserrat', sans-serif; }

/* misc */
.divider { border: none; border-top: 1px solid hsl(var(--border)); margin: 2rem 0; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: .85rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0 1rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; margin-bottom: 1rem; }
table.data th { text-align: left; padding: .6rem .8rem; background: hsl(var(--muted) / .6); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
table.data td { padding: .6rem .8rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: top; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .25s;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; }
  .menu-btn { display: block; }
  .view { padding: 1.25rem; }
  .topbar { padding: .8rem 1.25rem; }
  .hero { padding: 1.5rem 1.25rem; }
  .likert .likert-btn { height: 42px; }
  .q-anchors { flex-direction: column; gap: .3rem; }
  .q-anchor.high { text-align: left; }
}

/* ============================================================
   v2 additions: glass, motion, KPIs, video, flashcards, AI, auth
   ============================================================ */

/* animated frosted background */
.bg-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-aurora span {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(70px); opacity: .55; mix-blend-mode: multiply;
  animation: drift 26s ease-in-out infinite alternate;
}
body.dark .bg-aurora span { mix-blend-mode: screen; opacity: .4; }
.bg-aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -8vw; top: -6vw; background: hsl(var(--primary)); }
.bg-aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -6vw; top: 18vh; background: hsl(var(--amber)); animation-delay: -8s; animation-duration: 32s; }
.bg-aurora span:nth-child(3) { width: 38vw; height: 38vw; left: 28vw; bottom: -12vw; background: hsl(var(--accent)); animation-delay: -14s; animation-duration: 30s; }
/* minimal B&W theme: calm the aurora to a soft grey so it stays clean */
body.theme-light-minimal .bg-aurora { opacity: .18; }
@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(4vw,3vh) scale(1.12); }
  100% { transform: translate(-3vw,-2vh) scale(1.04); }
}

/* frosted glass surfaces */
.glass {
  background: hsl(var(--card) / .72);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid hsl(var(--border) / .8);
}
.glass-soft {
  background: hsl(var(--card) / .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sidebar { background: hsl(var(--sidebar-background) / .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.topbar { background: hsl(var(--background) / .7); }
.credit { font-size: .72rem; color: hsl(var(--muted-foreground)); margin: .6rem 0 0; font-style: italic; }
.module-hero h1, .module-hero .lead, .module-hero .eyebrow { text-shadow: 0 1px 12px hsl(var(--background) / .8); }

/* nav label hides nothing now; lang switch */
.lang-switch { display: flex; gap: .3rem; margin-bottom: .7rem; }
.lang-pill {
  flex: 1; padding: .35rem 0; border: 1px solid hsl(var(--border));
  background: hsl(var(--card)); color: hsl(var(--foreground));
  border-radius: calc(var(--radius) - 4px); cursor: pointer;
  font-family: inherit; font-size: .76rem; font-weight: 700;
}
.lang-pill.active { background: var(--gradient-sunset); color: hsl(var(--primary-foreground)); border-color: transparent; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi-card {
  background: hsl(var(--card) / .85); backdrop-filter: blur(8px);
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-soft); position: relative; overflow: hidden;
}
.kpi-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, hsl(var(--amber) / .18), transparent 70%); }
.kpi-icon { font-size: 1.1rem; opacity: .8; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: .2rem 0 .1rem; }
.kpi-label { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: hsl(var(--muted-foreground)); }
.kpi-sub { font-size: .74rem; color: hsl(var(--primary)); font-weight: 600; margin-top: .25rem; }

/* mini progress track inside bands/cards */
.mini-track { height: 6px; background: hsl(var(--muted)); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.mini-fill { height: 100%; border-radius: 99px; transition: width .5s; }
.band-link { display: block; color: inherit; }
.band-link:hover { text-decoration: none; transform: translateX(2px); transition: transform .15s; }

/* score chip emphasis on wheel fill */
.wheel-svg .seg-fill { transition: opacity .2s; }

/* video cards + click-to-load embeds */
.video-card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow: hidden; background: hsl(var(--card)); display: flex; flex-direction: column; }
.video-thumb { position: relative; aspect-ratio: 16/9; cursor: pointer; overflow: hidden; background: #000; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s, opacity .2s; opacity: .92; }
.video-thumb:hover img { transform: scale(1.05); opacity: 1; }
.video-thumb:focus-visible { outline: 3px solid hsl(var(--ring)); outline-offset: -3px; }
.video-play {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--primary) / .92); color: #fff; border-radius: 50%;
  font-size: 1.3rem; box-shadow: var(--shadow-sunset); transition: transform .2s;
}
.video-thumb:hover .video-play { transform: scale(1.12); }
.video-frame { position: relative; aspect-ratio: 16/9; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-meta { padding: .8rem 1rem; }
.video-meta .block { display: block; margin-top: .3rem; }

/* accordions (details/summary) */
.acc { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); margin-bottom: 1rem; padding: 0 1.25rem; }
.acc summary {
  cursor: pointer; padding: 1rem 0; font-weight: 700; font-size: 1.05rem; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: '＋'; color: hsl(var(--primary)); font-weight: 800; }
.acc[open] summary::after { content: '－'; }
.acc[open] summary { border-bottom: 1px solid hsl(var(--border)); }
.acc > *:not(summary) { padding-bottom: 1rem; }

/* flashcards */
.flashcard { perspective: 1400px; max-width: 560px; margin: 0 auto; height: 320px; cursor: pointer; }
.flashcard:focus-visible { outline: 3px solid hsl(var(--ring)); outline-offset: 4px; border-radius: var(--radius); }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: calc(var(--radius) * 1.3); padding: 2rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  box-shadow: var(--shadow-warm); border: 1px solid hsl(var(--border));
}
.flashcard-face.front { background: var(--gradient-hero); }
.flashcard-face.back { background: var(--gradient-amber); color: hsl(20 40% 18%); transform: rotateY(180deg); }
.flashcard-face p { font-size: 1.15rem; font-weight: 600; line-height: 1.5; }
.fc-tag { position: absolute; top: 1rem; left: 1.2rem; font-weight: 800; opacity: .35; font-size: 1.1rem; }
.fc-hint { position: absolute; bottom: 1rem; font-size: .78rem; opacity: .6; font-weight: 600; }
.flashcard-controls { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }

/* AI mentor dock */
.ai-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50;
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem; border: none; border-radius: 99px; cursor: pointer;
  background: var(--gradient-coral); color: #fff; font-family: inherit; font-weight: 700;
  box-shadow: var(--shadow-warm);
}
.ai-fab:hover { transform: translateY(-2px); transition: transform .15s; }
.ai-panel[hidden] { display: none; }
.ai-panel {
  position: fixed; right: 1.25rem; bottom: 5rem; z-index: 51;
  width: min(400px, calc(100vw - 2.5rem)); height: min(560px, 70vh);
  display: flex; flex-direction: column;
  background: hsl(var(--card) / .96); backdrop-filter: blur(18px);
  border: 1px solid hsl(var(--border)); border-radius: var(--radius); box-shadow: 0 18px 60px hsl(20 30% 10% / .35);
  overflow: hidden;
}
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.1rem; border-bottom: 1px solid hsl(var(--border)); background: var(--gradient-sunset); color: #fff; }
.ai-close { background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.ai-msg { padding: .65rem .9rem; border-radius: 14px; font-size: .9rem; line-height: 1.5; max-width: 90%; }
.ai-msg.model { background: hsl(var(--muted)); align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-msg.user { background: var(--gradient-sunset); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-msg.thinking { opacity: .6; font-style: italic; }
.ai-form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid hsl(var(--border)); }
.ai-form textarea { flex: 1; resize: none; border: 1px solid hsl(var(--input)); border-radius: 10px; padding: .55rem .7rem; font-family: inherit; font-size: .9rem; background: hsl(var(--background)); color: hsl(var(--foreground)); }

/* auth / profiles */
body.auth-mode .sidebar, body.auth-mode .topbar, body.auth-mode .safety-footer, body.auth-mode .menu-btn { display: none; }
body.auth-mode .main { width: 100%; }
body.auth-mode .view { max-width: 720px; }
.auth-logo { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow-warm); margin-bottom: 1rem; }
.profile-card { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); flex-wrap: wrap; }
.profile-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--gradient-sunset); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.pin-input { width: 80px; padding: .4rem .6rem; border: 1px solid hsl(var(--input)); border-radius: 8px; background: hsl(var(--background)); color: hsl(var(--foreground)); }
.admin-pill { background: hsl(var(--primary) / .15); color: hsl(var(--primary)); }
.err { color: hsl(var(--destructive)); }

/* form rows */
.form-row { margin-bottom: .9rem; }
.form-row label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: hsl(var(--muted-foreground)); }
.form-row input, .form-row select {
  width: 100%; padding: .6rem .8rem; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--background)); color: hsl(var(--foreground)); font-family: inherit; font-size: .95rem;
}
.lang-choice { display: flex; gap: .5rem; flex-wrap: wrap; }
.lang-btn { padding: .55rem 1.1rem; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground)); border-radius: calc(var(--radius) - 2px); cursor: pointer; font-family: inherit; font-weight: 600; }
.lang-btn.active { background: var(--gradient-sunset); color: #fff; border-color: transparent; }

/* admin table */
.admin-table td { vertical-align: middle; }
.admin-detail td { padding-top: 0; border-bottom: 2px solid hsl(var(--border)); }
.admin-pillars { display: flex; flex-wrap: wrap; gap: .4rem; }
.admin-pill-chip { font-size: .76rem; font-weight: 700; padding: .15rem .5rem; background: hsl(var(--muted)); border-radius: 99px; }
.online-dot { color: hsl(140 60% 45%); font-size: .7rem; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* chevron + hover reveal on rows */
.lesson-row .chev { margin-left: auto; color: hsl(var(--muted-foreground)); opacity: 0; transition: opacity .15s, transform .15s; }
.lesson-row:hover .chev { opacity: 1; transform: translateX(3px); }
.resource-card.deeper { border-left: 3px solid hsl(var(--accent)); }
.resource-card { transition: transform .15s, box-shadow .15s; }
.resource-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

@media (max-width: 900px) {
  .ai-panel { right: .75rem; bottom: 4.6rem; }
  .ai-fab { right: .75rem; bottom: .75rem; }
}

.brand-title { font-family: var(--font-display); font-weight: 600; }

/* ============================================================
   v3 additions: tooltips, recommendations, certificate, workbook,
   audio, feedback, triads, reveal animations, print
   ============================================================ */

/* hover-reveal tooltips (glossary terms + scripture refs) */
.gloss, .scrip { position: relative; cursor: help; border-bottom: 1.5px dotted hsl(var(--primary) / .6); }
.scrip { border-bottom-style: solid; border-bottom-color: hsl(var(--accent) / .55); font-style: italic; }
.gloss:focus-visible, .scrip:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.tip {
  position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 6px);
  width: max-content; max-width: 300px; z-index: 60;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  padding: .6rem .8rem; font-size: .82rem; line-height: 1.5; font-style: normal; font-weight: 500;
  box-shadow: 0 10px 30px hsl(20 30% 10% / .35);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s, transform .15s;
}
.tip-label { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: hsl(var(--accent)); margin-bottom: .2rem; }
.gloss:hover .tip, .gloss:focus .tip, .scrip:hover .tip, .scrip:focus .tip { opacity: 1; visibility: visible; transform: translate(-50%, -2px); }
@media (max-width: 700px) { .tip { max-width: 220px; } }

/* recommendations */
.rec-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.1rem 1.2rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card)); color: inherit; box-shadow: var(--shadow-soft);
  transition: transform .15s, box-shadow .15s;
}
.rec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-warm); text-decoration: none; }
.rec-icon { font-size: 1.5rem; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* audio cards */
.audio-card .r-icon { color: hsl(var(--primary)); }

/* feedback */
.feedback-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.feedback-out:not(:empty) { margin-top: .5rem; }
.feedback-out .ai-msg { max-width: 100%; }

/* triads */
.triad-row { padding: .6rem 0; border-bottom: 1px solid hsl(var(--border)); }
.triad-members { display: flex; flex-wrap: wrap; gap: .6rem; }
.chk { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; padding: .3rem .6rem; border: 1px solid hsl(var(--border)); border-radius: 99px; }

/* certificate requirement list */
.req-list { display: flex; flex-direction: column; gap: .5rem; }
.req-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; border-radius: calc(var(--radius) - 4px); background: hsl(var(--muted) / .5); }
.req-item .mark { font-weight: 800; }
.req-item.ok .mark { color: hsl(140 50% 42%); }
.req-item.no { opacity: .65; }

/* certificate */
.certificate { display: flex; justify-content: center; margin: 1rem 0; }
.cert-border {
  width: 100%; max-width: 760px; text-align: center;
  background: var(--gradient-hero); border: 2px solid hsl(var(--primary) / .4);
  border-radius: 14px; padding: 2.5rem 2rem; position: relative;
  box-shadow: var(--shadow-warm);
}
.cert-border::before { content: ''; position: absolute; inset: 10px; border: 1px solid hsl(var(--accent) / .4); border-radius: 8px; pointer-events: none; }
.cert-logo { width: 64px; height: 64px; border-radius: 14px; margin-bottom: .8rem; }
.cert-kicker { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: hsl(var(--primary)); }
.cert-sub { margin-top: 1.4rem; color: hsl(var(--muted-foreground)); font-size: .9rem; }
.cert-name { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; margin: .3rem 0 .6rem; }
.cert-body { max-width: 460px; margin: 0 auto; }
.cert-score { margin-top: 1rem; font-weight: 700; color: hsl(var(--primary)); }
.cert-foot { display: flex; justify-content: space-between; margin-top: 2rem; font-size: .82rem; color: hsl(var(--muted-foreground)); }
.cert-seal { font-weight: 700; }

/* workbook (screen) */
.workbook { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-soft); }
.wb-head { border-bottom: 2px solid hsl(var(--primary)); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.wb-brand { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: hsl(var(--primary)); }
.wb-sec { margin-bottom: 1.8rem; }
.wb-lesson h2 { border-left: 4px solid hsl(var(--accent)); padding-left: .7rem; }
.wb-box { border: 1px solid hsl(var(--border)); border-radius: 8px; padding: .8rem 1rem; background: hsl(var(--accent) / .07); margin: .6rem 0; }
.wb-lines { height: 90px; background: repeating-linear-gradient(hsl(var(--background)) 0 27px, hsl(var(--border)) 27px 28px); border-radius: 6px; margin-top: .5rem; }
.wb-lines.tall { height: 150px; }
.wb-write { margin: .5rem 0 1rem; }
.wb-write-label { display: block; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--primary)); margin-bottom: .25rem; }
.wb-saved { white-space: pre-wrap; background: hsl(var(--secondary) / .5); border: 1px solid hsl(var(--border)); border-radius: 6px; padding: .5rem .7rem; font-size: .9rem; line-height: 1.55; margin-bottom: .35rem; }
.wb-h3 { font-size: 1.02rem; margin: 1.2rem 0 .4rem; }
.cap-wrap .wb-field label { font-weight: 600; }
.wb-foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); font-size: .76rem; color: hsl(var(--muted-foreground)); text-align: center; }

/* ---------- print ---------- */
@media print {
  .bg-aurora, .sidebar, .topbar, .safety-footer, #aiDock, .no-print, .scrim { display: none !important; }
  body, body.dark { background: #fff !important; color: #111 !important; }
  .main, .view { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .app { display: block !important; }
  /* certificate-only print */
  body.printing-cert .view > *:not(.certificate) { display: none !important; }
  body.printing-cert .cert-border { box-shadow: none; background: #fff; border-color: #b45; }
  .certificate { page-break-inside: avoid; }
  /* workbook-only print */
  body.printing-wb .view > *:not(.workbook) { display: none !important; }
  .workbook { box-shadow: none !important; border: none !important; padding: 0 !important; background: #fff !important; }
  .wb-box { background: #f6f3ee !important; }
  .wb-lines { background: repeating-linear-gradient(#fff 0 27px, #ccc 27px 28px) !important; }
  .wb-saved { background: #f6f3ee !important; color: #111 !important; }
  .wb-space { border: 1px solid #ccc !important; background: #fff !important; color: #111 !important; }
  .wb-sec, .plan-row, .wb-field { page-break-inside: avoid; }
}

/* ============================================================
   v4 additions: library, exercises, voice, analytics, roadmap, badges
   ============================================================ */

/* library filters */
.lib-filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.lib-filters select {
  padding: .5rem .7rem; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--background)); color: hsl(var(--foreground)); font-family: inherit; font-size: .9rem;
}
.lib-count { margin-left: auto; font-size: .82rem; font-weight: 700; color: hsl(var(--muted-foreground)); }
.lib-pill { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.lib-card .r-title { font-weight: 700; }

/* interactive exercises */
.ex-pairs, .ex-seq { margin-bottom: 1.25rem; }
.pair-grid { display: flex; flex-direction: column; gap: .55rem; margin: .8rem 0; }
.pair-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: stretch; }
.pair-prompt {
  display: flex; align-items: center; padding: .6rem .8rem; font-weight: 600; font-size: .92rem;
  background: hsl(var(--muted) / .6); border-radius: calc(var(--radius) - 4px);
}
.pair-slot {
  min-height: 44px; border: 1.5px dashed hsl(var(--border)); border-radius: calc(var(--radius) - 4px);
  display: flex; align-items: center; padding: .2rem; transition: background .15s, border-color .15s;
}
.pair-slot.hot, .pair-pool.hot { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .08); }
.pair-slot.right { border-color: hsl(140 50% 42%); border-style: solid; background: hsl(140 50% 42% / .12); }
.pair-slot.wrong { border-color: hsl(var(--destructive)); border-style: solid; background: hsl(var(--destructive) / .1); }
.pair-pool { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem; border: 1.5px dashed hsl(var(--border)); border-radius: calc(var(--radius) - 4px); min-height: 50px; }
.pair-chip {
  padding: .45rem .7rem; background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 99px; font-size: .85rem; cursor: grab; box-shadow: var(--shadow-soft); user-select: none; width: 100%;
}
.pair-slot .pair-chip { width: 100%; box-shadow: none; }
.pair-chip.sel { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .12); }
.pair-chip.dragging { opacity: .4; }
.ex-actions { margin-top: .8rem; display: flex; align-items: center; gap: .7rem; }
.ex-msg.ok { color: hsl(140 50% 38%); font-weight: 700; }
.ex-msg.warn { color: hsl(var(--burnt)); font-weight: 600; }

.seq-list { list-style: none; padding: 0; margin: .8rem 0; counter-reset: seq; }
.seq-item {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; margin-bottom: .5rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 4px);
  cursor: grab; box-shadow: var(--shadow-soft); font-size: .92rem;
}
.seq-item::before { counter-increment: seq; content: counter(seq); width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; background: hsl(var(--muted)); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; }
.seq-item.dragging { opacity: .4; }
.seq-item.right { border-color: hsl(140 50% 42%); background: hsl(140 50% 42% / .1); }
.seq-item.wrong { border-color: hsl(var(--destructive)); background: hsl(var(--destructive) / .08); }
.seq-grip { color: hsl(var(--muted-foreground)); cursor: grab; }
.seq-move { margin-left: auto; display: flex; gap: .2rem; }
.seq-move button { background: none; border: 1px solid hsl(var(--border)); border-radius: 6px; cursor: pointer; color: hsl(var(--muted-foreground)); font-size: .7rem; padding: .1rem .3rem; }

/* voice buttons */
.ai-mic, .ai-speak {
  border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground));
  border-radius: 8px; cursor: pointer; font-size: .9rem; padding: 0 .55rem;
}
.ai-mic { align-self: stretch; }
.ai-mic.rec { background: hsl(var(--destructive)); color: #fff; border-color: transparent; animation: pulse 1.2s infinite; }
.ai-speak { font-size: .8rem; padding: 0 .35rem; margin-left: .3rem; vertical-align: middle; }

/* ai summary card */
.ai-summary-card summary { color: hsl(var(--primary)); }

/* analytics */
.ana-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.ana-label { width: 190px; flex-shrink: 0; font-size: .88rem; font-weight: 600; }
.ana-bar { flex: 1; height: 12px; background: hsl(var(--muted)); border-radius: 99px; overflow: hidden; }
.ana-fill { height: 100%; border-radius: 99px; transition: width .6s; }
.ana-val { width: 44px; text-align: right; font-size: .82rem; font-weight: 700; color: hsl(var(--muted-foreground)); }
.ana-big { display: flex; align-items: baseline; gap: .6rem; }
.ana-big-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; color: hsl(var(--primary)); }

/* roadmap / skill tree */
.roadmap { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }
.road-node {
  position: relative; flex: 1 1 130px; min-width: 110px; text-align: center; color: inherit;
  padding: 1rem .6rem; border: 1.5px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card)); transition: transform .15s, box-shadow .15s; overflow: hidden;
}
.road-node:hover { transform: translateY(-2px); box-shadow: var(--shadow-warm); text-decoration: none; }
.road-node.open { opacity: .7; }
.road-node.mastered { border-color: var(--nc); }
.road-node.mastered::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--nc); }
.road-dot {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: 0 auto .5rem;
  border-radius: 50%; background: var(--nc); color: #fff; font-weight: 800; font-size: 1rem;
}
.road-node.open .road-dot { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.road-title { display: block; line-height: 1.3; }
.road-badge { position: absolute; top: .4rem; right: .5rem; font-size: .8rem; color: var(--nc); }

/* achievement badges */
.badge-card {
  position: relative; display: flex; flex-direction: column; gap: .3rem; text-align: center;
  padding: 1.3rem 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card));
}
.badge-card.locked { opacity: .5; filter: grayscale(.6); }
.badge-card.earned { box-shadow: var(--shadow-warm); border-color: hsl(var(--accent) / .5); }
.badge-icon { font-size: 2.2rem; }
.badge-tick { position: absolute; top: .6rem; right: .7rem; color: hsl(140 50% 42%); font-weight: 800; }
.badge-lock { position: absolute; top: .6rem; right: .7rem; font-size: .8rem; }

@media (max-width: 700px) {
  .pair-row { grid-template-columns: 1fr; }
  .ana-label { width: 120px; }
}

/* ============================================================
   v5 — Deep Dive (module addendum), write-spaces, self-check quiz,
   best-books, key-concept chips, capstone questionnaire
   ============================================================ */
.dd-h { margin-top: 2.2rem; font-size: 1.32rem; }
.dd-intro { background: linear-gradient(180deg, hsl(var(--card)), hsl(var(--secondary) / .35)); }
.dd-intro p { font-size: 1.02rem; font-style: italic; }
.dd-list { margin: .2rem 0 0; padding-left: 1.1rem; }
.dd-list li { margin: .3rem 0; }
.dd-article { white-space: normal; font-size: .98rem; line-height: 1.7; }

/* write-in spaces */
.dd-ex { display: flex; flex-direction: column; gap: 1rem; }
.wb-field { display: flex; flex-direction: column; gap: .35rem; }
.wb-field label { font-weight: 600; font-size: .95rem; }
.wb-space {
  width: 100%; resize: vertical; min-height: 2.6rem;
  background: hsl(var(--background) / .6); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  padding: .55rem .7rem; font-family: inherit; font-size: .92rem; line-height: 1.6;
}
.wb-space:focus { outline: 2px solid hsl(var(--ring)); outline-offset: 1px; border-color: hsl(var(--primary) / .6); }

/* key-concept chips with hover-reveal */
.concept-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.concept-chip {
  position: relative; cursor: help;
  background: hsl(var(--primary) / .12); color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / .3); border-radius: 999px;
  padding: .3rem .75rem; font-size: .85rem; font-weight: 600;
}
.concept-chip:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.concept-chip[data-tip]:hover::after, .concept-chip[data-tip]:focus::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -6px);
  width: max-content; max-width: 280px; z-index: 60; white-space: normal; text-align: left;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  padding: .55rem .75rem; font-size: .8rem; font-weight: 500; line-height: 1.5;
  box-shadow: 0 10px 30px hsl(20 30% 10% / .35);
}

/* self-check quiz */
.dd-quiz { display: flex; flex-direction: column; gap: .9rem; }
.quiz-item { padding: .7rem .85rem; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); transition: border-color .2s, background .2s; }
.quiz-item.right { border-color: hsl(145 50% 42%); background: hsl(145 50% 42% / .08); }
.quiz-item.wrong { border-color: hsl(var(--destructive, 0 70% 50%)); background: hsl(0 70% 50% / .07); }
.quiz-q { margin: 0 0 .55rem; font-weight: 600; }
.quiz-btns { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.quiz-mark { font-size: .85rem; font-weight: 600; }
.quiz-item.right .quiz-mark { color: hsl(145 50% 38%); }
.quiz-item.wrong .quiz-mark { color: hsl(0 65% 52%); }

/* best-books grid */
.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .5rem; }
.book-card { display: flex; gap: .6rem; padding: .7rem .8rem; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); }
.book-spine { flex: 0 0 6px; border-radius: 3px; }
.book-meta { display: flex; flex-direction: column; gap: .15rem; }
.book-title { font-family: var(--font-display, serif); font-weight: 600; font-size: 1rem; line-height: 1.25; }
.book-author { font-size: .8rem; color: hsl(var(--muted-foreground)); }
.book-note { font-size: .85rem; line-height: 1.5; margin-top: .2rem; }

/* capstone questionnaire + peace plan */
.cap-q { counter-reset: capq; display: flex; flex-direction: column; gap: 1.1rem; }
.cap-q .wb-field label::before { counter-increment: capq; content: counter(capq) ". "; font-weight: 700; color: hsl(var(--primary)); }
.plan-table { display: flex; flex-direction: column; gap: 1rem; }
.plan-row { display: grid; grid-template-columns: 180px 1fr; gap: .8rem; align-items: start; }
.plan-row .plan-field { font-weight: 700; padding-top: .4rem; }
@media (max-width: 700px) {
  .book-grid { grid-template-columns: 1fr; }
  .plan-row { grid-template-columns: 1fr; gap: .3rem; }
  .concept-chip[data-tip]:hover::after, .concept-chip[data-tip]:focus::after { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  .bg-aurora { display: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   v6 — colour-coded key concepts, study & reading deep-dives,
   native-language lede, OIA panel, verse study links
   ============================================================ */
:root {
  --c-scripture: var(--accent);
  --c-biblical: 28 64% 48%;     /* terracotta/gold — biblical concept */
  --c-secular: 199 70% 42%;     /* teal — secular theory/framework */
  --c-practice: 150 46% 40%;    /* green — concrete practice/skill */
}
.dark {
  --c-biblical: 28 80% 62%;
  --c-secular: 195 75% 62%;
  --c-practice: 150 55% 60%;
}
/* category colours on key terms (the colour itself teaches) */
.gloss { border-bottom: 1.5px dotted hsl(var(--c-biblical) / .7); color: inherit; }
.gloss-biblical { border-bottom-color: hsl(var(--c-biblical) / .8); }
.gloss-secular  { border-bottom-color: hsl(var(--c-secular) / .85); }
.gloss-practice { border-bottom-color: hsl(var(--c-practice) / .85); }
.gloss-biblical { background: linear-gradient(transparent 62%, hsl(var(--c-biblical) / .14) 0); }
.gloss-secular  { background: linear-gradient(transparent 62%, hsl(var(--c-secular) / .16) 0); }
.gloss-practice { background: linear-gradient(transparent 62%, hsl(var(--c-practice) / .16) 0); }

/* concept colour legend */
.concept-legend { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; margin: .2rem 0 1.1rem; font-size: .8rem; }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; color: hsl(var(--muted-foreground)); }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend-swatch.scripture { background: hsl(var(--c-scripture)); }
.legend-swatch.biblical { background: hsl(var(--c-biblical)); }
.legend-swatch.secular { background: hsl(var(--c-secular)); }
.legend-swatch.practice { background: hsl(var(--c-practice)); }

/* native-language lede */
.native-lede { border-left: 4px solid hsl(var(--c-secular)); background: hsl(var(--c-secular) / .08); }
.native-tag { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: hsl(var(--c-secular)); margin-bottom: .3rem; }

/* scripture inline open arrow */
.scrip-open { text-decoration: none; font-weight: 700; color: hsl(var(--c-scripture)); padding: 0 .15rem; }

/* "Study this passage" deep-dive */
.study-panel summary { color: hsl(var(--c-scripture)); }
.study-body { margin-top: .8rem; display: flex; flex-direction: column; gap: 1rem; }
.study-ref { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: .8rem .9rem; background: hsl(var(--card)); }
.ref-chip { display: inline-block; font-weight: 700; font-size: .82rem; padding: .15rem .55rem; border-radius: 999px; background: hsl(var(--c-scripture) / .14); color: hsl(var(--c-scripture)); border: 1px solid hsl(var(--c-scripture) / .35); }
.verse-quote { margin: .6rem 0; padding-left: .9rem; border-left: 3px solid hsl(var(--c-scripture) / .5); font-style: italic; font-size: 1.02rem; }
.study-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.study-link { font-size: .78rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); text-decoration: none; background: hsl(var(--secondary) / .4); }
.study-link:hover { border-color: hsl(var(--primary) / .6); }
.study-link.official { background: hsl(var(--c-scripture) / .14); border-color: hsl(var(--c-scripture) / .4); color: hsl(var(--c-scripture)); font-weight: 600; }
.study-note { background: hsl(var(--amber) / .1); border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; line-height: 1.6; }
.oia { display: grid; gap: .5rem; margin: .4rem 0; }
.oia-step { display: flex; gap: .6rem; align-items: baseline; font-size: .92rem; }
.oia-tag { flex: 0 0 88px; font-weight: 700; color: hsl(var(--c-practice)); text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.study-caveat { margin: .3rem 0 0; }

/* reading deep-dive */
.reading-panel summary { color: hsl(var(--c-secular)); }
.reading-body { margin-top: .8rem; }
.reading-sub { margin: 1rem 0 .5rem; font-size: .92rem; color: hsl(var(--primary)); text-transform: uppercase; letter-spacing: .04em; }
.book-list { display: flex; flex-direction: column; gap: .6rem; }
.read-card { display: flex; justify-content: space-between; gap: .8rem; padding: .65rem .8rem; border: 1px solid hsl(var(--border)); border-radius: 10px; background: hsl(var(--card)); flex-wrap: wrap; }
.read-main { display: flex; flex-direction: column; gap: .15rem; flex: 1 1 60%; min-width: 200px; }
.read-title { font-weight: 600; font-size: .98rem; }
.read-author { font-size: .8rem; color: hsl(var(--muted-foreground)); }
.read-why { font-size: .86rem; line-height: 1.5; margin-top: .15rem; }
.read-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.read-type { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .5rem; border-radius: 999px; }
.read-type.faith { background: hsl(var(--c-biblical) / .16); color: hsl(var(--c-biblical)); }
.read-type.secular { background: hsl(var(--c-secular) / .16); color: hsl(var(--c-secular)); }
.read-type.article { background: hsl(var(--c-practice) / .16); color: hsl(var(--c-practice)); }
.read-rating { font-size: .78rem; color: hsl(var(--amber)); font-weight: 600; }
.read-link { font-size: .78rem; text-decoration: none; color: hsl(var(--primary)); font-weight: 600; }
.bp-class { margin-top: 1rem; }

/* study-guide method panel (foundations) */
.study-guide .acc { margin-bottom: .6rem; }
.sg-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 700px) { .sg-tools { grid-template-columns: 1fr; } .oia-tag { flex-basis: 70px; } }

/* v7 — full ESV verse text in hover popups + attribution */
.tip-body { display: block; max-height: 240px; overflow-y: auto; }
.tip-credit { display: block; margin-top: .45rem; padding-top: .35rem; border-top: 1px solid hsl(var(--border) / .6); font-size: .62rem; font-style: italic; color: hsl(var(--accent)); font-weight: 600; }
.esv-credit { font-size: .66rem; font-style: italic; color: hsl(var(--muted-foreground)); margin: -.3rem 0 .5rem; }
.verse-quote.esv { font-style: normal; }

/* v8 — cloud auth (Google SSO + email/password) */
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; color: #222; border: 1px solid hsl(var(--border)); }
.google-btn:hover { background: #f7f7f7; }
.dark .google-btn { background: #2a2024; color: #f3ece1; border-color: hsl(var(--border)); }
.g-ico { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); color: #fff; font-weight: 800; font-size: .8rem; }
.auth-sep { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; color: hsl(var(--muted-foreground)); font-size: .82rem; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: hsl(var(--border)); }
.ok { color: hsl(150 46% 40%); }

/* v8 — theme picker, font choice, Bible-version segmented control */
.sw-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--muted-foreground)); margin-bottom: .5rem; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.theme-swatch { position: relative; display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 2px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); cursor: pointer; text-align: left; transition: border-color .15s, transform .1s; }
.theme-swatch:hover { transform: translateY(-1px); border-color: hsl(var(--primary) / .5); }
.theme-swatch.active { border-color: hsl(var(--primary)); box-shadow: 0 0 0 3px hsl(var(--primary) / .15); }
.sw-chip { flex: 0 0 34px; height: 34px; border-radius: 8px; background: var(--sw); position: relative; box-shadow: inset 0 0 0 1px hsl(0 0% 0% / .15); }
.sw-dot { position: absolute; right: 5px; bottom: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 1px hsl(0 0% 100% / .4); }
.sw-name { font-size: .86rem; font-weight: 600; line-height: 1.2; color: hsl(var(--foreground)); }
.sw-check { position: absolute; top: .35rem; right: .45rem; color: hsl(var(--primary)); font-weight: 800; }
.font-choice { flex-wrap: wrap; margin-top: 0; }

.bible-ver-row { display: flex; align-items: center; gap: .8rem; margin: .55rem 0; flex-wrap: wrap; }
.bv-lang { flex: 0 0 90px; font-weight: 600; font-size: .9rem; color: hsl(var(--muted-foreground)); }
.bv-lang.cur { color: hsl(var(--primary)); }
.seg { display: inline-flex; border: 1px solid hsl(var(--border)); border-radius: 999px; overflow: hidden; background: hsl(var(--muted) / .5); }
.seg-btn { border: none; background: transparent; padding: .4rem .9rem; font: inherit; font-size: .85rem; font-weight: 600; color: hsl(var(--foreground)); cursor: pointer; transition: background .15s, color .15s; }
.seg-btn + .seg-btn { border-left: 1px solid hsl(var(--border)); }
.seg-btn.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
