:root {
  --ink: #14213d;
  --muted: #62708a;
  --paper: #f6f7f3;
  --white: #ffffff;
  --line: #dfe4ea;
  --blue: #1f6feb;
  --navy: #0b1f3a;
  --gold: #f2b544;
  --coral: #f26b5e;
  --green: #1f9d71;
  --shadow: 0 18px 60px rgba(19, 33, 61, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(20,33,61,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,33,61,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: "DM Sans", system-ui, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20,33,61,.1);
  background: rgba(246,247,243,.88);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { position: relative; width: 34px; height: 28px; display: inline-block; }
.brand-mark i { position: absolute; display: block; height: 3px; background: var(--blue); transform-origin: left center; border-radius: 2px; }
.brand-mark i:nth-child(1) { width: 31px; left: 2px; bottom: 2px; }
.brand-mark i:nth-child(2) { width: 31px; left: 3px; bottom: 3px; transform: rotate(-55deg); }
.brand-mark i:nth-child(3) { width: 31px; right: 2px; bottom: 2px; transform: rotate(55deg); transform-origin: right center; }
.status-pill { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; background: var(--white); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(44px, 7vw, 84px) 0 96px; }
h1, h2 { font-family: "Space Grotesk", sans-serif; letter-spacing: -.035em; }
h1 { font-size: clamp(36px, 5.3vw, 68px); line-height: 1.02; margin: 8px 0 20px; max-width: 900px; }
h2 { font-size: 24px; margin: 12px 0; }
p { line-height: 1.62; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; }
.lede { max-width: 760px; font-size: clamp(17px, 2vw, 21px); color: var(--muted); }
.study-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin: 34px 0 12px; }
.study-overview div { display: grid; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.82); box-shadow: 0 8px 26px rgba(19,33,61,.06); }
.study-overview strong { font-family: "Space Grotesk", sans-serif; color: var(--blue); font-size: 26px; line-height: 1; }
.study-overview span { color: var(--muted); font-size: 13px; font-weight: 600; }
.id-entry-card { max-width: 760px; margin-top: 28px; padding: clamp(22px, 4vw, 32px); border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.id-entry-card label { display: block; margin-bottom: 10px; font-family: "Space Grotesk", sans-serif; font-size: 18px; font-weight: 700; }
.entry-field { margin-bottom: 22px; }
.id-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.id-entry-card input { width: 100%; min-width: 0; padding: 14px 16px; border: 1px solid #b8c2d0; border-radius: 10px; color: var(--ink); background: #fbfcfe; font-size: 17px; font-weight: 600; }
#participantIdInput { font-size: 18px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.id-entry-card input:focus { outline: 3px solid rgba(31,111,235,.2); border-color: var(--blue); }
.id-entry-card input.invalid { border-color: var(--coral); background: #fff8f7; }
.id-help, .id-error { margin: 10px 0 0; font-size: 13px; }
.id-help { color: var(--muted); }
.id-error { min-height: 21px; color: #b43d31; font-weight: 700; }

.participant-shell { max-width: 1020px; margin: 0 auto; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: clamp(24px, 5vw, 54px); }
.study-workspace { display: grid; grid-template-columns: 1fr; gap: 18px; }
.study-workspace .panel { padding: clamp(24px, 4vw, 46px); }
.study-workspace .video-panel h1, .study-workspace .exam-panel h1 { font-size: clamp(34px, 5vw, 54px); }
.quiz-dropdown { width: 100%; }
.quiz-dropdown > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; border: 1px solid var(--line); border-radius: 16px; color: var(--white); background: var(--navy); box-shadow: var(--shadow); cursor: pointer; list-style: none; }
.quiz-dropdown > summary::-webkit-details-marker { display: none; }
.quiz-dropdown > summary:hover { background: #102b4e; }
.quiz-summary-copy { display: grid; gap: 3px; }
.quiz-summary-copy small { color: #a9bdd7; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.quiz-summary-copy strong { font-family: "Space Grotesk", sans-serif; font-size: clamp(20px, 3vw, 28px); }
.quiz-summary-actions { display: flex; align-items: center; gap: 14px; }
.quiz-progress-badge { padding: 7px 11px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #d6e3f2; font-size: 12px; font-weight: 700; white-space: nowrap; }
.dropdown-arrow { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; font-size: 28px; transition: transform .2s ease; }
.quiz-dropdown[open] .dropdown-arrow { transform: rotate(180deg); }
.quiz-dropdown[open] > summary { border-radius: 16px 16px 8px 8px; }
.quiz-dropdown .exam-panel { margin-top: 12px; }
.intro-panel h1, .video-panel h1, .exam-panel h1, .result-panel h1 { font-size: clamp(34px, 5vw, 54px); }
.instruction-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 34px 0; }
.instruction-row div { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.instruction-row span { font-family: "Space Grotesk"; color: var(--blue); font-weight: 700; }
.instruction-row p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.check-row { display: flex; align-items: flex-start; gap: 11px; padding: 16px 0; }
.check-row input { width: 20px; height: 20px; accent-color: var(--blue); }
.primary-button { padding: 14px 24px; border: 0; border-radius: 10px; color: white; background: var(--blue); font-weight: 800; box-shadow: 0 8px 18px rgba(31,111,235,.22); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: #155fcf; }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.primary-button:focus-visible, .pause-button:focus-visible, .quiz-dropdown > summary:focus-visible, .choice:has(input:focus-visible) { outline: 3px solid rgba(31,111,235,.38); outline-offset: 3px; }
.study-code { margin-top: 22px; color: var(--muted); font-size: 13px; }

.video-heading, .exam-sticky-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.video-heading h1, .exam-sticky-head h1 { margin-bottom: 8px; }
.time-chip, .timer { white-space: nowrap; padding: 10px 13px; border-radius: 9px; background: var(--navy); color: var(--white); font-family: "Space Grotesk"; font-weight: 700; }
.time-chip small { opacity: .62; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: #e8ebef; margin: 18px 0; }
.progress-track div { width: 0; height: 100%; background: var(--blue); transition: width .25s linear; }
.video-frame-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #07111f; }
#player, #player iframe { width: 100%; height: 100%; }
.video-frame-wrap.locked::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: auto; }
.play-instruction { margin: 0 0 10px; color: var(--muted); font-size: 14px; font-weight: 700; }
.caption-overlay { position: absolute; z-index: 4; left: 7%; right: 7%; bottom: 7%; text-align: center; pointer-events: none; }
.caption-overlay .caption-box { display: inline; padding: .14em .36em .2em; color: white; background: rgba(0,0,0,.82); box-decoration-break: clone; -webkit-box-decoration-break: clone; font-size: clamp(17px, 2.25vw, 29px); line-height: 1.42; font-weight: 600; text-shadow: 0 1px 2px #000; }
.caption-overlay.keyword .caption-box { background: rgba(7,17,31,.9); }
.caption-overlay mark { padding: 0 .08em; color: #ffe06a; background: transparent; font-weight: 800; }
.caption-overlay.chunked .caption-box { font-size: clamp(21px, 2.8vw, 34px); background: rgba(11,31,58,.92); }
.playback-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.pause-button { min-width: 118px; padding: 11px 18px; border: 1px solid var(--ink); border-radius: 9px; color: var(--ink); background: var(--white); font-weight: 800; }
.pause-button:hover:not(:disabled) { color: var(--white); background: var(--ink); }
.pause-button:disabled { opacity: .45; cursor: not-allowed; }
.pause-button span:first-child { display: inline-block; width: 18px; margin-right: 6px; }
.playback-status { color: var(--muted); font-size: 14px; }
.video-credit { color: var(--muted); font-size: 13px; }

.exam-directions { margin-bottom: 32px; color: var(--muted); }
.answer-progress { margin: 0 0 30px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9fc; }
.answer-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.answer-progress-copy strong { color: var(--ink); }
.answer-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e4e9f0; }
.answer-progress-track div { width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .2s ease; }
.question-card { margin: 0 0 22px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; }
.question-card.invalid { border-color: var(--coral); background: #fff8f7; }
.question-title { margin: 0 0 16px; font-size: 17px; font-weight: 700; line-height: 1.45; }
.question-number { color: var(--blue); margin-right: 7px; }
.choice { display: flex; gap: 11px; align-items: flex-start; margin: 9px 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.choice:hover { background: #f2f6fb; }
.choice:has(input:checked) { color: #0c4da2; background: #eaf3ff; box-shadow: inset 0 0 0 1px #b9d5fb; }
.choice input { margin-top: 3px; accent-color: var(--blue); }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 10px; }
#unansweredMessage { color: #b43d31; font-weight: 700; }
.result-panel { text-align: center; padding-top: 76px; padding-bottom: 76px; }
.result-panel h1 { margin-left: auto; margin-right: auto; }
.result-panel p { max-width: 630px; margin-left: auto; margin-right: auto; color: var(--muted); }
.result-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 50%; color: white; background: var(--green); font-size: 30px; font-weight: 800; }
.score-text { font-size: 21px; color: var(--ink) !important; font-weight: 700; }
@media (max-width: 780px) {
  .instruction-row { grid-template-columns: 1fr; }
  .study-overview { grid-template-columns: 1fr; }
  .id-input-row { grid-template-columns: 1fr; }
  .id-input-row .primary-button { width: 100%; }
  .status-pill { display: none; }
  .video-heading, .exam-sticky-head { flex-direction: column; }
  .exam-sticky-head { position: static; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row .primary-button { width: 100%; }
  .playback-controls { align-items: flex-start; flex-direction: column; }
  .quiz-progress-badge { display: none; }
  .quiz-dropdown > summary { padding: 18px 20px; }
  .panel, .study-workspace .panel { padding: 22px 18px; border-radius: 16px; }
  main { width: min(100% - 20px, 1180px); padding-top: 26px; }
  .question-card { padding: 19px 15px; }
  .choice { padding: 12px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
