:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --plyr-color-main: rgb(23 23 23);
  --plyr-control-radius: 6px;
  --plyr-video-control-background-hover: rgba(255, 255, 255, 0.16);
  --plyr-video-control-color-hover: white;
  --plyr-range-thumb-background: white;
  --plyr-range-fill-background: white;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

@keyframes candy-cane {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

@keyframes soft-blink {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(23, 23, 23, 0.15);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(23, 23, 23, 0);
  }
}

@keyframes float-up {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes scrub {
  0% {
    width: 18%;
  }
  100% {
    width: 82%;
  }
}

@keyframes drift-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lern-loading-bar {
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 32px 32px;
  animation: candy-cane 1s linear infinite;
}

.lern-loading-dot {
  animation: soft-blink 1s ease-in-out infinite;
}

.drift-in {
  animation: drift-in 500ms var(--ease-out) both;
}

.drift-in-delay-1 {
  animation-delay: 60ms;
}
.drift-in-delay-2 {
  animation-delay: 120ms;
}
.drift-in-delay-3 {
  animation-delay: 180ms;
}

.field {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgb(229 229 229);
  background: white;
  padding: 11px 13px;
  font-size: 0.9rem;
  outline: none;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.field:hover {
  border-color: rgb(200 200 200);
}

.field:focus {
  border-color: rgb(23 23 23);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.06);
  background: rgb(253 253 253);
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 200ms var(--ease-out),
    background 200ms ease,
    border-color 200ms ease,
    opacity 200ms ease,
    box-shadow 200ms var(--ease-out);
}

.btn-primary {
  background: rgb(23 23 23);
  color: white;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 8px 18px -10px rgba(15, 23, 42, 0.6);
}

.btn-primary:hover {
  background: rgb(38 38 38);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 12px 24px -10px rgba(15, 23, 42, 0.5);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 8px -4px rgba(15, 23, 42, 0.5);
}

.btn-secondary {
  border: 1px solid rgb(229 229 229);
  background: white;
  color: rgb(38 38 38);
}

.btn-secondary:hover {
  border-color: rgb(163 163 163);
  background: rgb(250 250 250);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgb(115 115 115);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.page-shell {
  animation: page-enter 400ms var(--ease-out) both;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

.page-shell-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.995);
}

.page-shell:has(#obRoot) {
  animation: none;
  transition: none;
  transform: none;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-shell {
    animation: none;
    transition: none;
  }
}

/* ---------- Onboarding ---------- */

.onboarding-stage {
  height: 100vh;
  height: 100dvh;
  position: relative;
}

.onboarding-slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 80px 28px 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.98);
  filter: blur(8px);
  transition:
    opacity 500ms var(--ease-out),
    transform 600ms var(--ease-out),
    filter 500ms var(--ease-out);
}

.onboarding-slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.onboarding-slide.exit-up {
  transform: translateY(-28px) scale(0.98);
  filter: blur(4px);
}

.onboarding-slide h1 {
  margin-top: 12px;
  max-width: 700px;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.onboarding-slide p.lead {
  margin-top: 18px;
  max-width: 540px;
  color: rgb(82 82 82);
  font-size: 1.05rem;
  line-height: 1.65;
}

@media (min-width: 900px) {
  .onboarding-slide {
    grid-template-columns: 0.95fr 1.05fr;
    padding: 96px 8vw 120px;
  }
}

.onboarding-stage-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 80% 0%, rgba(10, 10, 10, 0.07), transparent 70%),
    radial-gradient(
      50% 50% at 0% 100%,
      rgba(10, 10, 10, 0.055),
      transparent 65%
    );
}

/* Stagger entrance for slide content */
.onboarding-slide.active .eyebrow-pill {
  animation: ob-rise 640ms var(--ease-out) both;
}
.onboarding-slide.active h1 {
  animation: ob-rise 720ms 80ms var(--ease-out) both;
}
.onboarding-slide.active p.lead {
  animation: ob-rise 720ms 160ms var(--ease-out) both;
}
.onboarding-slide.active .walkthrough-stage {
  animation: ob-rise-demo 900ms 160ms var(--ease-out) both;
}
@keyframes ob-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes ob-rise-demo {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgb(82 82 82);
}

.eyebrow-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgb(23 23 23);
}

.walkthrough-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: 20px;
  background: white;
  border: 1px solid rgb(220 220 220);
  box-shadow:
    0 30px 80px -28px rgba(15, 23, 42, 0.18),
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 0 0 1px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.walkthrough-toolbar {
  display: flex;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid rgb(229 229 229);
  background: rgb(250 250 250);
}

.walkthrough-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgb(212 212 212);
}

.walkthrough-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 36px;
}

.walkthrough-body-simple {
  display: grid;
  place-items: center;
  padding: 0;
  aspect-ratio: 4 /3;
  flex: 0 0 auto;
}

.demo-window-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: rgb(10 10 10);
}

/* Slide 1 — hero glyph */
.demo-hero {
  display: grid;
  place-items: center;
  height: 100%;
  gap: 22px;
}
.demo-hero .pill {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  border: 1px solid rgb(229 229 229);
  border-radius: 999px;
  padding: 6px 12px;
  background: white;
}
.demo-hero .glyph {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 28px;
  background: linear-gradient(155deg, rgb(10 10 10), rgb(46 46 46));
  display: grid;
  place-items: center;
  color: white;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 30px 60px -10px rgba(0, 0, 0, 0.45);
  animation: float-up 5.5s ease-in-out infinite;
}
.demo-hero .glyph::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 22px solid white;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  margin-left: 6px;
}
.demo-hero .ring {
  position: absolute;
  inset: -14px;
  border-radius: 36px;
  border: 1px solid rgb(212 212 212);
  animation: ob-pulse 3.4s ease-out infinite;
}
.demo-hero .ring:nth-child(2) {
  animation-delay: 1.1s;
}
@keyframes ob-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

/* Slide 2 — typing form */
.demo-gen {
  display: grid;
  align-content: center;
  gap: 12px;
  height: 100%;
}
.demo-gen label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  font-weight: 600;
}
.demo-gen .input {
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.96rem;
  color: rgb(10 10 10);
  min-height: 48px;
  position: relative;
}
.demo-gen .input.misc {
  color: rgb(115 115 115);
  font-size: 0.88rem;
}
.demo-gen .typed::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1em;
  background: rgb(10 10 10);
  margin-left: 2px;
  vertical-align: -2px;
  animation: ob-caret 1s step-end infinite;
}
@keyframes ob-caret {
  50% {
    opacity: 0;
  }
}
.demo-gen .gen-btn {
  margin-top: 6px;
  align-self: start;
  background: rgb(10 10 10);
  color: white;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 0;
  position: relative;
  overflow: hidden;
}
.demo-gen .gen-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: ob-shimmer 3.5s var(--ease-out) infinite;
}
@keyframes ob-shimmer {
  0% {
    transform: translateX(-100%);
  }
  60%,
  100% {
    transform: translateX(120%);
  }
}

/* Slide 3 — quiz */
.demo-quiz {
  display: grid;
  align-content: center;
  gap: 10px;
  height: 100%;
}
.demo-quiz .q {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  font-weight: 600;
}
.demo-quiz .qtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgb(10 10 10);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  line-height: 1.35;
}
.demo-quiz .opt {
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: rgb(64 64 64);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 320ms var(--ease-out);
}
.demo-quiz .opt .dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1.5px solid rgb(212 212 212);
  flex-shrink: 0;
  position: relative;
}
.demo-quiz .opt.selected {
  border-color: rgb(10 10 10);
  background: rgb(10 10 10);
  color: white;
  transform: translateX(4px);
}
.demo-quiz .opt.selected .dot {
  border-color: white;
  background: white;
}
.demo-quiz .opt.selected .dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: rgb(10 10 10);
}

/* Slide 4 — animated player */
.demo-player {
  height: 100%;
  background: rgb(10 10 10);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.demo-player-canvas {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 30% 30%,
      rgba(255, 255, 255, 0.08),
      transparent 50%
    ),
    radial-gradient(
      ellipse at 70% 70%,
      rgba(255, 255, 255, 0.06),
      transparent 50%
    ),
    rgb(10 10 10);
}
.demo-player-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.demo-player-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: float-up 4.5s ease-in-out infinite;
}
.demo-player-play::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 14px solid rgb(10 10 10);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 4px;
}
.demo-player-bar {
  position: absolute;
  bottom: 18px;
  left: 18px;
  right: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.demo-player-bar span {
  display: block;
  height: 100%;
  background: white;
  border-radius: inherit;
  animation: scrub 4s var(--ease-out) infinite alternate;
}
.demo-player-time {
  position: absolute;
  bottom: 30px;
  left: 18px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.05em;
}
.demo-player-time.right {
  left: auto;
  right: 18px;
}

/* Slide 5 — animated results */
.demo-results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  height: 100%;
  align-content: center;
}
.demo-result-card {
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 14px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}
.demo-result-card .lbl {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  font-weight: 600;
}
.demo-result-card .val {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: rgb(10 10 10);
  line-height: 1;
}
.demo-result-card .delta {
  font-size: 0.76rem;
  color: rgb(115 115 115);
}
.demo-result-card.gain {
  background: rgb(10 10 10);
  border-color: rgb(10 10 10);
  color: white;
}
.demo-result-card.gain .lbl,
.demo-result-card.gain .delta {
  color: rgba(255, 255, 255, 0.6);
}
.demo-result-card.gain .val {
  color: white;
}
.demo-result-card .spark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  opacity: 0.6;
}

/* Top progress bar + counter */
.ob-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 25;
}
.ob-progress span {
  display: block;
  height: 100%;
  background: rgb(10 10 10);
  width: 0;
  transition: width 720ms var(--ease-out);
}
.ob-counter {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 28;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: rgb(163 163 163);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .ob-counter {
    display: none;
  }
}

.onboarding-controls {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 30;
}

.onboarding-dots {
  display: flex;
  gap: 8px;
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.onboarding-dot {
  width: 18px;
  height: 18px;
  border: 6px solid white;
  border-radius: 999px;
  background: rgb(212 212 212);
  cursor: pointer;
  padding: 0;
  transition:
    width 420ms var(--ease-out),
    background 320ms ease;
}

.onboarding-dot.active {
  width: 36px;
  background: rgb(10 10 10);
}

/* ---------- Quiz card deck ---------- */

.quiz-deck {
  position: relative;
  perspective: 1200px;
  padding-bottom: 44px;
}

.quiz-card-anim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border: 1px solid rgb(229 229 229);
  border-radius: 18px;
  background: white;
  min-height: 390px;
  padding: 36px 34px;
  box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.94);
  transition:
    opacity 420ms var(--ease-out),
    transform 480ms var(--ease-out);
  min-width: 0;
  will-change: transform, opacity;
  transform-origin: 50% 30%;
}

.quiz-card-anim[data-active="true"] {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1) rotate(0deg);
  z-index: 4;
}

.quiz-card-anim[data-stack="next"],
.quiz-card-anim[data-stack="future"] {
  bottom: 0;
  overflow: hidden;
}

.quiz-card-anim[data-stack="next"] {
  opacity: 1;
  transform: translateY(10px) scale(0.97);
  z-index: 3;
}

.quiz-card-anim[data-stack="future"] {
  opacity: 0.5;
  transform: translateY(20px) scale(0.94);
  z-index: 2;
}

.quiz-card-anim[data-direction="prev"] {
  opacity: 0;
  transform: translateX(-110%) translateY(-6px) rotate(-5deg) scale(0.94);
  z-index: 5;
  transition:
    opacity 320ms ease,
    transform 420ms var(--ease-out);
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid rgb(229 229 229);
  border-radius: 12px;
  padding: 15px 16px;
  font-size: 0.98rem;
  cursor: pointer;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    transform 200ms var(--ease-out),
    box-shadow 200ms ease;
  min-width: 0;
  line-height: 1.5;
}

.quiz-option input {
  flex: 0 0 auto;
  margin-top: 4px;
  accent-color: rgb(23 23 23);
}

.quiz-option span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.quiz-option:hover {
  border-color: rgb(163 163 163);
  background: rgb(250 250 250);
  transform: translateX(2px);
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option:has(input:checked) {
  border-color: rgb(23 23 23);
  background: rgb(245 245 245);
  transform: translateX(3px);
  box-shadow: 0 2px 8px -2px rgba(23, 23, 23, 0.12);
}

@media (max-width: 640px) {
  .quiz-card-anim {
    min-height: 430px;
    padding: 28px 22px;
  }
}

/* ---------- Status badges ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

.status-queued {
  background: rgb(245 245 245);
  color: rgb(82 82 82);
}

.status-running {
  background: rgb(239 246 255);
  color: rgb(29 78 216);
}

.status-running::before {
  animation: pulse-glow 2s ease-in-out infinite;
  background: rgb(29 78 216);
  opacity: 1;
}

.status-completed {
  background: rgb(236 253 245);
  color: rgb(4 120 87);
}

.status-failed {
  background: rgb(254 242 242);
  color: rgb(185 28 28);
}

.status-canceled {
  background: rgb(245 245 245);
  color: rgb(82 82 82);
}

/* ---------- Color theme swatches ---------- */

.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  background: white;
  border-radius: 999px;
  padding: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgb(82 82 82);
  cursor: pointer;
  transition:
    border-color 200ms ease,
    transform 200ms var(--ease-out),
    box-shadow 200ms ease;
}

.theme-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-swatch .dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 200ms var(--ease-spring);
}

.theme-swatch:hover {
  border-color: rgb(212 212 212);
}

.theme-swatch:hover .dot {
  transform: scale(1.1);
}

.theme-swatch:has(input:checked) {
  border-color: rgb(23 23 23);
}

.theme-swatch:has(input:checked) .dot {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ---------- Library groups + denser cards ---------- */

.library-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.library-tools {
  display: flex;
  flex: 1 1 360px;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  max-width: 672px;
}

.library-tools > label:first-child {
  min-height: 42px;
}

.library-tools .field {
  min-height: 42px;
}

.library-topic-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}

.library-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid hsl(var(--topic-hue, 210) 42% 88%);
  border-radius: 999px;
  background: hsl(var(--topic-hue, 210) 76% 97%);
  padding: 0 12px;
  color: hsl(var(--topic-hue, 210) 38% 32%);
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    color 200ms ease,
    transform 200ms var(--ease-out);
}

.library-topic-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  line-height: 1;
  color: hsl(var(--topic-hue, 210) 28% 54%);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.library-topic-chip:hover {
  border-color: hsl(var(--topic-hue, 210) 46% 70%);
  color: hsl(var(--topic-hue, 210) 48% 24%);
  transform: translateY(-1px);
}

.library-topic-chip:active {
  transform: scale(0.96);
}

.library-topic-chip.active {
  border-color: hsl(var(--topic-hue, 210) 48% 42%);
  background: hsl(var(--topic-hue, 210) 48% 32%);
  color: white;
}

.library-topic-chip.active span {
  color: hsl(var(--topic-hue, 210) 70% 84%);
}

.library-topic-chip[data-topic-filter="all"] {
  border-color: rgb(229 229 229);
  background: white;
  color: rgb(82 82 82);
}

.library-topic-chip[data-topic-filter="all"] span {
  color: rgb(163 163 163);
}

.library-topic-chip[data-topic-filter="all"].active {
  border-color: rgb(23 23 23);
  background: rgb(23 23 23);
  color: white;
}

.library-topic-chip[data-topic-filter="all"].active span {
  color: rgb(212 212 212);
}

.library-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.library-grid .video-card {
  animation: library-card-in 440ms var(--ease-out) both;
  transition:
    transform 280ms var(--ease-out),
    box-shadow 280ms ease,
    border-color 280ms ease;
}

.library-grid .video-card:hover {
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.12);
}

.library-grid .video-card:active {
  transform: scale(0.98) !important;
}

.library-card-topic {
  position: absolute;
  left: 8px;
  top: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: hsl(var(--topic-hue, 210) 76% 94% / 0.92);
  padding: 4px 8px;
  color: hsl(var(--topic-hue, 210) 54% 26%);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.library-grid.topic-filtered .library-card-topic {
  display: none;
}

.watch-topic-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid hsl(var(--topic-hue, 210) 42% 88%);
  border-radius: 999px;
  background: hsl(var(--topic-hue, 210) 76% 96%);
  padding: 0 10px;
  color: hsl(var(--topic-hue, 210) 48% 30%);
  font-size: 0.78rem;
  font-weight: 700;
}

.chapter-drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  display: grid;
  justify-items: end;
  pointer-events: none;
}

.chapter-toggle,
.chapter-drawer-panel {
  pointer-events: auto;
}

.chapter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.68);
  padding: 0 12px;
  color: white;
  font-size: 0.78rem;
  font-weight: 750;
  backdrop-filter: blur(12px);
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.chapter-toggle:hover,
.chapter-drawer.open .chapter-toggle {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(10, 10, 10, 0.82);
}

#chapter-count {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.chapter-drawer-panel {
  width: min(310px, calc(100vw - 48px));
  max-height: min(58vh, 360px);
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(10, 10, 10, 0.76);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.26);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  backdrop-filter: blur(18px);
}

.chapter-drawer.open .chapter-drawer-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.chapter-list {
  display: grid;
  gap: 4px;
  max-height: inherit;
  overflow: auto;
  padding: 8px;
}

.chapter-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.chapter-item:not(:disabled) {
  cursor: pointer;
}

.chapter-item:not(:disabled):hover,
.chapter-item.active {
  background: rgba(255, 255, 255, 0.12);
}

.chapter-item:disabled {
  opacity: 0.55;
}

.chapter-time {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.chapter-title {
  min-width: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.chapter-item.active .chapter-title {
  color: white;
}

.chapter-empty {
  padding: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.84rem;
  line-height: 1.45;
}

.video-shell .plyr__progress {
  position: relative;
}

.chapter-markers {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0;
  pointer-events: none;
  z-index: 3;
}

.chapter-marker {
  position: absolute;
  width: 2px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
  transform: translate(-1px, -6px);
}

@media (max-width: 640px) {
  .chapter-drawer {
    top: 8px;
    right: 8px;
  }

  .chapter-drawer-panel {
    width: calc(100vw - 32px);
    max-height: 48vh;
  }
}

@keyframes library-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .library-grid .video-card {
    animation: none;
  }
}

@media (min-width: 1100px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }
}

/* ---------- Dev mode cards ---------- */

.dev-metric {
  border: 1px solid rgb(229 229 229);
  border-radius: 14px;
  background: white;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dev-metric-label {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  font-weight: 700;
}

.dev-metric-value {
  margin-top: 6px;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: rgb(10 10 10);
  line-height: 1.05;
}

.dev-metric-sub {
  margin-top: 6px;
  font-size: 0.72rem;
  color: rgb(115 115 115);
}

.dev-card {
  border: 1px solid rgb(229 229 229);
  border-radius: 14px;
  background: white;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dev-card-label {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(115 115 115);
  font-weight: 700;
}

/* ---------- Quiz loading state ---------- */

.quiz-loading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  border: 1px solid rgb(229 229 229);
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.quiz-loading-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

.quiz-loading-spinner span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  border-top-color: rgb(23 23 23);
  animation: spin 1.1s linear infinite;
}

.quiz-loading-spinner span:nth-child(2) {
  inset: 6px;
  border-top-color: rgba(23, 23, 23, 0.55);
  animation-duration: 1.4s;
}

.quiz-loading-spinner span:nth-child(3) {
  inset: 12px;
  border-top-color: rgba(23, 23, 23, 0.3);
  animation-duration: 1.7s;
}

.quiz-loading-spinner span:nth-child(4) {
  inset: 18px;
  border-top-color: rgba(23, 23, 23, 0.15);
  animation-duration: 2s;
}

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

/* ---------- Onboarding: feedback demo card (slide 5) ---------- */

.demo-survey {
  display: grid;
  align-content: center;
  gap: 14px;
  height: 100%;
}

.demo-survey .qline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgb(229 229 229);
  border-radius: 12px;
  background: white;
  font-size: 0.92rem;
  color: rgb(64 64 64);
}

.demo-survey .qline .dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1.5px solid rgb(212 212 212);
  flex-shrink: 0;
  position: relative;
}

.demo-survey .qline .dot.full {
  background: rgb(10 10 10);
  border-color: rgb(10 10 10);
}

.demo-survey .qline .dot.full::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: white;
}

.demo-survey .qline .dot.half {
  background: linear-gradient(180deg, rgb(10 10 10) 50%, white 50%);
  border-color: rgb(10 10 10);
}

/* ---------- Trial checkbox ---------- */

.survey-form .trial-fieldset {
  background: rgb(248 250 252);
  box-shadow: inset 0 0 0 1px rgb(212 212 212);
}

.trial-checkbox {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  cursor: pointer;
}

.trial-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.trial-box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgb(163 163 163);
  background: white;
  margin-top: 2px;
  transition: all 160ms ease;
}

.trial-checkbox input:checked + .trial-box {
  background: rgb(23 23 23);
  border-color: rgb(23 23 23);
}

.trial-box::after {
  content: "";
  width: 12px;
  height: 6px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
  transition: opacity 120ms ease;
}

.trial-checkbox input:checked + .trial-box::after {
  opacity: 1;
}

.trial-label {
  display: grid;
  gap: 2px;
}

.trial-title {
  font-weight: 600;
  color: rgb(10 10 10);
  font-size: 0.94rem;
}

.trial-help {
  color: rgb(115 115 115);
  font-size: 0.82rem;
}

/* ---------- Video shell / Plyr ---------- */

.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgb(10 10 10);
  box-shadow:
    0 30px 70px -24px rgba(15, 23, 42, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.video-shell .plyr {
  height: 100%;
  border-radius: 14px;
  background: rgb(10 10 10);
}

.video-shell .plyr__video-wrapper {
  height: 100%;
  background: rgb(10 10 10);
}

.video-shell video {
  object-fit: contain;
}

.video-shell .plyr__controls {
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  padding: 42px 14px 14px;
}

.video-shell .plyr__control--overlaid {
  background: rgba(255, 255, 255, 0.92);
  color: rgb(23 23 23);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.video-shell .plyr__control--overlaid:hover {
  background: white;
  color: rgb(23 23 23);
}

@media (max-width: 720px) {
  .video-shell .plyr__volume {
    display: none;
  }
}

/* ---------- Survey ---------- */

.survey-form {
  display: grid;
  gap: 16px;
}

.survey-form fieldset {
  display: grid;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: white;
  min-inline-size: 0;
  padding: 20px;
  padding-top: 18px;
  box-shadow:
    inset 0 0 0 1px rgb(229 229 229),
    0 1px 2px rgba(15, 23, 42, 0.04);
}

.survey-form legend {
  display: table;
  float: left;
  width: 100%;
  margin-bottom: 4px;
  padding: 0;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.4;
  color: rgb(23 23 23);
  white-space: normal;
}

.survey-form legend + * {
  clear: both;
}

.survey-form label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: rgb(64 64 64);
  font-size: 0.92rem;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 8px;
  transition: background 160ms ease;
}

.survey-form label:hover {
  background: rgb(248 248 248);
}

.survey-form input[type="radio"],
.survey-form input[type="checkbox"] {
  accent-color: rgb(23 23 23);
}

.survey-form .other-field {
  display: grid;
  grid-template-columns: auto auto minmax(120px, 1fr);
}

/* ---------- Results celebration ---------- */

.results-celebration {
  animation: results-pop 600ms var(--ease-out) both;
}

@keyframes results-pop {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-10deg);
  }
  60% {
    transform: scale(1.15) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ---------- Improved focus ring ---------- */

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid rgb(23 23 23);
  outline-offset: 2px;
}

.field:focus-visible {
  outline: none;
}

/* ---------- Better disabled state ---------- */

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Smooth card entrance for library ---------- */

.library-grid .video-card {
  animation-delay: calc(var(--card-index, 0) * 50ms);
}

/* ---------- Quiz page header back link ---------- */

.quiz-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: rgb(163 163 163);
  transition: color 160ms ease;
}

.quiz-back-link:hover {
  color: rgb(23 23 23);
}

/* Keep the landing page and walkthrough usable on short and narrow screens. */
.onboarding-slide > *, .page-shell > * { min-width: 0; }
.onboarding-slide .walkthrough-stage { align-self: center; }
.onboarding-slide .demo-window-video { aspect-ratio: 1436 / 1080; }
#obRoot .walkthrough-body-simple { aspect-ratio: 1436 / 1080; }
.onboarding-slide .walkthrough-stage { max-width: 900px; }
@media (min-width: 900px) {
  .onboarding-slide { align-content: center; }
}
@media (max-width: 480px) {
  .onboarding-controls { left: 16px; right: 16px; gap: 8px; bottom: 16px; }
  .onboarding-dots { gap: 2px; padding: 6px; }
  .onboarding-controls .btn-primary, .onboarding-controls .btn-secondary { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
