@font-face {
  font-family: "Outfit";
  src: url("assets/outfit-variable.woff2") format("woff2-variations");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070b17;
  --bg-deep: #040710;
  --surface: #111829;
  --surface-2: #182238;
  --text: #f4f6fb;
  --muted: #a6b0c5;
  --line: rgb(190 201 224 / 0.14);
  --purple: #8f63ff;
  --blue: #5791ff;
  --green: #42d880;
  --green-deep: #123c29;
  --red: #ff6b74;
  --red-deep: #451d29;
  --focus: #f5c451;
  --radius: 22px;
  --radius-small: 15px;
  --content: 560px;
  font-family: "Outfit", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

button,
a { font: inherit; }
button { color: inherit; }

button:focus-visible,
a:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[tabindex="-1"]:focus { outline: none; }

.app {
  position: relative;
  width: min(100%, var(--content));
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  background: radial-gradient(circle at 92% 2%, rgb(87 145 255 / 0.12), transparent 30%), var(--bg);
  box-shadow: 0 0 80px rgb(0 0 0 / 0.55);
}

.screen {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  animation: screen-in 300ms ease both;
}

.topbar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 760;
  letter-spacing: -0.055em;
}

.brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-word { color: var(--text); }
.brand-word > span { color: var(--blue); }

.context,
.exit-button {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.exit-button {
  min-height: 40px;
  border: 0;
  padding: 0 2px 0 16px;
  cursor: pointer;
  background: transparent;
}

h1,
h2,
p { margin-top: 0; }

h1,
h2 {
  letter-spacing: -0.045em;
  text-wrap: balance;
}

h1 {
  max-width: 11ch;
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 12vw, 4.6rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.45rem, 6.5vw, 2.1rem);
  line-height: 1.12;
}

.eyebrow {
  margin: 0 0 16px;
  color: #b69cff;
  font-size: 0.9rem;
  font-weight: 680;
}

.lead {
  max-width: 34ch;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.55;
}

.intro-copy { padding-top: 14px; }

.mission-topic {
  display: grid;
  gap: 3px;
  margin: 0 0 18px;
}

.mission-topic span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mission-topic strong {
  max-width: 28ch;
  color: #b69cff;
  font-size: 1rem;
  line-height: 1.25;
}

.mission-preview {
  position: relative;
  margin: auto 0 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: rgb(17 24 41 / 0.84);
  box-shadow: inset 0 1px rgb(255 255 255 / 0.04);
}

.mission-preview::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(var(--purple), var(--blue), var(--green));
  content: "";
}

.preview-row {
  display: flex;
  align-items: start;
  gap: 12px;
}

.preview-row + .preview-row {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.preview-row > div {
  display: grid;
  flex: 1;
  gap: 3px;
}

.preview-row span { color: var(--muted); }

.preview-row > div span {
  line-height: 1.35;
}

.preview-number {
  width: 22px;
  flex: 0 0 22px;
}

.preview-row strong {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.preview-outcome {
  margin: 17px 0 0;
  color: #d9def0;
  font-size: 0.92rem;
}

.button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-small);
  padding: 14px 20px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 180ms ease, filter 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

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

.button-primary {
  width: 100%;
  color: #06130c;
  background: var(--green);
  font-weight: 750;
}

.button-primary:hover { filter: brightness(1.06); }

.button-primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-secondary {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgb(255 255 255 / 0.035);
  font-weight: 680;
}

.button-tertiary {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
}

.button-tertiary:hover { color: var(--text); }

.mission-hud,
.progress-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mission-hud strong,
.progress-meta strong {
  font-size: 0.93rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.score {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 5px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.1);
}

.progress > span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--green));
  transition: width 300ms ease;
}

.question-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgb(143 99 255 / 0.34);
  border-radius: var(--radius);
  padding: 24px 20px 22px;
  background: linear-gradient(145deg, rgb(50 37 97 / 0.62), rgb(17 24 41 / 0.96) 56%);
  box-shadow: 0 18px 45px rgb(1 3 12 / 0.3), inset 0 1px rgb(255 255 255 / 0.07);
}

.question-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(var(--purple), var(--blue));
  content: "";
}

.subject {
  display: inline-block;
  margin-bottom: 14px;
  color: #b69cff;
  font-size: 0.82rem;
  font-weight: 700;
}

.question-card h2 { margin-bottom: 0; }

.answers {
  display: grid;
  gap: 10px;
  margin: 14px 0 22px;
}

.answer {
  display: grid;
  min-height: 60px;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 11px 13px;
  cursor: pointer;
  text-align: left;
  background: var(--surface);
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.answer:hover:not(:disabled) {
  border-color: rgb(143 99 255 / 0.58);
  transform: translateY(-1px);
}

.answer:disabled { cursor: default; }

.answer-letter {
  color: #b99fff;
  font-size: 0.92rem;
  font-weight: 760;
}

.answer.selected {
  border-color: var(--purple);
  background: rgb(143 99 255 / 0.12);
}

.answer.correct {
  border-color: var(--green);
  background: var(--green-deep);
}

.answer.correct .answer-letter {
  color: var(--green);
}

.answer.wrong {
  border-color: var(--red);
  background: var(--red-deep);
}

.answer.wrong .answer-letter {
  color: var(--red);
}

.abandon-button {
  min-height: 44px;
  align-self: center;
  border: 0;
  padding: 8px 18px;
  cursor: pointer;
  color: #8e98ad;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: rgb(166 176 197 / 0.35);
  text-underline-offset: 4px;
}

.abandon-button:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.feedback-layer {
  position: fixed;
  z-index: 10;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: end;
  justify-content: center;
}

.feedback-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgb(2 5 12 / 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdrop-in 220ms ease both;
}

.feedback-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, var(--content));
  max-height: calc(100vh - 12px);
  max-height: calc(100dvh - 12px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  padding: 24px 20px max(22px, env(safe-area-inset-bottom));
  background: #121a2b;
  box-shadow: 0 -24px 70px rgb(0 0 0 / 0.44);
  animation: sheet-in 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.feedback-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.feedback-footer {
  flex: 0 0 auto;
}

.sheet-handle {
  display: block;
  width: 44px;
  height: 4px;
  margin: -8px auto 20px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.22);
}

.feedback-layer.is-leaving .feedback-backdrop { animation: backdrop-out 180ms ease both; }
.feedback-layer.is-leaving .feedback-sheet { animation: sheet-out 180ms ease both; }

.feedback-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid currentColor;
  border-radius: 15px;
  font-size: 1.35rem;
  font-weight: 780;
}

.feedback-sheet.is-correct .feedback-icon,
.feedback-sheet.is-correct h3 { color: var(--green); }
.feedback-sheet.is-wrong .feedback-icon,
.feedback-sheet.is-wrong h3 { color: var(--red); }

.feedback-sheet h3 {
  margin-bottom: 8px;
  font-size: 1.85rem;
}

.feedback-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.correct-answer {
  margin-bottom: 8px;
  color: #d9def0;
  font-weight: 650;
}

.feedback-scroll > div > p:last-child {
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.completion-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin: 24px 0 28px;
  border: 1px solid rgb(66 216 128 / 0.42);
  border-radius: 24px;
  color: var(--green);
  background: rgb(66 216 128 / 0.09);
  font-size: 1.9rem;
  font-weight: 780;
}

.completion-copy { margin-top: auto; }

.completion-score {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.completion-score span {
  color: var(--muted);
  line-height: 1.4;
}

.completion-score strong {
  font-size: 2.35rem;
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.completion-score small {
  color: var(--green);
  font-weight: 650;
}

.flash-screen {
  background: radial-gradient(circle at 15% 12%, rgb(143 99 255 / 0.17), transparent 32%), var(--bg);
}

.flash-stage {
  display: grid;
  flex: 1;
  place-items: center;
  perspective: 1100px;
  transition: transform 220ms ease, opacity 220ms ease;
}

.flash-stage.is-advancing {
  opacity: 0;
  transform: translateX(-38px) scale(0.98);
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: min(430px, 49dvh);
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  transform-style: preserve-3d;
  transform-origin: center;
  transition: transform 540ms cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.flashcard.is-flipped { transform: rotateY(-180deg); }

.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 28px;
  padding: 34px 28px;
  backface-visibility: hidden;
  box-shadow: 0 28px 70px rgb(0 0 0 / 0.34), inset 0 1px rgb(255 255 255 / 0.14);
}

.flash-front { background: linear-gradient(145deg, #6c45df, #2e63cc 64%, #174e87); }

.flash-back {
  background: linear-gradient(145deg, #35226f, #243b87 60%, #15335e);
  transform: rotateY(-180deg);
}

.flash-face::after {
  position: absolute;
  right: -18%;
  bottom: -24%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.06);
  content: "";
}

.flash-face p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.65rem, 7.5vw, 2.45rem);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.035em;
  text-align: center;
}

.flash-label {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1;
  color: rgb(255 255 255 / 0.7);
  font-size: 0.74rem;
  font-weight: 720;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.flash-reveal {
  position: absolute;
  bottom: 24px;
  z-index: 1;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  color: rgb(255 255 255 / 0.78);
  background: rgb(4 7 16 / 0.14);
  font-size: 0.78rem;
  font-weight: 620;
}

.recall-panel {
  margin-top: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.recall-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.recall-panel > p {
  margin: 0 0 10px;
  color: #d9def0;
  font-size: 0.88rem;
  font-weight: 650;
  text-align: center;
}

.recall-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.recall-button {
  display: grid;
  min-height: 64px;
  place-items: center;
  gap: 2px;
  border: 1px solid currentColor;
  border-radius: var(--radius-small);
  padding: 7px 4px;
  cursor: pointer;
  background: rgb(255 255 255 / 0.035);
  transition: transform 160ms ease, background-color 160ms ease;
}

.recall-button:hover { background: rgb(255 255 255 / 0.07); }
.recall-button:active { transform: scale(0.98); }
.recall-button:disabled { cursor: default; opacity: 0.55; }
.recall-button.is-hard { color: #ff7f88; }
.recall-button.is-medium { color: #f6bc62; }
.recall-button.is-easy { color: #55d9b0; }

.recall-face {
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: -0.08em;
}

.recall-button strong { font-size: 0.8rem; }

.result-title {
  max-width: 14ch;
  margin-bottom: 28px;
  font-size: clamp(2rem, 8.5vw, 3.2rem);
  line-height: 1.02;
}

.result-kicker {
  margin-bottom: 9px;
  color: var(--green);
  font-weight: 700;
}

.result-score {
  margin: 0;
  font-size: clamp(5rem, 25vw, 8.2rem);
  font-weight: 780;
  line-height: 0.82;
  letter-spacing: -0.075em;
}

.result-score span {
  color: var(--green);
  font-size: 0.42em;
}

.result-caption {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.result-breakdown {
  display: grid;
  gap: 10px;
  margin: 28px 0 24px;
}

.result-topic {
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-topic strong { color: #d9def0; }

.result-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 17px;
  background: var(--surface);
}

.result-block span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-block strong {
  grid-row: span 2;
  align-self: center;
  font-size: 1.32rem;
}

.result-block small {
  color: #b69cff;
  font-weight: 650;
}

.classification {
  margin-bottom: 24px;
  color: #d6dced;
  font-size: 1rem;
  line-height: 1.5;
}

.offer-screen {
  background: radial-gradient(circle at 10% 15%, rgb(143 99 255 / 0.18), transparent 34%), radial-gradient(circle at 92% 82%, rgb(66 216 128 / 0.1), transparent 28%), var(--bg);
}

.offer-screen h1 { max-width: 10ch; }

.offer-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.features {
  margin: 6px 0 28px;
  border-top: 1px solid var(--line);
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  font-weight: 620;
}

.feature span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 740;
  letter-spacing: 0.08em;
}

.price {
  margin: auto 0 24px;
  padding-top: 12px;
}

.price-old {
  display: block;
  color: var(--muted);
  text-decoration: line-through;
}

.price-current {
  display: block;
  margin-top: 5px;
  font-size: clamp(3.4rem, 17vw, 5.6rem);
  font-weight: 780;
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.price-term {
  display: block;
  margin-top: 7px;
  color: var(--green);
  font-weight: 650;
}

.offer-actions { display: grid; gap: 10px; }

.offer-actions .button-secondary { width: 100%; }

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

.exit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(2 5 12 / 0.78);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  animation: backdrop-in 180ms ease both;
}

.exit-modal {
  position: relative;
  width: min(100%, 430px);
  border: 1px solid rgb(143 99 255 / 0.28);
  border-radius: var(--radius);
  padding: 24px;
  background: #121a2b;
  box-shadow: 0 26px 80px rgb(0 0 0 / 0.54), inset 0 1px rgb(255 255 255 / 0.06);
  animation: modal-in 220ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.modal-kicker {
  margin-bottom: 10px;
  color: #b69cff;
  font-size: 0.82rem;
  font-weight: 680;
}

.exit-modal h2 { margin-bottom: 12px; }

.exit-modal > p:not(.modal-kicker) {
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.exit-actions { display: grid; gap: 8px; }

.danger-action { color: #ff9ba2; }

.exit-modal-layer.is-leaving .exit-modal-backdrop { animation: backdrop-out 160ms ease both; }
.exit-modal-layer.is-leaving .exit-modal { animation: modal-out 160ms ease both; }

.fine-print {
  margin: 15px 0 0;
  color: #7f8aa2;
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheet-out {
  to { opacity: 0; transform: translateY(32px); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
}

@keyframes backdrop-out {
  to { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@keyframes modal-out {
  to { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@media (min-width: 700px) {
  .screen { padding-inline: 38px; }
  .feedback-sheet { padding-inline: 38px; }
}

@media (max-width: 350px) {
  .screen { padding-inline: 16px; }
  .question-card { padding: 18px 16px; }
  .answer { min-height: 56px; padding-block: 9px; }
  .flash-face { padding-inline: 22px; }
}

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