/* =========================================================
   The Response Drill
   All styles scoped .drill-*
   Brand chrome stays navy; the drill zone uses an expressive
   palette because engagement requires colour.
   ========================================================= */

.drill {
  max-width: 960px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 40px 90px -60px rgba(1, 36, 86, 0.4);
  position: relative;
  overflow: hidden;
}

.drill-panel {
  padding: 36px;
  position: relative;
}
@media (max-width: 640px) {
  .drill-panel { padding: 22px; }
}

/* --- Terminal tape header ------------------------------------ */
.drill-tape {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin: -36px -36px 30px;
}
@media (max-width: 640px) {
  .drill-tape { margin: -22px -22px 20px; padding: 10px 14px; font-size: 0.66rem; }
}
.drill-tape-inner {
  display: flex; align-items: center; gap: 12px;
}
.drill-tape-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  animation: drillLed 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes drillLed { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .drill-tape-led { animation: none; } }

/* --- Intro screen -------------------------------------------- */
.drill-intro-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 780px) {
  .drill-intro-grid { grid-template-columns: 1fr; }
}
.drill-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 12px;
}
.drill-intro-body h3 {
  font-family: var(--serif);
  font-size: 1.75rem;
  color: var(--navy);
  margin: 0 0 14px;
  line-height: 1.2;
}
.drill-intro-body p {
  color: var(--ink);
  margin: 0 0 24px;
  font-size: 1.02rem;
  line-height: 1.65;
}
.drill-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 30px -18px rgba(1, 36, 86, 0.7);
}
.drill-start:hover { background: var(--navy-700); transform: translateY(-2px); box-shadow: 0 18px 34px -18px rgba(1, 36, 86, 0.8); }
.drill-start:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.drill-fine {
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.drill-intro-hero {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  aspect-ratio: 400 / 220;
}
.drill-intro-hero svg { display: block; width: 100%; height: 100%; }

/* --- Top status row (score / streak / clock) ----------------- */
.drill-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 620px) {
  .drill-topbar { grid-template-columns: 1fr 1fr; }
  .drill-streak-card { grid-column: 1 / -1; }
}
.drill-score-card,
.drill-clock-card,
.drill-streak-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: 6px;
  min-width: 0;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.drill-score-card { flex-direction: column; align-items: flex-start; gap: 4px; }
.drill-clock-card { flex-direction: column; align-items: flex-end; gap: 4px; }
.drill-card-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.drill-card-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--navy);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  position: relative;
}
.drill-clock-card .drill-card-value { font-family: var(--mono); font-size: 1.15rem; }

/* Streak card with animated flame */
.drill-streak-card {
  background: linear-gradient(135deg, #fff8dc 0%, #fed7aa 100%);
  border-color: #ea580c;
  box-shadow: 0 8px 26px -14px rgba(234, 88, 12, 0.6);
  animation: drillStreakGlow 2.4s ease-in-out infinite;
}
@keyframes drillStreakGlow {
  0%, 100% { box-shadow: 0 8px 26px -14px rgba(234, 88, 12, 0.6); }
  50% { box-shadow: 0 12px 32px -12px rgba(234, 88, 12, 0.9); }
}
@media (prefers-reduced-motion: reduce) { .drill-streak-card { animation: none; } }
.drill-flame {
  animation: drillFlameFlicker 1.2s ease-in-out infinite;
}
@keyframes drillFlameFlicker {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) { .drill-flame { animation: none; } }
.drill-streak-body { display: flex; flex-direction: column; gap: 2px; }
.drill-streak-card .drill-card-label { color: #7c2d12; }
.drill-streak-card .drill-card-value { color: #7c2d12; font-family: var(--mono); font-size: 1.35rem; }

/* Score card bump animations */
.drill-score-card.is-bump-up {
  animation: drillBumpUp 0.6s ease-out;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.drill-score-card.is-bump-down {
  animation: drillBumpDown 0.6s ease-out;
  border-color: #e94b4b;
  box-shadow: 0 0 0 3px rgba(233, 75, 75, 0.15);
}
@keyframes drillBumpUp {
  0% { transform: scale(1); }
  40% { transform: scale(1.08) translateY(-3px); }
  100% { transform: scale(1); }
}
@keyframes drillBumpDown {
  0% { transform: scale(1) translateX(0); }
  25% { transform: scale(0.98) translateX(-3px); }
  50% { transform: scale(0.98) translateX(3px); }
  75% { transform: scale(0.98) translateX(-2px); }
  100% { transform: scale(1) translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-score-card.is-bump-up, .drill-score-card.is-bump-down { animation: none; }
}

/* Floating delta bubble */
.drill-score-delta {
  position: absolute;
  right: -6px;
  top: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
}
.drill-score-delta.is-up {
  color: #166534;
  background: rgba(34, 197, 94, 0.18);
  animation: drillDeltaFloatUp 1.2s ease-out forwards;
}
.drill-score-delta.is-down {
  color: #7a1a1a;
  background: rgba(233, 75, 75, 0.18);
  animation: drillDeltaFloatDown 1.2s ease-out forwards;
}
@keyframes drillDeltaFloatUp {
  0%   { opacity: 0; transform: translateY(0) scale(0.6); }
  20%  { opacity: 1; transform: translateY(-8px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-32px) scale(1); }
}
@keyframes drillDeltaFloatDown {
  0%   { opacity: 0; transform: translateY(0) scale(0.6); }
  20%  { opacity: 1; transform: translateY(6px) scale(1.15); }
  100% { opacity: 0; transform: translateY(28px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-score-delta.is-up, .drill-score-delta.is-down { animation: none; opacity: 1; }
}

/* --- Chapter timeline ---------------------------------------- */
.drill-timeline {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
.drill-tl-dot {
  position: relative;
  height: 32px;
  border-radius: 6px;
  background: rgba(1, 36, 86, 0.06);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.drill-tl-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.drill-tl-dot.is-current {
  background: var(--navy);
  border-color: var(--navy);
  transform: scale(1.15);
  animation: drillTlPulse 1.6s ease-in-out infinite;
  z-index: 2;
}
.drill-tl-dot.is-current .drill-tl-num { color: #fff; }
@keyframes drillTlPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(1, 36, 86, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(1, 36, 86, 0); }
}
@media (prefers-reduced-motion: reduce) { .drill-tl-dot.is-current { animation: none; } }
.drill-tl-dot.verdict-correct { background: #22c55e; border-color: #166534; }
.drill-tl-dot.verdict-correct .drill-tl-num { color: #fff; }
.drill-tl-dot.verdict-neutral { background: #94a3b8; border-color: #64748b; }
.drill-tl-dot.verdict-neutral .drill-tl-num { color: #fff; }
.drill-tl-dot.verdict-bad     { background: #f97316; border-color: #7c2d12; }
.drill-tl-dot.verdict-bad     .drill-tl-num { color: #fff; }
.drill-tl-dot.verdict-worst   { background: #e94b4b; border-color: #7a1a1a; }
.drill-tl-dot.verdict-worst   .drill-tl-num { color: #fff; }

/* --- Hero illustration --------------------------------------- */
.drill-hero {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  margin-bottom: 26px;
  aspect-ratio: 400 / 220;
  background: var(--paper-2);
  position: relative;
}
.drill-hero svg { display: block; width: 100%; height: 100%; }
.drill-hero.is-hero-good {
  animation: drillHeroPulseGood 0.9s ease-out;
}
.drill-hero.is-hero-bad {
  animation: drillHeroPulseBad 0.9s ease-out;
}
@keyframes drillHeroPulseGood {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  30%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.6); filter: saturate(1.3); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes drillHeroPulseBad {
  0%   { box-shadow: 0 0 0 0 rgba(233, 75, 75, 0); }
  30%  { box-shadow: 0 0 0 8px rgba(233, 75, 75, 0.65); filter: hue-rotate(-10deg); }
  100% { box-shadow: 0 0 0 0 rgba(233, 75, 75, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-hero.is-hero-good, .drill-hero.is-hero-bad { animation: none; }
}

/* --- Scene text ---------------------------------------------- */
.drill-scene {
  border-left: 3px solid var(--navy);
  padding: 4px 0 4px 20px;
  margin-bottom: 26px;
}
.drill-scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.drill-scene-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.drill-scene-time {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--navy);
  padding: 3px 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.drill-scene-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 14px;
  color: var(--navy);
  line-height: 1.25;
}
.drill-scene-body {
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink);
  margin: 0;
}

/* Speaker chip */
.drill-speaker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 30px;
  margin-bottom: 14px;
}
.drill-speaker-avatar { display: inline-flex; }
.drill-speaker-avatar svg { display: block; }
.drill-speaker-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drill-speaker-name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--navy);
  line-height: 1.15;
}
.drill-speaker-role {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* --- Choices ------------------------------------------------- */
.drill-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drill-choice {
  display: grid;
  grid-template-columns: 30px 30px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border: 1.5px solid var(--rule);
  background: #fff;
  font-family: var(--sans);
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  border-radius: 6px;
  position: relative;
}
@media (max-width: 480px) {
  .drill-choice { padding: 12px 14px; grid-template-columns: 26px 26px 1fr; gap: 10px; font-size: 0.95rem; }
}
.drill-choice:hover:not([disabled]) {
  border-color: var(--navy);
  background: rgba(1, 36, 86, 0.03);
  transform: translateX(3px);
  box-shadow: -4px 6px 20px -12px rgba(1, 36, 86, 0.4);
}
.drill-choice:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.drill-choice[disabled] { cursor: default; opacity: 0.45; transform: none !important; box-shadow: none !important; }
.drill-choice.is-picked { opacity: 1; }
.drill-choice.is-picked.verdict-correct {
  border-color: #22c55e; background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  animation: drillChoiceCorrect 0.6s ease-out;
}
.drill-choice.is-picked.verdict-neutral {
  border-color: #64748b; background: rgba(100, 116, 139, 0.06);
}
.drill-choice.is-picked.verdict-bad {
  border-color: #f97316; background: rgba(249, 115, 22, 0.06);
  animation: drillChoiceBad 0.5s ease-out;
}
.drill-choice.is-picked.verdict-worst {
  border-color: #e94b4b; background: rgba(233, 75, 75, 0.08);
  box-shadow: 0 0 0 3px rgba(233, 75, 75, 0.15);
  animation: drillChoiceWorst 0.6s ease-out;
}
@keyframes drillChoiceCorrect {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes drillChoiceBad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes drillChoiceWorst {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px) rotate(-0.5deg); }
  45% { transform: translateX(6px) rotate(0.5deg); }
  75% { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-choice.is-picked { animation: none; }
}
.drill-choice.is-correct-answer {
  border-color: #22c55e; background: rgba(34, 197, 94, 0.06); opacity: 1;
}
.drill-choice.is-correct-answer::after {
  content: "correct answer";
  position: absolute;
  top: -8px; right: 12px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: #22c55e;
  color: #fff;
  border-radius: 3px;
}
.drill-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--navy);
  color: var(--navy);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 4px;
  background: var(--paper);
}
.drill-choice.is-picked .drill-key { background: var(--navy); color: #fff; }
.drill-choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}
.drill-choice-icon svg { display: block; }
.drill-choice-text { min-width: 0; }

/* --- Feedback panel ------------------------------------------ */
.drill-feedback {
  margin-top: 26px;
  padding: 24px 26px;
  border: 1px solid var(--rule);
  border-left-width: 5px;
  background: #fdfcf9;
  border-radius: 6px;
  animation: drillFeedbackIn 0.4s ease-out;
}
@keyframes drillFeedbackIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .drill-feedback { animation: none; } }
.drill-feedback.verdict-correct { border-left-color: #22c55e; background: linear-gradient(90deg, #f0fdf4 0%, #fdfcf9 40%); }
.drill-feedback.verdict-neutral { border-left-color: #64748b; }
.drill-feedback.verdict-bad     { border-left-color: #f97316; background: linear-gradient(90deg, #fff7ed 0%, #fdfcf9 40%); }
.drill-feedback.verdict-worst   { border-left-color: #e94b4b; background: linear-gradient(90deg, #fef2f2 0%, #fdfcf9 40%); }

.drill-verdict-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.drill-verdict {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 8px;
  border-radius: 30px;
  color: #fff;
}
.drill-verdict::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drill-verdict.verdict-correct { background: #22c55e; }
.drill-verdict.verdict-correct::before {
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 12 10 18 20 6'/></svg>") no-repeat center/60%;
}
.drill-verdict.verdict-neutral { background: #64748b; }
.drill-verdict.verdict-neutral::before {
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round'><line x1='6' y1='12' x2='18' y2='12'/></svg>") no-repeat center/60%;
}
.drill-verdict.verdict-bad { background: #f97316; }
.drill-verdict.verdict-bad::before {
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='3' stroke-linecap='round'><line x1='12' y1='6' x2='12' y2='14'/><circle cx='12' cy='18' r='1.2' fill='%23f97316' stroke='none'/></svg>") no-repeat center/60%;
}
.drill-verdict.verdict-worst { background: #e94b4b; }
.drill-verdict.verdict-worst::before {
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e94b4b' stroke-width='3' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='18' y1='6' x2='6' y2='18'/></svg>") no-repeat center/60%;
}

.drill-verdict-delta {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
}
.drill-verdict-delta.is-up   { color: #166534; background: rgba(34, 197, 94, 0.15); }
.drill-verdict-delta.is-down { color: #7a1a1a; background: rgba(233, 75, 75, 0.15); }

.drill-feedback p { margin: 0 0 16px; color: var(--ink); font-size: 0.98rem; line-height: 1.6; }
.drill-lesson {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.drill-lesson-head {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.drill-lesson p { color: var(--ink-soft); font-size: 0.94rem; margin: 0; line-height: 1.6; }
.drill-next {
  margin-top: 22px;
  padding: 12px 24px;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.drill-next:hover { background: var(--navy-700); transform: translateX(2px); }
.drill-next:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }

/* --- Overlays: flash / shake / confetti / achievement -------- */
.drill-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 8;
}
.drill-flash.is-flash-green {
  background: radial-gradient(circle at center, rgba(34, 197, 94, 0.35) 0%, rgba(34, 197, 94, 0) 70%);
  animation: drillFlash 0.34s ease-out;
}
.drill-flash.is-flash-orange {
  background: radial-gradient(circle at center, rgba(249, 115, 22, 0.35) 0%, rgba(249, 115, 22, 0) 70%);
  animation: drillFlash 0.42s ease-out;
}
.drill-flash.is-flash-red {
  background: radial-gradient(circle at center, rgba(233, 75, 75, 0.45) 0%, rgba(233, 75, 75, 0) 70%);
  animation: drillFlash 0.5s ease-out;
}
@keyframes drillFlash {
  0% { opacity: 0; }
  35% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .drill-flash.is-flash-green,
  .drill-flash.is-flash-orange,
  .drill-flash.is-flash-red { animation: none; opacity: 0; }
}

.drill-game.is-shaking {
  animation: drillShake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes drillShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-game.is-shaking { animation: none; }
}

.drill-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: hidden;
}
.drill-confetti-piece {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 1px;
  opacity: 0;
  transform-origin: center;
  animation: drillConfetti 1.4s cubic-bezier(.16,.72,.36,1) forwards;
}
@keyframes drillConfetti {
  0%   { opacity: 1; transform: translate(0,0) rotate(0); }
  70%  { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.05), calc(var(--dy) + 120px)) rotate(calc(var(--rot) + 180deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .drill-confetti-piece { animation: none; opacity: 0; }
}

.drill-achievement {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 240px;
  max-width: 300px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 2px solid #eab308;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 20px 40px -20px rgba(234, 179, 8, 0.6);
  z-index: 12;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(.16,.72,.36,1), opacity 0.4s ease;
}
.drill-achievement.is-in {
  transform: translateX(0);
  opacity: 1;
}
.drill-ach-icon { flex-shrink: 0; }
.drill-ach-title {
  font-family: var(--serif);
  font-weight: 700;
  color: #713f12;
  font-size: 0.98rem;
  line-height: 1.15;
}
.drill-ach-detail {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: #854d0e;
  margin-top: 2px;
}

/* --- End screen ---------------------------------------------- */
.drill-end-hero {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  margin-bottom: 26px;
  aspect-ratio: 400 / 200;
}
.drill-end-hero svg { display: block; width: 100%; height: 100%; }

.drill-end-head {
  display: grid;
  grid-template-columns: minmax(200px, auto) 1fr;
  gap: 32px;
  align-items: center;
  padding: 26px 0 30px;
  margin: 0 0 30px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 700px) {
  .drill-end-head {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: left;
  }
}
.drill-score-block { display: flex; flex-direction: column; gap: 8px; }
.drill-score-number {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  background: linear-gradient(135deg, #012456 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.drill-score-caption {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.drill-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.drill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 1px solid #eab308;
  border-radius: 20px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  color: #713f12;
}

.drill-verdict-band {
  padding: 22px 24px;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--navy);
  background: #fdfcf9;
  border-radius: 6px;
}
.drill-verdict-band.verdict-correct { border-left-color: #22c55e; background: linear-gradient(90deg, #f0fdf4 0%, #fdfcf9 40%); }
.drill-verdict-band.verdict-neutral { border-left-color: #64748b; }
.drill-verdict-band.verdict-bad     { border-left-color: #f97316; background: linear-gradient(90deg, #fff7ed 0%, #fdfcf9 40%); }
.drill-verdict-band.verdict-worst   { border-left-color: #e94b4b; background: linear-gradient(90deg, #fef2f2 0%, #fdfcf9 40%); }
.drill-verdict-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.3;
}
.drill-verdict-body {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.55;
}

.drill-recap-head {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--navy);
  margin: 6px 0 12px;
}
.drill-recap {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  border-top: 1px solid var(--rule);
}
.drill-recap li {
  padding: 14px 4px;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 14px;
  align-items: center;
}
@media (max-width: 560px) {
  .drill-recap li {
    grid-template-columns: 30px 1fr;
    grid-template-rows: auto auto;
  }
  .drill-recap li .rec-verdict { grid-column: 2; justify-self: start; }
}
.drill-recap .idx {
  font-family: var(--mono);
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.drill-recap .rec-title {
  font-family: var(--serif);
  font-size: 0.98rem;
  color: var(--navy);
}
.drill-recap .rec-time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  display: block;
  margin-top: 2px;
}
.drill-recap .rec-verdict {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
  color: #fff;
}
.drill-recap .rec-verdict.verdict-correct { background: #22c55e; }
.drill-recap .rec-verdict.verdict-neutral { background: #64748b; }
.drill-recap .rec-verdict.verdict-bad     { background: #f97316; }
.drill-recap .rec-verdict.verdict-worst   { background: #e94b4b; }

.drill-end-actions {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}
.drill-restart {
  padding: 12px 24px;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.drill-restart:hover { background: var(--navy-700); }
.drill-restart:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.drill-linkout {
  font-family: var(--sans);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.drill-linkout:hover { color: var(--navy-700); }

/* =========================================================
   Home-page teaser (used on index.html) - reuses .drill-teaser
   ========================================================= */
.drill-teaser {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 44px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--navy);
}
@media (max-width: 820px) {
  .drill-teaser { grid-template-columns: 1fr; padding: 30px; gap: 26px; }
}
.drill-teaser-body h2 {
  margin: 8px 0 12px;
  font-family: var(--serif);
  font-size: 1.9rem;
  color: var(--navy);
  line-height: 1.2;
}
.drill-teaser-body p {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0 0 20px;
}
.drill-teaser-visual {
  position: relative;
  background: var(--navy);
  color: #fff;
  padding: 24px 26px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow: hidden;
  box-shadow: 0 20px 40px -30px rgba(1, 36, 86, 0.6);
}
.drill-teaser-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.drill-teaser-visual .dtv-head {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-bottom: 18px;
  position: relative;
}
.drill-teaser-visual .dtv-head::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52b47c;
}
.drill-teaser-visual pre {
  margin: 0;
  color: rgba(255,255,255,0.9);
  white-space: pre-wrap;
  position: relative;
}
.drill-teaser-visual .dtv-caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: rgba(255,255,255,0.85);
  vertical-align: text-bottom;
  animation: drillCaret 1s steps(2, start) infinite;
}
@keyframes drillCaret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drill-teaser-visual .dtv-caret { animation: none; } }
