/* ============================================================================
   Anatomy learning app â€” design system
   Warm paper, ink typography, one accent colour that also drives the 3D stage.
   ========================================================================== */

:root {
  --paper: #f5f2ee;
  --paper-raise: #fbf9f7;
  --surface: #ffffff;

  --ink: #16130f;
  --ink-2: #4c463f;
  --ink-3: #8b837a;
  --ink-4: #c2b9ae;

  --line: rgba(22, 19, 15, 0.14);
  --line-soft: rgba(22, 19, 15, 0.075);

  --accent: #d7263d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(215, 38, 61, 0.12);
  --accent-line: rgba(215, 38, 61, 0.34);

  --danger: #b8332b;

  --radius: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(22, 19, 15, 0.05);
  --shadow: 0 1px 2px rgba(22, 19, 15, 0.04), 0 18px 40px -28px rgba(22, 19, 15, 0.35);
  --shadow-lift: 0 1px 2px rgba(22, 19, 15, 0.05), 0 28px 60px -32px rgba(22, 19, 15, 0.42);

  --font-sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --pad-x: clamp(20px, 4vw, 48px);
  --maxw: 1240px;
}

/* --- reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, 0.9), rgba(245, 242, 238, 0) 60%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

img,
canvas,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- primitives ---------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow__mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: color 0.2s var(--ease);
}

.link:hover {
  color: var(--accent);
}

.button {
  --button-bg: var(--ink);
  --button-fg: var(--paper-raise);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
  box-shadow: var(--shadow-sm);
}

.button:hover {
  background-color: #000;
  box-shadow: var(--shadow);
}

.button:active {
  transform: translateY(1px);
}

.button__icon {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}

.button:hover .button__icon {
  transform: translateX(3px);
}

.button--ghost {
  --button-bg: transparent;
  --button-fg: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.button--ghost:hover {
  background-color: rgba(22, 19, 15, 0.04);
}

.button--danger {
  --button-bg: var(--accent);
  --button-fg: var(--accent-ink);
}

.button--danger:hover {
  background-color: #bf1f34;
}

.iconbutton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.iconbutton svg {
  width: 19px;
  height: 19px;
}

.iconbutton:hover {
  background: rgba(22, 19, 15, 0.05);
  color: var(--ink);
}

.icon-sound-off {
  display: none;
}

.iconbutton.is-muted .icon-sound-on {
  display: none;
}

.iconbutton.is-muted .icon-sound-off {
  display: block;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 10px 0;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden,
.input-proxy {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================================
   Play screen
   ========================================================================== */

.play {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.playbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 340px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  padding: 12px clamp(14px, 2vw, 26px);
}

.playbar__group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.playbar__group--end {
  justify-content: flex-end;
  gap: 16px;
}

.playbar__identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.playbar__identity .eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
}

.playbar__title {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgba(22, 19, 15, 0.09);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.5s var(--ease);
}

.steps {
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(22, 19, 15, 0.16);
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.steps__dot.is-done {
  background: rgba(22, 19, 15, 0.38);
}

.steps__dot.is-active {
  background: var(--accent);
  transform: scale(1.35);
}

/* --- stage --------------------------------------------------------------- */

.stage {
  position: relative;
  min-height: 220px;
  isolation: isolate;
  touch-action: pan-y;
}

.stage__views {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 44%) minmax(0, 1fr);
  align-items: stretch;
  padding: 0 clamp(8px, 3vw, 46px);
  pointer-events: none;
}

.view {
  position: relative;
  min-width: 0;
}

.view__label {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
  transition: color 0.4s var(--ease);
}

.view__label--main {
  font-size: 10.5px;
  color: var(--ink-3);
}

.view__label--main::before {
  display: none;
}

.stage__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.stage__canvas:active {
  cursor: grabbing;
}

.stage__overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}

.stage__overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loader__track {
  position: relative;
  width: 128px;
  height: 2px;
  border-radius: 2px;
  background: rgba(22, 19, 15, 0.1);
  overflow: hidden;
}

.loader__bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.loader__text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stage__feedback {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translate(-50%, 6px);
  z-index: 3;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
}

.stage__feedback.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stage__fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 30ch;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}

.stage.has-fallback .stage__controls {
  display: none;
}

.stage__controls {
  position: absolute;
  right: clamp(14px, 2vw, 26px);
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stage__turn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.stage__turn[hidden] {
  display: none;
}

.stage__turn svg {
  width: 15px;
  height: 15px;
}

.stage__turn:hover {
  color: var(--ink);
  border-color: var(--line);
}

.stage__turn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.92);
}

/* --- task ---------------------------------------------------------------- */

.task {
  position: relative;
  z-index: 2;
  padding: clamp(6px, 1.2vh, 16px) var(--pad-x) clamp(10px, 1.6vh, 20px);
  text-align: center;
}

.task__prompt {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.task__meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.task__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-4);
}

.word {
  display: flex;
  align-items: baseline;
  justify-content: center;
  min-height: 1.16em;
  margin: clamp(6px, 1.4vh, 14px) 0 clamp(8px, 1.4vh, 14px);
  font-size: clamp(34px, 5.4vw, 62px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.word.is-empty {
  min-height: 1.16em;
}

/* Long German terms (e.g. "zweikÃ¶pfiger oberarmmuskel") need a smaller size. */
.word.is-long {
  font-size: clamp(24px, 3.4vw, 42px);
  letter-spacing: -0.02em;
}

.word.is-xlong {
  font-size: clamp(18px, 2.5vw, 30px);
  letter-spacing: -0.012em;
}

.word__char {
  display: inline-block;
  color: var(--ink-4);
  transition: color 0.12s var(--ease);
}

.word__char.is-space {
  width: 0.34em;
}

.word__char.is-typed {
  color: var(--accent);
}

.word__char.is-wrong {
  color: var(--danger);
  text-decoration: underline;
  text-decoration-color: var(--danger);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

/* One dot per letter, in a fixed-width slot so the row reads as a letter grid. */
.word__char.is-dot {
  width: 0.62em;
  text-align: center;
  font-size: 0.46em;
  color: var(--ink-3);
  transform: translateY(-0.16em);
}

.word__char.is-dot.is-space,
.word__char.is-space.is-dot {
  width: 0.62em;
}

.word__cursor {
  display: inline-block;
  width: 2px;
  height: 0.86em;
  margin-left: 2px;
  border-radius: 1px;
  background: var(--accent);
  transform: translateY(0.04em);
  animation: caret 1.1s steps(1, end) infinite;
}

@keyframes caret {
  0%,
  45% {
    opacity: 1;
  }
  55%,
  100% {
    opacity: 0.15;
  }
}

.word.is-shake {
  animation: shake 0.36s var(--ease);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  25%,
  75% {
    transform: translateX(3px);
  }
  50% {
    transform: translateX(-4px);
  }
}

.task__hint {
  min-height: 1.5em;
  font-size: clamp(12.5px, 1.15vw, 14px);
  line-height: 1.5;
  color: var(--ink-3);
  max-width: 54ch;
  margin: 0 auto;
}

.task__caption {
  margin: -6px auto 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.task__caption::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--ink-4);
  vertical-align: 2px;
}

/* --- terminology picker -------------------------------------------------- */

.terms {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.terms__option {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.terms__option:hover {
  color: var(--ink);
}

.terms__option.is-active {
  background: var(--ink);
  color: var(--paper-raise);
}

/* --- keyboard ------------------------------------------------------------ */

.keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--pad-x) clamp(14px, 2.4vh, 26px);
  user-select: none;
}

.keyboard__row {
  display: flex;
  gap: 6px;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(30px, 3vw, 40px);
  height: clamp(32px, 4vh, 44px);
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-bottom-color: rgba(22, 19, 15, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 0 1px 0 rgba(22, 19, 15, 0.04);
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease),
    border-color 0.12s var(--ease), transform 0.12s var(--ease);
}

.key--modifier {
  min-width: clamp(44px, 5vw, 62px);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.key--space {
  min-width: clamp(160px, 24vw, 260px);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.key.is-expected {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.key.is-hit {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(1px);
}

.key.is-miss {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: shake 0.3s var(--ease);
}

/* --- level done ---------------------------------------------------------- */

.leveldone {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 24px;
  background: rgba(245, 242, 238, 0.55);
  backdrop-filter: blur(2px);
  animation: fade-in 0.3s var(--ease);
}

.leveldone[hidden] {
  display: none;
}

.leveldone__panel {
  width: min(520px, 100%);
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  animation: rise-in 0.4s var(--ease);
}

.leveldone__panel:focus {
  outline: none;
}

.leveldone__eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.leveldone__body {
  font-size: 17px;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 20px;
}

.leveldone__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.leveldone__actions .button {
  flex: 1 1 auto;
  justify-content: center;
}

.leveldone__note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
}

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- modal --------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 19, 15, 0.28);
  backdrop-filter: blur(3px);
}

.modal__panel {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  animation: rise-in 0.28s var(--ease);
}

.modal__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal__body {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 24px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.noscript {
  position: fixed;
  inset: auto 0 0 0;
  padding: 16px;
  text-align: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
}

/* ============================================================================
   Category picker
   ========================================================================== */

.picker {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) var(--pad-x) clamp(48px, 6vw, 88px);
}

.picker__head {
  max-width: 46rem;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.picker__title {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 16px 0 14px;
}

.picker__lead {
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 52ch;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.cards__heading {
  grid-column: 1 / -1;
  margin: 20px 0 -4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.cards__heading:first-child {
  margin-top: 0;
}

.card.is-locked {
  opacity: 0.62;
}

.card.is-locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.55);
}

.card__action--locked {
  color: var(--ink-3);
  cursor: default;
}

.card__action--locked:hover {
  color: var(--ink-3);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease), background-color 0.25s var(--ease);
}

.card:hover {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card.is-current {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.card.is-current::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card.is-current .card__tag {
  color: var(--accent);
}

.card__resume {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin-bottom: 6px;
}

.card__subtitle {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.card__foot {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card__action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: color 0.2s var(--ease);
}

.card__action svg {
  width: 15px;
  height: 15px;
  transition: transform 0.25s var(--ease);
}

.card__action:hover {
  color: var(--accent);
}

.card__action:hover svg {
  transform: translateX(3px);
}

.card__count {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.card__stages {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-soft);
}

.card__stage a {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.card__stage a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.leveldone__link {
  display: inline-block;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: color 0.2s var(--ease);
}

.leveldone__link:hover {
  color: var(--ink);
}

/* ============================================================================
   Document / error pages
   ========================================================================== */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  border-bottom: 1px solid var(--line-soft);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar__label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 32px);
  font-size: 14px;
  color: var(--ink-2);
}

.topbar__nav a {
  position: relative;
  padding: 4px 0;
  transition: color 0.2s var(--ease);
}

.topbar__nav a:hover {
  color: var(--ink);
}

.topbar__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}

.topbar__nav a:hover::after {
  transform: scaleX(1);
}

.document {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) var(--pad-x) clamp(56px, 8vw, 96px);
}

.document__title {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 18px 0 16px;
}

.document__intro {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 44ch;
  margin-bottom: 44px;
}

.document__section {
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--line-soft);
}

.document__section h2 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.document__section p {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 10px;
}

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

.document__note {
  font-size: 13px !important;
  color: var(--ink-3) !important;
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
}

.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px var(--pad-x) 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
}

.footer__note {
  font-size: 12.5px;
  color: var(--ink-3);
  max-width: 70ch;
}

.footer__links {
  display: flex;
  gap: 22px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.footer__links a {
  transition: color 0.2s var(--ease);
}

.footer__links a:hover {
  color: var(--ink);
}

.page--error {
  justify-content: center;
}

.error {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 40px var(--pad-x);
  text-align: center;
}

.error__code {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 18px;
}

.error__title {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin-bottom: 14px;
}

.error__body {
  color: var(--ink-2);
  margin-bottom: 32px;
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 1024px) {
  .stage__views {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 52%) minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .keyboard {
    display: none;
  }

  .playbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "identity tools"
      "progress progress";
    row-gap: 10px;
  }

  .playbar__group:first-child {
    grid-area: identity;
  }

  .playbar__group--end {
    grid-area: tools;
    gap: 10px;
  }

  .progress {
    grid-area: progress;
  }

  .stage__views {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 12px;
  }

  .view--side {
    display: none;
  }

  .word {
    font-size: clamp(30px, 8.4vw, 46px);
  }

  .leveldone {
    padding: 12px;
  }

  .leveldone__actions .button {
    flex: 1 1 100%;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  .word {
    font-size: clamp(30px, 4.2vw, 44px);
    margin: 4px 0 6px;
  }

  .task {
    padding-top: 2px;
    padding-bottom: 6px;
  }

  .key {
    height: 30px;
    min-width: 28px;
    font-size: 11px;
  }

  .key--space {
    min-width: 180px;
  }

  .keyboard {
    gap: 4px;
    padding-bottom: 10px;
  }
}

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

@media print {
  .playbar,
  .keyboard,
  .footer {
    display: none;
  }
}

/* ============================================================================
   Adaptive Learning Dashboard & Cloze / Rescue UI
   ========================================================================== */

.topbar__identity {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar__user {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
  padding: clamp(22px, 3vw, 34px);
  margin-bottom: clamp(24px, 3vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.dash-hero__stats {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

.dash-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.dash-hero__meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dash-kpi {
  padding: 12px 14px;
  background: var(--paper-raise);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.dash-kpi__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}

.dash-kpi__label {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.dash-profs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-profs__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.card__badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card__pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.card__pill--due {
  background: var(--accent-soft);
  color: var(--accent);
}

.card__pill--hard {
  background: rgba(184, 51, 43, 0.12);
  color: var(--danger);
}

.mod-progress {
  height: 5px;
  margin: 12px 0 10px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}

.mod-progress__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 320ms var(--ease);
}

.mod-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.mod-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--paper-raise);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px 9px;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.mod-cat:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

.learn-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.learn-badge--hard {
  background: rgba(184, 51, 43, 0.12);
  color: var(--danger);
  border-color: rgba(184, 51, 43, 0.25);
}

.learn-badge--requeue {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.word__char.is-cue {
  color: var(--ink-3);
}

/* ============================================================================
   Clinical Flat UI System — Restraint, Swiss Typography, Zero Clutter
   ========================================================================== */

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page > main {
  flex: 1 0 auto;
}

/* --- Buttons (.btn) ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn--primary {
  background: var(--ink);
  color: #ffffff;
}

.btn--primary:hover {
  background: #2b2620;
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn--secondary:hover {
  background: var(--paper-raise);
  border-color: rgba(22, 19, 15, 0.28);
}

.btn--danger {
  background: var(--danger);
  color: #ffffff;
}

.btn--danger:hover {
  background: #9c2922;
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 7px 13px;
  font-size: 13px;
}

/* --- Top Navigation (.appbar) -------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}

.appbar__inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.appbar__brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.appbar__nav {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.appbar__link {
  padding: 4px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease;
}

.appbar__link:hover {
  color: var(--ink);
}

.appbar__link.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.appbar__link--muted {
  color: var(--ink-3);
}

.appbar__user {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar__logout {
  margin: 0;
  display: flex;
}

.lang-switch {
  display: inline-flex;
  gap: 10px;
}

.lang-switch__item {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}

.lang-switch__item.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* --- Footer (.site-footer) ----------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line-soft);
  margin-top: 48px;
}

.site-footer__inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
}

.site-footer__credit a,
.site-footer__links a {
  color: var(--ink-2);
}

.site-footer__links {
  display: flex;
  gap: 18px;
}

.site-footer__links a:hover,
.site-footer__credit a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Dashboard (.home, .overview, .curriculum) --------------------------- */

.home {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 40px) var(--pad-x) 0;
}

.overview {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.overview__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.overview__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(24px, 3.2vw, 30px);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}

.overview__sub {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-2);
}

.overview__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.overview__metrics {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.metric {
  padding: 14px 16px 14px 0;
}

.metric + .metric {
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
}

.metric__val {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.metric__val--accent {
  color: var(--accent);
}

.metric__lbl {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.overview__progress {
  margin-top: 16px;
}

.segbar {
  position: relative;
  height: 6px;
  background: rgba(22, 19, 15, 0.09);
  border-radius: 3px;
  overflow: hidden;
}

.segbar__learned,
.segbar__solid {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  transition: width 300ms ease;
}

.segbar__learned {
  background: rgba(215, 38, 61, 0.3);
}

.segbar__solid {
  background: var(--accent);
}

.overview__bar-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.overview__pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-2);
}

/* --- Domain Underline Tabs & Flat Module List ---------------------------- */

.curriculum {
  margin-top: 32px;
}

.domain-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}

.domain-tabs::-webkit-scrollbar {
  display: none;
}

.domain-tab {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.domain-tab:hover {
  color: var(--ink);
}

.domain-tab.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.domain-tab__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.domain-group {
  margin-bottom: 28px;
}

.domain-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.domain-group__title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.domain-group__meta {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.mod-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
}

.mod-row {
  border-bottom: 1px solid var(--line-soft);
}

.mod-row__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 6px;
  transition: background 120ms ease;
}

.mod-row__link:hover {
  background: rgba(22, 19, 15, 0.035);
}

.mod-row__main {
  min-width: 0;
  flex: 1 1 auto;
}

.mod-row__title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-row__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.mod-row__sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}

.mod-row__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.mod-row__count {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  min-width: 40px;
  text-align: right;
}

.mod-row__bar {
  width: 60px;
  height: 4px;
  background: rgba(22, 19, 15, 0.09);
  border-radius: 2px;
  overflow: hidden;
}

.mod-row__bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: rgba(22, 19, 15, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

.tag--hard {
  background: rgba(184, 51, 43, 0.1);
  color: var(--danger);
}

/* --- Auth & Settings (Flat & Calm) --------------------------------------- */

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 6vw, 64px) var(--pad-x);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.step-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.auth-card__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}

.auth-card__lead {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.5;
}

.auth-form {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.field__input,
.field__select {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition: border-color 120ms ease;
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--ink);
}

.field__input--code {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.3em;
  text-align: center;
}

.field__hint {
  font-size: 12.5px;
  color: var(--ink-3);
}

.field--check {
  gap: 6px;
  cursor: pointer;
}

.field__check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.field__checkbox {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.google-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-3);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.auth-card__aux {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-link {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.45;
}

.alert--error {
  background: rgba(184, 51, 43, 0.08);
  border: 1px solid rgba(184, 51, 43, 0.24);
  color: var(--danger);
}

.alert--info {
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.24);
  color: #0f766e;
}

.settings-shell {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 40px) var(--pad-x) 0;
}

.settings-head__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.025em;
}

.settings-head__lead {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-2);
}

.settings-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.settings-section__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.settings-section__body {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.settings-section--danger .settings-section__title {
  color: var(--danger);
}

.settings-dl {
  margin: 12px 0 0;
}

.settings-dl__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  font-size: 14px;
}

.settings-dl__row dt {
  color: var(--ink-3);
}

.settings-dl__row dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

.settings-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-form__actions {
  margin-top: 4px;
  display: flex;
}

/* --- Learn & Placement Screen Polish ------------------------------------- */

.play {
  height: var(--vvh, 100dvh);
}

.stage__canvas {
  touch-action: none;
}

.playbar--clean {
  padding-top: 10px;
  padding-bottom: 8px;
}

.playbar__cat {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  line-height: 1.2;
}

.task__sep {
  opacity: 0.45;
  margin: 0 4px;
}

.task__caption::before {
  display: none;
}

/* Clinical pearl: slim top strip that NEVER blocks the 3D model or bottom controls */
.stage__pearl {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(245, 242, 238, 0.94);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-2);
  z-index: 12;
  cursor: pointer;
}

.stage__pearl-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.stage__pearl-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playbar__counter {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.placement-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.leveldone__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.leveldone__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Mobile (<= 860px) --------------------------------------------------- */

@media (max-width: 860px) {
  .appbar__inner {
    height: 48px;
    padding: 0 14px;
  }

  .appbar__brand {
    font-size: 14px;
  }

  .appbar__nav {
    gap: 12px;
  }

  .appbar__link {
    font-size: 13px;
  }

  .appbar__user {
    display: none;
  }

  .home {
    padding: 18px 16px 0;
  }

  .overview__actions {
    width: 100%;
  }

  .overview__actions .btn {
    flex: 1 1 auto;
  }

  .metric {
    padding: 10px 8px 10px 0;
  }

  .metric + .metric {
    padding-left: 10px;
  }

  .metric__val {
    font-size: 20px;
  }

  .mod-row__link {
    padding: 11px 2px;
    gap: 10px;
  }

  .mod-row__bar {
    display: none;
  }

  /* Pin play screen to the live visualViewport on mobile so different phone keyboards never shift or clip it */
  .play {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--vvt, 0px);
    height: var(--vvh, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  /* Compact single-row mobile playbar */
  .playbar--clean {
    padding: 6px 10px 6px;
    row-gap: 6px;
  }

  .playbar--clean .playbar__identity {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
  }

  .playbar--clean .playbar__cat {
    font-size: 13px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .playbar--clean .playbar__title {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
  }

  .stage {
    min-height: 0;
  }

  .stage__controls {
    right: 10px;
    bottom: 8px;
    gap: 6px;
  }

  .stage__turn {
    padding: 5px 9px;
    font-size: 11.5px;
  }

  .task {
    padding: 4px 12px 8px;
  }

  .word {
    min-height: 40px;
    cursor: text;
    font-size: clamp(26px, 7.5vw, 38px);
    margin: 2px 0;
  }

  .play.is-kb-open .task__prompt,
  .play.is-kb-open .task__meta,
  .play.is-kb-open .task__hint {
    display: none;
  }

  .play.is-kb-open .word {
    font-size: clamp(22px, 6.8vw, 32px);
    margin: 0;
  }
}

/* --- Brand Logo Sizing & Responsive Swap --------------------------------- */

.appbar__brand {
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  display: block;
  width: auto;
  height: 24px;
}

.brand-logo--iso {
  display: none;
}

.auth-logo {
  display: block;
  width: auto;
  height: 34px;
  margin-bottom: 22px;
}

.site-footer__credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-mark {
  display: block;
  width: auto;
  height: 15px;
  opacity: 0.85;
}

.loader__mark {
  display: block;
  width: auto;
  height: 32px;
  margin: 0 auto 12px;
}

@media (max-width: 860px) {
  .brand-logo--full {
    display: none;
  }

  .brand-logo--iso {
    display: block;
    height: 22px;
  }

  .auth-logo {
    height: 28px;
    margin-bottom: 18px;
  }
}

/* --- Topnav Icon Controls & 3-Pillar Domain Selector --------------------- */

.appbar__nav {
  gap: 8px;
}

.appbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.appbar__btn:hover {
  background: rgba(22, 19, 15, 0.055);
  color: var(--ink);
}

.appbar__btn.is-active {
  background: var(--surface);
  border-color: var(--line-soft);
  color: var(--ink);
}

.appbar__btn--icon {
  padding: 6px 7px;
  color: var(--ink-3);
}

.appbar__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.appbar__divider {
  width: 1px;
  height: 18px;
  background: var(--line-soft);
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.domain-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.domain-tile:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.domain-tile.is-active {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
}

.domain-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--ink-2);
}

.domain-tile__icon svg {
  width: 22px;
  height: 22px;
}

.domain-tile.is-active .domain-tile__icon {
  color: #991a37;
}

.domain-tile__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
}

.domain-tile__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.domain-tile__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(22, 19, 15, 0.06);
}

.domain-tile__bar-fill {
  display: block;
  height: 100%;
  background: var(--ink-3);
  transition: width 240ms ease, background 120ms ease;
}

.domain-tile.is-active .domain-tile__bar-fill {
  background: #991a37;
}

/* Module row completion status indicator */
.mod-status {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mod-status--new {
  border: 1.5px solid var(--line);
}

.mod-status--active {
  border: 1.5px solid #991a37;
}

.mod-status__fill {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #991a37;
}

.mod-status--done {
  background: var(--ink);
  color: #ffffff;
}

.mod-status--done svg {
  width: 11px;
  height: 11px;
}

@media (max-width: 860px) {
  .appbar__btn-label {
    display: none;
  }

  .appbar__btn {
    padding: 7px;
  }

  .domain-grid {
    gap: 7px;
    margin-bottom: 18px;
  }

  .domain-tile {
    padding: 11px 10px 13px;
    gap: 4px;
  }

  .domain-tile__icon {
    width: 22px;
    height: 22px;
  }

  .domain-tile__icon svg {
    width: 19px;
    height: 19px;
  }

  .domain-tile__title {
    font-size: 12.5px;
  }

  .domain-tile__count {
    font-size: 11px;
  }
}

/* --- Multi-Module Selection & Sticky Start Bar --------------------------- */

.mod-row__select {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mod-row__select.is-selected {
  background: rgba(153, 26, 55, 0.055);
}

.mod-check {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: transparent;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.mod-check svg {
  width: 12px;
  height: 12px;
}

.mod-row__select:hover .mod-check {
  border-color: var(--ink-2);
}

.mod-row__select.is-selected .mod-check {
  background: #991a37;
  border-color: #991a37;
  color: #ffffff;
}

.tag--done {
  background: rgba(22, 19, 15, 0.07);
  color: var(--ink);
  font-weight: 700;
}

body.has-selection-bar .site-footer {
  padding-bottom: 88px;
}

.selection-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 12px var(--pad-x) calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.selection-bar__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 12px 18px;
  background: #16130f;
  color: #f5f2ee;
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(22, 19, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: auto;
}

.selection-bar__info {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.selection-bar__summary {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

.selection-bar__clear {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  color: rgba(245, 242, 238, 0.65);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.selection-bar__clear:hover {
  color: #ffffff;
}

.btn--start-selected {
  background: #991a37;
  color: #ffffff;
  padding: 11px 22px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn--start-selected:hover {
  background: #b01e40;
}

@media (max-width: 640px) {
  .selection-bar {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .selection-bar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .selection-bar__info {
    justify-content: space-between;
  }

  .btn--start-selected {
    width: 100%;
    padding: 12px 18px;
    font-size: 15px;
  }
}

/* --- Settings & Inline Feedback Form Tweaks ------------------------------ */

.settings-form--spaced {
  margin-top: 18px;
}

.field__textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-form .modal__actions {
  margin-top: 4px;
}

/* --- PWA Install Banner, Guide & Standalone Safe Areas ------------------- */

.pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
}

.pwa-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-banner__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.pwa-banner__sub {
  font-size: 12.5px;
  color: var(--ink-2);
}

.pwa-banner__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn--compact {
  padding: 7px 12px;
  font-size: 12.5px;
}

.pwa-banner__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.pwa-banner__close svg {
  width: 16px;
  height: 16px;
}

.pwa-banner__close:hover {
  background: rgba(22, 19, 15, 0.05);
  color: var(--ink);
}

.pwa-steps {
  margin: 0 0 22px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.pwa-share-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-left: 4px;
  color: var(--ink);
}

@media (max-width: 640px) {
  .pwa-banner {
    flex-wrap: wrap;
  }

  .pwa-banner__actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (display-mode: standalone) {
  .appbar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .playbar--clean {
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
  }
}

/* --- Onboarding Device Recommendation Notice ----------------------------- */

.device-notice {
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ink);
  border-radius: 6px;
  background: rgba(22, 19, 15, 0.025);
}

.device-notice__title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.device-notice__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* --- Pricing, Locked Modules & Auth Demo CTA ----------------------------- */

.auth-demo-links {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-pricing-link {
  font-size: 13px;
}

.mod-row__locked {
  opacity: 0.68;
}

.mod-row__locked:hover {
  opacity: 1;
}

.mod-lock {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

.mod-lock svg {
  width: 15px;
  height: 15px;
}

.pricing-shell {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 52px) var(--pad-x) 56px;
}

.pricing-head {
  max-width: 52ch;
  margin-bottom: 22px;
}

.pricing-head__title {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin-bottom: 8px;
}

.pricing-head__lead {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}

.pricing-included {
  list-style: none;
  margin: 0 0 22px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pricing-included li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pricing-included strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.pricing-included span {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-3);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.plan-card {
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
}

.plan-card--featured {
  border: 1.5px solid var(--ink);
}

.plan-card--current {
  border-color: #991a37;
}

.plan-card__head {
  margin-bottom: 12px;
}

.plan-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.plan-card__badge {
  font-size: 12px;
  font-weight: 600;
  color: #991a37;
}

.plan-card__price {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 4px;
}

.plan-card__term {
  font-size: 12.5px;
  color: var(--ink-3);
}

.plan-card__pitch {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 20px;
}

.plan-card__foot {
  margin-top: auto;
}

.pricing-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

.dev-plan-bar {
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.dev-plan-bar__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--ink-2);
}

.dev-plan-bar__text strong {
  color: var(--ink);
}

.dev-plan-bar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .pricing-included {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 0;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .plan-card {
    padding: 18px 16px 16px;
  }

  .plan-card__price {
    font-size: 28px;
  }
}

/* --- Basiswissen Starter Pack (Dashboard) -------------------------------- */

.basics {
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line-soft);
}

.basics__head {
  margin-bottom: 16px;
}

.basics__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 4px;
}

.basics__sub {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
  margin: 0;
}

.basics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.basics-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  transition: border-color 120ms ease, background 120ms ease;
}

.basics-card:hover {
  border-color: var(--ink);
}

.basics-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.basics-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #991a37;
}

.basics-card__icon svg {
  width: 20px;
  height: 20px;
}

.basics-card__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.basics-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.basics-card__sub {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0;
}

.basics-card__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(22, 19, 15, 0.06);
}

.basics-card__bar-fill {
  display: block;
  height: 100%;
  background: #991a37;
  transition: width 240ms ease;
}

@media (max-width: 640px) {
  .basics-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Dedicated Learning Language Popup (Demo & Placement Quiz) ----------- */

.playbar__lang-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.playbar__lang-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.modal--lang {
  z-index: 80;
}

.lang-modal__panel {
  width: min(440px, 100%);
  padding: 26px 24px 24px;
}

.lang-modal__title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 6px;
}

.lang-modal__lead {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
  margin: 0 0 20px;
}

.lang-modal__choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lang-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.lang-choice:hover {
  border-color: var(--ink);
  background: var(--paper-raise);
}

.lang-choice--primary {
  border: 1.5px solid var(--ink);
}

.lang-choice__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.lang-choice__title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.lang-choice__badge {
  font-size: 12px;
  font-weight: 600;
  color: #991a37;
}

.lang-choice__sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .modal--lang {
    align-items: end;
    padding: 0;
  }

  .lang-modal__panel {
    width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .lang-choice {
    padding: 16px;
  }
}

/* --- OTP Send Status Popup (Spinner -> Green Check / Red X) -------------- */

.otp-modal__panel {
  width: min(300px, calc(100% - 32px));
  padding: 26px 22px 24px;
  text-align: center;
}

.otp-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.otp-status__ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 19, 15, 0.06);
  color: var(--ink);
  transition: background-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.otp-status__icon {
  width: 24px;
  height: 24px;
  display: none;
}

.otp-status[data-otp-status="loading"] .otp-status__icon--spin {
  display: block;
  animation: otp-spin 0.8s linear infinite;
}

.otp-status[data-otp-status="success"] .otp-status__ring {
  background: #1f7a4c;
  color: #ffffff;
  transform: scale(1.04);
}

.otp-status[data-otp-status="success"] .otp-status__icon--ok {
  display: block;
}

.otp-status[data-otp-status="error"] .otp-status__ring {
  background: #b82035;
  color: #ffffff;
  transform: scale(1.04);
}

.otp-status[data-otp-status="error"] .otp-status__icon--err {
  display: block;
}

.otp-status__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.otp-status__detail {
  margin: -4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.otp-status__btn {
  margin-top: 4px;
}

@keyframes otp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Editorial Landing Page (Spacious Hero + Roadmap) -------------------- */

.landing {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.landing__lang {
  position: absolute;
  top: clamp(16px, 2.4vh, 26px);
  right: clamp(16px, 3vw, 32px);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.65);
}

.landing__lang-link {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  transition: background-color 140ms ease, color 140ms ease;
}

.landing__lang-link:hover {
  color: var(--ink);
}

.landing__lang-link.is-active {
  background: var(--ink);
  color: var(--paper);
}

.landing__page {
  flex: 1 1 auto;
  width: 100%;
}

.landing__hero {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(44px, 7vh, 72px) var(--pad-x) clamp(52px, 8vh, 84px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.landing__brand {
  margin-bottom: clamp(26px, 4vh, 40px);
}

.landing__logo {
  display: block;
  width: auto;
  height: clamp(26px, 3.4vh, 32px);
}

.landing__stage {
  width: 100%;
  margin-bottom: clamp(28px, 4.4vh, 44px);
}

.landing__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 24px 54px -28px rgba(22, 19, 15, 0.24);
}

.landing__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--paper-raise);
}

.landing__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(245, 242, 238, 0.92) 100%);
}

.landing__placeholder-mark {
  display: block;
  width: auto;
  height: 38px;
  opacity: 0.42;
}

.landing__placeholder-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.landing__copy {
  margin-bottom: clamp(24px, 3.6vh, 34px);
}

.landing__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(28px, 4.4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--ink);
}

.landing__subtitle {
  margin: 12px auto 0;
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 44ch;
}

.landing__stats {
  margin: 0 0 clamp(26px, 4vh, 38px);
  width: 100%;
  max-width: 540px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.landing__stat {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  padding: 16px 12px;
}

.landing__stat + .landing__stat {
  border-left: 1px solid var(--line-soft);
}

.landing__stat dd {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.landing__stat dt {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.landing__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 460px;
}

.landing__btn {
  flex: 1 1 0;
  height: 48px;
  font-size: 15px;
  transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 140ms ease, border-color 140ms ease;
}

.landing__btn:active {
  transform: scale(0.985);
}

/* Choreographed hero entrance */
.landing-enter {
  opacity: 0;
  transform: translateY(14px);
  animation: landing-settle 620ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.landing-enter--2 {
  transform: translateY(18px) scale(0.985);
  animation-name: landing-frame-in;
  animation-duration: 720ms;
}

.landing-enter--1 { animation-delay: 20ms; }
.landing-enter--2 { animation-delay: 100ms; }
.landing-enter--3 { animation-delay: 200ms; }
.landing-enter--4 { animation-delay: 290ms; }
.landing-enter--5 { animation-delay: 370ms; }

@keyframes landing-settle {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes landing-frame-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Roadmap Section ----------------------------------------------------- */

.roadmap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 80px) var(--pad-x) clamp(56px, 8vw, 88px);
  border-top: 1px solid var(--line-soft);
}

.roadmap__head {
  margin-bottom: 32px;
}

.roadmap__title {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}

.roadmap__lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 52ch;
}

.roadmap__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
}

.roadmap__item {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 16px 24px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

.roadmap__status {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.roadmap__status--live {
  color: var(--ink);
}

.roadmap__status--next {
  color: #991a37;
}

.roadmap__status--planned {
  color: var(--ink-3);
}

.roadmap__item-title {
  display: block;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.roadmap__item--planned .roadmap__item-title {
  color: var(--ink-2);
}

.roadmap__item-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* Scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .landing-enter,
  [data-reveal] {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
}

@media (max-width: 640px) {
  .landing__hero {
    padding-top: 64px;
    padding-bottom: 48px;
  }

  .landing__brand {
    margin-bottom: 24px;
  }

  .landing__stage {
    margin-bottom: 24px;
  }

  .landing__frame {
    border-radius: 9px;
  }

  .landing__actions {
    flex-direction: column;
    gap: 10px;
  }

  .landing__btn {
    width: 100%;
    flex: none;
    height: 46px;
  }

  .roadmap__item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 16px 0;
  }
}

/* --- Legal Documents, Onboarding Terms & GDPR Cookie Banner -------------- */

.document__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.document__nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.document__nav a:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.document__nav a.is-current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper, #F5F2EE);
}

.document__callout {
  padding: 20px 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface, rgba(255, 255, 255, 0.72));
  margin-bottom: 24px;
}

.document__callout h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 10px;
}

.document__callout p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 10px;
}

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

.document__list {
  margin: 10px 0 12px;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.65;
}

.document__list li {
  margin-bottom: 8px;
}

.document__list li:last-child {
  margin-bottom: 0;
}

.document__section code {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.site-footer__links {
  flex-wrap: wrap;
}

.site-footer__btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink-2);
  cursor: pointer;
}

.site-footer__btn:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer__made {
  flex: 1 0 100%;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  margin-bottom: 16px;
}

.terms-check__input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.terms-check__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.auth-legal-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
}

.pricing-legal {
  margin: 10px auto 0;
  max-width: 62ch;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
  text-align: center;
}

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper, #F5F2EE);
  box-shadow: 0 14px 40px rgba(20, 18, 16, 0.14);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
}

.cookie-banner__copy {
  flex: 1 1 auto;
}

.cookie-banner__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.cookie-banner__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.cookie-banner__actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

@media (max-width: 640px) {
  .cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .cookie-banner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Admin Panel (.page--admin) ------------------------------------------ */

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper, #F5F2EE);
  border-bottom: 1px solid var(--line-soft);
}

.admin-bar__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-bar__brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-bar__title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}

.admin-bar__user {
  font-size: 12px;
  color: var(--ink-3);
}

.admin-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px var(--pad-x) 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-kpi {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface, rgba(255, 255, 255, 0.72));
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-kpi__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.admin-kpi__value {
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
}

.admin-kpi__value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.admin-kpi__sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
}

.admin-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-section__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
  max-width: 440px;
}

.admin-search__input {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
}

.admin-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper, #F5F2EE);
}

.admin-users {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface, rgba(255, 255, 255, 0.72));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-user-card__info {
  flex: 1 1 260px;
  min-width: 0;
}

.admin-user-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.admin-user-card__name {
  font-size: 15px;
  color: var(--ink);
}

.admin-user-card__email {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--ink-2);
  word-break: break-all;
}

.admin-user-card__meta {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
}

.admin-user-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.admin-badge--lifetime {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper, #F5F2EE);
}

.admin-badge--study {
  background: rgba(180, 96, 56, 0.14);
  border-color: rgba(180, 96, 56, 0.35);
  color: var(--ink);
}

.admin-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-3);
}

.admin-pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-pagination__info {
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

.admin-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-panel {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface, rgba(255, 255, 255, 0.72));
}

.admin-panel__title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.admin-simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-simple-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.admin-simple-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-simple-list li > span {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.admin-empty {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

@media (max-width: 820px) {
  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Disable Mobile Double-Tap & Input Focus Zoom ------------------------ */

html,
body,
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}
