/* Move safely: quest look. Purple ramp, chunky buttons, levels and points. */
:root {
  --q-50: #eeedfe;
  --q-100: #cecbf6;
  --q-200: #afa9ec;
  --q-400: #7f77dd;
  --q-600: #534ab7;
  --q-800: #3c3489;
  --q-900: #26215c;
  --ink: #26215c;
  --muted: #4a4470;
  --card: #ffffff;
  --good: #27500a;
  --good-bg: #eaf3de;
  --good-line: #639922;
  --bad: #791f1f;
  --bad-bg: #fcebeb;
  --bad-line: #e24b4a;
  --note: #633806;
  --note-bg: #faeeda;
  --focus: #e24b4a;
  --radius: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--q-50);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 24px;
}

a { color: var(--q-600); }

/* Big, obvious focus ring for keyboard users */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--q-900);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  z-index: 10;
}
.skip:focus { left: 16px; }

/* Header: course name, points, progress bar */
.top {
  width: 100%;
  max-width: 640px;
  padding: 18px 0 8px;
}
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.course-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--q-900);
  text-decoration: none;
}
.points {
  background: var(--card);
  border: 2px solid var(--q-200);
  border-radius: 999px;
  padding: 3px 14px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--q-800);
  white-space: nowrap;
}
.points.bump { animation: bump 0.4s ease; }
@keyframes bump { 50% { transform: scale(1.15); } }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--q-800);
  margin-bottom: 6px;
}
.progress-track {
  height: 14px;
  background: var(--q-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--q-600);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* The lesson card */
.screen {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 2px solid var(--q-100);
  border-bottom-width: 6px;
  border-radius: var(--radius);
  padding: 24px 22px 20px;
  margin-top: 12px;
}
.screen:focus { outline: none; }
.screen:focus-visible { outline: 3px solid var(--focus); }

.level-tag {
  display: inline-block;
  background: var(--q-50);
  color: var(--q-800);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 8px;
}
.screen h1 {
  font-size: 1.7rem;
  line-height: 1.2;
  font-weight: 800;
  margin: 10px 0 14px;
  color: var(--q-900);
}
.screen p { margin: 0 0 14px; }
.screen ul { margin: 0 0 16px; padding-left: 1.2em; }
.screen li { margin-bottom: 6px; }
.screen li::marker { color: var(--q-600); }

/* Callouts */
.callout {
  display: flex;
  gap: 12px;
  background: var(--q-50);
  border: 2px solid var(--q-100);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.callout.note { background: var(--note-bg); border-color: #fac775; color: var(--note); }
.callout .icon { flex: none; color: var(--q-600); margin-top: 3px; }
.callout.note .icon { color: var(--note); }
.callout h2 { font-size: 1.05rem; margin: 0 0 4px; font-weight: 800; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }

/* Flip cards */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.flip {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  min-height: 150px;
  border-radius: 14px;
}
.flip-inner {
  display: grid;
  height: 100%;
  transition: transform 0.45s ease;
  transform-style: preserve-3d;
}
.flip[aria-pressed='true'] .flip-inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.face.front {
  background: var(--card);
  border: 2px solid var(--q-600);
  border-bottom-width: 6px;
}
.face.back {
  background: var(--q-600);
  color: #fff;
  border: 2px solid var(--q-800);
  border-bottom-width: 6px;
  transform: rotateY(180deg);
  font-size: 1rem;
  line-height: 1.5;
}
.face .num { font-weight: 800; font-size: 0.85rem; color: var(--q-600); }
.face strong { font-size: 1.15rem; font-weight: 800; line-height: 1.25; }
.face .hint { font-size: 0.85rem; font-weight: 700; color: var(--q-600); display: flex; align-items: center; gap: 6px; }
.face.back .hint { color: var(--q-100); }
.flip-count { font-size: 0.9rem; font-weight: 700; color: var(--muted); margin: 6px 0 0; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0 0 16px; counter-reset: step; }
.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.steps .n {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--q-600);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  border-bottom: 3px solid var(--q-900);
}
.steps strong { display: block; font-weight: 800; }

/* Choices (scenario and quiz) */
.situation {
  background: var(--q-50);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 700;
}
.choices { display: grid; gap: 10px; margin-bottom: 14px; }
.choice {
  appearance: none;
  font: inherit;
  font-size: 1rem;
  text-align: left;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--q-200);
  border-bottom-width: 5px;
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 52px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.choice:hover { border-color: var(--q-400); }
.choice .letter {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--q-50);
  color: var(--q-800);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}
.choice.right { border-color: var(--good-line); background: var(--good-bg); color: var(--good); }
.choice.wrong { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.choice[aria-disabled='true'] { cursor: default; }
.choice.dim { opacity: 0.6; }

.feedback {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  font-weight: 700;
}
.feedback:empty { display: none; }
.feedback.good { background: var(--good-bg); color: var(--good); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback svg { flex: none; margin-top: 3px; }

.question { border: 0; padding: 0; margin: 0 0 22px; }
.question legend { font-weight: 800; font-size: 1.1rem; margin-bottom: 10px; padding: 0; }
.q-count { font-size: 0.85rem; font-weight: 700; color: var(--muted); display: block; }

/* Results */
.score {
  text-align: center;
  background: var(--q-50);
  border-radius: 14px;
  padding: 20px 16px;
  margin-bottom: 18px;
}
.score .big { font-size: 2.6rem; font-weight: 800; color: var(--q-600); line-height: 1.1; }
.score .of { font-weight: 700; color: var(--muted); }
.badge-row { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge {
  background: var(--card);
  border: 2px solid var(--q-200);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--q-800);
}

/* Sources under each screen */
.sources {
  border-top: 2px dashed var(--q-100);
  margin-top: 18px;
  padding-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.sources ul { list-style: none; padding: 0; margin: 4px 0 0; }
.sources li { margin: 0 0 2px; }

/* Back and next */
.section-nav {
  width: 100%;
  max-width: 640px;
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.btn {
  appearance: none;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  border-radius: 14px;
  min-height: 52px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(3px); }
.btn.primary {
  flex: 2;
  background: var(--q-600);
  color: #fff;
  border: 0;
  border-bottom: 5px solid var(--q-900);
}
.btn.primary:hover { background: var(--q-800); }
.btn.secondary {
  flex: 1;
  background: var(--card);
  color: var(--q-800);
  border: 2px solid var(--q-200);
  border-bottom-width: 5px;
}
.btn.secondary:hover { border-color: var(--q-400); }
.btn[aria-disabled='true'] {
  background: var(--q-100);
  color: var(--q-800);
  border-bottom-color: var(--q-200);
  cursor: not-allowed;
}
.nav-hint {
  width: 100%;
  max-width: 640px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin: 8px 0 0;
  min-height: 1.4em;
}

.foot {
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  .screen { padding: 20px 16px 16px; }
  .screen h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
