:root {
  --page-bg: #ffffff;
  --surface: #ffffff;
  --text: #111111;
  --muted: #777777;
  --border: #777777;
  --faint: #e5e5e5;
  --inactive-line: #dedede;
  --font-body: "DIN Pro", "DINPro", Arial, "Helvetica Neue", sans-serif;
  --inset-x: 30px;
  /* Phone-frame content column (402 − 30 − 30). Caps lesson UI in every mode. */
  --content-max: 342px;
  /* Top inset (phone frame): 150 default; compound exception 100. */
  --content-top: 150px;
  --content-top-compact: 150px;
  --content-top-chart: 150px;
  --content-top-compound: 100px;
  --chart-top: 295px;
  --chart-height: 200px;
  --chart-label-gap: 8px;
  /* Default assumes "You" sits above the top emoji (58). JS sets 40px when
     the top emoji has no label so amount → emoji stays 8px. */
  --chart-marker-head: 58px;
  --chart-body-gap: 32px;
  --scrub-hint-gap: 8px;
  --support-text-size: 14px;
  --support-text-weight: 400;
  --support-text-line-height: 1.25;
  --support-text-color: var(--muted);
  --title-text-size: 18px;
  --title-text-weight: 400;
  --title-text-line-height: 1.25;
  --title-text-color: var(--text);
  --inline-bold-weight: 700;
  --cta-height: 52px;
  --cta-bottom: 54px;
  --safe-top: constant(safe-area-inset-top);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: constant(safe-area-inset-bottom);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --footer-min-height: calc(var(--cta-height) + var(--cta-bottom));
  --app-height: 100vh;
  --app-height: 100dvh;
  --app-height: 100svh;
  --sheet-overlay: rgba(0, 0, 0, 0.6);
  /* 60% black over white — matches the sheet shade for iOS status bar. */
  --sheet-overlay-on-white: #666666;
}

.cta,
.continue-btn,
.year-btn {
  min-height: var(--cta-height);
  min-width: 142px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border: 1.5px solid #111111;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.12s ease;
}

.cta:focus-visible,
.continue-btn:focus-visible,
.year-btn:focus-visible,
.cta:active,
.continue-btn:active,
.year-btn:active,
.cta.is-pressed,
.continue-btn.is-pressed,
.year-btn.is-pressed {
  opacity: 0.75;
  filter: opacity(0.75);
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .cta:hover,
  .continue-btn:hover,
  .year-btn:hover,
  .cta.is-hovered,
  .continue-btn.is-hovered,
  .year-btn.is-hovered {
    opacity: 0.75;
    filter: opacity(0.75);
  }
}

@font-face {
  font-family: "DIN Pro";
  src: url("../assets/fonts/DINPro-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DIN Pro";
  src: url("../assets/fonts/DINPro-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DIN Pro";
  src: url("../assets/fonts/DINPro-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DIN Pro";
  src: url("../assets/fonts/DINPro-Medium.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DIN Pro";
  src: url("../assets/fonts/DINPro-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

html {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--page-bg);
}

body {
  height: var(--app-height);
  min-height: var(--app-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
}

html.custom-cursor-enabled,
html.custom-cursor-enabled * {
  cursor: none !important;
}

.custom-cursor {
  width: 44px;
  height: 44px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  border: 1px solid rgba(50, 50, 50, 0.05);
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.05s ease-out, opacity 0.12s ease-out;
}

.custom-cursor.visible {
  opacity: 1;
}

.custom-cursor.clicking {
  transform: translate(-50%, -50%) scale(0.85);
}

.app-shell {
  width: 402px;
  height: 874px;
  max-width: 100%;
  max-height: calc(var(--app-height) - 4rem);
  position: relative;
  overflow: hidden;
  border-radius: 54px;
  outline: 1px solid #ffffff;
  background: var(--surface);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.18);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  flex-direction: column;
}

.app-shell * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.app-shell textarea,
.app-shell input {
  -webkit-user-select: text;
  user-select: text;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.debug-swatch,
.blueprint-debug-toggle,
.skip-end-btn {
  position: absolute;
  top: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.debug-swatch {
  z-index: 9998;
  pointer-events: none;
  visibility: hidden;
  /* box-shadow paints on iOS Safari even when background-color on empty nodes does not */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.debug-swatch-blue {
  left: 0;
  background-color: #0066ff;
  background-image: linear-gradient(#0066ff, #0066ff);
  box-shadow: inset 0 0 0 44px #0066ff;
}

.debug-swatch-red {
  right: 0;
  left: auto;
  background-color: #ff0000;
  background-image: linear-gradient(#ff0000, #ff0000);
  box-shadow: inset 0 0 0 44px #ff0000;
}

.app-shell.show-blueprint-debug .debug-swatch {
  visibility: visible;
}

.blueprint-debug-toggle,
.skip-end-btn {
  appearance: none;
  -webkit-appearance: none;
  z-index: 9999;
  border: 0;
  padding: 0;
  margin: 0;
  /* Keep the control itself opaque. iOS Safari drops taps on opacity:0 / empty buttons. */
  opacity: 1;
  color: transparent;
  font-size: 44px;
  line-height: 44px;
  cursor: pointer;
  background-color: rgba(0, 102, 255, 0.01);
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.blueprint-debug-toggle {
  left: 0;
}

.skip-end-btn {
  right: 0;
  left: auto;
  background-color: rgba(255, 0, 0, 0.01);
}

.blueprint-debug-toggle::before,
.skip-end-btn::before {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
}

.blueprint-debug-overlay {
  position: absolute;
  inset: 0;
  z-index: 10000;
  display: none;
  color: #006cff;
  opacity: 0.25;
  pointer-events: none;
}

.app-shell.show-blueprint-debug .blueprint-debug-overlay {
  display: block;
}

.blueprint-guide,
.blueprint-label {
  position: absolute;
  color: #006cff;
}

.blueprint-guide {
  background: #006cff;
}

.blueprint-guide-vertical {
  width: 1px;
  top: 0;
  bottom: 0;
}

.blueprint-guide-horizontal {
  height: 1px;
  left: 0;
  right: 0;
}

.blueprint-guide-left {
  left: 30px;
}

.blueprint-guide-right {
  right: 30px;
}

.blueprint-guide-top-100 {
  top: 100px;
}

.blueprint-guide-top-150 {
  top: 150px;
}

.blueprint-guide-bottom-74 {
  bottom: 74px;
}

.blueprint-guide-bottom-54 {
  bottom: 54px;
}

.blueprint-label {
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
}

.blueprint-label-left {
  left: 34px;
}

.blueprint-label-right {
  right: 34px;
}

.blueprint-label-top-100 {
  top: 84px;
}

.blueprint-label-top-150 {
  top: 154px;
}

.blueprint-label-mid-30 {
  top: 121px;
}

.blueprint-label-lower-30 {
  bottom: 92px;
}

.blueprint-label-bottom-74 {
  bottom: 78px;
}

.blueprint-label-bottom-54 {
  bottom: 38px;
}

.overall-progress {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 2 * var(--inset-x)), var(--content-max));
  z-index: 20;
  pointer-events: none;
}

.overall-progress[hidden] {
  display: none;
}

.overall-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 100px;
  background: #d9d9d9;
  overflow: hidden;
}

.overall-progress-fill {
  width: 100%;
  height: 100%;
  background: #222222;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 500ms cubic-bezier(0.32, 0, 0, 1);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .overall-progress-fill {
    transition-duration: 1ms;
  }
}

.status-bar {
  width: 100%;
  height: 60px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding-top: 11px;
  pointer-events: none;
}

.dynamic-island {
  width: 126px;
  height: 37px;
  border-radius: 100px;
  background: #000000;
}

.stage {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  display: none;
  background: var(--surface);
}

.screen.active {
  display: block;
  height: 100%;
  min-height: 0;
}

.screen.has-footer.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.screen-body {
  flex: 1 1 auto;
  grid-row: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--content-top) var(--inset-x) 24px;
}

/* Column cap for lesson blocks. Tags live in .tag-row so the pill can hug
   its label while the row shares this column. */
.screen-body:not(.post-lesson-body) > *:not(.tag) {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}

/* Lone tag children: keep hug-width, align to the same column start. */
.screen-body:not(.post-lesson-body) > .tag {
  width: max-content;
  max-width: max-content;
  margin-inline: auto;
  margin-left: max(0px, calc((100% - var(--content-max)) / 2));
}

.screen-footer {
  /* Grid row aligns the CTA band with the blueprint 54px line. */
  position: relative;
  grid-row: 2;
  bottom: auto;
  left: auto;
  right: auto;
  transform: none;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  justify-self: center;
  width: min(calc(100% - 2 * var(--inset-x)), var(--content-max));
  min-height: var(--cta-height);
  padding: 0 0 var(--cta-bottom);
  background: inherit;
  z-index: 6;
  box-sizing: border-box;
  pointer-events: none;
}

.screen-footer > * {
  pointer-events: auto;
}

.screen.has-footer:has(.screen-footer button:not([hidden])) .screen-body {
  padding-bottom: 24px;
}

.screen-footer:not(:has(button:not([hidden]))) {
  display: none;
}

.option-stack,
.guess-field,
.character-grid {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.screen.controls-ready:not(.controls-waiting) .option-stack,
.screen.controls-ready:not(.controls-waiting) .guess-field,
.screen.controls-ready:not(.controls-waiting) .character-grid {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: controls-in 180ms cubic-bezier(0.32, 0, 0, 1) both;
}

@keyframes controls-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen-footer.is-end {
  justify-content: flex-end;
}

.screen-footer.is-center {
  justify-content: center;
}

.screen-footer.is-split {
  justify-content: space-between;
}

.screen-footer .icon-btn {
  min-width: var(--cta-height);
  width: var(--cta-height);
  height: var(--cta-height);
  min-height: var(--cta-height);
  padding: 0;
}

.setup-confirm-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.setup-confirm-body .lesson-copy {
  min-height: calc(var(--title-text-size) * var(--title-text-line-height));
  flex-shrink: 0;
}

.setup-confirm-image {
  width: 160px;
  height: 160px;
  flex: 0 0 160px;
  margin: 48px auto 0;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 150ms cubic-bezier(0.32, 0, 0, 1),
    transform 150ms cubic-bezier(0.32, 0, 0, 1);
}

.setup-confirm-summary {
  width: 100%;
  max-width: var(--content-max);
  margin-top: 32px;
  color: #111111;
  font-size: 18px;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 150ms cubic-bezier(0.32, 0, 0, 1) 40ms,
    transform 150ms cubic-bezier(0.32, 0, 0, 1) 40ms;
}

.setup-confirm-body.is-details-ready .setup-confirm-image,
.setup-confirm-body.is-details-ready .setup-confirm-summary {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .setup-confirm-image,
  .setup-confirm-summary {
    transition-duration: 1ms;
    transition-delay: 0ms;
  }
}

.screen-footer.is-chart {
  justify-content: center;
}

.screen-footer .cta,
.screen-footer .continue-btn,
.screen-footer .year-btn,
.screen-footer .start-quest-btn,
.screen-footer .visualize-btn,
.screen-footer .table-action-btn,
.screen-footer .icon-btn {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  margin: 0;
}

.screen-footer.is-stretch .start-quest-btn {
  width: 100%;
}

.screen-footer .chart-controls {
  position: static;
  left: auto;
  bottom: auto;
  width: 100%;
  max-width: var(--content-max);
  transform: none;
}

.screen-footer .chart-controls[hidden],
.screen-footer .visualize-btn[hidden],
.screen-footer .cta[hidden],
.screen-footer .continue-btn[hidden],
.screen-footer .table-action-btn[hidden] {
  display: none !important;
}

.start-screen.active {
  background: #000000;
  color: #ffffff;
  --start-emblem-top: 70px;
  --start-title-gap: 32px;
}

.start-screen .screen-footer {
  background: #000000;
}

.start-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--start-emblem-top);
}

.start-emblem {
  width: 300px;
  height: 300px;
  flex: 0 0 auto;
  align-self: center;
  display: block;
  margin-top: 0;
  transform-origin: center center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.start-copy-carousel {
  flex: 0 0 auto;
  width: 100%;
  margin-top: var(--start-title-gap);
  overflow: hidden;
  touch-action: pan-x;
  cursor: grab;
}

.start-copy-carousel.is-dragging {
  cursor: grabbing;
}

.start-copy-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.32, 0, 0, 1);
  will-change: transform;
}

.start-copy-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  padding: 0;
  /* Column may be centered; copy stays left-aligned inside it. */
  text-align: left;
}

.start-copy-slide h1 {
  color: #ffffff;
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.start-copy-slide p {
  margin-top: 16px;
  max-width: var(--content-max);
  color: #b1b1b1;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.25;
}

.start-feature-list {
  list-style: none;
  margin-top: 16px;
  max-width: var(--content-max);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.start-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #b1b1b1;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.25;
}

.start-feature-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: #ffffff;
}

.start-footer {
  flex-direction: column;
  align-items: stretch;
  min-height: auto;
}

.start-footer-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
  width: 100%;
}

.start-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.start-page-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #444444;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.start-page-dot.is-active {
  background: #ffffff;
}

.start-page-dot:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.start-screen.has-footer:has(.screen-footer button:not([hidden])) .screen-body {
  padding-bottom: 24px;
}

.start-screen .start-quest-btn {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  height: var(--cta-height);
  min-height: var(--cta-height);
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transform: none;
  transition: transform 0.12s ease;
}

.start-screen .start-quest-btn:focus-visible,
.start-screen .start-quest-btn:active,
.start-screen .start-quest-btn.is-pressed {
  opacity: 0.9375;
  filter: opacity(0.9375);
  outline: none;
  transform: translateY(1px);
}

@media (hover: hover) and (pointer: fine) {
  .start-screen .start-quest-btn:hover,
  .start-screen .start-quest-btn.is-hovered {
    opacity: 0.9375;
    filter: opacity(0.9375);
  }
}

.choice-body {
  padding-top: var(--content-top);
}

.support-text {
  color: var(--support-text-color);
  font-size: var(--support-text-size);
  font-weight: var(--support-text-weight);
  line-height: var(--support-text-line-height);
}

.title-text,
.choice-copy h1,
.favorite-food-copy h1,
.lesson-copy h1,
.lesson-copy .prompt {
  color: var(--title-text-color);
  font-size: var(--title-text-size);
  font-weight: var(--title-text-weight);
  line-height: var(--title-text-line-height);
  letter-spacing: 0;
}

strong,
b {
  font-weight: var(--inline-bold-weight);
}

.choice-copy .support-text,
.favorite-food-copy .support-text,
.lesson-copy .support-text {
  margin-top: 8px;
}

.choice-copy {
  position: static;
  left: auto;
  top: auto;
  width: 100%;
  max-width: var(--content-max);
  /* Centered column position ≠ centered text. */
  text-align: left;
}

.character-grid {
  position: static;
  left: auto;
  top: auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 32px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  transform: none;
}

.character-card {
  appearance: none;
  -webkit-appearance: none;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #ffffff;
  background-image: none;
  color: #000000;
  font: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.character-card:focus,
.character-card:focus-visible {
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .character-card:hover {
    opacity: 0.75;
  }
}

.character-card.is-selected {
  border: 2px solid #222222;
  padding: 23px 15px;
  outline: none;
}

.character-card:active {
  transform: scale(0.985);
}

.character-image-wrap {
  width: 80px;
  height: 80px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.character-image {
  width: 68px;
  height: 68px;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.favorite-food-body {
  padding-top: var(--content-top);
}

.favorite-food-copy {
  width: 100%;
  max-width: var(--content-max);
}

.favorite-food-grid {
  width: 100%;
  max-width: var(--content-max);
  margin: 24px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  overflow: visible;
}

.favorite-food-card {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: auto;
  flex: 0 0 auto;
  min-height: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px 8px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.favorite-food-card.is-custom {
  justify-content: center;
  padding: 8px 24px;
  text-align: center;
}

.favorite-food-card:focus,
.favorite-food-card:focus-visible {
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .favorite-food-card:hover {
    opacity: 0.75;
  }
}

.favorite-food-card.is-selected {
  border: 2px solid #111111;
  padding: 7px 23px 7px 15px;
}

.favorite-food-card.is-custom.is-selected {
  padding: 7px 23px;
}

.favorite-food-card:active {
  transform: scale(0.985);
}

.favorite-food-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-self: center;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.favorite-food-label {
  min-width: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.favorite-food-card.is-custom .favorite-food-label {
  flex: 0 1 auto;
}

.favorite-food-custom {
  display: none;
  width: 12ch;
  min-width: 12ch;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 18px;
  font-weight: 400;
  text-align: center;
  outline: none;
}

.favorite-food-card.is-custom.is-selected .favorite-food-label {
  display: none;
}

.favorite-food-card.is-custom.is-selected .favorite-food-custom {
  display: block;
}

.favorite-food-check {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

.favorite-food-card.is-selected .favorite-food-check {
  /* Hidden for now. Restore opacity: 1 to show the selected check. */
  opacity: 0;
}

.favorite-food-screen .screen-footer .cta {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-copy {
  position: static;
  width: 100%;
  max-width: var(--content-max);
  margin: 32px 0 0;
  color: #111111;
  font-size: 18px;
  line-height: 1.25;
}

.continue-btn {
  position: static;
  min-width: 154px;
}

.start-quest-btn {
  position: static;
}

/* All lesson viz bodies share the same top inset token band. */
.chart-body {
  padding-top: var(--content-top);
}

.voo-body,
.table-body {
  padding-top: var(--content-top-compact);
}

.compound-body {
  padding-top: var(--content-top-compound);
}

.investment-heading {
  position: static;
  left: auto;
  top: auto;
  /* Keep chart from jumping when scrub swaps the dual-value header in. */
  min-height: 64px;
}

.investment-heading h2,
.investment-heading p {
  color: #111111;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
}

.investment-heading p {
  margin-top: 4px;
}

.chart-wrap {
  width: 100%;
  max-width: var(--content-max);
  /* Height comes from the SVG aspect-ratio so the plot always spans the
     full content column (no meet letterboxing when --chart-height shrinks). */
  height: auto;
  position: relative;
  left: auto;
  top: auto;
  margin: var(--chart-label-gap) auto 0;
  padding-top: var(--chart-marker-head);
  overflow: visible;
  touch-action: none;
}

.investment-chart {
  width: 100%;
  height: auto;
  aspect-ratio: 342 / 200;
  display: block;
  overflow: visible;
}

.axis-line {
  stroke: #d9d9d9;
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.growth-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.growth-line.comparison {
  stroke: #d9d9d9;
  stroke-width: 4;
}

.growth-line.active-growth {
  stroke: #222222;
  stroke-width: 4;
}

.year-labels text {
  fill: #9a9a9a;
  font: 500 12px var(--font-body);
}

.chart-year-labels {
  position: relative;
  width: 100%;
  height: 12px;
  margin-top: var(--chart-label-gap);
  color: #9a9a9a;
  font: 500 12px / 12px var(--font-body);
  pointer-events: none;
}

.chart-year-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.chart-year-label.is-start {
  transform: none;
}

.chart-year-label.is-end {
  transform: translateX(-100%);
}

.scrub-cursor {
  display: none;
}

.chart-screen.is-scrubbing .scrub-cursor {
  display: block;
}

.scrub-line {
  stroke: #d0d0d0;
  stroke-width: 1;
}

.scrub-year-label {
  fill: #9a9a9a;
  font: 500 12px var(--font-body);
}

.investment-scrub {
  display: none;
}

.chart-screen.is-scrubbing .investment-normal {
  display: none;
}

.chart-screen.is-scrubbing .investment-scrub {
  display: block;
}

.chart-screen.is-scrubbing.is-solo-scrub .investment-normal {
  display: block;
}

.chart-screen.is-scrubbing.is-solo-scrub .investment-scrub {
  display: none;
}

.scrub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  color: #111111;
}

.scrub-row + .scrub-row {
  margin-top: 4px;
}

.scrub-char-img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: cover;
  flex: 0 0 auto;
}

.scrub-row-comparison {
  color: var(--muted);
}

.scrub-you {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.chart-marker {
  width: 42px;
  height: 55px;
  position: absolute;
  display: block;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition: left 520ms cubic-bezier(0.32, 0, 0, 1), top 520ms cubic-bezier(0.32, 0, 0, 1), opacity 0.2s ease;
}

.chart-screen.no-marker-transition .chart-marker {
  transition: none;
}

.chart-screen.is-scrubbing .chart-marker {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

.scrub-swatch {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border-radius: 50%;
  background: #222222;
}

.scrub-row-comparison .scrub-swatch {
  background: #d9d9d9;
}

.scrub-dot {
  stroke: none;
}

.scrub-dot.is-active {
  fill: #222222;
}

.scrub-dot.is-comparison {
  fill: #d9d9d9;
}

.chart-marker img {
  width: 32px;
  height: 32px;
  display: block;
  position: absolute;
  left: 50%;
  bottom: 0;
  object-fit: cover;
  transform: translateX(-50%);
}

.marker-label {
  position: absolute;
  left: 50%;
  bottom: 34px;
  padding: 2px;
  border-radius: 2px;
  background: #ffffff;
  color: #777777;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.scrub-hint {
  position: static;
  margin: var(--chart-body-gap) auto 0;
  max-width: var(--content-max);
  padding: 0;
  text-align: center;
  transition: opacity 0.5s ease;
}

.scrub-hint.is-dismissed {
  opacity: 0;
  pointer-events: none;
}

/* Visualize button */
.visualize-btn {
  position: static;
}

/* Table screen */

.table-header {
  position: static;
  display: flex;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--faint);
  font-weight: 500;
}

.table-header h2 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

.compound-head {
  min-height: 32px;
  align-items: center;
  gap: 12px;
}

.compound-head h2 {
  opacity: 1;
  display: flex;
  align-items: center;
  min-height: 32px;
}

.compound-widget.is-chart .compound-head {
  border-bottom-color: transparent;
}

.compound-widget.is-chart .compound-head h2,
.compound-widget.is-chart .table-chip {
  transition: none;
}

.compound-widget.is-scrubbing .compound-head {
  pointer-events: none;
}

.compound-widget.is-scrubbing .compound-head h2,
.compound-widget.is-scrubbing .table-chip.is-visible {
  opacity: 0;
  visibility: hidden;
}

.compound-panel {
  width: 100%;
  margin-top: 8px;
  overflow: visible;
}

.compound-panel.is-locked {
  height: var(--compound-table-height);
}

.compound-panel .table-rows,
.compound-chart-wrap {
  margin-top: 0;
}

.compound-panel.is-locked .table-rows,
.compound-panel.is-locked .compound-chart-wrap {
  height: 100%;
}

.compound-chart-wrap {
  width: 100%;
  height: var(--compound-table-height);
  touch-action: none;
}

.compound-chart {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.compound-scrub-cursor {
  display: none;
}

.compound-widget.is-scrubbing .compound-scrub-cursor {
  display: block;
}

.compound-scrub-value,
.compound-scrub-year {
  fill: #9a9a9a;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
}

.compound-axis-label {
  fill: #9a9a9a;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
}

.th-spacer {
  flex: 0 0 44px;
}

.th-char {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.table-char-img {
  width: 22px;
  height: 22px;
  object-fit: cover;
}

.table-you {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.table-rows {
  position: static;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-weight: 500;
}

.table-row {
  display: flex;
  align-items: center;
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: 6px;
}

#tableRows .table-row {
  opacity: 0;
  transform: translateY(8px);
}

#compoundRows .table-row,
.compound-row {
  display: flex;
  align-items: center;
  height: var(--compound-row-height);
  min-height: var(--compound-row-height);
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: 6px;
  line-height: var(--compound-row-height);
  opacity: 1;
  transform: none;
}

.t-year {
  flex: 0 0 44px;
  font-size: 12px;
  color: var(--muted);
}

.t-val {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.t-val.zero-val {
  color: var(--muted);
}

.t-val.comp-val {
  color: #afafaf;
}

.t-val.comp-val.cell-highlighted {
  color: var(--text);
}

/* Highlighted Y5: both character amounts share dark text. */
.table-row.is-highlighted .t-val {
  color: var(--text);
}

.val-text {
  display: inline-block;
  position: relative;
  isolation: isolate;
  border-radius: 6px;
  transition: background 0.35s ease, padding 0.35s ease;
}

.val-text.is-elevated-pill::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 8px;
  background: #f5f5f5;
}


.t-val.cell-highlighted .val-text {
  background: #f5f5f5;
  padding: 8px 16px;
  margin: -8px 0;
}

.table-narrative {
  position: static;
  margin-top: 32px;
  font-size: 18px;
  line-height: 1.25;
  opacity: 0;
  min-height: 1.25em;
}

.table-narrative p + p {
  margin-top: 12px;
}

.cta-end {
  position: static;
}

.cta-center {
  position: static;
}

.table-action-btn {
  position: static;
}

.chart-controls {
  position: static;
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-controls.is-start {
  justify-content: flex-end;
}

.year-arrow {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
}

.year-arrow-back {
  transform: rotate(180deg);
}

.back-year-btn {
  padding-left: 8px;
}

.fast-forward-btn {
  padding-right: 8px;
}

.year-btn:active {
  transform: scale(0.98);
}

.table-action-btn,
.table-action-btn:active {
  transform: none;
}

.visualize-btn,
.visualize-btn:active {
  transform: none;
}

.year-btn[hidden],
[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 440px), (max-height: 956px) {
  :root {
    /* Fullscreen: 100px default; compound exception 50. */
    --content-top: 100px;
    --content-top-compact: 100px;
    --content-top-chart: 100px;
    --content-top-compound: 50px;
    /* Large viewport so the shell can reach the home-indicator edge.
       Standalone JS may replace this with screen.height in CSS pixels. */
    --app-height: 100vh;
    --app-height: 100lvh;
  }

  html {
    overflow: hidden;
    height: var(--app-height);
    background: #ffffff;
  }

  body {
    margin: 0;
    height: var(--app-height);
    min-height: var(--app-height);
    display: block;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    background: #ffffff;
  }

  html:has(.app-shell.is-sheet-open),
  body:has(.app-shell.is-sheet-open) {
    background: var(--sheet-overlay-on-white);
  }

  .app-shell {
    /* Fill from the physical top (under the island) to the physical bottom.
       Do not pin `bottom: 0` — that follows the visual viewport, which on an
       iOS home-screen app stops above the home indicator and leaves a gap.
       Ignore --safe-bottom here; the 54px CTA line is from the screen edge. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--app-height);
    min-height: var(--app-height);
    max-height: none;
    max-width: none;
    border-radius: 0;
    outline: 0;
    box-shadow: none;
    padding-top: var(--safe-top);
    padding-bottom: 0;
    background: #ffffff;
  }

  /* Overlay is absolute vs the padding edge (y=0 under the island).
     Offset it so the 100 line matches --content-top and guides stay out
     of the island while still reaching the physical bottom. */
  .blueprint-debug-overlay {
    top: var(--safe-top);
    right: 0;
    bottom: 0;
    left: 0;
  }

  /* Pin the CTA to the 54px blueprint line. Keep a grid spacer so lesson
     copy does not run under the button. Post-lesson already overlays. */
  .screen.has-footer.active:not(.post-lesson-screen) {
    grid-template-rows: minmax(0, 1fr) var(--footer-min-height);
  }

  .screen.has-footer.active:not(.post-lesson-screen) .screen-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: var(--cta-bottom);
  }

  .stage {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
  }

  .screen.active {
    height: 100%;
    min-height: 0;
  }

  html:has(#startScreen.active),
  html:has(.app-shell.is-landing),
  body:has(#startScreen.active),
  body:has(.app-shell.is-landing) {
    background: #000000;
  }

  .app-shell:has(#startScreen.active),
  .app-shell.is-landing {
    background: #000000;
  }

  /* Paint black behind the Dynamic Island — landing only. */
  .app-shell:has(#startScreen.active)::before,
  .app-shell.is-landing::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-top);
    background: #000000;
    pointer-events: none;
    z-index: 10000;
  }

  /* Lesson screens: white safe-area band under black-translucent chrome. */
  .app-shell:not(:has(#startScreen.active)):not(.is-landing)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-top);
    background: #ffffff;
    pointer-events: none;
    z-index: 10000;
  }

  .app-shell.is-sheet-open:not(:has(#startScreen.active)):not(.is-landing)::before {
    background: var(--sheet-overlay-on-white);
  }

  .status-bar {
    display: none;
  }

  /* Absolute from the shell padding edge; offset past the Dynamic Island band. */
  .overall-progress {
    top: calc(var(--safe-top) + 8px);
    z-index: 10001;
  }

  .blueprint-guide-top-150,
  .blueprint-label-top-150 {
    display: none;
  }

  .start-screen.active {
    --start-emblem-top: 24px;
  }

  .start-body {
    padding-top: var(--start-emblem-top);
  }

  .start-copy-carousel {
    margin-top: var(--start-title-gap);
  }
}

@media (max-width: 380px) {
  .character-grid {
    gap: 10px;
  }

  .character-card {
    min-height: 154px;
    padding: 20px 10px;
    font-size: 15px;
  }

  .character-card.is-selected {
    padding: 19px 9px;
  }
}

.lesson-screen.has-footer.active,
.story-screen.has-footer.active {
  display: grid;
}

.lesson-body,
.myth-body,
.story-body,
.quiz-body {
  padding-top: var(--content-top);
}

.lesson-copy {
  position: static;
  width: 100%;
  max-width: var(--content-max);
}

.lesson-copy .prompt {
  margin-top: 16px;
}

.lesson-copy ul.facts {
  margin-top: 12px;
  padding-left: 18px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}

.guess-field {
  width: 100%;
  max-width: 356px;
  margin-top: 32px;
}

.guess-input {
  position: static;
  display: block;
  width: 100%;
  height: 162px;
  margin: 0;
  padding: 16px;
  border: 1.5px solid #222222;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  resize: none;
  outline: none;
}

.guess-input.is-invalid {
  border-color: #e23c3c;
}

.guess-input::placeholder {
  color: #bcbcbc;
}

.guess-quality-hint {
  margin-top: 8px;
  color: #e23c3c;
}

.compound-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#compoundScreen .compound-body {
  padding-top: var(--content-top-compound);
  padding-bottom: calc(var(--cta-height) + var(--cta-bottom) + 20px);
}

.compound-widget {
  position: static;
  overflow: visible;
  flex: 0 0 auto;
  width: 100%;
  --compound-row-height: 20px;
  --compound-row-gap: 16px;
  --compound-table-height: calc(7 * var(--compound-row-height) + 6 * var(--compound-row-gap));
}

.compound-btn {
  width: 100%;
  height: 40px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: #efefef;
  color: #222222;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease;
}

.compound-btn:active,
.compound-btn.is-pressed {
  background: #e2e2e2;
}

@media (hover: hover) and (pointer: fine) {
  .compound-btn:hover,
  .compound-btn.is-hovered {
    background: #e2e2e2;
  }
}

.table-chip {
  height: 32px;
  padding: 0 8px 0 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.table-chip.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.table-chip-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: block;
}

.compound-story {
  position: static;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: var(--content-max);
  margin: 32px auto 0;
}

.compound-story .tag {
  /* Width hug comes from .tag; keep flex placement explicit here. */
  flex: 0 0 auto;
  align-self: flex-start;
}

.compound-copy-slot {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.compound-copy-slot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: linear-gradient(to bottom, var(--surface) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 1;
}

.compound-story .story-copy {
  height: 100%;
  margin-top: 0;
  padding-top: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.compound-story .story-copy::-webkit-scrollbar {
  display: none;
}

.compound-story .story-copy p,
.compound-story .story-copy ul {
  margin: 0;
}

.compound-story .story-copy p + p,
.compound-story .story-copy ul,
.compound-story .story-copy ul + p {
  margin-top: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  /* Invariant: tags hug their label. Never stretch to the content column,
     a flex parent, or any width: 100% / max-width column rule. */
  width: max-content;
  max-width: max-content;
  flex: 0 0 auto;
  align-self: flex-start;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.tag-row {
  display: flex;
  gap: 8px;
  margin: 16px 0 12px;
}

.tag-sim {
  background: #c6e6c5;
  color: #367934;
}

.tag-psych {
  background: #fabbd6;
  color: #8f0a43;
}

.tag-myth {
  background: #abbdde;
  color: #142552;
}

.tag-story {
  background: #decfe6;
  color: #81509a;
}

.story-copy {
  color: var(--text);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
}

.story-copy p + p,
.story-copy ul,
.story-copy ul + p {
  margin-top: 16px;
}

.story-copy a,
.story-copy .sheet-link {
  color: inherit;
}

.sheet-link {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.bottom-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s linear 0s;
}

.bottom-sheet.hidden {
  visibility: hidden;
  pointer-events: none;
}

.bottom-sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--sheet-overlay);
  opacity: 0;
  transition: opacity 250ms cubic-bezier(0.32, 0, 0, 1);
}

.bottom-sheet .bottom-sheet-overlay {
  opacity: 1;
}

.bottom-sheet.hidden .bottom-sheet-overlay {
  opacity: 0;
}

.bottom-sheet-content {
  position: relative;
  max-height: calc(100% - 24px);
  overflow: visible;
  padding: 24px var(--inset-x) calc(var(--cta-bottom) + var(--safe-bottom));
  background: var(--surface);
  color: var(--text);
  border-radius: 0;
  transform: translateY(100%);
  transition: transform 250ms cubic-bezier(0.32, 0, 0, 1);
}

.bottom-sheet .bottom-sheet-content {
  transform: translateY(0);
}

.bottom-sheet.hidden .bottom-sheet-content {
  transform: translateY(100%);
}

.bottom-sheet:not(.hidden) .bottom-sheet-content {
  animation: slide-up 250ms cubic-bezier(0.32, 0, 0, 1) forwards;
}

.bottom-sheet.closing .bottom-sheet-overlay {
  opacity: 0;
}

.bottom-sheet.closing .bottom-sheet-content {
  animation: slide-down 250ms cubic-bezier(0.32, 0, 0, 1) forwards;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.bottom-sheet-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  line-height: var(--title-text-line-height);
  font-family: var(--font-body);
}

.bottom-sheet-body {
  color: var(--text);
  font-size: var(--title-text-size);
  font-weight: var(--title-text-weight);
  line-height: var(--title-text-line-height);
  font-family: var(--font-body);
}

.bottom-sheet-body p {
  margin: 0 0 16px;
}

.bottom-sheet-body p:last-child {
  margin-bottom: 0;
}

.dismiss-btn {
  width: 100%;
  min-height: var(--cta-height);
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1.5px solid #111111;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.dismiss-btn:focus-visible,
.dismiss-btn:active {
  opacity: 0.75;
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .dismiss-btn:hover {
    opacity: 0.75;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(100%);
  }
}

.story-copy ul {
  padding-left: 18px;
}

.year-labels-svg {
  font-family: var(--font-body);
}

.voo-body .chart-wrap {
  margin-top: var(--chart-label-gap);
}

.voo-body .scrub-hint {
  margin-top: var(--chart-body-gap);
}

#vooScreen.is-scrubbing #vooCopy,
#vooScreen.is-scrubbing #vooScrubHint {
  opacity: 0;
  pointer-events: none;
}

.story-screen .story-copy,
.myth-copy {
  position: static;
  width: 100%;
  max-width: var(--content-max);
  margin-top: 24px;
}

#vooCopy {
  position: static;
  width: 100%;
  max-width: var(--content-max);
  margin-top: var(--chart-body-gap);
}

#mythScreen .yt-list {
  position: relative;
  width: 100%;
  max-width: var(--content-max);
  height: 186px;
  margin-left: auto;
  margin-right: auto;
}

#mythScreen .yt-card {
  position: absolute;
  left: 50%;
  top: 45px;
  width: 168px;
  margin: 0 0 0 -84px;
  border: 2px solid #ffffff;
  border-radius: 8px;
  overflow: hidden;
  background: #111111;
  box-shadow:
    0 14px 28px rgba(17, 17, 17, 0.22),
    0 2px 6px rgba(17, 17, 17, 0.12);
  transform: translate(0, 0) rotate(0deg);
  transition: transform 750ms cubic-bezier(0.32, 0, 0, 1);
}

#mythScreen .yt-list.is-instant .yt-card {
  transition: none;
}

#mythScreen .yt-card--left {
  z-index: 1;
}

#mythScreen .yt-card--right {
  z-index: 2;
}

#mythScreen .yt-card--front {
  z-index: 3;
}

#mythScreen .yt-list.is-scattered .yt-card--left {
  transform: translate(-71px, -39px) rotate(-4deg);
}

#mythScreen .yt-list.is-scattered .yt-card--right {
  transform: translate(71px, -19px) rotate(4deg);
}

#mythScreen .yt-list.is-scattered .yt-card--front {
  transform: translate(0, 42px) rotate(0deg);
}

#mythScreen .yt-thumb {
  display: block;
  width: 168px;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
}

#mythScreen:not(.is-copy-ready) .tag-row,
#mythScreen:not(.is-copy-ready) .myth-copy {
  display: none;
}

#mythScreen .tag-row {
  margin-top: 32px;
  margin-bottom: 0;
}

#mythScreen .tag-myth {
  position: static;
  display: inline-flex;
}

#mythScreen .myth-copy {
  margin-top: 16px;
}

#storyScreen .photo-frame {
  width: 240px;
  max-width: 240px;
  height: auto;
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  overflow: hidden;
}

.photo-frame[hidden] {
  display: none;
}

.story-photo {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

#storyScreen .tag-row,
#storyScreen .story-copy,
#storyScreen #tapRevealBtn {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

#storyScreen .tag-row {
  margin-top: 0;
  margin-bottom: 0;
}

#storyScreen .tag-row:empty {
  display: none;
}

#storyScreen .story-copy {
  margin-top: 0;
}

/* 32px only under a visible photo; 16px only under tags. Copy alone sits on --content-top. */
#storyScreen .photo-frame:not([hidden]) + .tag-row {
  margin-top: 32px;
}

#storyScreen .photo-frame:not([hidden]) + .tag-row[hidden] + .story-copy,
#storyScreen .photo-frame:not([hidden]) + .tag-row:empty + .story-copy {
  margin-top: 32px;
}

#storyScreen .tag-row:not([hidden]):not(:empty) + .story-copy {
  margin-top: 16px;
}

#storyScreen .story-copy:not([hidden]) + .story-copy,
#storyScreen #tapRevealBtn + .story-copy {
  margin-top: 16px;
}

#storyScreen #tapRevealBtn {
  margin-top: 16px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    background 0.12s ease,
    opacity 180ms cubic-bezier(0.32, 0, 0, 1),
    transform 180ms cubic-bezier(0.32, 0, 0, 1);
}

#storyScreen #tapRevealBtn.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.loss {
  color: #c1121f;
  font-weight: 700;
}

.option-stack {
  position: static;
  width: 100%;
  max-width: 356px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: visible;
}

.option-stack > div {
  width: 100%;
  overflow: visible;
}

.option-card {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  cursor: pointer;
  width: 100%;
  min-height: 65px;
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #ffffff;
  background-image: none;
  color: #222222;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}

.option-card:focus,
.option-card:focus-visible {
  outline: none;
}

.option-card.is-center {
  justify-content: center;
  text-align: center;
}

.option-card.is-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dollar-meter {
  letter-spacing: 2px;
  color: #d0d0d0;
  font-weight: 700;
}

.dollar-meter .on {
  color: #222222;
}

.option-card.is-selected {
  border: 2px solid #222222;
  padding: 15px 23px;
}

.option-card.is-wrong {
  border: 2px solid #c1121f;
  background: #fff5f5;
  color: #c1121f;
}

.option-card.is-right {
  border: 2px solid #2e7d32;
  background: #f1f8f1;
  color: #2e7d32;
}

@keyframes option-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.option-card.is-shaking {
  animation: option-shake 200ms cubic-bezier(0.32, 0, 0, 1);
}

@keyframes option-pop {
  0% {
    transform: scale(1);
    animation-timing-function: cubic-bezier(0.1, 0.85, 0.05, 1);
  }
  68.627% {
    transform: scale(1.1);
    animation-timing-function: linear;
  }
  78.431% {
    transform: scale(1.1);
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.15);
  }
  100% {
    transform: scale(1);
  }
}

.option-card.is-popping {
  position: relative;
  z-index: 2;
  transform-origin: center center;
  animation: option-pop 510ms linear both;
}

.option-feedback-slot {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 330ms cubic-bezier(0.32, 0, 0, 1);
}

.option-feedback-slot.is-open {
  grid-template-rows: 1fr;
}

.option-feedback {
  margin-top: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
  min-height: 0;
  overflow: hidden;
}

.option-feedback-slot > .option-feedback {
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 330ms cubic-bezier(0.32, 0, 0, 1) 40ms,
    transform 330ms cubic-bezier(0.32, 0, 0, 1) 40ms,
    margin-top 330ms cubic-bezier(0.32, 0, 0, 1);
}

.option-feedback-slot.is-open > .option-feedback {
  margin-top: 6px;
  opacity: 1;
  transform: translateY(0);
}

.option-card.is-wrong + .option-feedback,
.option-feedback.is-wrong {
  color: #c1121f;
}

.option-feedback.is-right {
  color: #2e7d32;
}

#quizBtn.is-entering {
  animation: quiz-cta-in 330ms cubic-bezier(0.32, 0, 0, 1) both;
}

@keyframes quiz-cta-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .option-card.is-shaking,
  .option-card.is-popping {
    animation: none;
  }

  .option-feedback-slot,
  .option-feedback-slot > .option-feedback {
    transition-duration: 1ms;
    transition-delay: 0ms;
  }

  #quizBtn.is-entering {
    animation-duration: 1ms;
  }
}

.option-card.is-amount .custom-amount {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  text-align: right;
  outline: none;
  cursor: text;
}

.cta-mid {
  /* footer alignment handled by .screen-footer.is-center */
}

.screen-footer.is-center .cta,
.screen-footer:has(.cta-mid) {
  justify-content: center;
}

.screen-footer:has(.cta-end) {
  justify-content: flex-end;
}

/* Post-lesson completion flow */
.post-lesson-screen {
  --post-stage-ms: 800ms;
  --post-ticket-ms: 1200ms;
  --post-cta-ms: 330ms;
  --post-ease: cubic-bezier(0.32, 0, 0, 1);
  /* Content centers in the band between these insets. */
  --post-band-top: 50px;
  --post-band-bottom: calc(var(--cta-bottom) + var(--cta-height) + 20px);
  /* Readiness title end position: 100 in the phone frame, 50 fullscreen. */
  --readiness-title-top: 100px;
}

@media (max-width: 440px), (max-height: 956px) {
  .post-lesson-screen {
    --readiness-title-top: 50px;
  }
}

.post-lesson-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  padding: 0;
  overflow: hidden;
}

.post-phase {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 var(--inset-x);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--post-stage-ms) var(--post-ease),
    visibility 0s linear var(--post-stage-ms);
}

.post-lesson-screen[data-stage="1"] .post-phase-knowledge,
.post-lesson-screen[data-stage="2"] .post-phase-knowledge,
.post-lesson-screen[data-stage="3"] .post-phase-knowledge {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.post-lesson-screen[data-stage="4"] .post-phase-readiness,
.post-lesson-screen[data-stage="5"] .post-phase-readiness,
.post-lesson-screen[data-stage="6"] .post-phase-readiness,
.post-lesson-screen[data-stage="7"] .post-phase-readiness {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.post-lesson-screen[data-stage="8"] .post-phase-tomorrow,
.post-lesson-screen[data-stage="9"] .post-phase-tomorrow,
.post-lesson-screen[data-stage="10"] .post-phase-tomorrow {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.post-phase-knowledge {
  padding: var(--post-band-top) var(--inset-x) var(--post-band-bottom);
  align-items: center;
  justify-content: center;
}

.post-knowledge-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
  width: 100%;
  transition: transform var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="1"] .post-knowledge-group {
  transform: translateY(calc(50% - 18px));
}

.post-lesson-screen[data-stage="2"] .post-knowledge-group,
.post-lesson-screen[data-stage="3"] .post-knowledge-group {
  transform: translateY(0);
}

.post-knowledge-count {
  position: static;
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.post-knowledge-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition:
    opacity var(--post-stage-ms) var(--post-ease),
    transform var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="2"] .post-knowledge-reveal,
.post-lesson-screen[data-stage="3"] .post-knowledge-reveal {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.post-knowledge-cards {
  position: relative;
  align-self: center;
  flex: 0 0 250px;
  width: 240px;
  height: 250px;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.post-knowledge-cards:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 4px;
  border-radius: 16px;
}

.knowledge-card {
  --knowledge-card-ms: 250ms;
  --knowledge-card-text-ms: 70ms;
  position: absolute;
  left: 0;
  top: 10px;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  border-style: solid;
  border-color: #d9d9d9;
  border-width: 1px;
  border-radius: 16px;
  background: #ffffff;
  text-align: center;
  box-sizing: border-box;
  transform-origin: center center;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  transition:
    opacity var(--knowledge-card-ms) var(--post-ease),
    transform var(--knowledge-card-ms) var(--post-ease),
    background-color var(--knowledge-card-ms) var(--post-ease),
    border-width var(--knowledge-card-ms) var(--post-ease);
}

.knowledge-card.is-next {
  z-index: 0;
  background: #f3f3f3;
  /* Counter-scale stroke so a 1px border stays 1px visually. */
  border-width: calc(1px * 240 / 220);
  transform: scale(calc(220 / 240));
}

.knowledge-card.is-back {
  z-index: 1;
  background: #f3f3f3;
  border-width: calc(1px * 240 / 220);
  /* -20px: centered scale insets 10px, then lift to peek 10px above front. */
  transform: translateY(-20px) scale(calc(220 / 240));
}

.knowledge-card.is-front {
  z-index: 2;
  background: #ffffff;
  border-width: 1px;
  transform: none;
}

.knowledge-card.is-leaving {
  opacity: 0;
  transform: translateY(10px);
  z-index: 3;
  /* Chrome fades after the title is gone, so texts never stack semi-opaque. */
  transition:
    transform var(--knowledge-card-ms) var(--post-ease),
    opacity calc(var(--knowledge-card-ms) - var(--knowledge-card-text-ms)) var(--post-ease) var(--knowledge-card-text-ms),
    background-color var(--knowledge-card-ms) var(--post-ease),
    border-width var(--knowledge-card-ms) var(--post-ease);
}

.knowledge-card.is-leaving h2 {
  opacity: 0;
}

.knowledge-card.is-promoting {
  z-index: 2;
  background: #ffffff;
  border-width: 1px;
  transform: none;
}

.knowledge-card.is-entering {
  z-index: 1;
  background: #f3f3f3;
  border-width: calc(1px * 240 / 220);
  transform: translateY(-20px) scale(calc(220 / 240));
}

.knowledge-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  color: #000000;
  transition: opacity var(--knowledge-card-text-ms) var(--post-ease);
}

.post-knowledge-cards.is-settling .knowledge-card,
.post-knowledge-cards.is-settling .knowledge-card h2 {
  transition: none;
}

.post-knowledge-caption {
  margin: 0 auto;
  width: 100%;
  max-width: var(--content-max);
  min-height: calc(18px * 1.35 * 2);
  align-self: center;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.35;
  color: #777777;
  text-align: center;
}

.post-phase-readiness {
  padding: 0 var(--inset-x);
  overflow: visible;
}

.post-readiness-group {
  --readiness-sticker-bleed: 24px;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 0;
  overflow: visible;
  /* Half of the 32px / 1.1 title so the title sits on the vertical center. */
  transform: translateY(-18px);
  transition:
    top var(--post-stage-ms) var(--post-ease),
    transform var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="5"] .post-readiness-group,
.post-lesson-screen[data-stage="6"] .post-readiness-group,
.post-lesson-screen[data-stage="7"] .post-readiness-group {
  top: var(--readiness-title-top);
  transform: none;
}

.post-readiness-title {
  margin: 0;
  flex: 0 0 auto;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.readiness-list {
  list-style: none;
  margin: 0 calc(var(--readiness-sticker-bleed) * -1);
  padding: 0 var(--readiness-sticker-bleed) 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="5"] .readiness-list,
.post-lesson-screen[data-stage="6"] .readiness-list,
.post-lesson-screen[data-stage="7"] .readiness-list {
  opacity: 1;
  pointer-events: auto;
}

.readiness-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 96px;
  gap: 16px;
  padding: 16px 0;
  font-size: 18px;
  line-height: 1.25;
  overflow: visible;
  position: relative;
}

.readiness-icon {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 1px solid #d9d9d9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  background: transparent;
  transition:
    border-color var(--post-stage-ms) var(--post-ease),
    transform var(--post-stage-ms) var(--post-ease);
}

.readiness-item.is-filled .readiness-icon {
  background: transparent;
  transform: none;
}

.readiness-item.is-filled {
  z-index: 6;
}

.readiness-icon.has-sticker {
  padding: 0;
  overflow: visible;
  position: relative;
  z-index: 8;
}

.readiness-icon.has-sticker img {
  --sticker-stamp-ms: 280ms;
  position: relative;
  z-index: 9;
  width: 80px;
  height: 80px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.readiness-icon.is-stamping img {
  animation: readiness-stamp var(--sticker-stamp-ms) cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes readiness-stamp {
  0% {
    opacity: 0;
    transform: translate(var(--sticker-x, 0px), calc(var(--sticker-y, 0px) - 4px))
      rotate(var(--sticker-r, 0deg)) scale(1.1);
  }
  14% {
    opacity: 1;
    transform: translate(var(--sticker-x, 0px), calc(var(--sticker-y, 0px) - 4px))
      rotate(var(--sticker-r, 0deg)) scale(1.1);
  }
  64% {
    opacity: 1;
    transform: translate(var(--sticker-x, 0px), var(--sticker-y, 0px))
      rotate(var(--sticker-r, 0deg)) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translate(var(--sticker-x, 0px), var(--sticker-y, 0px))
      rotate(var(--sticker-r, 0deg)) scale(1);
  }
}

.readiness-label {
  flex: 1 1 auto;
  text-align: left;
}

.post-phase-tomorrow {
  padding: var(--post-band-top) var(--inset-x) var(--post-band-bottom);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.post-tomorrow-group {
  --ticket-width: min(320px, 86vw);
  --ticket-height: calc(var(--ticket-width) * 557 / 1197);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  /* Stage 8: ticket alone sits in the band center; copy is invisible below. */
  transform: translateY(calc((100% - var(--ticket-height)) / 2));
  transition: transform var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="9"] .post-tomorrow-group,
.post-lesson-screen[data-stage="10"] .post-tomorrow-group {
  /* Stage 9+: middle of ticket + title + body sits in the band center. */
  transform: translateY(0);
}

.post-ticket {
  position: relative;
  width: var(--ticket-width);
  aspect-ratio: 1197 / 557;
  height: auto;
  margin: 0;
  display: block;
  object-fit: contain;
  transform: rotate(-5deg);
  transform-origin: center center;
  opacity: 1;
  transition: transform var(--post-ticket-ms) var(--post-ease);
}

.post-lesson-screen.is-ticket-offstage .post-ticket {
  transform: translateY(110vh) rotate(5deg);
  transition: none;
}

.post-tomorrow-copy-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--post-stage-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="9"] .post-tomorrow-copy-block,
.post-lesson-screen[data-stage="10"] .post-tomorrow-copy-block {
  opacity: 1;
  pointer-events: auto;
}

.post-tomorrow-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.post-tomorrow-copy {
  margin: 0 auto;
  width: 100%;
  max-width: var(--content-max);
  font-size: 18px;
  line-height: 1.4;
  color: #666666;
  text-align: center;
}

.post-lesson-screen.has-footer.active {
  /* Footer slides up over content; body keeps full height (readiness list must not clip). */
  display: block;
  height: 100%;
}

.post-lesson-screen.has-footer.active .post-lesson-body {
  height: 100%;
  min-height: 100%;
}

.post-lesson-screen .screen-footer {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  /* Overlay the bottom — do not consume a grid row while hidden (stages 5–6). */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  grid-row: unset;
  justify-self: unset;
  width: 100%;
  max-width: none;
  min-height: calc(var(--cta-height) + var(--cta-bottom) + 20px);
  padding: 20px var(--inset-x) var(--cta-bottom);
  background: #ffffff;
  opacity: 0;
  transform: translateY(88px);
  pointer-events: none;
  transition:
    opacity var(--post-cta-ms) var(--post-ease),
    transform var(--post-cta-ms) var(--post-ease);
}

.post-lesson-screen[data-stage="7"] .screen-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: #e8e8e8;
}

.post-lesson-screen[data-stage="3"] .screen-footer,
.post-lesson-screen[data-stage="7"] .screen-footer,
.post-lesson-screen[data-stage="10"] .screen-footer {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.post-lesson-screen.is-clearing[data-stage] .post-phase,
.post-lesson-screen.is-clearing[data-stage] .screen-footer {
  opacity: 0;
  pointer-events: none;
  transition-duration: var(--post-cta-ms);
  transition-delay: 0s;
}


