/* Onboarding, as drawn in the "Onboarding flow" design: one framed card in
   the middle of the page rather than a full-screen takeover, the logo along
   its top, the question in its body and the way on along its foot. The
   sign-up step keeps the Sign In v2 card's own markup and styles (auth.css),
   only set inside this frame. */
.onboard {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  font-size: 14px;
  line-height: 1.5;
}
.onboard-card {
  width: 100%;
  max-width: 880px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--panel-frame);
  border-radius: var(--radius-surface);
  overflow: hidden;
}
.onboard-card { position: relative; }
.onboard-card[hidden] { display: none; }

/* One thin bar along the top of every card, filling as the journey goes on. */
.onboard-progress { position: absolute; inset: 0 0 auto; height: 3px; background: var(--line); }
.onboard-progress i { display: block; height: 100%; width: var(--progress-to, 0%); background: var(--ink); }
.onboard-dark .onboard-progress { background: #2a2a2a; }

/* Movement says where you came from: forward steps arrive from the right,
   going back arrives from the left. Reading text itself never moves. */
@keyframes onboard-in {
  from { opacity: 0; transform: translateX(var(--enter-from, 14px)); }
  to { opacity: 1; transform: none; }
}
@keyframes onboard-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes onboard-fill {
  from { width: var(--progress-from, 0%); }
  to { width: var(--progress-to, 0%); }
}
.onboard-card.is-back { --enter-from: -14px; }
.onboard-card.is-entering { animation: onboard-in 260ms cubic-bezier(.2, .7, .2, 1) both; }
.onboard-card.is-entering .onboard-progress i { animation: onboard-fill 520ms cubic-bezier(.2, .7, .2, 1) both; }
.onboard-card.is-entering .onboard-option {
  animation: onboard-rise 320ms cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms + 60ms);
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="off"]) .onboard-card.is-entering,
  html:not([data-reduced-motion="off"]) .onboard-card.is-entering .onboard-progress i,
  html:not([data-reduced-motion="off"]) .onboard-card.is-entering .onboard-option { animation: none; }
}
html[data-reduced-motion="on"] .onboard-card.is-entering,
html[data-reduced-motion="on"] .onboard-card.is-entering .onboard-progress i,
html[data-reduced-motion="on"] .onboard-card.is-entering .onboard-option { animation: none; }

.onboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 40px 0;
}
.onboard-logo { width: 96px; height: auto; display: block; }
.onboard-skip {
  padding: 4px 6px;
  font-size: 13px;
  font-weight: bold;
  color: var(--ink-dim);
  border-radius: var(--radius-control);
}
.onboard-skip:hover { color: var(--ink); background: var(--surface-alt); }

.onboard-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 36px 40px 0;
}
.onboard-head h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
.onboard-head p { margin: 0; font-size: 15px; color: var(--ink-dim); text-wrap: pretty; }
.onboard-note { margin: 0; color: var(--ink-dim); }
.onboard-dim { font-size: 13px; color: var(--ink-dim); }

.onboard-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 28px 40px 32px;
}
.onboard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.onboard-foot .btn { white-space: nowrap; text-decoration: none; }
.onboard-foot .btn .material-symbol { font-size: 18px; line-height: 1; }
.onboard-next { padding-inline: 26px; }

/* Cards with a live preview beside the question: the preview answers, in the
   product's own terms, whatever was just picked. It stacks under the question
   on a narrow screen. */
.onboard-card.has-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto 1fr auto;
}
.onboard-card.has-preview[hidden] { display: none; }
.has-preview .onboard-top { grid-column: 1; grid-row: 1; }
.has-preview .onboard-body { grid-column: 1; grid-row: 2; }
.has-preview .onboard-foot { grid-column: 1; grid-row: 3; }
.onboard-preview {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 40px 28px;
  background: var(--sunken);
  border-left: 1px solid var(--line-strong);
}
.demo-label { margin: 0; font-size: 12px; font-weight: bold; color: var(--ink-dim); }
.demo-caption { margin: 0; font-size: 13px; color: var(--ink-dim); text-wrap: pretty; min-height: 3.9em; }
/* A frame from a video: its colours are the scene's own, in either palette. */
.demo-screen {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px 12px 18px;
  text-align: center;
  background: #131313;
  border: 1px solid #383838;
  border-radius: var(--radius-surface);
}
.demo-de, .demo-en { padding: 2px 8px; background: rgba(0, 0, 0, .85); border-radius: var(--radius-control); }
.demo-de { font-size: 19px; font-weight: 500; line-height: 1.5; color: #ffffff; text-wrap: balance; }
.demo-en { font-size: 13px; color: #d8d6d0; text-wrap: balance; }
.demo-de span { padding: 0 2px; border-radius: var(--radius-control); transition: background-color 220ms, color 220ms; }
.demo-de .is-marked { color: #0a0a0a; background: #ffe680; }
@keyframes demo-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.demo-screen.is-changed .demo-de, .demo-screen.is-changed .demo-en { animation: demo-swap 260ms ease-out both; }

.demo-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--ink-faint);
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-surface);
  transition: color 200ms, background-color 200ms, border-color 200ms;
}
.demo-tile .material-symbol { font-size: 22px; line-height: 1; }
.demo-tile.is-on { color: var(--ink); background: var(--surface); border: 1px solid var(--control-line-over); }
.demo-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="off"]) .demo-screen.is-changed .demo-de,
  html:not([data-reduced-motion="off"]) .demo-screen.is-changed .demo-en { animation: none; }
}
html[data-reduced-motion="on"] .demo-screen.is-changed .demo-de,
html[data-reduced-motion="on"] .demo-screen.is-changed .demo-en { animation: none; }

/* A pickable row. Chosen is the pale square the rest of the site uses for
   "on", never a blue fill; the mark itself says which kind of choice it is. */
.onboard-options { display: flex; flex-direction: column; gap: 4px; }
.onboard-option {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}
.onboard-option:hover { border-color: var(--control-line-over); }
.onboard-option[aria-checked="true"] { background: var(--surface-alt); border-color: var(--control-line-over); }
#onboard-levels .onboard-option { grid-template-columns: 20px 34px 150px minmax(0, 1fr); }
#onboard-levels b { font-size: 15px; }
#onboard-sentences .onboard-option { grid-template-columns: 20px minmax(0, 1fr); padding-block: 11px; }
.onboard-de { font-size: 15px; text-wrap: pretty; }
#onboard-uses .onboard-option { grid-template-columns: 20px 24px 170px minmax(0, 1fr); }
.onboard-mark, .onboard-glyph { display: inline-flex; font-size: 20px; line-height: 1; }
.onboard-mark { color: var(--ink-faint); }
.onboard-option[aria-checked="true"] .onboard-mark { color: var(--ink); }
.onboard-glyph { color: var(--ink-dim); }

/* The sign-up step is the Sign In v2 card as auth.css draws it on /login;
   only its page-filling height and padding give way to this page's own. */
.auth-page.is-clerk .onboard-signin.auth-main { min-height: 0; padding: 0; }
.onboard-signin[hidden],
.auth-page.is-clerk .onboard-signin.auth-main[hidden] { display: none; }

/* The extension step is always dark: it shows a scene from a series, and
   Lenton's subtitles over it look as they will on Disney+ or Max. The
   colours are the scene's own, so they stay put in either palette. */
.onboard-dark {
  color: #f2f2f2;
  background: #0c0c0c;
  border-color: #4a4a4a;
  --ink: #f2f2f2;
  --ink-dim: #b5b5b5;
  --surface: #101010;
  --surface-alt: #1d1d1d;
  --control-line: #5a5a5a;
  --control-line-over: #7d7d7d;
}
.onboard-dark .onboard-head h1 { font-size: 24px; }
.onboard-scene {
  --loop: 9s;
  position: relative;
  flex: 1;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 16px 30px;
  background: #131313;
  border: 1px solid #383838;
  border-radius: var(--radius-surface);
}
.onboard-scene span { text-align: center; }
.onboard-scene-de, .onboard-scene-en {
  padding: 2px 10px;
  background: rgba(0, 0, 0, .85);
  border-radius: var(--radius-control);
}
.onboard-scene-de { font-size: 24px; font-weight: 500; color: #ffffff; }
.onboard-scene-de mark {
  position: relative;
  padding: 0 3px;
  color: #0a0a0a;
  background: #ffe680;
  border-radius: var(--radius-control);
}
.onboard-scene-en { font-size: 15px; color: #d8d6d0; }
.scene-source { position: absolute; top: 12px; left: 14px; font-size: 12px; color: #6f6f6f; }

/* The two counters in the corner: what you have saved, and that it is headed
   for Anki. */
.scene-stats { position: absolute; top: 10px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 12px;
  color: #d8d6d0;
  background: #1d1d1d;
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-control);
}
.scene-chip .material-symbol { font-size: 15px; line-height: 1; }
.scene-count { position: relative; display: inline-grid; font-weight: bold; color: #fff; }
.scene-count i { grid-area: 1 / 1; font-style: normal; }
.scene-count .was { opacity: 0; }

/* The word's popup, hung from the word itself so it stays with it. */
.scene-pop {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  width: 176px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  font-size: 13px;
  text-align: left !important;
  color: #f2f2f2;
  background: #1d1d1d;
  border: 1px solid #5a5a5a;
  border-radius: var(--radius-surface);
}
.scene-pop b { font-size: 15px; }
.scene-gloss { color: #b5b5b5; text-align: left !important; }
.scene-save {
  margin-top: 8px;
  display: inline-grid;
  justify-items: center;
  align-self: flex-start;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: bold;
  color: #0a0a0a;
  background: #f2f2f2;
  border-radius: var(--radius-control);
}
.scene-save > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 4px; }
.scene-save .material-symbol { font-size: 14px; line-height: 1; }
.scene-save .was { opacity: 0; }

.scene-cursor {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-flex;
  font-size: 24px;
  line-height: 1;
  color: #fff;
  opacity: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .7));
  pointer-events: none;
}
.scene-bar { position: absolute; inset: auto 0 0; height: 3px; background: #2a2a2a; }
.scene-bar i { display: block; width: 38%; height: 100%; background: #f2f2f2; }

@keyframes scene-cursor {
  0%, 6% { opacity: 0; transform: translate(130px, 100px); }
  14% { opacity: 1; transform: translate(130px, 100px); }
  28%, 44% { opacity: 1; transform: translate(0, 8px); }
  54% { opacity: 1; transform: translate(62px, -44px) scale(1); }
  57% { transform: translate(62px, -44px) scale(.8); }
  60%, 80% { opacity: 1; transform: translate(62px, -44px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(62px, -44px); }
}
@keyframes scene-word {
  0%, 24% { background-color: transparent; }
  28%, 90% { background-color: #ffe680; }
  96%, 100% { background-color: transparent; }
}
@keyframes scene-pop {
  0%, 26% { opacity: 0; transform: translate(-50%, 8px); }
  32%, 88% { opacity: 1; transform: translate(-50%, 0); }
  94%, 100% { opacity: 0; transform: translate(-50%, 4px); }
}
@keyframes scene-idle {
  0%, 56% { opacity: 1; }
  58%, 100% { opacity: 0; }
}
@keyframes scene-done {
  0%, 56% { opacity: 0; }
  58%, 94% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes scene-press {
  0%, 54% { background: #f2f2f2; }
  57% { background: #b5b5b5; }
  60%, 100% { background: #f2f2f2; }
}
@keyframes scene-old-count {
  0%, 59% { opacity: 1; transform: none; }
  63%, 100% { opacity: 0; transform: translateY(-8px); }
}
@keyframes scene-new-count {
  0%, 59% { opacity: 0; transform: translateY(8px); }
  63%, 94% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes scene-bump {
  0%, 59% { transform: none; }
  64% { transform: scale(1.08); }
  70%, 100% { transform: none; }
}
@keyframes scene-anki {
  0%, 66% { opacity: 0; transform: translateY(-6px); }
  72%, 90% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; transform: translateY(-6px); }
}
@keyframes scene-scrub { from { width: 18%; } to { width: 64%; } }

.onboard-scene-de mark { animation: scene-word var(--loop) infinite; }
.scene-pop { animation: scene-pop var(--loop) infinite; }
.scene-cursor { animation: scene-cursor var(--loop) infinite; }
.scene-save { animation: scene-press var(--loop) infinite; }
.scene-save .was { animation: scene-idle var(--loop) infinite; }
.scene-save .now { animation: scene-done var(--loop) infinite; }
.scene-count .was { animation: scene-old-count var(--loop) infinite; }
.scene-count .now { animation: scene-new-count var(--loop) infinite; }
.scene-stats .scene-chip:first-child { animation: scene-bump var(--loop) infinite; }
.scene-anki { animation: scene-anki var(--loop) infinite; }
.scene-bar i { animation: scene-scrub calc(var(--loop) * 4) linear infinite alternate; }

/* Reduced motion rests on the last frame: the word saved, counted, and on
   its way to Anki. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="off"]) .onboard-scene *,
  html:not([data-reduced-motion="off"]) .onboard-scene-de mark { animation: none; }
}
html[data-reduced-motion="on"] .onboard-scene *,
html[data-reduced-motion="on"] .onboard-scene-de mark { animation: none; }
.scene-save .now, .scene-count .now { opacity: 1; }

/* Ready: something at the learner's level to start with. */
.onboard-faint { font-size: 12px; color: var(--ink-faint); }
.onboard-video {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-surface);
  overflow: hidden;
}
.onboard-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  background: repeating-linear-gradient(135deg, #1e1e1d 0 10px, #252524 10px 20px);
}
.onboard-video-text { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.onboard-video-text b, .onboard-start-text b { font-size: 15px; }
.onboard-badge {
  width: max-content;
  margin-top: auto;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: bold;
  color: var(--act-save);
  border: 1px solid var(--act-save);
  border-radius: var(--radius-control);
}
.onboard-start {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-surface);
}
.onboard-video:hover, .onboard-start:hover { border-color: var(--control-line-over); }
.onboard-start-text { display: flex; flex-direction: column; }
.onboard-tip { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-dim); }
.onboard-tip .material-symbol { font-size: 18px; }

@media (max-width: 880px) {
  .onboard-card.has-preview { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .has-preview .onboard-top, .has-preview .onboard-body, .has-preview .onboard-foot,
  .onboard-preview { grid-column: 1; grid-row: auto; }
  .onboard-preview { order: 2; padding: 24px 20px; border-left: 0; border-top: 1px solid var(--line-strong); }
  .has-preview .onboard-foot { order: 3; }
  .demo-screen { min-height: 150px; }
}
@media (max-width: 640px) {
  .onboard { padding: 16px; align-items: flex-start; }
  .onboard-card { min-height: 0; }
  .onboard-top { padding: 18px 20px 0; }
  .onboard-body { padding: 24px 20px 0; }
  .onboard-foot { padding: 24px 20px 20px; flex-wrap: wrap; }
  .onboard-head h1 { font-size: 22px; }
  /* The level and use rows drop their description under the name. */
  #onboard-levels .onboard-option { grid-template-columns: 20px 34px minmax(0, 1fr); }
  #onboard-uses .onboard-option { grid-template-columns: 20px 24px minmax(0, 1fr); }
  #onboard-levels .onboard-dim, #onboard-uses .onboard-dim { grid-column: 3; margin-top: -10px; }
  .onboard-scene { min-height: 250px; }
  .onboard-video { grid-template-columns: 120px minmax(0, 1fr); }
}

/* Under the sign-up card: the answers given so far. */
.onboard-recap { margin: 14px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.onboard-recap[hidden] { display: none; }
.onboard-chip {
  padding: 2px 9px;
  font-size: 12px;
  font-weight: bold;
  color: var(--ink-dim);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}
