/* =====================================================
   CPR TRAINING MODULE — DESIGN SYSTEM
   Matches Figma: EZSCmviGdkyMIRSAHVG1jw
   ===================================================== */

/* ─── CUSTOM PROPERTIES ─────────────────────────────── */
:root {
  --blue-primary:    #276aff;
  --blue-medium:     #709dff;
  --blue-drop:       rgba(112, 157, 255, 0.45);
  --blue-x-bg:       #b1c5ff;
  --blue-x-text:     #0055af;
  --gray-progress:   #d9d9d9;
  --red-critical:    #bc1919;
  --white:           #ffffff;
  --black:           #000000;
  --radius:          14px;
  --font:            'Inter', sans-serif;
}

/* ─── RESET / BASE ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  overflow: hidden;
}

/* ─── APP SHELL ──────────────────────────────────────── */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ─── SCREEN BASE ────────────────────────────────────── */
.screen {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--white);
  overflow-y: auto;
}
.screen.active { display: block; }

/* ─── X / CLOSE BUTTON ───────────────────────────────── */
.x-btn {
  position: absolute;
  top: 32px;
  left: 32px;
  width: 70px;
  height: 72px;
  background: var(--blue-x-bg);
  border: none;
  border-radius: var(--radius);
  color: var(--blue-x-text);
  font-family: var(--font);
  font-size: 40px;
  font-weight: 500;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.x-btn:hover { opacity: .85; }

/* ─── PROGRESS BAR ───────────────────────────────────── */
.progress-bar-wrap {
  position: absolute;
  top: 53px;
  left: 120px;
  right: 32px;
  height: 32px;
  background: var(--gray-progress);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--blue-primary);
  border-radius: var(--radius);
  transition: width .4s ease;
}

/* ─── LESSON SCREENS ─────────────────────────────────── */

.lesson-body {
  position: absolute;
  top: 140px;
  left: 32px;
  right: 32px;
  bottom: 100px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
}

.lesson-left {
  flex: 0 0 auto;
  width: 466px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20px;
}

.lesson-img {
  width: 466px;
  height: 679px;
  object-fit: cover;
  border-radius: var(--radius);
}

.lesson-divider {
  flex: 0 0 1px;
  align-self: stretch;
  background: #709dff;
  margin: 20px 40px 0 40px;
  opacity: .6;
}

.lesson-right {
  flex: 1 1 0;
  padding-top: 20px;
}

.lesson-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.44px;
  margin-bottom: 32px;
  text-align: left;
}

.lesson-body-text {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.22px;
  max-width: 558px;
}
.lesson-body-text p { margin-bottom: 16px; }
.lesson-body-text p:last-child { margin-bottom: 0; }

.text-link {
  color: var(--blue-primary);
  text-decoration: none;
}
.text-link:hover { text-decoration: underline; }

.critical-fail {
  color: var(--red-critical);
  font-weight: 700;
}

/* ─── NAVIGATION BAR ─────────────────────────────────── */
.nav-bar {
  position: absolute;
  bottom: 60px;         /* Figma: arrow bottom = y(902)+h(62)=964, screen=1024 → 60px gap */
  left: 791px;          /* Figma: left arrow x=791 on 1440px screen */
  width: 466px;         /* Figma: total nav group width (791→1257) */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;            /* Figma: 60px gap between each arrow and counter box */
}

.nav-arrow {
  width: 61px;
  height: 62px;
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--black);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: background .15s;
}
.nav-arrow:hover { background: #f0f4ff; }

.nav-counter {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.44px;
  min-width: 224px;     /* Figma: counter box width = 224px */
  text-align: center;
}

/* ─── TITLE PAGE ─────────────────────────────────────── */
/* Figma canvas: 1440×1024px — all vertical values in vh so nothing overflows */
#screen-title { overflow: hidden; }

#screen-title .x-btn {
  left: calc(4.17% + 27px);   /* Figma: x≈87px on 1440px */
  top: 3.22vh;                /* Figma: 33px ÷ 1024 */
}

.title-heading {
  position: absolute;
  top: 3.81vh;                /* Figma: 39px ÷ 1024 */
  left: 0;
  right: 0;
  font-size: clamp(22px, 3.9vh, 40px);
  font-weight: 700;
  letter-spacing: -0.44px;
  line-height: 1.5;
  text-align: center;
  color: var(--black);
  pointer-events: none;
}

.title-hero-wrap {
  position: absolute;
  top: 15.43vh;               /* Figma: 158px ÷ 1024 */
  left: calc(8.33% + 2px);    /* Figma: x=122px on 1440px */
  right: calc(8.33% + 2px);
  height: 53.32vh;            /* Figma: 546px ÷ 1024 */
  border-radius: var(--radius);
  overflow: hidden;
}

.title-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.title-buttons {
  position: absolute;
  top: 74.51vh;               /* Figma: 763px ÷ 1024 */
  left: calc(8.33% + 2px);
  right: calc(8.33% + 2px);
  height: 10.84vh;            /* Figma: 111px ÷ 1024 */
  display: flex;
  justify-content: space-between;
  align-items: stretch;
}

/* Title-page button overrides (Figma: 446×111px each, 40px text) */
.title-buttons .btn-primary,
.title-buttons .btn-secondary {
  flex: 0 0 37.3%;             /* 446px ÷ 1196px container ≈ 37.3% */
  height: 100%;                /* fill the vh-sized container */
  font-size: clamp(18px, 3.9vh, 40px);
  padding: 0;
  min-width: unset;
}

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn-primary {
  background: var(--blue-primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.35px;
  padding: 0 40px;
  height: 75px;
  min-width: 345px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .9; }

.btn-secondary {
  background: var(--blue-medium);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.35px;
  padding: 0 40px;
  height: 75px;
  min-width: 345px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.btn-secondary:hover { opacity: .9; }

.btn-submit {
  background: var(--blue-primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.35px;
  height: 75px;
  width: 365px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
  margin: 0 auto;
}
.btn-submit:hover { opacity: .9; }

/* ─── CHECK-IN SCREENS ───────────────────────────────── */
.checkin-screen {
  overflow-y: auto;
}

.checkin-inner {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.checkin-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.44px;
  text-align: center;
  margin-bottom: 12px;
}

.checkin-part {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.33px;
}

.checkin-subtitle {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: -0.264px;
  text-align: center;
  margin-bottom: 40px;
}

.checkin-question {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.264px;
  text-align: center;
  margin-bottom: 8px;
  max-width: 739px;
}

.checkin-divider {
  width: 739px;
  height: 2px;
  background: var(--blue-medium);
  margin-bottom: 32px;
  opacity: .7;
}

/* ─── DROP ZONE ──────────────────────────────────────── */
.drop-zone {
  width: 365px;
  height: 123px;
  background: var(--blue-drop);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  transition: background .2s;
  border: 2px dashed transparent;
  position: relative;
}
.drop-zone.drag-over {
  background: rgba(112, 157, 255, 0.65);
  border-color: var(--blue-primary);
}
.drop-zone.has-answer {
  background: var(--blue-medium);
}
.drop-placeholder {
  font-size: 18px;
  font-weight: 300;
  color: var(--blue-x-text);
  opacity: .7;
  pointer-events: none;
}
.drop-zone.has-answer .drop-placeholder { display: none; }
.drop-zone .dropped-tile {
  font-size: 24px;
  font-weight: 500;
  color: var(--white);
  text-align: center;
  padding: 0 16px;
}

/* ─── ANSWER TILES ROW ───────────────────────────────── */
.answer-tiles {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.answer-tile {
  background: var(--blue-medium);
  color: var(--white);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.264px;
  text-align: center;
  width: 310px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  cursor: grab;
  user-select: none;
  transition: opacity .15s, transform .15s;
}
.answer-tile:hover { opacity: .9; transform: scale(1.02); }
.answer-tile.dragging { opacity: .4; cursor: grabbing; }
.answer-tile.used { opacity: 0; pointer-events: none; }

/* ─── FEEDBACK SCREENS ───────────────────────────────── */
.feedback-screen {
  background: var(--white);
}
.feedback-screen.active { display: flex !important; align-items: center; }

.feedback-left {
  flex: 0 0 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 60px;
  gap: 24px;
}

.feedback-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.44px;
  text-align: center;
}

.feedback-divider {
  width: 100%;
  max-width: 460px;
  height: 2px;
  background: var(--blue-medium);
  opacity: .7;
}

.feedback-hint {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.22px;
  max-width: 460px;
  text-align: left;
}

.feedback-btn {
  min-width: 345px;
  height: 81px;
  font-size: 40px;
}

.feedback-right {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100%;
}

.feedback-img {
  max-width: 600px;
  max-height: 585px;
  object-fit: contain;
}

/* JS-built composite illustrations */
.feedback-composite {
  position: relative;
  width: 100%;
  max-width: 600px;
}
.feedback-composite[data-type="good-job"] { aspect-ratio: 598 / 585; }
.feedback-composite[data-type="so-close"] { aspect-ratio: 644 / 649; }

/* ─── QUIZ SCREEN ─────────────────────────────────────── */
.quiz-screen {
  overflow-y: auto;
}

.quiz-inner {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: 96%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-bottom: 40px;
}

.quiz-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.44px;
  text-align: center;
  margin-bottom: 12px;
}

.quiz-subtitle {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: -0.264px;
  text-align: center;
  margin-bottom: 32px;
}

.quiz-columns {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  width: 100%;
  justify-content: center;
  margin-bottom: 32px;
}

/* Quiz drop slots column */
.quiz-drop-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  max-width: 520px;
}

.quiz-slot {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slot-num {
  font-size: 28px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
  color: var(--black);
}

.slot-zone {
  flex: 1;
  height: 80px;
  background: var(--blue-drop);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed transparent;
  transition: background .2s;
  position: relative;
}
.slot-zone.drag-over {
  background: rgba(112, 157, 255, 0.65);
  border-color: var(--blue-primary);
}
.slot-zone.has-answer {
  background: var(--blue-medium);
}
.slot-placeholder {
  font-size: 16px;
  font-weight: 300;
  color: var(--blue-x-text);
  opacity: .7;
  pointer-events: none;
}
.slot-zone.has-answer .slot-placeholder { display: none; }
.slot-zone .dropped-tile {
  font-size: 20px;
  font-weight: 500;
  color: var(--white);
  text-align: center;
  padding: 0 12px;
}

/* Quiz tiles source column */
.quiz-tiles-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  width: 340px;
}

.quiz-tile {
  width: 100%;
  min-height: 80px;
  font-size: 18px;
}

.quiz-submit-btn {
  width: 365px;
  height: 75px;
  font-size: 32px;
}

/* ─── RESULTS SCREEN ──────────────────────────────────── */
.results-screen {
  background: var(--white);
}
.results-screen.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.results-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  max-width: 600px;
}

.results-title {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.56px;
}

.results-score {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.results-message {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.26px;
  max-width: 500px;
}

.results-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── EXIT MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--blue-medium);
  border-radius: var(--radius);
  width: 710px;
  padding: 56px 48px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.modal-title {
  font-size: 51px;
  font-weight: 700;
  letter-spacing: -0.56px;
  color: var(--white);
  text-align: center;
}

.modal-subtitle {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.35px;
  color: var(--white);
  text-align: center;
}

.modal-buttons {
  display: flex;
  gap: 32px;
}

.btn-modal {
  background: var(--blue-primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.35px;
  width: 224px;
  height: 62px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.btn-modal:hover { opacity: .9; }

/* ─── RESPONSIVE ADJUSTMENTS ─────────────────────────── */
@media (max-width: 1100px) {
  .lesson-left { width: 360px; }
  .lesson-img { width: 360px; height: 520px; }
  .lesson-title { font-size: 32px; }
  .lesson-body-text { font-size: 18px; }
  .quiz-columns { flex-direction: column; align-items: center; }
  .quiz-tiles-column { width: 100%; max-width: 520px; flex-direction: row; flex-wrap: wrap; }
  .quiz-tile { width: calc(50% - 6px); }
}

@media (max-width: 768px) {
  .lesson-body { flex-direction: column; top: 160px; }
  .lesson-left { width: 100%; }
  .lesson-img { width: 100%; height: 280px; }
  .lesson-divider { width: 100%; height: 1px; margin: 16px 0; }
  .progress-bar-wrap { left: 80px; }
  /* Restore centered nav on mobile (single-column layout) */
  .nav-bar { left: 0; right: 0; width: auto; bottom: 24px; justify-content: center; gap: 32px; }
  .x-btn { width: 52px; height: 52px; font-size: 28px; top: 20px; left: 16px; }
  .title-hero-wrap { height: 280px; top: 120px; }
  .title-heading { font-size: 28px; top: 20px; }
  .title-buttons { top: 430px; height: auto; flex-direction: column; gap: 12px; align-items: center; }
  .title-buttons .btn-primary, .title-buttons .btn-secondary { flex: none; width: 80%; height: 75px; font-size: 28px; }
  .modal-card { width: 90%; }
  .answer-tile { width: 260px; font-size: 18px; }
}
