/* Shared styles for landing and demo pages. */

:root {
  /* Neutral light theme with white cards. */
  --bg: #f7f7f7;
  --surface: #ffffff;
  /* Use a zero-sized resting shadow because this token appears in shadow lists. */
  --card-border: var(--hairline);
  --card-shadow: 0 0 0 rgba(0, 0, 0, 0);
  /* Review cards keep a resting shadow. */
  --flashcard-shadow: 0 18px 36px -22px var(--shadow-lg);
  --card-border-hover: var(--hairline);
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.16);
  /* No negative spread, so menu shadows reach every edge. */
  --menu-shadow: 0 3px 6px rgba(0, 0, 0, 0.05), 0 18px 40px rgba(0, 0, 0, 0.18);
  /* Surface tones move from hover, to nested, to selected. */
  --surface-2: rgba(34, 34, 34, 0.06);
  --surface-deep: rgba(34, 34, 34, 0.078);
  --surface-active: rgba(34, 34, 34, 0.11);
  --ink: #222222;
  --ink-2: #4a4a4a;
  --ink-3: #6c6c6c;
  --sidebar-nav-ink: var(--ink-3);
  --hairline: #ebebeb;
  --skeleton-sheen: rgba(255, 255, 255, 0.6);
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  /* Large blurred shadows need a stronger colour. */
  --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;
  /* Alpha chip colours work at every card depth. */
  --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);
  --field-face-hover: var(--surface-deep);
  /* Give the hero card and its overlapping chip different tones. */
  --hero-card-face: var(--surface);
  --hero-chip-face: var(--bg);

  --accent-green: #10b981;
  --accent-orange: #d97706;
  --accent-red: #dc2626;
  --accent-blue: #007dff;
  --stage-new: var(--ink-3);
  --control-on-bg: var(--ink);
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #1a1a1a;
  --surface-2: #2c2c2c;
  --surface-active: rgba(218, 218, 218, 0.08);
  --surface-deep: var(--bg);
  --ink: #fafafa;
  --ink-2: #ababab;
  --ink-3: #818181;
  --sidebar-nav-ink: var(--ink-2);
  --hairline: #252525;
  --hairline-subtle: #1a1a1a;
  --divider: #3d3d3d;
  --divider-subtle: #212121;
  --decorative: #262626;
  --skeleton-sheen: rgba(218, 218, 218, 0.05);
  --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(28, 28, 28, 0.72);
  --dot: rgba(168, 168, 168, 0.06);
  --btn-face: #2c2c2c;
  --btn-face-hover: #363636;
  --chip-face: rgba(218, 218, 218, 0.07);
  --chip-face-hover: rgba(218, 218, 218, 0.12);
  --field-face: rgba(0, 0, 0, 0.24);
  --field-face-hover: rgba(0, 0, 0, 0.38);
  --hero-card-face: var(--bg);
  --hero-chip-face: var(--surface);
  --card-border: var(--hairline);
  --card-shadow: 0 0 0 rgba(0, 0, 0, 0);
  --card-border-hover: var(--hairline);
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.45), 0 14px 30px rgba(0, 0, 0, 0.4);
  --menu-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.45);

  --accent-green: #34d399;
  --accent-orange: #ffb86c;
  --accent-red: #f87171;
  --accent-blue: #93c5fd;

  --control-on-bg: color-mix(in srgb, #ffffff 25%, var(--hairline));
}

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

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.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;
}

.brand-lockup {
  display: inline-grid;
  aspect-ratio: 1200 / 260;
  line-height: 0;
}

.brand-lockup-image {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-lockup-image--dark {
  visibility: hidden;
}

[data-theme="dark"] .brand-lockup-image--light {
  visibility: hidden;
}

[data-theme="dark"] .brand-lockup-image--dark {
  visibility: visible;
}

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

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

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

/* Floating navigation. */
.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 label. */
.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;
}

/* Page sections. */
.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;
}

/* Deck list. */
.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;
}

/* Progress bar. */
.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-green);
}
.bar-fill.mid-high {
  background: var(--accent-orange);
}
.bar-fill.mid {
  background: var(--accent-red);
}
.bar-fill.low {
  background: var(--ink-3);
}

/* Rounded buttons. */
.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 use an opaque grey background without a border. */
.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. */
.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-green);
}
.activity-pct.mid-high {
  color: var(--accent-orange);
}
.activity-pct.mid {
  color: var(--accent-red);
}

/* Card table. */
.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-green);
}
.mini-fill.mid-high {
  background: var(--accent-orange);
}
.mini-fill.mid {
  background: var(--accent-red);
}
.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);
}

/* New, Learning and Review counts. */
.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-blue);
}
.qc-new .qc-num {
  color: var(--accent-blue);
}
.qc-learning .qc-dot {
  background: var(--accent-red);
}
.qc-learning .qc-num {
  color: var(--accent-red);
}
.qc-review .qc-dot {
  background: var(--accent-green);
}
.qc-review .qc-num {
  color: var(--accent-green);
}

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

/* Colours show cards remaining in each state. */
.seg-bar {
  position: relative;
  display: flex;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.seg {
  height: 100%;
  min-width: 0;
  transition:
    width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    flex-grow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
/* The offset keeps remaining-state colours under the progress fill. */
.seg-done {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  background: var(--ink);
  border-radius: 0 999px 999px 0;
}
.seg-new {
  background: var(--accent-blue);
  opacity: 0.28;
}
.seg-learning {
  background: var(--accent-red);
  opacity: 0.28;
}
.seg-review {
  background: var(--accent-green);
  opacity: 0.28;
}

/* The deck name may change between cards in a mixed session. */
.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);
  /* Review cards keep a resting shadow. */
  box-shadow: var(--flashcard-shadow);
  border-radius: 32px;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.25s ease,
    box-shadow 0.3s ease;
  min-height: 360px;
}

.flashcard-wrap {
  position: relative;
}

/* Show edge fades while more card content exists in that direction. */
.scroll-fade {
  position: absolute;
  left: 1px;
  right: 1px;
  height: 36px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.scroll-fade--top {
  top: 1px;
  border-radius: 31px 31px 0 0;
  background: linear-gradient(to bottom, var(--surface), transparent);
}

.scroll-fade--bottom {
  bottom: 1px;
  border-radius: 0 0 31px 31px;
  background: linear-gradient(to top, var(--surface), transparent);
}

.flashcard.can-scroll-up ~ .scroll-fade--top,
.flashcard.can-scroll-down ~ .scroll-fade--bottom {
  opacity: 1;
}

.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;
  /* Do not shrink sections. Long content must scroll. */
  flex: 1 0 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;
}

/* Theme-coloured divider shown after the answer appears. */
.flashcard-divider {
  height: 6px;
  width: 84px;
  background: var(--ink-3);
  border: none;
  margin: 10px auto;
  flex: 0 0 auto;
  opacity: 0.55;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='6' viewBox='0 0 14 6'%3E%3Cpath d='M0 3q3.5-2.25 7 0t7 0' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='6' viewBox='0 0 14 6'%3E%3Cpath d='M0 3q3.5-2.25 7 0t7 0' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  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);
}

/* Grid rows animate to the answer's real height without clipping it. */
.flashcard-section.answer .answer-reveal {
  display: grid;
  grid-template-rows: 0fr;
  justify-items: center;
  width: 100%;
  opacity: 0;
  transition:
    opacity 0.35s ease,
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.answer-reveal > .answer-text {
  min-height: 0;
  overflow: hidden;
}

.flashcard.is-revealed .flashcard-section.answer .answer-reveal {
  opacity: 1;
  grid-template-rows: 1fr;
}

.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-red);
  border-color: var(--accent-red);
}
.rating-btn.again .rating-interval {
  color: var(--accent-red);
}

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

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

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

@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));
  }

  /* Equal breathing room above and below the deck name. The stage centres
     its card in the leftover height, which adds half of that below the
     header, so the bottom margin stays small to land on the same gap. */
  body.review-session-body .page-header {
    flex: 0 0 auto;
    margin: 18px 0 6px;
  }

  /* The mobile menu already shows the page name. */
  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: 0;
    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);
  /* Completion cards keep the same resting shadow as review cards. */
  box-shadow: var(--flashcard-shadow);
  border-radius: 32px;
  padding: 48px 40px;
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.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;
}

/* Create card form. */
.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 select menu. */
.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(--hairline);
  /* No negative spread, so the menu shadow reaches every edge. */
  box-shadow: var(--menu-shadow);
  border-radius: 16px;
  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-green);
  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;
}

/* Entrance 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;
}

/* Small screens. */
@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;
  }
}

/* Demo app shell, sidebar and page layouts. */

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

/* Keep the shell flush with the viewport. */
body.app-shell-body {
  background-attachment: fixed;
}

/* App layout. */
.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. */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  /* Keep both card and panel shadow layers in one declaration. */
  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;
  /* JS sets these fades when content is hidden past either edge. */
  --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);
}

/* Keep Soon quieter than a due badge. */
.sidebar-nav-soon {
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--hairline);
  border-radius: 999px;
  padding: 2px 8px;
}

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

/* 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;
}

/* Keep the account card's tone when it opens. */
.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-red);
}

.account-menu-item.danger:hover {
  background: var(--accent-red);
  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;
}

/* Menu button shown when the sidebar is closed. */
.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);
}

/* The icon and text show hover, so the border stays unchanged. */

.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. */
.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;
}

/* Home 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;
  }
}

/* Side 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-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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;
}

/* Match the Stats calendar's 3px radius on 11px cells at every grid size. */
.home-activity-card > .heatmap .heatmap-cell {
  border-radius: 20%;
}

.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;
}

.home-activity-card .heatmap-cell.lvl-1 {
  background: color-mix(in srgb, var(--accent-green) 26%, var(--surface));
  opacity: 1;
}
.home-activity-card .heatmap-cell.lvl-2 {
  background: color-mix(in srgb, var(--accent-green) 48%, var(--surface));
  opacity: 1;
}
.home-activity-card .heatmap-cell.lvl-3 {
  background: color-mix(in srgb, var(--accent-green) 72%, var(--surface));
  opacity: 1;
}
.home-activity-card .heatmap-cell.lvl-4 {
  background: var(--accent-green);
  opacity: 1;
}
.home-activity-card .heatmap-legend-scale .heatmap-cell {
  border-radius: 2px;
}

/* 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-row .due-count {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: center;
}

.due-count--none {
  color: var(--ink-3);
}

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

/* Stats grid. */
.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;
}

/* Flex overrides the browser's hidden rule, so restore it here. */
.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);
}

/* Toggle switch. */
.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-red) 9%, var(--surface));
  color: var(--accent-red);
  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-red);
  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-green);
}

/* Account tier badge. */
.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;
}

/* Use the same tier colours in the sidebar and account page. */
.tier-badge--plus::before,
.plan-badge.tier-badge--plus::before {
  background: var(--accent-green);
}

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

/* Keep the name and tier on one line. Truncate the name 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;
}

/* Review 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;
}

/* Two-column card editor. */
.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);
}

/* Mobile sidebar backdrop. */
.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 entrance delays. */
.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;
}

/* Shared utility classes. */
.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);
}

/* Folder styles for the sidebar and dashboard. */

/* 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);
}

/* Home folder list. */
.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;
}

/* Recessed cards keep a transparent border on hover. */
.feed-item--mini:hover {
  background: var(--surface-deep);
  border-color: transparent;
}

.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;
  }
}

/* Library page. */
.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;
}

/* Home deck shortcuts. */
.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 use a form on the left and decoration on the 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-red);
  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-green);
  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;
  /* Match the page body's dot pattern strength. */
  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;
  /* Keep the flashcard clearly raised above the pane. */
  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-green);
  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;
  }
}

/* Home activity and continue cards. */

.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 layout with a 1.6 to 1 column split. */
.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;
}

/* Let the breakdown grow and keep the CTA at 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);
}

/* Daily-goal home layout. */
.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;
  }
}

/* Overview dashboard layout. */
.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-green);
  border-color: var(--accent-green);
  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);
}

/* Discover cards use a raised surface because Add is their only action. */
.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 an @ 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-green);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Public landing page. The `lp-` prefix avoids demo-page style clashes. */

.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 {
  width: 188px;
}

.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 content. */
.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;
}
/* The signed-in swap hides the secondary button; .btn's own display would
   otherwise win over the hidden attribute. */
.lp-cta-row .btn[hidden] {
  display: none;
}

/* A faint halo in the button's own ink so the call to action lifts off the
   page without reading as a shadow; a touch stronger on hover. */
.lp-cta-row .btn-primary {
  box-shadow: 0 0 14px color-mix(in srgb, var(--ink) 18%, transparent);
}
.lp-cta-row .btn-primary:hover {
  box-shadow:
    0 0 18px color-mix(in srgb, var(--ink) 28%, transparent),
    0 12px 24px -16px var(--shadow-lg);
}

/* Hero preview using the auth mockup styles. */
.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%);
}

/* Keep the streak badge below the card footer. */
.lp-hero-visual .auth-mock-streak {
  right: -6%;
  bottom: -3%;
}

/* Feature cards. */
.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 {
  width: 136px;
  opacity: 0.78;
}

.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);
}

/* Match the auth small-screen 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;
  }
}

/* Wide screens show a desktop preview. Narrow screens show a phone. */

.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;
}

/* Use transform instead of zoom because Safari sizes zoomed iframes wrongly. */
.device-app {
  display: block;
  border: 0;
  background: var(--bg);
  pointer-events: none;
}

/* Shared preview frame. */
.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 preview. */
.device-desktop {
  padding: 6px;
  border-radius: 20px;
}

.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%;
  flex-shrink: 0;
}

.device-dot:nth-child(1) {
  background: #ff5f57;
}

.device-dot:nth-child(2) {
  background: #febc2e;
}

.device-dot:nth-child(3) {
  background: #28c840;
}

.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: 10px;
  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 preview. */
.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;
}

/* Shrink the desktop preview, then switch to the 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 progress ring. */

.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;
}

/* Discovery home layout with search, filters and due cards. */
.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;
}
/* The card supplies its own Continue label, so hide the injected one. */
.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;
  }
}

/* Shared layout for mixed and single-deck review sessions. */
.review-session-page .page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 76px 32px 40px;
}

/* Progress rail and queue counts. */
.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;
}

/* Show counts as low-contrast inline labels without boxes. */
.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;
}

/* Use a small italic session label. Mixed review only appears for many decks. */
.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);
}

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

/* Use one large card with generous spacing. */
.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;
  }
}

/* Editorial home layout. */
.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;
  }
}

/* Review-first home layout. */
.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;
}

/* Keep the weekly summary at the bottom of a stretched streak card. */
.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;
  }
}

/* Legal pages with a summary and sticky contents list. */

.legal-body {
  scroll-padding-top: 32px;
}

.legal-shell {
  max-width: 1180px;
}

.legal-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--surface);
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.legal-skip-link:focus {
  transform: translateY(0);
}

.legal-topbar {
  padding-top: 28px;
}

.legal-top-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legal-top-links a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.legal-top-links a:hover,
.legal-top-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}

.legal-main {
  flex: 1;
  padding: clamp(64px, 9vw, 112px) 0 96px;
}

.legal-hero {
  max-width: 980px;
  margin: 0 auto clamp(72px, 9vw, 116px);
  opacity: 0;
  animation: fadeUp 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.legal-title {
  max-width: 12ch;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 72,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(46px, 7vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
}

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

.legal-intro {
  max-width: 720px;
  margin-top: 28px;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 28,
    "SOFT" 100,
    "wght" 400;
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.5;
  letter-spacing: -0.012em;
  color: var(--ink-2);
}

.legal-promises {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: clamp(42px, 6vw, 64px);
}

.legal-promise {
  min-height: 210px;
  padding: 26px 24px;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 10px 28px -24px var(--shadow-lg);
}

.legal-promise-number {
  display: block;
  margin-bottom: 34px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.legal-promise h2 {
  margin-bottom: 10px;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 30,
    "SOFT" 100,
    "wght" 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

.legal-promise p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-3);
}

.legal-meta span:first-child {
  font-weight: 600;
  color: var(--ink-2);
}

.legal-meta a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 720px);
  align-items: start;
  justify-content: center;
  gap: clamp(48px, 7vw, 88px);
}

.legal-toc {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
}

.legal-toc-title {
  margin-bottom: 15px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.legal-toc nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.legal-toc a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-3);
  transition: color 0.2s ease;
}

.legal-toc a:hover,
.legal-toc a:focus-visible,
.legal-toc a.is-current {
  color: var(--ink);
}

.legal-toc a.is-current {
  font-weight: 600;
}

.legal-article {
  min-width: 0;
}

.legal-article section {
  padding: 0 0 58px;
  scroll-margin-top: 28px;
}

.legal-article section + section {
  padding-top: 56px;
  border-top: 1px solid var(--hairline);
}

.legal-article h2 {
  margin-bottom: 22px;
  font-family: "Fraunces", serif;
  font-variation-settings:
    "opsz" 48,
    "SOFT" 100,
    "wght" 500;
  font-size: clamp(29px, 3.6vw, 39px);
  line-height: 1.1;
  letter-spacing: -0.028em;
  color: var(--ink);
}

.legal-article h3 {
  margin: 30px 0 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.legal-article p,
.legal-article li {
  font-size: 16px;
  line-height: 1.78;
  color: var(--ink-2);
}

.legal-article p + p,
.legal-article p + ul,
.legal-article ul + p,
.legal-article ul + ul {
  margin-top: 18px;
}

.legal-article ul {
  padding-left: 21px;
}

.legal-article li + li {
  margin-top: 8px;
}

.legal-article strong {
  color: var(--ink);
  font-weight: 600;
}

.legal-article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.legal-article a:hover {
  text-decoration-color: var(--ink);
}

.legal-basis-list {
  display: grid;
  gap: 12px;
}

.legal-basis-list > div {
  padding: 22px 24px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
}

.legal-basis-list h3 {
  margin-top: 0;
}

.legal-provider-list strong {
  display: inline;
}

.legal-contact-card {
  padding: 24px 26px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-style: normal;
  line-height: 1.8;
  color: var(--ink-2);
}

.legal-footer {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .legal-main {
    padding-top: 54px;
  }

  .legal-promises {
    grid-template-columns: 1fr;
  }

  .legal-promise {
    min-height: 0;
  }

  .legal-promise-number {
    margin-bottom: 22px;
  }

  .legal-layout {
    grid-template-columns: minmax(0, 720px);
    gap: 62px;
  }

  .legal-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 22px;
    border: 1px solid var(--hairline);
    border-radius: 18px;
    background: var(--surface);
  }

  .legal-toc nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 12px;
  }

  .legal-toc a {
    padding: 6px 0;
  }
}

@media (max-width: 560px) {
  .legal-top-links {
    gap: 0;
  }

  .legal-top-links a {
    padding-inline: 9px;
  }

  .legal-main {
    padding-top: 48px;
  }

  .legal-title {
    font-size: clamp(40px, 13vw, 56px);
  }

  .legal-intro {
    margin-top: 22px;
  }

  .legal-promises {
    margin-top: 38px;
  }

  .legal-meta {
    flex-direction: column;
    gap: 6px;
  }

  .legal-toc nav {
    grid-template-columns: 1fr;
  }

  .legal-article section {
    padding-bottom: 46px;
  }

  .legal-article section + section {
    padding-top: 44px;
  }

  .legal-article p,
  .legal-article li {
    font-size: 15px;
    line-height: 1.72;
  }
}

@media print {
  .legal-body {
    background: #fff;
    background-image: none;
    color: #000;
  }

  .legal-top-links,
  .legal-toc,
  .legal-promises,
  .lp-footer-links {
    display: none;
  }

  .legal-main {
    padding: 36px 0;
  }

  .legal-hero {
    margin-bottom: 52px;
  }

  .legal-layout {
    display: block;
  }

  .legal-article section {
    break-inside: avoid;
  }
}

/* Keep the embedded app previews aligned with the current application shell.
   These rules live last because the landing bundle also carries styles for
   older standalone mock pages. */
.sidebar-header {
  padding: 12px 18px 14px;
}

.sidebar-nav-item {
  border-radius: 16px;
  color: var(--sidebar-nav-ink);
}

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

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

.sidebar-nav-item.is-active::before {
  display: none;
}

/* Current sidebar folder cards use tone, not chevrons, to show structure. */
.sidebar-folders {
  gap: 6px;
}

.sidebar-folder-card,
.sidebar-folder-card.is-open {
  border-radius: 16px;
  background: var(--surface-deep);
}

.sidebar-folder {
  padding: 10px 18px 10px 12px;
  color: var(--ink-2);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    padding 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-folder-card.is-open > .sidebar-folder {
  padding-bottom: 6px;
  color: var(--ink);
}

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

.sidebar-folder-decks {
  display: grid;
  grid-template-rows: 0fr;
  max-height: none;
  padding: 0;
  gap: 0;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    visibility 0s linear 0.4s;
}

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

.sidebar-folder-card.is-open > .sidebar-folder-decks {
  grid-template-rows: 1fr;
  max-height: none;
  padding: 0;
  opacity: 1;
  visibility: inherit;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}

.sidebar-folder-card.is-open
  > .sidebar-folder-decks
  > .sidebar-folder-decks-inner {
  padding: 2px 6px 6px;
}

.sidebar-deck-row--nested {
  border-radius: 11px;
  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);
}

/* Match the app's disclosure-backed account card and current default avatar. */
.sidebar-account-card {
  display: flex;
  flex-direction: column-reverse;
}

.sidebar-account-menu {
  display: grid;
  grid-template-rows: 0fr;
  max-height: none;
  padding: 0;
  gap: 0;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    visibility 0s linear 0.4s;
}

.sidebar-account-menu-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 6px;
  transition: padding 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-account-card.is-open .sidebar-account-menu {
  grid-template-rows: 1fr;
  max-height: none;
  padding: 0;
  opacity: 1;
  visibility: inherit;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}

.sidebar-account-card.is-open
  .sidebar-account-menu
  .sidebar-account-menu-inner {
  padding: 6px 6px 4px;
}

.avatar {
  overflow: hidden;
  color: transparent;
  background:
    radial-gradient(circle at 63% 63%, #6154f3 0 14%, transparent 43%),
    radial-gradient(circle at 42% 53%, #29c3ee 0 20%, transparent 48%), #bcebf2;
}

/* Current Home shows reviews and today's remaining new-card allowance as a pair. */
.dashboard-grid,
#deckFolders {
  opacity: 1;
  animation: none;
}

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

.aside-stat-pair {
  display: flex;
  align-items: baseline;
  gap: 22px;
}

.aside-stat-pair .aside-stat-big {
  font-size: 38px;
}

.aside-stat-pair .aside-stat-big .stat-unit {
  font-size: 15px;
  margin-left: 3px;
}

.due-count,
.aside-breakdown-row .due-count {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-deep);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.activity:has(.activity-row) {
  margin: -10px 0;
}

.aside-card .activity {
  border-top: 0;
}

.aside-card .activity-row {
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px;
  margin: 0 -10px;
  border: 0;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.aside-card .activity-row:first-child,
.aside-card .activity-row:last-child {
  padding: 10px;
}

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

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

  .home-dashboard-page .dashboard-aside {
    display: contents;
  }

  .home-dashboard-page .dashboard-aside > * {
    order: 3;
  }

  .home-dashboard-page .dashboard-aside > .aside-card:first-child,
  .home-dashboard-page .dashboard-aside > .home-activity-card {
    order: 1;
  }

  .home-dashboard-page .dashboard-main {
    order: 2;
    margin: 18px 0;
  }
}

/* Current feed cards keep a quiet resting surface and use nested tone only
   when their depth calls for it. */
.feed-item:hover {
  transform: none;
  box-shadow: var(--card-shadow);
}

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

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

.feed-folder-body {
  display: grid;
  grid-template-rows: 0fr;
  max-height: none;
  padding: 0;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    visibility 0s linear 0.5s;
}

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

.feed-folder.is-open > .feed-folder-body {
  grid-template-rows: 1fr;
  max-height: none;
  padding: 0;
  opacity: 1;
  visibility: inherit;
  transition:
    grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.feed-folder.is-open > .feed-folder-body > .feed-folder-body-inner {
  padding: 4px 18px 18px;
}

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

.feed-item--mini.feed-item--recessed,
.feed-item--mini.feed-item--recessed:hover {
  background: var(--surface-deep);
  border-color: transparent;
  box-shadow: none;
}

.feed-folder.is-open
  > .feed-folder-body
  > .feed-folder-body-inner
  > .feed-item--mini {
  opacity: 1;
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.feed-folder.is-open
  > .feed-folder-body
  > .feed-folder-body-inner
  > :nth-child(1) {
  animation-delay: 0.08s;
}

.feed-folder.is-open
  > .feed-folder-body
  > .feed-folder-body-inner
  > :nth-child(2) {
  animation-delay: 0.14s;
}

@media (max-width: 720px) {
  .feed-folder-body-inner {
    padding: 0 14px;
  }

  .feed-folder.is-open > .feed-folder-body > .feed-folder-body-inner {
    padding: 0 14px 14px;
  }
}
