/* 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: #868686;
  --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 {
  font-family: "OpenDyslexic", "Fraunces", serif;
  font-variation-settings: normal;
  letter-spacing: 0;
}

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

/* Floating navigation. */

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

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

/* Page sections. */
.section {
  margin-bottom: 96px;
}

/* Deck list. */

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

/* Card table. */

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.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
}

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

/* Custom select menu. */
.custom-select {
  position: relative;
  width: 100%;
  font-family: "DM Sans", sans-serif;
}

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

/* 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) {
  .nav {
    padding: 5px 5px 5px 14px;
  }
  .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;
  }
  .flashcard {
    padding: 28px 24px;
    border-radius: 28px;
    min-height: 300px;
  }
  thead th,
  tbody td {
    padding: 14px 16px;
  }
  .session-complete {
    padding: 36px 24px;
    border-radius: 28px;
  }
  .session-complete .complete-stats {
    gap: 24px;
  }
}

@media (max-width: 460px) {
  .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-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);
}

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

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

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

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

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

/* Scoreboard rows for stats page */

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

/* Segmented control */

.segmented-option {
  appearance: none;
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 9px;
  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;
}

/* 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 {
  background: var(--accent-green);
}

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

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

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

#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-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  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-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;
}

/* Right pane - decorative flashcard mockup */

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

/* Continue where you left off - section heading + 3-card grid */

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

/* Daily-goal home layout. */

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

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

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

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

/* Under the buttons: the Apple apps, quieter than either button. */
.lp-store-line {
  margin-top: 22px;
  font-size: 14px;
  color: var(--ink-3);
}

.lp-store-link {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: var(--ink-3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.lp-store-link:hover {
  text-decoration-color: currentColor;
}

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

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

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