:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1d1b19;
  --muted: #6b645c;
  --line: #e4ddd2;
  --brass: #a8792b;
  --brass-dark: #8a621f;
  --red: #b3261e;
  --good: #1f7a45;
  --good-bg: #e8f5ec;
  --bad: #b3261e;
  --bad-bg: #fbeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.modal-open { overflow: hidden; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 14px; }
.team { color: #d8c49c; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }

/* Intro */
.intro { padding: 40px 0 24px; }
.eyebrow { margin: 0 0 6px; color: var(--red); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0 0 8px; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; }
.lede { margin: 0; color: var(--muted); font-size: 18px; max-width: 60ch; }

/* Video */
.player { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.player video { display: block; width: 100%; max-height: 70vh; background: #000; }

/* Action buttons */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 48px; }
@media (max-width: 640px) { .actions { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 14px 20px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: left; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .option:focus-visible, .close:focus-visible, .link:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

.actions .btn { justify-content: flex-start; padding: 18px 20px; box-shadow: var(--shadow); }
.actions .btn strong { display: block; font-size: 17px; }
.actions .btn small { display: block; font-weight: 400; font-size: 14px; opacity: .8; }

.btn-step {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  font-weight: 700; font-size: 15px;
}

.btn-primary { background: var(--brass); color: #fff; }
.btn-primary:hover { background: var(--brass-dark); }
.btn-primary .btn-step { background: rgba(255,255,255,.2); }

.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--brass); }
.btn-secondary .btn-step { background: var(--bg); color: var(--brass-dark); }

.footer { color: var(--muted); font-size: 13px; padding-bottom: 32px; }

/* Dialogs */
.modal {
  border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
.modal::backdrop { background: rgba(20,18,16,.6); }
.modal[open] { display: flex; flex-direction: column; }
.modal-guide { width: min(1000px, calc(100vw - 32px)); height: calc(100vh - 32px); }

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head-actions { display: flex; align-items: center; gap: 16px; }
.link { color: var(--brass-dark); font-weight: 600; font-size: 14px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.close {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.close:hover { background: var(--line); }

.guide-frame { flex: 1; width: 100%; border: 0; background: #525659; }

/* Quiz */
.quiz-body { padding: 20px 24px 24px; overflow-y: auto; }
.progress { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress-bar { height: 100%; background: var(--brass); transition: width .25s; }
.q-count { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.q-text { margin: 0 0 16px; font-size: 20px; line-height: 1.35; }

.options { display: grid; gap: 10px; }
.option {
  width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.option:hover:not(:disabled) { border-color: var(--brass); }
.option:disabled { cursor: default; }
.option.is-correct { border-color: var(--good); background: var(--good-bg); }
.option.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.option:disabled:not(.is-correct):not(.is-wrong) { opacity: .55; }

.feedback { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; font-size: 15px; }
.feedback.good { background: var(--good-bg); color: #164d2d; }
.feedback.bad { background: var(--bad-bg); color: #7a1a14; }
.next { margin-top: 16px; width: 100%; }

.result { text-align: center; padding: 8px 0 16px; }
.result-score { margin: 0; font-size: 48px; font-weight: 800; color: var(--brass-dark); }
.result-msg { margin: 4px 0 0; color: var(--muted); }
.review-title { font-size: 16px; margin: 8px 0 8px; }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.review li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.review p { margin: 0; }
.review-q { font-weight: 600; }
.review-a { color: var(--good); margin-top: 4px !important; }
.review-why { color: var(--muted); font-size: 14px; margin-top: 4px !important; }
.result-actions { display: flex; gap: 12px; margin-top: 20px; }
.result-actions .btn { flex: 1; justify-content: center; }

@media (max-width: 640px) {
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .quiz-body { padding: 16px; }
  .q-text { font-size: 18px; }
}
