/* Halley's website: the homepage (index.html), the text pages and the shared-deck page
   (server/src/community.ts deckPageHtml). Plain CSS, no build step. */

/* Halley's palette (mobile/src/lib/theme.ts): violet brand, the four answer colors, light and dark surfaces. */
:root {
  color-scheme: light dark;
  --brand: #6c4cf1;
  --deep: #4b2fd6;
  --soft: #a996ff;
  --spark: #ffc94d;
  --again: #f2546b;
  --hard: #f5a524;
  --good: #17b890;
  --easy: #3b8bff;
  --bg: #f6f5fb;
  --surface: #ffffff;
  --sunken: #eceaf5;
  --border: #e2dfee;
  --text: #17142b;
  --text-2: #5f5a7a;
  --text-3: #8a85a3;
  --tint: #eeeaff;
  --shadow: 0 1px 2px rgba(40, 24, 120, 0.05), 0 12px 32px -18px rgba(40, 24, 120, 0.28);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8b73ff;
    --bg: #0d0b18;
    --surface: #18152a;
    --sunken: #100e1e;
    --border: #2c2746;
    --text: #f4f2ff;
    --text-2: #b3add3;
    --text-3: #8d88ad;
    --tint: #251f48;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--brand);
}
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}
img {
  max-width: 100%;
}
.muted {
  color: var(--text-2);
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 640px) {
  .wrap {
    padding-inline: 24px;
  }
}

/* ---------- Header and footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.header-cta {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.site-footer {
  margin-top: 40px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--text);
}
.footer-brand img {
  border-radius: 7px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.footer-links a {
  color: var(--text-2);
}
.footer-legal {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
}

/* ---------- Store badges ---------- */

/* The official artwork, unmodified, at the same visible height. Never rounded or clipped:
   Apple's badge has its own corners and grey hairline border. */
.badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.badges.center {
  justify-content: center;
}
.badges a {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}
.badges img {
  height: 52px;
  width: auto;
  max-width: none;
  border-radius: 0;
}
/* Google's PNG (646×250) has transparent padding: the badge itself is 168 px tall from y 41.
   Scale it so that part is 52 px and pull the padding in. */
.badges .badge-google {
  height: calc(52px * 250 / 168);
  margin: calc(-52px * 41 / 168);
}

/* ---------- Type ---------- */

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}
.display {
  font-size: clamp(40px, 8vw, 70px);
  line-height: 1.02;
  font-weight: 850;
  letter-spacing: -0.035em;
}
.section-title {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.section-title.sub {
  font-size: clamp(26px, 3.4vw, 34px);
}
.lead {
  margin: 18px 0 0;
  color: var(--text-2);
  font-size: clamp(18px, 2.2vw, 21px);
  line-height: 1.5;
  text-wrap: pretty;
}
.prose p {
  margin: 16px 0 0;
  color: var(--text-2);
  text-wrap: pretty;
}
.prose p b {
  color: var(--text);
}
.source {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- Homepage ---------- */

.section {
  padding-block: 72px;
}
@media (min-width: 900px) {
  .section {
    padding-block: 104px;
  }
}
.section-head {
  max-width: 720px;
  margin-bottom: 40px;
}
.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.hero {
  position: relative;
  overflow: clip;
  padding-block: 48px 64px;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto;
  height: 120%;
  background:
    radial-gradient(40% 50% at 78% 30%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(35% 40% at 15% 10%, color-mix(in srgb, var(--spark) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  gap: 40px;
  align-items: center;
}
.hero-copy {
  text-align: center;
}
.hero-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 18px 40px -16px rgba(75, 47, 214, 0.55);
}
.hero-copy .eyebrow {
  margin-top: 20px;
}
.hero-copy .lead {
  margin-inline: auto;
  max-width: 560px;
}
.hero-note {
  margin: 16px 0 0;
  color: var(--text-3);
  font-size: 14px;
}
@media (min-width: 900px) {
  .hero {
    padding-block: 72px 96px;
  }
  .hero-grid {
    grid-template-columns: 1.1fr 1fr;
    gap: 56px;
  }
  .hero-copy {
    text-align: left;
  }
  .hero-copy .lead {
    margin-inline: 0;
  }
  .hero-copy .badges {
    justify-content: flex-start;
  }
}

/* A screenshot in a phone frame. Percentages follow the iPhone's own proportions. */
.device {
  position: relative;
  padding: 3.2%;
  border-radius: 15% / 7%;
  background: #121019;
  box-shadow:
    0 30px 60px -24px rgba(40, 20, 120, 0.5),
    inset 0 0 0 1.5px #2e2a3b;
}
.device img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12.5% / 5.8%;
}
.device-island {
  position: absolute;
  top: 2.75%;
  left: 50%;
  width: 29%;
  height: 4%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #050409;
}
.phone-pair {
  position: relative;
  width: min(100%, 440px);
  margin-inline: auto;
  padding-block: 2% 4%;
}
.phone-pair .front {
  position: relative;
  z-index: 1;
  width: 60%;
  margin-left: auto;
  margin-right: 5%;
  transform: rotate(3deg);
}
.phone-pair .back {
  position: absolute;
  top: 12%;
  left: 4%;
  width: 52%;
  transform: rotate(-6deg);
  filter: saturate(0.9);
}
.phone-single {
  width: min(72%, 300px);
  margin-inline: auto;
}

.split {
  display: grid;
  gap: 40px;
  align-items: center;
}
@media (min-width: 900px) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: 72px;
  }
  .split.flip > :first-child {
    order: 2;
  }
}
.split-media {
  display: grid;
  gap: 24px;
}

.band {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

/* ---------- Charts ---------- */

.chart {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.band .chart {
  background: var(--bg);
  box-shadow: none;
}
.chart-title {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}
.curve-plot {
  position: relative;
  height: clamp(190px, 42vw, 270px);
  margin-left: 42px;
}
.curve-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.curve-plot .grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}
.curve-plot .axis {
  stroke: var(--border);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.curve {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.curve-once {
  stroke: var(--again);
  stroke-width: 2.5;
  opacity: 0.85;
}
.curve-spaced {
  stroke: var(--brand);
  stroke-width: 3;
}
.y-label {
  position: absolute;
  left: -42px;
  width: 34px;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 12px;
  text-align: right;
}
.review-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--surface);
}
.band .review-dot {
  box-shadow: 0 0 0 3px var(--bg);
}
.x-labels {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 0 42px;
  color: var(--text-3);
  font-size: 12px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 13px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.legend i {
  display: inline-block;
  width: 16px;
  height: 4px;
  border-radius: 2px;
}
.legend i.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}

/* Right on schedule: one card back on each review day (the app's CardReturns), hops higher the longer the wait. */
.returns-plot {
  position: relative;
  height: clamp(150px, 32vw, 210px);
  margin-inline: 24px;
  --card-w: clamp(24px, 4.2vw, 34px);
  --card-h: calc(var(--card-w) * 1.3);
}
.returns-plot::after {
  content: '';
  position: absolute;
  left: calc(var(--card-w) / -2 - 4px);
  right: calc(var(--card-w) / -2 - 4px);
  bottom: -2px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--border);
}
.returns-plot svg {
  position: absolute;
  inset: 0 0 calc(var(--card-h) + 6px);
  width: 100%;
  height: calc(100% - var(--card-h) - 6px);
  overflow: visible;
}
.hop {
  fill: none;
  stroke: var(--soft);
  stroke-width: 1.6;
  stroke-dasharray: 1.5 4.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.return-card {
  position: absolute;
  bottom: 0;
  width: var(--card-w);
  height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  padding: calc(var(--card-w) * 0.32) calc(var(--card-w) * 0.2) 0;
  border: 1.5px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 3px 8px -2px color-mix(in srgb, var(--brand) 30%, transparent);
}
.return-card::before,
.return-card::after {
  content: '';
  display: block;
  height: 3px;
  border-radius: 1.5px;
  background: var(--soft);
}
.return-card::after {
  width: 60%;
  margin-top: 4px;
  opacity: 0.6;
}
.returns-days {
  position: relative;
  height: 20px;
  margin: 8px 24px 0;
  color: var(--text-3);
  font-size: 12px;
}
.returns-days span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Testing beats re-reading: the app's TestingEffect, a slope chart from 5 minutes to a week. */
.slope-plot {
  position: relative;
  height: clamp(170px, 34vw, 230px);
  margin-inline: 56px;
}
.slope-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.slope-plot .grid,
.slope-plot .guide {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.slope-plot .grid {
  stroke-dasharray: 3 4;
}
.slope-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface);
}
.slope-value {
  position: absolute;
  transform: translateY(-50%);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.slope-value.soon {
  right: calc(100% + 12px);
  font-size: 14px;
}
.slope-value.week {
  left: calc(100% + 13px);
  font-size: 20px;
  font-weight: 850;
}
.slope-x {
  position: relative;
  height: 20px;
  margin: 10px 56px 0;
  color: var(--text-3);
  font-size: 12px;
}
.slope-x span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ratings ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ratings li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.ratings li:first-child {
  border-top: 0;
  padding-top: 0;
}
.ratings .technique {
  font-weight: 650;
}
.ratings .technique small {
  display: block;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}
.ratings .rating {
  flex-shrink: 0;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.ratings .high .rating {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 15%, transparent);
}
.ratings .low .rating {
  color: var(--text-2);
  background: var(--sunken);
}
.ratings .low .technique {
  color: var(--text-2);
}

/* Charts draw in once, when the script at the end of index.html sees them on screen: it adds .will-draw to each
   [data-draw] figure (never under reduced motion), then .drawn. Lines are wiped in with clip-path, not dashes: a
   dash pattern on a non-scaling stroke is measured in screen pixels, not the path's length, so it breaks the line. */
.will-draw .lines {
  clip-path: inset(-12px calc(100% + 12px) -12px -12px);
}
.will-draw.drawn .lines {
  clip-path: inset(-12px -12px -12px -12px);
}
.will-draw .review-dot,
.will-draw .return-card {
  transform: scale(0);
}
.will-draw .hop,
.will-draw .slope-dot.week,
.will-draw .slope-value.week {
  opacity: 0;
}
.will-draw.drawn :is(.review-dot, .return-card) {
  transform: none;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) var(--delay, 0s);
}
.will-draw.drawn :is(.hop, .slope-dot.week, .slope-value.week) {
  opacity: 1;
  transition: opacity 0.35s ease-out var(--delay, 0s);
}
/* The forgetting curve: both lines left to right, each review's dot as the line reaches it (--at, its x in 0–1). */
.curve-chart.drawn .lines {
  transition: clip-path 1.6s linear;
}
.curve-chart .review-dot {
  --delay: calc(var(--at) * 1.6s + 0.05s);
}
/* One card's reviews: the card, its hop, the card again, a longer hop… */
.return-card:nth-of-type(2) {
  --delay: 0.4s;
}
.return-card:nth-of-type(3) {
  --delay: 0.8s;
}
.return-card:nth-of-type(4) {
  --delay: 1.2s;
}
.return-card:nth-of-type(5) {
  --delay: 1.6s;
}
.hop:nth-of-type(1) {
  --delay: 0.15s;
}
.hop:nth-of-type(2) {
  --delay: 0.55s;
}
.hop:nth-of-type(3) {
  --delay: 0.95s;
}
.hop:nth-of-type(4) {
  --delay: 1.35s;
}
/* Testing beats re-reading: the week passes, then the week's results. */
.slope-chart.drawn .lines {
  transition: clip-path 1s cubic-bezier(0.4, 0, 0.3, 1);
}
.slope-chart {
  --delay: 0.85s;
}

/* ---------- How it works, features, research ---------- */

.pillars {
  display: grid;
  gap: 16px;
}
@media (min-width: 860px) {
  .pillars {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}
.tile {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.band .tile {
  background: var(--bg);
  box-shadow: none;
}
.tile h3 {
  margin-top: 16px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.tile p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 16px;
  text-wrap: pretty;
}
.tile .source {
  font-size: 12.5px;
}
.emoji-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 26px;
  line-height: 1;
  background: color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
}
.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--deep));
}
.answer-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 16px;
}
.answer-row span {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 2px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, currentColor 40%, transparent);
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.answer-row small {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

.feature-rows {
  display: grid;
  gap: 72px;
}
.features {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  margin-top: 72px;
}
.features .tile {
  padding: 22px;
}
.features .tile h3 {
  font-size: 18px;
}
.features .tile p {
  font-size: 15px;
}
.checks {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.checks li {
  position: relative;
  padding-left: 30px;
  color: var(--text-2);
}
.checks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 100% no-repeat,
    var(--brand);
}
.checks li b {
  color: var(--text);
}

.lessons {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
/* On phones the fifteen lessons are a row to swipe through (the next one peeks in), not a page-long column. */
@media (max-width: 639px) {
  .lessons {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 84%;
    gap: 12px;
    margin-inline: -16px;
    padding: 4px 16px 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }
  .lessons::-webkit-scrollbar {
    display: none;
  }
  .lessons .tile {
    scroll-snap-align: start;
  }
  /* Feature tiles as compact rows: the emoji beside the words. */
  .features .tile {
    display: grid;
    grid-template-columns: 48px 1fr;
    column-gap: 14px;
    padding: 18px;
  }
  .features .emoji-tile {
    grid-row: span 2;
  }
  .features .tile h3 {
    margin-top: 0;
  }
  .features .tile p {
    margin-top: 4px;
  }
}
.swipe-hint {
  display: none;
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: 14px;
}
@media (max-width: 639px) {
  .swipe-hint {
    display: block;
  }
}
.lesson h3 {
  font-size: 18px;
}
.lesson p {
  font-size: 15px;
}
.cites {
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cta {
  position: relative;
  overflow: clip;
  padding: 48px 24px;
  border-radius: 32px;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, #8f74ff 0%, #6c4cf1 45%, #4b2fd6 100%);
  box-shadow: 0 30px 60px -30px rgba(75, 47, 214, 0.7);
}
.cta img.cta-icon {
  width: 80px;
  height: 80px;
  border-radius: 19px;
  box-shadow: 0 14px 30px -12px rgba(20, 8, 80, 0.6);
}
.cta h2 {
  margin-top: 20px;
}
.cta p {
  max-width: 560px;
  margin: 14px auto 0;
  color: rgba(255, 255, 255, 0.86);
  text-wrap: pretty;
}
.cta .fine {
  margin-top: 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
}

/* ---------- Text pages (privacy, terms, delete-account, sign-in) and the deck page ---------- */

/* One readable column for every page but the homepage (<main class="home">). */
main:not(.home) {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 24px;
}
@media (min-width: 640px) {
  main:not(.home) {
    padding-inline: 24px;
  }
}
main:not(.home) h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 8px 0;
}
main:not(.home) h2 {
  font-size: 20px;
  margin-top: 28px;
}
main:not(.home) li + li {
  margin-top: 6px;
}
.open {
  display: inline-block;
  margin: 18px 0 8px;
  padding: 14px 26px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--deep));
  text-decoration: none;
  font-weight: 700;
}

/* ---------- Shared deck page: a phone studying the deck's first card ---------- */

main.deck {
  max-width: 768px;
}
.deck-head {
  text-align: center;
}
.deck-emoji {
  width: 104px;
  height: 104px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 30px;
  font-size: 56px;
  background: color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
}
.deck-head h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.deck-head p {
  overflow-wrap: anywhere;
}
.deck-head .badges {
  justify-content: center;
}
.how {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  align-items: center;
  margin: 56px 0 24px;
}
.how ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
  display: grid;
  gap: 22px;
}
.how li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: start;
}
.how li::before {
  content: counter(step);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--deep));
}
.how li b {
  display: block;
}
.how li span {
  color: var(--text-2);
  font-size: 15px;
}
@media (max-width: 640px) {
  .how {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 28px;
  }
}

.demo-phone {
  position: relative;
  width: 280px;
  height: 572px;
  border-radius: 46px;
  padding: 14px;
  background: #121019;
  box-shadow:
    0 30px 60px -20px rgba(40, 20, 120, 0.45),
    inset 0 0 0 2px #2a2635;
}
.demo-phone .screen {
  position: relative;
  height: 100%;
  border-radius: 34px;
  overflow: hidden;
  background: var(--bg);
  padding: 46px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.demo-phone .island {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 84px;
  height: 24px;
  margin-left: -42px;
  border-radius: 14px;
  background: #121019;
}
.demo-phone .bar {
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.demo-phone .bar i {
  display: block;
  height: 100%;
  width: 35%;
  border-radius: 3px;
  background: var(--brand);
}
.demo-phone .counts {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-2);
}
.demo-phone .counts b {
  font-weight: 800;
}
.demo-phone .flip {
  position: relative;
  flex: 1;
  perspective: 1200px;
}
.demo-phone .face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 14px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 5px solid var(--accent, var(--brand));
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 24px -14px rgba(40, 20, 120, 0.35);
}
.demo-phone .label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-2);
}
.demo-phone .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 10px;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.demo-phone .front .body {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}
.demo-phone .back .q {
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.demo-phone .back .body {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.demo-phone .body img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 12px;
  object-fit: contain;
}
.demo-phone .tap {
  font-size: 10px;
  color: var(--text-2);
  text-align: center;
}
.demo-phone .grades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  height: 40px;
}
.demo-phone .grades span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1.5px solid;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}
.demo-phone .grades small {
  font-weight: 500;
  font-size: 9px;
  opacity: 0.85;
}
.demo-phone .again {
  color: #e5484d;
  border-color: #e5484d66;
}
.demo-phone .hard {
  color: #e0892b;
  border-color: #e0892b66;
}
.demo-phone .good {
  color: #2e9e6a;
  border-color: #2e9e6a66;
}
.demo-phone .easy {
  color: #3478c6;
  border-color: #3478c666;
}
.demo-phone .reveal {
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--deep));
}
.demo-phone .controls {
  position: relative;
  height: 40px;
}
.demo-phone .controls > * {
  position: absolute;
  inset: 0;
}

/* The loop: look at the question, reveal, grade, next. */
.demo-phone .front {
  animation: front-face 7s ease-in-out infinite;
}
.demo-phone .back {
  animation: back-face 7s ease-in-out infinite;
}
.demo-phone .reveal {
  animation: reveal-button 7s ease-in-out infinite;
}
.demo-phone .grades {
  animation: grade-buttons 7s ease-in-out infinite;
}
.demo-phone .good {
  animation: good-press 7s ease-in-out infinite;
}
@keyframes front-face {
  0%,
  38% {
    transform: rotateY(0);
  }
  46%,
  92% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}
@keyframes back-face {
  0%,
  38% {
    transform: rotateY(-180deg);
  }
  46%,
  92% {
    transform: rotateY(0);
  }
  100% {
    transform: rotateY(180deg);
  }
}
@keyframes reveal-button {
  0%,
  36% {
    opacity: 1;
  }
  42%,
  94% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes grade-buttons {
  0%,
  42% {
    opacity: 0;
    transform: translateY(6px);
  }
  50%,
  92% {
    opacity: 1;
    transform: none;
  }
  98%,
  100% {
    opacity: 0;
  }
}
@keyframes good-press {
  0%,
  80% {
    background: transparent;
  }
  84%,
  90% {
    background: #2e9e6a22;
    transform: scale(0.94);
  }
  94%,
  100% {
    background: transparent;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .demo-phone .front,
  .demo-phone .reveal {
    animation: none;
    opacity: 0;
  }
  .demo-phone .back,
  .demo-phone .grades,
  .demo-phone .good {
    animation: none;
    transform: none;
    opacity: 1;
  }
}

.deck-cards h2 {
  margin-top: 8px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-wrap: anywhere;
}
.card span {
  color: var(--text-2);
}
.card b img,
.card span img {
  display: block;
  max-width: 160px;
  max-height: 110px;
  border-radius: 10px;
  margin-top: 6px;
  object-fit: contain;
}
.credit {
  display: block;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  opacity: 0.6;
  margin: 2px 0 4px;
}

/* ---------- FAQ (index.html #faq): native <details>, so it opens without the script ---------- */

.faq {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  font-weight: 700;
  font-size: 18px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
  background: var(--tint);
}
.faq details[open] summary::after {
  content: '−';
}
.faq summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 18px;
}
.faq details p {
  margin: 0;
  padding: 0 22px 20px;
  color: var(--text-2);
}
