/* ============================================================
   NeuroCards — shared stylesheet
   Design tokens & components carried over from personal-page sample.
   ============================================================ */

:root {
  /* Palette v2 (ported from the app, 17 Jul 2026): a soft grey page
     field with pure-white cards lifted off it by shadow, not border —
     the iOS/Airbnb grouped-surface pattern. Greys stay hueless. */
  --bg: #f7f7f7;
  --surface: #ffffff;
  /* Card edges: light mode draws cards with shadow only (transparent
     border keeps layout identical); dark mode has no usable shadow, so
     it separates by its tonal ladder plus a black halo. */
  --card-border: transparent;
  --card-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 6px 16px rgba(0, 0, 0, 0.12);
  --card-border-hover: transparent;
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.05),
    0 12px 28px rgba(0, 0, 0, 0.16);
  /* Monochromatic ink-alpha ladder: --surface-2 (hover/focus/chip) < --surface-deep (nested recess) < --surface-active (selected state).
     Over white these land at ≈ #f7f7f7 / #ebebeb / #e5e5e5. */
  --surface-2: rgba(34, 34, 34, 0.036);
  --surface-deep: rgba(34, 34, 34, 0.078);
  --surface-active: rgba(34, 34, 34, 0.11);
  --ink: #222222;
  --ink-2: #4a4a4a;
  --ink-3: #6c6c6c;
  --hairline: #ebebeb;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  /* Hero-scale throws: at 40–60px blurs the 0.12 tier washes out —
     big floating props need a darker ink. */
  --shadow-xl: rgba(0, 0, 0, 0.22);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --dot: rgba(74, 74, 74, 0.09);
  /* Opaque button faces (surface-defined buttons, no border): opaque
     so the bg dot pattern never shows through the face. */
  --btn-face: #ececec;
  --btn-face-hover: #e2e2e2;
  /* Small round chips (chevrons, arrow circles) on cards at any
     nesting depth: ink-alpha, so the face adapts to whatever surface
     is beneath instead of matching it. */
  --chip-face: rgba(34, 34, 34, 0.059);
  --chip-face-hover: rgba(34, 34, 34, 0.1);
  --field-face: rgba(34, 34, 34, 0.05);
  /* The hero flashcard prop and its overlapping streak chip pair the
     theme's two structural tones so the stacked props never share a
     face (light: white card + bg-grey chip; dark mirrors it). */
  --hero-card-face: var(--surface);
  --hero-chip-face: var(--bg);

  --accent-high: #10b981;
  --accent-mid-high: #d97706;
  --accent-mid: #dc2626;
  --accent-low: #2563eb;
}

[data-theme="dark"] {
  /* Dark surfaces follow a +~8-per-channel lightness ladder over --bg, preserving the warm-brown hue (R > G > B). --hairline sits one step lighter than --surface-2 in the same family. */
  --bg: #1a1816;
  --surface: #22201e;
  --surface-2: #2a2724;
  --surface-active: rgba(240, 235, 227, 0.08);
  --surface-deep: var(--bg);
  --ink: #f0ebe3;
  --ink-2: #b8b0a4;
  --ink-3: #7a7268;
  --hairline: #2f2c28;
  --shadow: rgba(0, 0, 0, 0.35);
  --shadow-lg: rgba(0, 0, 0, 0.5);
  --shadow-xl: rgba(0, 0, 0, 0.65);
  --nav-bg: rgba(34, 32, 30, 0.72);
  --dot: rgba(184, 176, 164, 0.06);
  --btn-face: #2a2724;
  --btn-face-hover: #332f2b;
  --chip-face: rgba(240, 235, 227, 0.07);
  --chip-face-hover: rgba(240, 235, 227, 0.12);
  --field-face: rgba(240, 235, 227, 0.055);
  /* Unlike the app's sign-in (where the hero sits on a surface-toned
     pane), the landing hero sits directly on the bg field — so dark
     raises the stacked props one tonal-ladder step each: bg field →
     surface card → surface-2 chip. A bg-toned card here would vanish
     into the page (dark shadows alone can't carry it). */
  --hero-card-face: var(--surface);
  --hero-chip-face: var(--surface-2);
  /* Dark cards are borderless like light ones: the +8 surface ladder
     does the separating, helped by a black halo — dark shadows need
     higher opacity than light to read at all. */
  --card-border: transparent;
  --card-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 8px 20px rgba(0, 0, 0, 0.35);
  --card-border-hover: transparent;
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 14px 30px rgba(0, 0, 0, 0.4);

  --accent-high: #79ffe1;
  --accent-mid-high: #ffb86c;
  --accent-mid: #f87171;
  --accent-low: #93c5fd;
}

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

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces.25e420d8c154.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Italic.b02ea6375899.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans.0add1329f56a.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Italic.e805753a818d.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.8e085aa43809.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("opendyslexic/OpenDyslexic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("opendyslexic/OpenDyslexic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("opendyslexic/OpenDyslexic-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("opendyslexic/OpenDyslexic-Bold-Italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

html[data-card-font="dyslexic"] .flashcard-text,
html[data-card-font="dyslexic"] .flashcard-preview-text {
  font-family: "OpenDyslexic", "Fraunces", serif;
  font-variation-settings: normal;
  letter-spacing: 0;
}

.font-dyslexic-option {
  font-family: "OpenDyslexic", sans-serif;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family:
    "DM Sans",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  font-variation-settings: "opsz" 14;
  transition:
    background 0.3s ease,
    color 0.3s ease;
  background-image: radial-gradient(
    circle,
    var(--dot) 1.2px,
    transparent 1.3px
  );
  background-size: 28px 28px;
  background-position: 0 0;
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 28px 96px;
}

.container-wide {
  max-width: 980px;
}

/* ========== Floating pill nav ========== */
.nav-wrap {
  position: sticky;
  top: 18px;
  z-index: 100;
  display: flex;
  justify-content: center;
  margin: 18px 0 80px;
  padding: 0 20px;
  pointer-events: none;
}

.nav {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 6px 18px;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 10px 28px -18px var(--shadow-lg);
  opacity: 0;
  animation: fadeUp 0.7s ease 0s forwards;
}

.nav-brand {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-right: 14px;
  margin-right: 4px;
  border-right: 1px solid var(--hairline);
}

.nav-brand em {
  font-style: italic;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.nav-back:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-back .nav-back-arrow {
  font-size: 15px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-back:hover .nav-back-arrow {
  transform: translateX(-2px);
}

.nav-links {
  display: flex;
  gap: 1px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-progress {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-size: 15px;
  color: var(--ink-2);
  padding: 6px 14px;
  border-left: 1px solid var(--hairline);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.nav-progress em {
  font-style: italic;
  color: var(--ink-3);
}

.theme-toggle {
  background: transparent;
  border: none;
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 2px;
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

/* ========== Animations ========== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

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

/* ========== Hero ========== */
.hero {
  margin-bottom: 96px;
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
  max-width: 720px;
}

.hero-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero-greeting {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 22px;
  color: var(--ink-3);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.hero-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 144,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 400;
  margin-bottom: 28px;
  color: var(--ink);
}

.hero-title em {
  font-style: italic;
  color: var(--ink-2);
}

.hero-title.compact {
  font-size: clamp(40px, 6.4vw, 64px);
  margin-bottom: 20px;
}

.hero-tagline {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.35;
  color: var(--ink-2);
  margin-bottom: 28px;
  letter-spacing: -0.01em;
  max-width: 620px;
}

.hero-about {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 600px;
  margin-bottom: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

/* ========== Subject pill ========== */
.subject-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: all 0.2s ease;
  background: var(--surface-2);
}

.subject-pill:hover {
  color: var(--ink);
  background: var(--surface-deep);
}

.subject-pill.standalone {
  margin-bottom: 18px;
}

/* ========== Section ========== */
.section {
  margin-bottom: 96px;
}

.section-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(34px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 32px;
}

.section-title em {
  font-style: italic;
  color: var(--ink-2);
}

.section-projects {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}
.section-results {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards;
}
.section-contact {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
}

/* ========== Feed (deck cards) ========== */
.feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 28px;
  padding: 28px 32px 26px;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.25s ease,
    background 0.25s ease;
  cursor: pointer;
  position: relative;
}

.feed-item:hover {
  transform: translateY(-3px) scale(1.005);
  box-shadow: 0 18px 36px -20px var(--shadow-lg);
  border-color: var(--card-border-hover);
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.feed-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.feed-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 500;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-live {
  background: var(--ink);
}

.dot-progress {
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--ink-2);
  position: relative;
  overflow: hidden;
}

.dot-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink-2);
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.dot-archive {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
}

.feed-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 60,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(28px, 3.6vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.feed-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  background: var(--chip-face);
  border-radius: 999px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.feed-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.feed-item:hover .feed-arrow {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  transform: rotate(-2deg);
}

.feed-desc {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 14px;
  max-width: 620px;
}

.feed-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.feed-foot .bar-wrap {
  flex: 1 1 200px;
  min-width: 140px;
  max-width: 280px;
}

.feed-foot-stat strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* ========== Bar (progress) ========== */
.bar {
  display: block;
  width: 100%;
  height: 6px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  transform-origin: left;
  animation: grow 1.3s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

.bar-fill.high {
  background: var(--accent-high);
}
.bar-fill.mid-high {
  background: var(--accent-mid-high);
}
.bar-fill.mid {
  background: var(--accent-mid);
}
.bar-fill.low {
  background: var(--ink-3);
}

/* ========== Buttons (pills) ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.3s ease;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn-primary:hover {
  box-shadow: 0 12px 24px -16px var(--shadow-lg);
  background: var(--ink-2);
  border-color: var(--ink-2);
}

/* Secondary buttons are surface-defined: an opaque grey face with no
   border (the face colour itself is the button's edge). */
.btn-secondary {
  background: var(--btn-face);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--btn-face-hover);
}

.btn-arrow {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.btn:hover .btn-arrow {
  transform: translateX(2px);
}

.btn-large {
  font-size: 15px;
  padding: 14px 28px;
}

/* ========== Recent activity (compact list) ========== */
.activity {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline);
}

.activity-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.2s ease;
}

.activity-row:hover {
  background: var(--surface);
}

.activity-time {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-width: 84px;
}

.activity-deck {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.activity-count {
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.activity-pct {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-size: 19px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  min-width: 52px;
  text-align: right;
}

.activity-pct.high {
  color: var(--accent-high);
}
.activity-pct.mid-high {
  color: var(--accent-mid-high);
}
.activity-pct.mid {
  color: var(--accent-mid);
}

/* ========== Table (deck cards listing) ========== */
.table-wrap {
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

thead th {
  text-align: left;
  padding: 16px 22px;
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}

thead th.num {
  text-align: right;
}

tbody td {
  padding: 18px 22px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

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

td.front-cell {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-size: 16.5px;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--ink);
  max-width: 320px;
}

td.back-cell {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
  max-width: 340px;
}

td.date-cell {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
}

.pct-cell {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.mini-bar {
  display: inline-block;
  width: 60px;
  height: 4px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
}

.mini-fill {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  transform-origin: left;
  animation: grow 1s cubic-bezier(0.22, 1, 0.36, 1) 0.9s both;
}

.mini-fill.high {
  background: var(--accent-high);
}
.mini-fill.mid-high {
  background: var(--accent-mid-high);
}
.mini-fill.mid {
  background: var(--accent-mid);
}
.mini-fill.low {
  background: var(--ink-3);
}

.table-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  text-align: center;
}

.table-foot a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.table-foot a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

/* ========== Study session ========== */
.study-progress {
  width: 100%;
  max-width: 620px;
  margin: 0 auto 8px;
}
.study-progress .bar {
  height: 3px;
}
.study-progress .bar-fill {
  background: var(--ink-2);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Queue status — live New/Learning/Review counts + segmented bar */
.queue-status {
  width: 100%;
  max-width: 620px;
  margin: 0 auto 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-counts {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: opacity 0.3s ease;
}

.qc-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.qc-num {
  font-variant-numeric: tabular-nums;
}

.qc-label {
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.qc-new .qc-dot {
  background: var(--accent-low);
}
.qc-new .qc-num {
  color: var(--accent-low);
}
.qc-learning .qc-dot {
  background: var(--accent-mid);
}
.qc-learning .qc-num {
  color: var(--accent-mid);
}
.qc-review .qc-dot {
  background: var(--accent-high);
}
.qc-review .qc-num {
  color: var(--accent-high);
}

.qc.is-zero {
  opacity: 0.45;
}
.qc.is-zero .qc-dot {
  background: var(--ink-3);
}
.qc.is-zero .qc-num {
  color: var(--ink-3);
}

/* Segmented bar: colored segments = cards remaining per state;
   the muted track showing through on the right reads as "done". */
.seg-bar {
  display: flex;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.seg {
  height: 100%;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.seg-done {
  background: var(--ink-3);
}
.seg-new {
  background: var(--accent-low);
}
.seg-learning {
  background: var(--accent-mid);
}
.seg-review {
  background: var(--accent-high);
}

/* Session header — the deck name is the title; sized calmer than a hero
   headline so per-card changes on the mixed queue read as gentle updates. */
.session-deck {
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.1;
  margin-bottom: 0;
}

.study-stage {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.flashcard-wrap {
  width: 100%;
  max-width: 620px;
}

.flashcard {
  position: relative;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 32px;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 18px 36px -22px var(--shadow-lg);
  transition:
    border-color 0.25s ease,
    box-shadow 0.3s ease;
  min-height: 360px;
}

.flashcard:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 24px 44px -22px var(--shadow-lg);
}

.flashcard-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  padding: 16px 0;
  min-height: 0;
  transition:
    flex-basis 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.3s ease;
}

.flashcard:not(.is-revealed) .flashcard-section.answer {
  flex: 0 0 0;
  padding: 0;
  overflow: hidden;
}

.flashcard-divider {
  height: 1px;
  background: var(--hairline);
  border: none;
  margin: 8px 0;
  width: 100%;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.flashcard:not(.is-revealed) .flashcard-divider {
  opacity: 0;
}

.flashcard-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.flashcard-text {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(24px, 3.2vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 480px;
}

.flashcard-section.answer .flashcard-text {
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(20px, 2.6vw, 26px);
}

/* Answer hidden until card is revealed */
.flashcard-section.answer .answer-text {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.35s ease,
    max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.flashcard.is-revealed .flashcard-section.answer .answer-text {
  opacity: 1;
  max-height: 240px;
}

.flashcard-hint {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-align: center;
  font-weight: 500;
}

.flashcard-hint kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  margin: 0 2px;
}

.flashcard-hint .hint-shortcuts {
  display: none;
}

.flashcard-hint .hint-touch-reveal {
  display: none;
}

.study-stage:has(.flashcard.is-revealed) .flashcard-hint .hint-reveal {
  display: none;
}

.study-stage:has(.flashcard.is-revealed) .flashcard-hint .hint-shortcuts {
  display: inline;
}

/* Rating row (Again / Hard / Good / Easy) */
.rating-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.rating-row.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.rating-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 96px;
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--ink-2);
  border: 1.5px solid var(--hairline);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.25s ease;
  line-height: 1.1;
}

.rating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -12px var(--shadow-lg);
}

.rating-btn .rating-interval {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.7;
}

.rating-btn.again {
  color: var(--accent-mid);
  border-color: var(--accent-mid);
}
.rating-btn.again .rating-interval {
  color: var(--accent-mid);
}

.rating-btn.hard {
  color: var(--accent-mid-high);
  border-color: var(--accent-mid-high);
}
.rating-btn.hard .rating-interval {
  color: var(--accent-mid-high);
}

.rating-btn.good {
  color: var(--accent-high);
  border-color: var(--accent-high);
}
.rating-btn.good .rating-interval {
  color: var(--accent-high);
}

.rating-btn.easy {
  color: var(--accent-low);
  border-color: var(--accent-low);
}
.rating-btn.easy .rating-interval {
  color: var(--accent-low);
}

@media (hover: none) and (pointer: coarse), (max-width: 720px) {
  html:has(body.review-session-body),
  body.review-session-body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.review-session-body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
  }

  body.review-session-body .app-shell,
  body.review-session-body .app-main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.review-session-body .page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: calc(92px + env(safe-area-inset-top)) 22px
      calc(104px + env(safe-area-inset-bottom));
  }

  body.review-session-body .page-header {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  /* The floating menu pill already carries the page name (Review / Studying),
       so the eyebrow is redundant on mobile — only the deck name shows. */
  body.review-session-body .session-eyebrow {
    display: none;
  }

  body.review-session-body .session-deck {
    font-size: 16px;
    line-height: 1.25;
  }

  body.review-session-body .queue-status {
    flex: 0 0 auto;
    margin-bottom: 0;
    gap: 10px;
  }

  body.review-session-body .study-stage {
    flex: 1 1 auto;
    min-height: 0;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 1;
    animation: none;
    transform: none;
  }

  body.review-session-body .flashcard-wrap {
    max-width: 620px;
    min-height: 0;
  }

  body.review-session-body .flashcard {
    height: clamp(
      320px,
      calc(
        100dvh - 318px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
      ),
      600px
    );
    min-height: 0;
    overflow: hidden;
  }

  .flashcard:hover {
    border-color: var(--hairline);
    box-shadow: 0 18px 36px -22px var(--shadow-lg);
  }

  .flashcard-hint .hint-reveal,
  .study-stage:has(.flashcard.is-revealed) .flashcard-hint .hint-shortcuts {
    display: none;
  }

  .flashcard-hint .hint-touch-reveal {
    display: inline;
  }

  .flashcard-hint {
    min-height: 1.55em;
  }

  .study-stage:has(.flashcard.is-revealed) .flashcard-hint .hint-touch-reveal {
    display: none;
  }

  .study-stage:has(.flashcard.is-revealed) .flashcard-hint {
    visibility: hidden;
    pointer-events: none;
  }

  .rating-row {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 40;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .rating-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* Session complete state */
.session-complete {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 32px;
  padding: 48px 40px;
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 36px -22px var(--shadow-lg);
}

.session-complete .complete-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.session-complete .complete-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 22px;
}

.session-complete .complete-title em {
  font-style: italic;
  color: var(--ink-2);
}

.session-complete .complete-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.session-complete .stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.session-complete .stat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.session-complete .stat-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 60,
    "SOFT" 100,
    "wght" 400;
  font-size: 34px;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.session-complete .complete-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ========== Form (create card) ========== */
.form-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 32px;
  padding: 40px;
  max-width: 640px;
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.form-input,
.form-textarea,
.form-select {
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--field-face);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 18px;
  line-height: 1.5;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
  width: 100%;
  resize: vertical;
}

.form-textarea {
  min-height: 96px;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 18,
    "SOFT" 100,
    "wght" 400;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.form-textarea.back {
  min-height: 140px;
  font-variation-settings:
    "opsz" 14,
    "SOFT" 100,
    "wght" 400;
  font-size: 15.5px;
  font-family: "DM Sans", sans-serif;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--surface-2);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) center,
    calc(100% - 16px) center;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  padding-right: 44px;
  cursor: pointer;
}

/* ========== Custom dropdown (replaces native <select>) ========== */
.custom-select {
  position: relative;
  width: 100%;
  font-family: "DM Sans", sans-serif;
}

.custom-select.select-compact {
  width: auto;
  min-width: 200px;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px 18px;
  line-height: 1.5;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.custom-select.select-compact .custom-select-trigger {
  padding-top: 10px;
  padding-bottom: 10px;
}

.custom-select-trigger:hover {
  background: var(--surface-deep);
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  outline: none;
  border-color: var(--ink-2);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--surface-2);
}

.custom-select-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  color: var(--ink-3);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.custom-select-chevron svg {
  width: 16px;
  height: 16px;
  display: block;
}

.custom-select.is-open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--ink-2);
}

.custom-select-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 16px;
  box-shadow: 0 18px 36px -16px var(--shadow-lg);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.custom-select.is-open .custom-select-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 14.5px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.custom-select-option:hover,
.custom-select-option.is-focused {
  background: var(--surface-2);
  color: var(--ink);
}

.custom-select-option[aria-selected="true"] {
  background: var(--surface-active);
  color: var(--ink);
  font-weight: 500;
}

.custom-select-option[aria-selected="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: var(--ink-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.form-help {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  align-items: center;
}

.form-success {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 8px 16px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.form-success.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.form-success::before {
  content: "✓";
  color: var(--accent-high);
  font-weight: 700;
}

/* ========== Footer ========== */
footer.page-footer {
  margin-top: 80px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.04em;
}

footer.page-footer span {
  margin: 0 8px;
}

/* ========== Stagger delays ========== */
.feed-item:nth-child(1) {
  animation-delay: 0.05s;
}
.feed-item:nth-child(2) {
  animation-delay: 0.12s;
}
.feed-item:nth-child(3) {
  animation-delay: 0.19s;
}
.feed-item:nth-child(4) {
  animation-delay: 0.26s;
}
.feed-item:nth-child(5) {
  animation-delay: 0.33s;
}

/* ========== Responsive ========== */
@media (max-width: 720px) {
  .container {
    padding: 0 18px 64px;
  }
  .nav-wrap {
    margin-bottom: 56px;
  }
  .nav {
    padding: 5px 5px 5px 14px;
  }
  .nav-brand {
    font-size: 16px;
    padding-right: 10px;
  }
  .nav-link {
    padding: 7px 11px;
    font-size: 13px;
  }
  .nav-progress {
    font-size: 13px;
    padding: 5px 10px;
  }
  .hero {
    margin-bottom: 64px;
  }
  .section {
    margin-bottom: 64px;
  }
  .feed-item {
    padding: 24px 24px 22px;
    border-radius: 24px;
  }
  .activity-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time pct"
      "deck pct"
      "count count";
    gap: 4px 18px;
    padding: 16px 4px;
  }
  .activity-time {
    grid-area: time;
  }
  .activity-deck {
    grid-area: deck;
    font-size: 16px;
  }
  .activity-count {
    grid-area: count;
  }
  .activity-pct {
    grid-area: pct;
    font-size: 22px;
  }
  .flashcard {
    padding: 28px 24px;
    border-radius: 28px;
    min-height: 300px;
  }
  .table-wrap {
    border-radius: 20px;
  }
  thead th,
  tbody td {
    padding: 14px 16px;
  }
  td.front-cell {
    font-size: 15px;
  }
  .form-card {
    padding: 28px 22px;
    border-radius: 24px;
  }
  .session-complete {
    padding: 36px 24px;
    border-radius: 28px;
  }
  .session-complete .complete-stats {
    gap: 24px;
  }
}

@media (max-width: 460px) {
  .nav-brand {
    border-right: none;
    padding-right: 6px;
    margin-right: 0;
  }
  .nav-brand-text {
    display: none;
  }
  .nav-link {
    padding: 7px 10px;
  }
  .rating-btn {
    min-width: 78px;
    padding: 10px 14px;
    font-size: 12.5px;
  }
}

@media (max-width: 460px) {
  .rating-row {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }

  .rating-btn {
    min-width: 0;
    padding: 10px 8px;
  }
}

/* ============================================================
   v2 — App shell, sidebar, dashboard grid, new pages
   ============================================================ */

:root {
  --sidebar-w: 240px;
  --sidebar-gutter: 16px;
  --topbar-h: 56px;
  --radius-btn: 14px;
}

/* Override v1 body background so the shell layout has no margins */
body.app-shell-body {
  background-attachment: fixed;
}

/* ========== App shell ========== */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ========== Sidebar (floating) ========== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  /* Card elevation plus the panel's wide diffuse throw (single merged
     stack — a trailing second box-shadow silently overrides the first,
     the exact trap from the app's iteration 54). */
  box-shadow:
    var(--card-shadow),
    0 18px 40px -24px var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--sidebar-gutter) * 2);
  position: sticky;
  top: var(--sidebar-gutter);
  margin: var(--sidebar-gutter) 0 var(--sidebar-gutter) var(--sidebar-gutter);
  overflow: hidden;
  transition:
    margin-left 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 50;
}

.app-shell.is-collapsed .sidebar {
  margin-left: calc((var(--sidebar-w) + var(--sidebar-gutter)) * -1);
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  flex-shrink: 0;
}

.sidebar-brand {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.sidebar-brand em {
  font-style: normal;
  font-weight: 500;
}

.sidebar-toggle {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
}

/* Registered so the mask fade can animate smoothly when toggled. */
@property --sidebar-fade-top {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --sidebar-fade-bottom {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.sidebar-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* Gradient fade-out softens the hard scroll cut-off under the wordmark
       and above the account card. Depths are 0 until JS detects hidden
       content past that edge (.fade-top / .fade-bottom). */
  --sidebar-fade-top: 0px;
  --sidebar-fade-bottom: 0px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 var(--sidebar-fade-top),
    #000 calc(100% - var(--sidebar-fade-bottom)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 var(--sidebar-fade-top),
    #000 calc(100% - var(--sidebar-fade-bottom)),
    transparent 100%
  );
  transition:
    --sidebar-fade-top 0.25s ease,
    --sidebar-fade-bottom 0.25s ease;
}

.sidebar-body.fade-top {
  --sidebar-fade-top: 28px;
}

.sidebar-body.fade-bottom {
  --sidebar-fade-bottom: 28px;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0 10px 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition:
    background 0.2s ease,
    color 0.2s ease;
  cursor: pointer;
}

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

.sidebar-nav-item.is-active {
  background: var(--surface-active);
  color: var(--ink);
}

.sidebar-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--ink);
  border-radius: 999px;
}

.sidebar-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-nav-label {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-nav-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-deep);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.sidebar-nav-item.is-active .sidebar-nav-badge {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Decks list inside sidebar */
.sidebar-decks {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-deck-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 14px;
  border-radius: 10px;
  color: var(--ink-2);
  transition:
    background 0.2s ease,
    color 0.2s ease;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.sidebar-deck-row:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.subject-badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 18,
    "SOFT" 100,
    "wght" 500;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg);
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-deck-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-deck-due {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* Sidebar footer (expanding account card) */
.sidebar-footer {
  padding: 12px;
  flex-shrink: 0;
}

.sidebar-account-card {
  background: var(--surface-deep);
  border: 1px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

/* No hover ring and no tone change on open (ported from the app,
   iterations 28–30): the recessed tint is the card's identity. */
.sidebar-account-card.is-open {
  background: var(--surface-deep);
}

/* Account menu (expands upward inside the card) */
.sidebar-account-menu {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    padding 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-account-card.is-open .sidebar-account-menu {
  max-height: 280px;
  opacity: 1;
  padding: 6px 6px 4px;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.account-menu-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.account-menu-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.account-menu-divider {
  height: 1px;
  background: var(--hairline);
  border: none;
  margin: 4px 8px;
}

.account-menu-item.danger {
  color: var(--accent-mid);
}

.account-menu-item.danger:hover {
  background: var(--accent-mid);
  color: var(--bg);
}

/* Toggle theme menu item — swap icon based on current theme */
.account-menu-item[data-action="theme"] .icon-moon,
.account-menu-item[data-action="theme"] .icon-sun {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.account-menu-item[data-action="theme"] .icon-moon {
  display: inline-flex;
}
.account-menu-item[data-action="theme"] .icon-sun {
  display: none;
}
[data-theme="light"] .account-menu-item[data-action="theme"] .icon-moon {
  display: none;
}
[data-theme="light"] .account-menu-item[data-action="theme"] .icon-sun {
  display: inline-flex;
}

/* The visible account row (always shown) */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.sidebar-account-card.is-open .sidebar-account {
  background: transparent;
}

.account-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.2s ease;
}

.sidebar-account-card.is-open .account-chevron {
  transform: rotate(180deg);
  color: var(--ink-2);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 500;
  font-size: 14px;
  flex-shrink: 0;
  letter-spacing: -0.01em;
  line-height: 1;
}

.avatar.lg {
  width: 88px;
  height: 88px;
  font-size: 40px;
}

.sidebar-account-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-account-name {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ========== Floating menu pill (visible when sidebar collapsed) ========== */
.shell-menu-pill {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 10px 28px -18px var(--shadow-lg);
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  transition:
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-shell.is-collapsed ~ .shell-menu-pill,
.app-shell.is-collapsed + .shell-menu-pill,
.shell-menu-pill.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.shell-menu-pill:hover {
  border-color: var(--ink-3);
}

.shell-menu-pill-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.shell-menu-pill:hover .shell-menu-pill-icon {
  background: var(--surface-2);
  color: var(--ink);
}

.shell-menu-pill-icon svg {
  width: 15px;
  height: 15px;
}

.shell-menu-pill-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
  padding-right: 4px;
}

/* ========== Page content area ========== */
.page {
  flex: 1 1 auto;
  padding: 76px 40px 80px;
  min-width: 0;
}

.page-narrow {
  max-width: 720px;
  margin: 0 auto;
}

.page-wide {
  max-width: 1100px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.page-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.page-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 12px;
}

.page-title em {
  font-style: italic;
  color: var(--ink-2);
}

.page-subtitle {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 620px;
  letter-spacing: -0.005em;
}

/* ========== Dashboard grid ========== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.dashboard-row {
  display: grid;
  gap: 14px;
  align-items: start;
}

.dashboard-row--top {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-row--bottom {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1080px) {
  .dashboard-row--top,
  .dashboard-row--bottom {
    grid-template-columns: 1fr;
  }
}

.home-decks-section {
  margin-top: 36px;
}

.home-section-label {
  margin-bottom: 14px;
}

.home-dashboard-page .dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.home-dashboard-page .dashboard-main {
  min-width: 0;
}

.home-dashboard-page .dashboard-aside {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 1080px) {
  .home-dashboard-page .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .home-dashboard-page .dashboard-aside {
    position: static;
  }
}

/* ========== Aside cards ========== */
.aside-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

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

.aside-card-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.aside-stat-big {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 52px;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.aside-stat-big .stat-unit {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
  margin-left: 4px;
  letter-spacing: -0.005em;
}

.aside-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 8px;
}

.aside-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-2);
}

.aside-breakdown-row .due-count {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.aside-cta {
  margin-top: 4px;
}

.aside-cta .btn {
  width: 100%;
}

/* Streak heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin: 4px 0;
}

.heatmap-cell {
  aspect-ratio: 1 / 1;
  background: var(--hairline);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.heatmap-cell.lvl-1 {
  background: var(--ink-3);
  opacity: 0.4;
}
.heatmap-cell.lvl-2 {
  background: var(--ink-2);
  opacity: 0.6;
}
.heatmap-cell.lvl-3 {
  background: var(--ink);
  opacity: 0.85;
}
.heatmap-cell.lvl-4 {
  background: var(--ink);
}

[data-theme="dark"] .heatmap-cell.lvl-1 {
  opacity: 0.3;
}
[data-theme="dark"] .heatmap-cell.lvl-2 {
  opacity: 0.55;
}
[data-theme="dark"] .heatmap-cell.lvl-3 {
  opacity: 0.8;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.heatmap-legend-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.heatmap-legend-scale {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Activity card header: label left, active-days count right */
.activity-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity-active-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.heatmap-legend-scale .heatmap-cell {
  width: 8px;
  height: 8px;
  aspect-ratio: auto;
}

/* Compact activity rows inside aside */
.aside-card .activity {
  border-top: none;
}

.aside-card .activity-row {
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.aside-card .activity-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.aside-card .activity-row:first-child {
  padding-top: 0;
}

.aside-card .activity-time {
  grid-column: 1 / 2;
  grid-row: 1;
  min-width: 0;
  font-size: 11px;
}

.aside-card .activity-deck {
  grid-column: 1 / 2;
  grid-row: 2;
  font-size: 14.5px;
}

.aside-card .activity-pct {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  font-size: 17px;
  min-width: 0;
}

.aside-card .activity-count {
  display: none;
}

/* ========== Stat tile grid (stats page) ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 20px;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    border-color 0.25s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-tile:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-tile-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stat-tile-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-tile-value .stat-unit {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
  margin-left: 3px;
}

.stat-tile-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Scoreboard rows for stats page */
.scoreboard {
  display: flex;
  flex-direction: column;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(160px, 2.4fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 8px;
  border-bottom: 1px solid var(--hairline);
}

.score-row:last-child {
  border-bottom: none;
}

.score-name {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.15;
}

.score-papers {
  display: block;
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

.score-value {
  text-align: right;
  white-space: nowrap;
}

.score-pct {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 60,
    "SOFT" 100,
    "wght" 400;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.score-pct-suffix {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-2);
  margin-left: 2px;
}

.score-marks {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
  font-weight: 500;
}

@media (max-width: 720px) {
  .score-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name value"
      "bar bar";
    gap: 10px 16px;
    padding: 18px 4px;
  }
  .score-name-wrap {
    grid-area: name;
  }
  .score-value-wrap {
    grid-area: value;
  }
  .bar-wrap {
    grid-area: bar;
  }
  .score-pct {
    font-size: 28px;
  }
}

/* ========== Settings ========== */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 24px;
  overflow: visible;
}

.settings-section-header {
  padding: 20px 24px 6px;
}

.settings-section-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.settings-section-desc {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 2px;
  font-weight: 500;
}

.settings-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
}

/* The flex display above otherwise overrides the browser default for [hidden],
   leaving toggled-off rows (e.g. Upgrade when on Plus, Cancel when on Free)
   visible. Restore hide-on-hidden for settings rows. */
.settings-row[hidden] {
  display: none;
}

.settings-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--hairline);
}

.settings-row-text {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-row-label {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.settings-row-help {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
  line-height: 1.45;
}

.settings-row-control {
  flex-shrink: 0;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--surface-deep);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.segmented-option {
  appearance: none;
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  letter-spacing: 0.01em;
}

.segmented-option:hover {
  color: var(--ink);
}

.segmented-option.is-active {
  background: var(--ink);
  color: var(--bg);
}

/* iOS-style toggle (monochrome) */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--hairline);
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: 999px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-track {
  background: var(--ink);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* Number input compact */
.input-compact {
  width: 80px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.select-compact {
  width: auto;
  min-width: 160px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.settings-row.danger .btn-danger {
  background: color-mix(in srgb, var(--accent-mid) 9%, var(--surface));
  color: var(--accent-mid);
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  padding: 9px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.settings-row.danger .btn-danger:hover {
  background: var(--accent-mid);
  color: var(--bg);
}

/* ========== Account ========== */
.account-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.account-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-hero-name {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.account-hero-email {
  font-size: 14px;
  color: var(--ink-3);
  font-weight: 500;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  letter-spacing: 0.02em;
}

.plan-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-high);
}

/* Tier indicator — a compact pill used inline beside the sidebar account name.
   Shares the rounded-pill language of .plan-badge; colour comes from the
   tier modifiers below. */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 9px 4px 7px;
  line-height: 1;
}

.tier-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

/* Tier colours — Plus green, Free grey. Applied to both .tier-badge and the
   account-page .plan-badge so the indicator reads the same everywhere. */
.tier-badge--plus::before,
.plan-badge.tier-badge--plus::before {
  background: var(--accent-high);
}

.tier-badge--free::before,
.plan-badge.tier-badge--free::before {
  background: var(--ink-3);
}

/* Sidebar name + tier badge sit on one line; the name truncates first. */
.sidebar-account-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* When the name overflows (toggled by initAccountNameFade in app.js), soften
   the cut-off with a right-edge gradient mask instead of a hard ellipsis. */
.sidebar-account-name.is-faded {
  text-overflow: clip;
  -webkit-mask-image: linear-gradient(
    to right,
    #000 calc(100% - 20px),
    transparent
  );
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}

.connected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--hairline);
}

.connected-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connected-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-deep);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-2);
  flex-shrink: 0;
}

/* ========== Queue / Study card source label ========== */
.flashcard-source {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ========== Create page two-column ========== */
.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.create-aside {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 980px) {
  .create-grid {
    grid-template-columns: 1fr;
  }
  .create-aside {
    position: static;
  }
}

.flashcard-preview {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 24px;
  padding: 32px 28px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.25s ease;
}

.flashcard-preview:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--card-shadow-hover);
}

.flashcard-preview .flashcard-label {
  margin-bottom: 16px;
}

.flashcard-preview-text {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.flashcard-preview-text.empty {
  color: var(--ink-3);
  font-style: italic;
}

.preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  align-self: center;
}

.preview-toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ========== Sidebar overlay (mobile) ========== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: var(--sidebar-gutter);
    left: var(--sidebar-gutter);
    bottom: var(--sidebar-gutter);
    height: auto;
    margin: 0;
  }
  /* Default: hide sidebar on mobile */
  .app-shell:not(.is-open) .sidebar {
    margin-left: 0;
    transform: translateX(
      calc((var(--sidebar-w) + var(--sidebar-gutter) * 2) * -1)
    );
    opacity: 0;
    pointer-events: none;
  }
  .app-shell:not(.is-open) .sidebar-backdrop {
    display: none;
  }
  .app-shell.is-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }
  .app-shell.is-collapsed:not(.is-open) .sidebar {
    margin-left: 0;
    transform: translateX(
      calc((var(--sidebar-w) + var(--sidebar-gutter) * 2) * -1)
    );
  }
  .page {
    padding: 70px 22px 64px;
  }
}

/* ========== Page-level entrance stagger ========== */
.dashboard-row--top .aside-card:nth-child(1) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}
.dashboard-row--top .aside-card:nth-child(2) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both;
}
.dashboard-row--top .aside-card:nth-child(3) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.39s both;
}
.dashboard-row--bottom .aside-card:nth-child(1) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.39s both;
}
.dashboard-row--bottom .aside-card:nth-child(2) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.46s both;
}
.dashboard-row--bottom .aside-card:nth-child(3) {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.53s both;
}

/* ========== Misc utilities for v2 ========== */
.muted-link {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
  transition:
    text-decoration-color 0.2s ease,
    color 0.2s ease;
}

.muted-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink-3);
}

/* ============================================================
   v3 — Folders (sidebar + dashboard) & cleaner active state
   ============================================================ */

/* Drop the left accent strip on the active sidebar nav item.
   The surface-2 fill plus an upgraded font weight does the job. */
.sidebar-nav-item.is-active::before {
  display: none;
}

.sidebar-nav-item.is-active {
  font-weight: 600;
}

/* ========== Sidebar folders ========== */
.sidebar-folders {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-folder-card {
  border-radius: 16px;
  transition: background 0.25s ease;
}

.sidebar-folder-card.is-open {
  background: var(--surface-deep);
}

.sidebar-folder {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px 8px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.sidebar-folder:hover {
  color: var(--ink);
}

.sidebar-folder:hover .sidebar-folder-chevron {
  color: var(--ink-2);
}

.sidebar-folder-card.is-open .sidebar-folder {
  color: var(--ink);
}

.sidebar-folder-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-folder-due {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.sidebar-folder-card.is-open .sidebar-folder-due {
  background: var(--surface);
  color: var(--ink-2);
}

.sidebar-folder-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-folder-chevron svg {
  width: 100%;
  height: 100%;
}

.sidebar-folder-card.is-open .sidebar-folder-chevron {
  transform: rotate(180deg);
  color: var(--ink-2);
}

.sidebar-folder-decks {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    padding 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-folder-card.is-open .sidebar-folder-decks {
  max-height: 320px;
  opacity: 1;
  padding: 2px 6px 6px;
}

.sidebar-deck-row--nested {
  padding-left: 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  gap: 8px;
}

.sidebar-deck-row--nested:hover {
  background: var(--surface);
  color: var(--ink);
}

.sidebar-folder-card.is-open .sidebar-deck-row--nested:hover {
  background: var(--surface-2);
}

/* ========== Dashboard folder feed ========== */
.feed .feed-folder {
  display: block;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 28px;
  transition:
    border-color 0.25s ease,
    box-shadow 0.35s ease;
  overflow: hidden;
}

#deckFolders {
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.feed-folder {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 28px;
  transition:
    border-color 0.25s ease,
    box-shadow 0.35s ease,
    background 0.25s ease;
  overflow: hidden;
}

.feed-folder:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--card-shadow-hover);
}

.feed-folder-head {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 24px 28px;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}

.feed-folder-head:hover {
  background: var(--surface-2);
}

.feed-folder.is-open .feed-folder-head:hover {
  background: transparent;
}

.feed-folder-head-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-folder-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--ink);
}

.feed-folder-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.feed-folder-meta strong {
  color: var(--ink-2);
  font-weight: 600;
}

.feed-folder-meta .caught-up {
  color: var(--ink-3);
  font-weight: 500;
}

.feed-folder-meta .bar-wrap {
  flex: 0 1 200px;
  min-width: 120px;
  max-width: 240px;
}

.feed-folder-chevron {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  background: var(--chip-face);
  border-radius: 999px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feed-folder-chevron svg {
  width: 14px;
  height: 14px;
}

.feed-folder:hover .feed-folder-chevron {
  background: var(--chip-face-hover);
  color: var(--ink-2);
}

.feed-folder.is-open .feed-folder-chevron {
  transform: rotate(180deg);
  color: var(--ink);
  background: var(--chip-face-hover);
}

.feed-folder-body {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    padding 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-folder.is-open .feed-folder-body {
  max-height: 1600px;
  opacity: 1;
  padding: 4px 18px 18px;
}

/* Mini feed-item — used inside an open folder. Recedes on --surface-deep tone. */
.feed-item--mini {
  background: var(--surface-deep);
  border-radius: 20px;
  padding: 22px;
  border-color: transparent;
}

.feed-item--mini:hover {
  background: var(--surface-deep);
  border-color: var(--hairline);
}

.feed-item--mini .feed-meta {
  margin-bottom: 10px;
}

.feed-item--mini .feed-title {
  font-size: clamp(22px, 2.4vw, 26px);
  margin-bottom: 8px;
}

.feed-item--mini .feed-arrow {
  width: 28px;
  height: 28px;
}

.feed-item--mini .feed-arrow svg {
  width: 14px;
  height: 14px;
}

.feed-item--mini .feed-desc {
  font-size: 14px;
  margin-bottom: 10px;
}

.feed-item--mini .feed-foot {
  font-size: 11.5px;
}

/* Stagger the mini items inside an open folder */
.feed-folder.is-open .feed-folder-body .feed-item--mini {
  opacity: 0;
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.feed-folder.is-open .feed-folder-body .feed-item--mini:nth-child(1) {
  animation-delay: 0.08s;
}
.feed-folder.is-open .feed-folder-body .feed-item--mini:nth-child(2) {
  animation-delay: 0.14s;
}
.feed-folder.is-open .feed-folder-body .feed-item--mini:nth-child(3) {
  animation-delay: 0.2s;
}
.feed-folder.is-open .feed-folder-body .feed-item--mini:nth-child(4) {
  animation-delay: 0.26s;
}

@media (max-width: 720px) {
  .feed-folder-head {
    padding: 20px 22px;
    gap: 12px;
  }
  .feed-folder-body {
    padding: 0 14px;
  }
  .feed-folder.is-open .feed-folder-body {
    padding: 0 14px 14px;
  }
  .feed-item--mini {
    padding: 18px;
  }
}

/* ========== Decks page (library) ========== */
.deck-library {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.deck-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

@media (max-width: 1080px) {
  .deck-library {
    grid-template-columns: 1fr;
  }
}

.deck-library .feed-folder-row {
  display: flex;
  align-items: stretch;
}

.deck-library .feed-folder-row .feed-folder-head {
  flex: 1 1 auto;
  min-width: 0;
}

.deck-library .feed-item--mini-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.deck-library .feed-item--mini-wrap .feed-item--mini {
  flex: 1 1 auto;
  min-width: 0;
}

.deck-grip {
  width: 0;
  padding: 0;
  margin-right: 0;
  overflow: hidden;
  opacity: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  cursor: grab;
  align-self: center;
  border-radius: 6px;
  transition:
    width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease,
    padding 0.25s ease,
    margin-right 0.25s ease,
    color 0.2s ease;
}

.deck-library.is-editing .deck-grip,
.deck-grip:focus-visible {
  width: 28px;
  padding: 8px 0;
  margin-right: 4px;
  opacity: 1;
  color: var(--ink-2);
}

.deck-grip:active {
  cursor: grabbing;
}

.deck-grip svg {
  width: 16px;
  height: 16px;
}

/* ========== Quick deck shortcuts (dashboard) ========== */
.quick-deck-list {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}

.quick-deck-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 10px 4px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition:
    background 0.15s ease,
    padding 0.2s ease;
}

.quick-deck-row:last-child {
  border-bottom: none;
}

.quick-deck-row:hover {
  background: var(--surface-2);
  padding-left: 10px;
}

.quick-deck-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-deck-meta {
  grid-column: 1 / 2;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.quick-deck-arrow {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  color: var(--ink-3);
  align-self: center;
  width: 16px;
  height: 16px;
}

.quick-deck-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ============================================================
   Auth pages — used by login.html
   Standalone shell (no sidebar), split layout: form left, decorative right.
   ============================================================ */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 1fr;
  min-height: 100vh;
}

.auth-form-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(28px, 6vw, 96px);
  gap: 32px;
}

.auth-brand {
  position: absolute;
  top: 32px;
  left: max(clamp(28px, 6vw, 96px), calc(50% - 190px));
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}

.auth-brand em {
  font-style: normal;
  font-weight: 500;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.auth-card[hidden] {
  display: none;
}

.auth-card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.auth-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.auth-subtitle {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}

.auth-email-pinned {
  font-style: normal;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  color: var(--ink);
}

.auth-change-email {
  background: none;
  border: none;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-change-email:hover {
  color: var(--ink);
}

.auth-provider {
  width: 100%;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  position: relative;
}

.auth-provider[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-provider[disabled]:hover {
  transform: none;
  background: transparent;
  border-color: var(--hairline);
}

.provider-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 11px;
  line-height: 1;
}

.provider-soon {
  position: absolute;
  right: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 12px;
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form .form-label {
  margin-top: 2px;
}

.auth-form .form-label + .form-input {
  margin-bottom: 4px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  padding: 13px 22px;
}

.auth-secondary-link {
  font-size: 13px;
  color: var(--ink-3);
  align-self: flex-start;
  margin-top: -2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-secondary-link:hover {
  color: var(--ink);
}

.auth-back-link {
  display: block;
  margin: 14px auto 0;
  padding: 0;
  background: none;
  border: none;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-back-link:hover {
  color: var(--ink);
}

.auth-footnote {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  max-width: 340px;
}

.auth-footnote a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-form-error {
  font-size: 12.5px;
  color: var(--accent-mid);
  margin-top: 2px;
  line-height: 1.4;
}

.auth-form-error[hidden] {
  display: none;
}

/* Magic-link sent illustration */
.auth-magic-illustration {
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
}

.auth-magic-envelope {
  position: relative;
  width: 96px;
  height: 64px;
}

.auth-magic-envelope svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-magic-sparkle {
  position: absolute;
  top: -14px;
  right: -10px;
  color: var(--accent-high);
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px 12px var(--shadow-lg);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

/* Right pane — decorative flashcard mockup */
.auth-mock-pane {
  background: var(--surface);
  border-left: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.auth-mock-pane::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    var(--dot) 1.2px,
    transparent 1.3px
  );
  background-size: 28px 28px;
  /* Full strength, matching the page body's pattern (the 0.6 dim was
     a warm-theme leftover). */
  pointer-events: none;
}

.auth-mock-stage {
  position: relative;
  width: min(440px, 80%);
  aspect-ratio: 3 / 4;
  perspective: 1200px;
}

.auth-mock-card {
  position: absolute;
  inset: 12% 6% 18% 10%;
  background: var(--hero-card-face);
  border: 1px solid transparent;
  border-radius: 28px;
  padding: 32px 28px 26px;
  display: flex;
  flex-direction: column;
  /* Hero-tier throw (ported from the app's sign-in, iteration 54):
     a white raised face under a full-strength halo. */
  box-shadow:
    0 22px 48px -10px var(--shadow-xl),
    0 3px 8px -2px var(--shadow);
  transform: rotate(-4deg);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-mock-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.auth-mock-card-text {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1;
}

.auth-mock-card-text em {
  font-style: italic;
  color: var(--ink-2);
}

.auth-mock-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-3);
}

.auth-mock-chip {
  background: var(--chip-face);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.auth-mock-flip {
  font-family: "DM Sans", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-mock-flip-icon,
.auth-mock-flip-icon svg {
  width: 13px;
  height: 13px;
  display: block;
}

.auth-mock-streak {
  position: absolute;
  right: -2%;
  bottom: 4%;
  background: var(--hero-chip-face);
  border: 1px solid transparent;
  border-radius: 22px;
  padding: 18px 22px;
  min-width: 150px;
  /* Same hero-tier throw as the flashcard it overlaps, scaled down. */
  box-shadow:
    0 14px 32px -8px var(--shadow-xl),
    0 2px 6px -2px var(--shadow);
  transform: rotate(5deg);
  z-index: 2;
}

.auth-mock-streak-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-mock-streak-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 500;
  font-size: 38px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.auth-mock-streak-value span {
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.auth-mock-streak-dots {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}

.auth-mock-streak-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-active);
  border: 1px solid transparent;
}

.auth-mock-streak-dots span.on {
  background: var(--accent-high);
  border-color: transparent;
}

@media (max-width: 960px) {
  .auth-body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .auth-mock-pane {
    display: none;
  }
  .auth-form-pane {
    height: 100%;
    min-height: 0;
    padding: calc(env(safe-area-inset-top) + 88px) clamp(20px, 6vw, 32px)
      max(24px, env(safe-area-inset-bottom));
    gap: 24px;
    overflow: hidden;
  }

  .auth-card {
    max-height: calc(100dvh - 128px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .auth-card::-webkit-scrollbar {
    display: none;
  }
}

/* ============================================================
   Dashboard redesign — activity card + continue-where-you-left-off
   ============================================================ */

.home-mock-page .page {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* Let each top-row card take its natural height (matches Home spacing) */
.dashboard-row--top {
  align-items: start;
}

.stats-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
}

.stats-row:first-child {
  border-top: none;
}

.stats-label {
  font-size: 13px;
  color: var(--ink-2);
}

.stats-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stats-value .stat-unit {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-3);
  margin-left: 2px;
  letter-spacing: -0.005em;
}

/* Continue where you left off — section heading + 3-card grid */
.continue-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 14px;
}

.continue-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.continue-section-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.continue-section-title em {
  font-style: italic;
  color: var(--ink-2);
}

.continue-section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}

.continue-section-link:hover {
  color: var(--ink);
}

.continue-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.continue-deck-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 22px;
  padding: 22px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: inherit;
  transition:
    border-color 0.25s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
}

.continue-deck-card:hover {
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 18px 32px -24px var(--shadow-lg);
}

.continue-deck-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.continue-deck-time {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.continue-deck-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1 1 auto;
}

.continue-deck-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.continue-deck-stats {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.3;
}

.continue-deck-stats strong {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.continue-deck-arrow {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--chip-face);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-2);
  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}

.continue-deck-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.continue-deck-card:hover .continue-deck-arrow {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  transform: translateX(2px);
}

@media (max-width: 1080px) {
  .continue-deck-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Home Mock 1 — golden-ratio split (1.6fr / 1fr)
   ============================================================ */
.mock1-split {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.mock1-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Right stack: streak card grows to absorb extra height, heatmap stays centered */
.mock1-aside .streak-hero {
  flex: 1 1 auto;
  justify-content: center;
}

@media (max-width: 1080px) {
  .mock1-split {
    grid-template-columns: 1fr;
  }
}

.due-today-hero {
  gap: 18px;
}

/* Hero fills its stretched height: breakdown grows, CTA pins to the bottom */
.due-today-hero .subject-bars {
  flex: 1 1 auto;
}
.due-today-hero .aside-cta {
  margin-top: auto;
}

.due-today-headline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.due-today-big {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: 72px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.due-today-suffix {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-3);
  letter-spacing: -0.005em;
}

.subject-bars {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.subject-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 40px;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
  font-size: 13.5px;
  color: var(--ink-2);
}

.subject-bar-row:first-child {
  border-top: none;
}

.subject-bar-row--other .subject-bar-name {
  color: var(--ink-2);
  font-weight: 400;
}

.subject-bar-name {
  font-weight: 500;
  color: var(--ink);
}

.subject-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--hairline);
  overflow: hidden;
  position: relative;
}

.subject-bar-fill {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
}

.subject-bar-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  font-size: 14px;
}

.streak-hero-heatmap {
  gap: 6px;
}

.stats-strip {
  gap: 14px;
}

.stats-strip-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.stats-strip-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.stats-strip-item strong {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.stats-strip-item > span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stats-strip-divider {
  width: 1px;
  background: var(--hairline);
}

/* ============================================================
   Mock 4 — "Daily goal ritual" (progress-led, habit)
   ============================================================ */
.home-mock-4-page .page {
  max-width: 680px;
}

.ritual-layout {
  display: flex;
  flex-direction: column;
  gap: 44px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.ritual-header {
  margin-bottom: 0;
}

.ritual-goal {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ritual-goal-figure {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.ritual-goal-done {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(64px, 10vw, 96px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ritual-goal-total {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 22px;
  color: var(--ink-3);
  letter-spacing: -0.01em;
}

.ritual-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-active);
  border: 1px solid var(--hairline);
  box-sizing: border-box;
  overflow: hidden;
}

.ritual-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.ritual-goal-note {
  font-size: 14px;
  color: var(--ink-2);
}

.ritual-goal-note strong {
  color: var(--ink);
  font-weight: 600;
}

.ritual-cta {
  align-self: flex-start;
  margin-top: 6px;
}

.ritual-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.ritual-section-meta {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.ritual-section-link {
  font-size: 13px;
  color: var(--ink-3);
  transition: color 0.2s ease;
}

.ritual-section-link:hover {
  color: var(--ink);
}

.momentum-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
  align-items: end;
  height: 120px;
}

.momentum-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  height: 100%;
  justify-content: flex-end;
}

.momentum-track {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.momentum-fill {
  width: 100%;
  border-radius: 8px 8px 4px 4px;
  background: var(--surface-active);
  transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.momentum-col.is-today .momentum-fill {
  background: var(--ink);
}

.momentum-day {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.momentum-col.is-today .momentum-day {
  color: var(--ink);
}

.ritual-activity {
  border-top: 1px solid var(--hairline);
}

@media (max-width: 600px) {
  .momentum-bars {
    gap: 8px;
    height: 100px;
  }
}

/* ============================================================
   Home Mock 6 — Overview / control dashboard
   ============================================================ */
.home-mock-6-page .page {
  max-width: 1100px;
}

.overview-kpis {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 0;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 16px;
  padding: 18px 8px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

.overview-kpi {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 24px;
  border-left: 1px solid var(--hairline);
}

.overview-kpi:first-child {
  border-left: none;
}

.overview-kpi-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 400;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.overview-kpi-value .stat-unit {
  font-style: italic;
  font-size: 13px;
  color: var(--ink-3);
  margin-left: 1px;
}

.overview-kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.overview-kpis-cta {
  margin-left: auto;
  padding-right: 12px;
}

.overview-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

.overview-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.overview-hero {
  padding: 28px;
  gap: 16px;
}

.chain-calendar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
}

.chain-calendar .heatmap-cell {
  border-radius: 8px;
}

.chain-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.overview-hero .chain-calendar {
  gap: 8px;
}

.twin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: stretch;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

/* Pin each panel's closing note to the bottom so equal-height cards stay tidy */
.twin-panel .panel-note {
  margin-top: auto;
}

.twin-panel {
  padding: 28px;
  gap: 16px;
}

.panel-goal-figure {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.panel-goal-done {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 56px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.panel-goal-total {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
}

.panel-note {
  font-size: 13px;
  color: var(--ink-2);
}
.panel-note strong {
  color: var(--ink);
  font-weight: 600;
}

.panel-cta {
  margin-top: 4px;
}
.panel-cta .btn {
  width: 100%;
}

@media (max-width: 1080px) {
  .overview-two,
  .twin-grid {
    grid-template-columns: 1fr;
  }
  .overview-kpis-cta {
    margin-left: 0;
    width: 100%;
    padding: 0 24px;
  }
  .overview-kpis-cta .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .overview-kpi {
    padding: 0 16px;
  }
  .chain-calendar {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ========== Discover page ========== */
.discover-section {
  margin-bottom: 36px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.discover-section-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-size: 26px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.discover-section-desc {
  font-size: 14px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 2px;
  margin-bottom: 16px;
}

.discover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

@media (max-width: 1080px) {
  .discover-grid {
    grid-template-columns: 1fr;
  }
}

/* Folder cards: header row holds the expand button + a copy action */
.discover-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

/* @handle credit — an indicator, so a pill (per design language) */
.discover-handle {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.01em;
}

.discover-copies {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

/* Add action — a rounded-rect button (per design language) */
.discover-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.discover-add-btn:hover {
  transform: translateY(-2px);
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.discover-add-btn--sm {
  font-size: 12.5px;
  padding: 7px 12px;
  background: var(--surface-2);
  color: var(--ink);
  border-color: transparent;
}

.discover-add-btn--sm:hover {
  background: var(--surface-deep);
}

.discover-add-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.discover-add-btn--sm .discover-add-icon svg {
  width: 14px;
  height: 14px;
}

.discover-add-btn.is-added {
  color: var(--accent-high);
  border-color: var(--accent-high);
  background: transparent;
  cursor: default;
}

.discover-add-btn.is-added:hover {
  transform: none;
}

/* Folder footer — holds the "add the full collection" action */
.discover-folder-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--hairline);
}

.discover-foot-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

/* Standalone discover deck cards (not navigable — add is the action).
   Use a solid surface + hairline (like folder cards) so they read as cards
   against the page background, not the recessed in-folder mini style. */
.discover-deck {
  background: var(--surface);
  border-color: var(--hairline);
  cursor: default;
}

.discover-deck:hover {
  transform: none;
  box-shadow: none;
  background: var(--surface);
  border-color: var(--hairline);
}

.discover-deck-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 6px;
}

/* Nested deck rows inside a discover folder — static preview + per-deck add */
.feed-item--static {
  cursor: default;
}

.feed-item--static:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--hairline);
}

.discover-nested-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ========== Input with @ prefix ========== */
.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-prefix .input-prefix {
  position: absolute;
  left: 16px;
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 500;
  pointer-events: none;
}

.input-with-prefix .form-input {
  width: 100%;
  padding-left: 30px;
}

/* ========== Toast ========== */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 16px 40px -16px var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.3s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: min(92vw, 440px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-check {
  color: var(--accent-high);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   Landing page (public front door — index.html)
   Namespaced .lp-* / .landing-* to avoid colliding with the
   sample's existing .hero. Reuses tokens, .btn*, fadeUp, and
   the .auth-mock-* flashcard from the sign-in page.
   ============================================================ */

.landing-body {
  min-height: 100vh;
  min-height: 100dvh;
}

.lp-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ----- Top bar ----- */
.lp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 0;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0s forwards;
}

.lp-brand {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}

.lp-brand em {
  font-style: normal;
  font-weight: 500;
}

.lp-signin {
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 4px;
  transition: color 0.2s ease;
}

.lp-signin:hover {
  color: var(--ink);
}

/* ----- Main ----- */
.lp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(72px, 12vh, 128px);
  padding: clamp(56px, 9vh, 112px) 0;
}

/* ----- Hero ----- */
.lp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(40px, 6vw, 88px);
}

.lp-hero-copy {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.lp-eyebrow {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 22px;
}

.lp-hero-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(40px, 6vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.lp-hero-title em {
  font-style: italic;
  color: var(--ink-2);
}

.lp-hero-subtitle {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  max-width: 32ch;
  margin-top: 22px;
}

.lp-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* ----- Hero visual (reuses .auth-mock-* markup) ----- */
.lp-hero-visual {
  display: grid;
  place-items: center;
  min-height: 460px;
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

.lp-hero-visual .auth-mock-stage {
  width: min(420px, 92%);
}

/* Drop the streak badge below the card's "Tap to flip" footer so it
   no longer covers that text — a gentler overlap like the auth page.
   (The mobile breakpoint resets this so it stays within the stacked
   visual.) */
.lp-hero-visual .auth-mock-streak {
  right: -6%;
  bottom: -3%;
}

/* ----- Vignettes ----- */
.lp-vignettes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.lp-vignette {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 24px;
  padding: 30px 28px;
  box-shadow: 0 10px 28px -22px var(--shadow-lg);
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.lp-vignette:nth-child(1) {
  animation-delay: 0.3s;
}
.lp-vignette:nth-child(2) {
  animation-delay: 0.38s;
}
.lp-vignette:nth-child(3) {
  animation-delay: 0.46s;
}

.lp-vignette-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 32,
    "SOFT" 100,
    "wght" 500;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 12px;
}

.lp-vignette-text {
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ----- Footer ----- */
.lp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-3);
}

.lp-footer-brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

.lp-footer-brand em {
  font-style: normal;
  font-weight: 500;
}

.lp-footer-links {
  display: flex;
  gap: 20px;
}

.lp-footer-links a {
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  transition: color 0.2s ease;
}

.lp-footer-links a:hover {
  color: var(--ink);
}

/* ----- Responsive (mirrors the auth breakpoint) ----- */
@media (max-width: 880px) {
  .lp-main {
    gap: clamp(64px, 9vh, 88px);
    padding: 32px 0 72px;
  }

  .lp-hero {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .lp-hero-visual {
    order: -1;
    min-height: 318px;
    margin: -18px 0 0;
    place-items: start center;
  }

  .lp-hero-visual .auth-mock-stage {
    width: min(390px, 90%);
    transform: translate(-10px, -12px);
  }

  .lp-hero-visual .auth-mock-streak {
    right: -1%;
    bottom: 1%;
    transform: rotate(3deg) scale(0.86);
    transform-origin: center;
  }

  .lp-hero-subtitle {
    max-width: none;
  }

  .lp-vignettes {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ============================================================
   Landing — device showcase (live app in matte-glass frames)
   Embeds the real app pages via <iframe>, with phone scaling kept
   off Safari's fragile iframe `zoom` path. One device per
   viewport: desktop window on wide screens, phone on narrow.
   The frosted bezel lives on a ::before layer so it is never a
   paint ancestor of the iframe — keeping the iframe visible.
   ============================================================ */

.lp-showcase {
  text-align: center;
}

.lp-showcase-head {
  margin-bottom: clamp(40px, 6vw, 64px);
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.lp-showcase-title {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-top: 14px;
}

.lp-showcase-title em {
  font-style: italic;
  color: var(--ink-2);
}

.lp-showcase-stage {
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

/* Live app iframe — decorative, scaled with transform (NOT zoom:
   Safari mis-sizes the document inside a zoomed iframe, leaving a
   whitespace strip and the wrong layout; transform scales the painted
   result and renders identically everywhere). */
.device-app {
  display: block;
  border: 0;
  background: var(--bg);
  pointer-events: none;
}

/* ----- Shared matte-glass bezel ----- */
.device-desktop,
.device-phone {
  position: relative;
  display: inline-block;
  border: 1px solid var(--hairline);
  box-shadow:
    0 50px 90px -40px var(--shadow-lg),
    0 16px 36px -20px var(--shadow);
}

.device-desktop::before,
.device-phone::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(22px);
  -webkit-backdrop-filter: saturate(1.4) blur(22px);
  z-index: 0;
}

.device-desktop-window,
.device-phone-window {
  position: relative;
  z-index: 1;
}

/* ----- Desktop window ----- */
.device-desktop {
  padding: 12px;
  border-radius: 26px;
}

.device-desktop-window {
  border: 1px solid var(--hairline);
  border-radius: 15px;
  overflow: hidden;
  background: var(--bg);
}

.device-desktop-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}

.device-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface-active);
  flex-shrink: 0;
}

.device-url {
  margin-left: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 16px;
}

.device-desktop-screen {
  --dscale: 0.72;
  position: relative;
  width: calc(1280px * var(--dscale));
  height: calc(820px * var(--dscale));
  overflow: hidden;
  background: var(--bg);
}

.device-desktop-screen .device-app {
  position: absolute;
  inset: 0;
  width: 1280px;
  height: 820px;
  transform: scale(var(--dscale));
  transform-origin: top left;
  -webkit-transform: scale(var(--dscale));
  -webkit-transform-origin: top left;
}

/* ----- Phone (shown on narrow viewports) ----- */
.device-phone {
  display: none;
  padding: 10px;
  border-radius: 46px;
}

.device-phone-window {
  border-radius: 38px;
  overflow: hidden;
  background: var(--bg);
}

.device-phone-screen {
  --pscale: 0.76;
  position: relative;
  width: calc(390px * var(--pscale));
  height: calc(800px * var(--pscale));
  overflow: hidden;
  background: var(--bg);
}

.device-phone-screen .device-app {
  position: absolute;
  inset: 0;
  width: 390px;
  height: 800px;
  transform: scale(var(--pscale));
  transform-origin: top left;
  -webkit-transform: scale(var(--pscale));
  -webkit-transform-origin: top left;
}

/* ----- Responsive: shrink desktop, then swap to phone ----- */
@media (max-width: 1040px) {
  .device-desktop-screen {
    --dscale: 0.62;
  }
}

@media (max-width: 860px) {
  .device-desktop-screen {
    --dscale: 0.54;
  }
}

@media (max-width: 760px) {
  .device-desktop {
    display: none;
  }
  .device-phone {
    display: inline-block;
  }
}

@media (max-width: 380px) {
  .device-phone-screen {
    --pscale: 0.7;
  }
}

/* ============================================================
   Goal ring — conic-gradient progress ring (used by Mock 6)
   ============================================================ */

.goal-ring {
  --pct: 0;
  position: relative;
  width: clamp(132px, 28vw, 168px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.goal-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.goal-ring-track,
.goal-ring-arc {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}

.goal-ring-track {
  stroke: var(--surface-active);
}

.goal-ring-arc {
  stroke: var(--ink);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--pct));
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.goal-ring-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.goal-ring-pct {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.goal-ring-pct-unit {
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
}

.goal-ring-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Home Mock 8 — Discovery Hub (content discovery)
   Builds on the home deck-folder browse; adds search, subject
   filter chips, a continue rail and a due-now panel.
   ============================================================ */
.home-mock-8-page .page {
  max-width: 1100px;
}

.discover-search {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.discover-searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 14px;
  padding: 13px 16px;
  transition:
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

.discover-searchbar:focus-within {
  border-color: var(--ink-3);
  box-shadow: 0 12px 28px -22px var(--shadow-lg);
}

.discover-search-icon {
  display: inline-flex;
  color: var(--ink-3);
  flex: 0 0 auto;
}

.discover-search-icon svg {
  width: 18px;
  height: 18px;
}

.discover-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}

.discover-search-input::placeholder {
  color: var(--ink-3);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.filter-chip:hover {
  background: var(--surface-deep);
  color: var(--ink);
}

.filter-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.discover-block {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
  margin-bottom: 28px;
}

.discover-rail {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.discover-two-up {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 28px;
}

.discover-due-card {
  justify-content: space-between;
}
/* renderQuickDecks injects its own "Continue…" label; hide it — the card supplies its own. */
.discover-due-card #quickDecks > .aside-card-label {
  display: none;
}
.discover-due-card .quick-deck-list {
  flex: 1 1 auto;
}
.discover-due-cta {
  align-self: flex-start;
  margin-top: 18px;
}

.discover-summary-card {
  gap: 14px;
}

.discover-summary-link {
  margin-top: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 0.2s ease;
}

.discover-summary-link:hover {
  color: var(--ink);
}

@media (max-width: 860px) {
  .discover-two-up {
    grid-template-columns: 1fr;
  }
  .discover-due-cta {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   Review session — shared design for review.html (mixed cross-deck
   queue) and study.html (single deck). Adopted from review mock 3
   (immersive focus card) with mock 1's progress rail, labelled
   counts and quiet header: mock 1's top spacing, mock 3's 720px
   column. Reuses the flashcard / reveal / rating engine untouched.
   ============================================================ */
.review-session-page .page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 76px 32px 40px; /* top spacing follows the base .page rhythm */
}

/* Slim progress rail + labelled counts pinned at the top */
.review-session-page .session-rail {
  max-width: 720px;
  width: 100%;
  margin: 0 auto 36px;
  gap: 14px;
}
.review-session-page .session-rail .seg-bar {
  height: 6px;
}

/* Counts read as quiet inline labels, not boxed pills */
.review-session-page .session-counts {
  gap: 24px;
}
.review-session-page .session-counts .qc {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
}
.review-session-page .session-counts .qc-label {
  letter-spacing: 0.06em;
}

/* Quiet session label — small italic serif, centered. The eyebrow
   ("Mixed review") only exists on the cross-deck queue page. */
.review-session-page .session-header {
  text-align: center;
  margin-bottom: 0;
}
.review-session-page .session-eyebrow {
  margin-bottom: 8px;
}
.review-session-page .session-deck {
  font-size: clamp(16px, 1.8vw, 20px);
  font-style: italic;
  color: var(--ink-3);
}

/* Stage fills the remaining height and centres the card */
.review-session-page .session-stage {
  flex: 1 1 auto;
  min-height: 0;
  gap: 30px;
  margin-top: 0;
}

/* One big, breathable card — the whole interface */
.review-session-page .session-card-wrap {
  max-width: 720px;
}
.review-session-page .session-card {
  border-radius: 36px;
  padding: 64px;
  min-height: clamp(360px, 56vh, 560px);
  box-shadow: 0 36px 72px -42px var(--shadow-lg);
}
.review-session-page .session-card .flashcard-text {
  font-size: clamp(26px, 3.6vw, 38px);
}
.review-session-page .session-card .flashcard-section.answer .flashcard-text {
  font-size: clamp(22px, 2.8vw, 30px);
}
.review-session-page .session-hint {
  letter-spacing: 0.05em;
}

/* Tighter count spacing on mobile */
@media (hover: none) and (pointer: coarse), (max-width: 720px) {
  .review-session-page .session-counts {
    gap: 18px;
  }
}

/* ============================================================
   Home Mock 14 — Editorial (typographic hero, hairline rules,
   single-row heatmap ribbon; no boxes above the continue rail)
   ============================================================ */
.home-mock-14-page .page {
  max-width: 1020px;
}

.edit-hero {
  margin-bottom: 44px;
}

.edit-headline {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 96,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(46px, 6.5vw, 74px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 18px;
  font-variant-numeric: tabular-nums;
}

.edit-headline em {
  font-style: italic;
  color: var(--ink-2);
}

.edit-sub {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 600px;
  letter-spacing: -0.005em;
}

.edit-sub strong {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.edit-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 28px;
}

.edit-cta-note {
  font-size: 13px;
  color: var(--ink-3);
}

/* Stat rule: serif figures between two hairlines */
.edit-figures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 24px 0;
  margin-bottom: 44px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.edit-figure {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 30px;
  border-left: 1px solid var(--hairline);
}

.edit-figure:first-child {
  border-left: none;
  padding-left: 4px;
}

.edit-figure-value {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.edit-figure-value .stat-unit {
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 24,
    "SOFT" 100,
    "wght" 400;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-3);
  margin-left: 3px;
  letter-spacing: -0.005em;
}

.edit-figure-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Consistency ribbon: the 30-day heatmap as a single row */
.edit-consistency {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.22s forwards;
}

.edit-consistency-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.edit-ribbon {
  grid-template-columns: repeat(30, 1fr);
  gap: 4px;
  margin: 0;
}

.edit-ribbon .heatmap-cell {
  border-radius: 5px;
}

.home-mock-14-page .continue-section {
  margin-top: 0;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

.home-mock-14-page .continue-section-header {
  border-top: 1px solid var(--hairline);
  padding-top: 22px;
}

.home-mock-14-page .continue-section-title {
  font-size: clamp(24px, 2.4vw, 30px);
}

@media (max-width: 720px) {
  .edit-figures {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 22px;
  }
  .edit-figure {
    padding: 0 22px;
  }
  .edit-figure:nth-child(odd) {
    border-left: none;
    padding-left: 4px;
  }
}

@media (max-width: 640px) {
  .edit-ribbon {
    grid-template-columns: repeat(15, 1fr);
    gap: 5px;
  }
}

/* ============================================================
   Home Mock 15 — refined dashboard (review-first)
   Mock 1's due-today hero as the single dominant element, with
   today's goal + streak stacked beside it and the continue rail
   below. One primary CTA; everything else is supporting matter.
   ============================================================ */
.home-mock-15-page .page {
  max-width: 1140px;
}

.mock15-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 14px;
  align-items: stretch;
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

.mock15-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Streak card absorbs leftover height so the two columns bottom-align */
.mock15-aside .mock15-streak {
  flex: 1 1 auto;
}

.mock15-hero {
  padding: 28px;
  gap: 18px;
}

.mock15-goal,
.mock15-streak {
  padding: 24px;
}

.mock15-cta-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}

.mock15-cta-note strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* Weekly summary pins to the card bottom when the streak card stretches */
.mock15-week-note {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.mock15-grid + .continue-section {
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.22s forwards;
}

@media (max-width: 1080px) {
  .mock15-grid {
    grid-template-columns: 1fr;
  }
}
