:root {
  --bg: #070b14;
  --bg-elev: #0c1220;
  --card: #121a2b;
  --line: rgba(148, 163, 184, 0.16);
  --text: #f4f7fb;
  --muted: #9aa8bc;
  --blue: #4c7dff;
  --blue-2: #3b6fff;
  --blue-soft: rgba(76, 125, 255, 0.16);
  --rose: #fb7185;
  --rose-bg: rgba(127, 29, 29, 0.45);
  --green: #34d399;
  --amber: #fbbf24;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --touch: 52px;
  --primary-h: 64px;
  --font: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(76, 125, 255, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 23, 42, 0.9), transparent 50%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  background: var(--blue);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
}

.shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 40px;
}

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

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #1e2a44, #10182a);
  border: 1px solid var(--line);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 11px;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.where {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.where .lesson {
  font-size: 16px;
  font-weight: 700;
}

.where .step {
  color: var(--muted);
  font-size: 13px;
}

.review-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--amber);
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;
}

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

.step-btn {
  min-height: var(--touch);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.step-btn .n {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

.step-btn .l {
  font-size: 11px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-btn.done {
  border-color: rgba(52, 211, 153, 0.4);
}

.step-btn.now {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.18);
}

.step-btn.locked {
  opacity: 0.45;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.player-card,
.side-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.player-wrap {
  position: relative;
  background: #05070d;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.player-wrap video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: contain;
}

.lower-third {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 16px;
  bottom: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  pointer-events: none;
}

.chip {
  pointer-events: none;
  background: rgba(7, 11, 20, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.caption {
  background: rgba(7, 11, 20, 0.96);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  min-height: 48px;
}

.error-cover,
.big-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 13, 0.55);
}

.error-cover {
  z-index: 6;
  background: rgba(5, 7, 13, 0.88);
}

.big-play {
  z-index: 3;
}

.error-box {
  width: min(420px, 100%);
  background: #121a2b;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
}

.error-box .primary,
.error-box .secondary {
  width: 100%;
}

.error-box p {
  margin: 0 0 16px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.error-box h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.ctrl {
  min-height: 44px;
  min-width: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 650;
}

.ctrl.on {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.fs-ctrl {
  font-weight: 800;
  padding: 8px 14px;
}

.fs-exit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  min-height: 48px;
  min-width: 160px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #5b8aff, var(--blue-2));
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(5, 7, 13, 0.45);
}

.stage {
  display: grid;
  gap: 16px;
}

#player-stage:fullscreen,
#player-stage:-webkit-full-screen,
body.is-theater #player-stage {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  box-sizing: border-box;
  padding: 12px 16px 16px;
  background: var(--bg);
}

body.is-theater {
  overflow: hidden;
}

body.is-theater #player-stage {
  position: fixed;
  inset: 0;
  z-index: 40;
}

#player-stage:fullscreen .layout,
#player-stage:-webkit-full-screen .layout,
body.is-theater .layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

#player-stage:fullscreen .player-card,
#player-stage:-webkit-full-screen .player-card,
body.is-theater .player-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#player-stage:fullscreen .player-wrap,
#player-stage:-webkit-full-screen .player-wrap,
body.is-theater .player-wrap {
  flex: 1;
  min-height: 0;
}

#player-stage:fullscreen .player-wrap video,
#player-stage:-webkit-full-screen .player-wrap video,
body.is-theater .player-wrap video {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

#player-stage:fullscreen .caption,
#player-stage:-webkit-full-screen .caption,
body.is-theater .caption,
#player-stage:fullscreen .controls,
#player-stage:-webkit-full-screen .controls,
body.is-theater .controls {
  flex: 0 0 auto;
}

#player-stage:fullscreen .controls,
#player-stage:-webkit-full-screen .controls,
body.is-theater .controls {
  background: var(--card);
}

#player-stage:fullscreen .primary-bar,
#player-stage:-webkit-full-screen .primary-bar,
body.is-theater .primary-bar {
  flex: 0 0 auto;
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  z-index: 9;
  background: var(--bg);
}

.seek {
  flex: 1;
  min-width: 140px;
  display: grid;
  gap: 4px;
}

.seek input[type="range"],
.vol input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  height: 28px;
}

.time {
  color: var(--muted);
  font-size: 12px;
}

.vol {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.side-card {
  padding: 20px;
  min-height: 280px;
}

.kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.side-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

.goal,
.help {
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.45;
}

.takeaways {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.takeaways li {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.4;
}

.takeaways li::before {
  content: "✓ ";
  color: var(--green);
  font-weight: 800;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-options label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 14px;
  padding: 14px;
  min-height: var(--touch);
}

.quiz-options label:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.quiz-options input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--blue);
}

.feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.feedback.good {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.08);
}

.feedback.bad {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.08);
}

.primary-bar {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.primary {
  min-height: var(--primary-h);
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #5b8aff, var(--blue-2));
  color: white;
  font-size: 20px;
  font-weight: 800;
  padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(59, 111, 255, 0.35);
}

.primary:disabled {
  background: #243044;
  color: #7b8798;
  box-shadow: none;
}

.secondary {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  padding: 12px 16px;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.lock-toast {
  margin: 8px 0 0;
  color: var(--amber);
  text-align: center;
  font-weight: 650;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.78);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.modal ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.modal .primary {
  width: 100%;
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 18px;
  color: var(--muted);
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
}

.done-screen {
  text-align: center;
  padding: 28px 12px 12px;
}

.done-screen h2 {
  font-size: 34px;
  margin: 0 0 8px;
}

.done-screen .lead {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 20px;
}

.learned {
  text-align: left;
  width: min(640px, 100%);
  margin: 0 auto 24px;
}

.noscript {
  padding: 24px;
  font-size: 20px;
}

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

  .where {
    align-items: flex-start;
    text-align: left;
  }

  .steps {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .step-btn .l {
    display: none;
  }

  .brand h1 {
    font-size: 13px;
  }

  .primary {
    font-size: 18px;
  }

  .caption {
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 16px, 1180px);
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .vol,
  .seek,
  .fs-ctrl {
    width: 100%;
  }

  .fs-exit {
    min-width: 0;
    width: auto;
    font-size: 15px;
  }
}
