:root {
  --bg: #0f1b2d;
  --bg-deep: #0a1420;
  --card: #16273d;
  --card-2: #1c3049;
  --line: #2a4160;
  --text: #eef2f6;
  --text-muted: #9fb0c3;
  --amber: #e8a13d;
  --amber-soft: rgba(232, 161, 61, 0.16);
  --green: #4fb586;
  --green-soft: rgba(79, 181, 134, 0.16);
  --red: #e0616b;
  --red-soft: rgba(224, 97, 107, 0.16);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Poppins', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--serif);
  min-height: 100%;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 12px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
  flex: none;
}

.progress {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.progress li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.progress li .dot {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.4s ease;
}

.progress li.done .dot { background: var(--amber); }
.progress li.current .dot { background: var(--amber); }
.progress li.current,
.progress li.done { opacity: 1; }

/* ---------- Stage / screens ---------- */
.stage {
  flex: 1;
  position: relative;
  display: flex;
}

.screen {
  display: none;
  width: 100%;
  animation: fadeSlideIn 0.45s ease both;
}

.screen.active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 30px 28px;
  position: relative;
  overflow: hidden;
}

/* ---------- Intro ---------- */
.intro-card { text-align: center; }

.scene { margin: 0 auto 8px; width: 200px; max-width: 60%; }
.scene-svg { width: 100%; height: auto; overflow: visible; }
.photo-frame { fill: #0a1420; stroke: var(--amber); stroke-width: 2; }
.photo-inner { fill: #24344a; }
.photo-hill { fill: #2f4a63; }
.photo-sun { fill: var(--amber); opacity: 0.85; }
.sparkle path { fill: var(--amber); }
.sparkle-a { animation: twinkle 2.4s ease-in-out infinite; }
.sparkle-b { animation: twinkle 2.4s ease-in-out infinite 0.6s; }
.sparkle-c { animation: twinkle 2.4s ease-in-out infinite 1.2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--amber);
  font-weight: 600;
  margin: 4px 0 6px;
}

h1 {
  font-family: var(--sans);
  font-size: 30px;
  margin: 0 0 14px;
  font-weight: 600;
}

h2 {
  font-family: var(--sans);
  font-size: 22px;
  margin: 4px 0 8px;
  font-weight: 600;
}

.body-text {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  max-width: 60ch;
  margin: 0 auto 18px;
}

.meta-line {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  border-radius: 999px;
  padding: 13px 28px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--amber);
  color: #1a1204;
  box-shadow: 0 6px 20px rgba(232, 161, 61, 0.25);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(232, 161, 61, 0.4); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.action-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ---------- Step label / tag ---------- */
.step-label {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 2px;
}

.tag-pill {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.instruction {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
  max-width: 68ch;
}

/* ---------- Header row (title + decorative icon) ---------- */
.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Concept animation: data leaving your desk ---------- */
.concept-animation {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px 10px;
  margin-bottom: 18px;
}

.anim-svg { width: 100%; height: auto; max-height: 90px; overflow: visible; display: block; }

.anim-desk { fill: #24344a; stroke: var(--line); }
.anim-lines { stroke: var(--text-muted); stroke-width: 1.5; fill: none; }

.anim-cloud ellipse { fill: #0f1e30; stroke: var(--line); }
.anim-cloud-label {
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  fill: var(--text-muted);
}

.anim-doc {
  fill: var(--amber);
  animation: docTravel 4s ease-in-out infinite;
}

@keyframes docTravel {
  0% { transform: translate(17px, 30px); opacity: 0; }
  8% { opacity: 1; }
  45% { transform: translate(152px, 27px); opacity: 1; }
  55% { transform: translate(152px, 27px); opacity: 0; }
  100% { transform: translate(152px, 27px); opacity: 0; }
}

.anim-node {
  fill: var(--red);
  opacity: 0;
  animation: nodePulse 4s ease-in-out infinite;
  transform-origin: center;
}
.anim-node.n2 { animation-delay: 0.12s; }
.anim-node.n3 { animation-delay: 0.24s; }

@keyframes nodePulse {
  0%, 48% { opacity: 0; transform: scale(0.6); }
  62% { opacity: 1; transform: scale(1.2); }
  85%, 100% { opacity: 0.15; transform: scale(1); }
}

.anim-caption {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  margin: 2px 0 0;
}

/* ---------- Traffic light flourish (Step 3) ---------- */
.traffic-light { flex: none; width: 34px; }
.traffic-svg { width: 100%; height: auto; }
.traffic-body { fill: #0a1420; stroke: var(--line); }
.tl-light { opacity: 0.18; }
.tl-red { fill: var(--red); animation: glowRed 6s ease-in-out infinite; }
.tl-amber { fill: var(--amber); animation: glowAmber 6s ease-in-out infinite; }
.tl-green { fill: var(--green); animation: glowGreen 6s ease-in-out infinite; }

@keyframes glowRed {
  0%, 100% { opacity: 0.18; }
  8%, 25% { opacity: 1; }
  33% { opacity: 0.18; }
}
@keyframes glowAmber {
  0%, 33% { opacity: 0.18; }
  41%, 58% { opacity: 1; }
  66% { opacity: 0.18; }
}
@keyframes glowGreen {
  0%, 66% { opacity: 0.18; }
  74%, 91% { opacity: 1; }
  100% { opacity: 0.18; }
}

@media (prefers-reduced-motion: reduce) {
  .anim-doc, .anim-node, .tl-red, .tl-amber, .tl-green,
  .sparkle-a, .sparkle-b, .sparkle-c {
    animation: none !important;
  }
}

/* ---------- Step 1: prompt chips ---------- */
.prompt-box {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  font-size: 17px;
  line-height: 1.9;
}

.chip {
  display: inline;
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 3px;
  border-bottom: 2px dashed var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.chip:hover { background: rgba(255,255,255,0.06); }

.chip.selected {
  background: var(--red-soft);
  border-bottom-color: var(--red);
  color: #ffd8da;
  text-decoration: line-through;
  text-decoration-color: var(--red);
}

.chip.reveal-correct {
  background: var(--green-soft);
  border-bottom-color: var(--green);
}

.chip.reveal-missed {
  background: var(--red-soft);
  border-bottom-color: var(--red);
  animation: pulseMiss 1s ease 2;
}

.chip.reveal-overremoved {
  background: var(--amber-soft);
  border-bottom-color: var(--amber);
}

@keyframes pulseMiss {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,97,107,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(224,97,107,0.15); }
}

/* ---------- Step 2: compare ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .compare-grid { grid-template-columns: 1fr; }
}

.col-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.draft-box, .ref-box {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 15.5px;
  line-height: 1.7;
  height: 100%;
}

.ref-box { color: var(--text-muted); }
.ref-box strong { color: var(--text); }

.sentence {
  cursor: pointer;
  display: block;
  padding: 6px 8px;
  margin: 2px -8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sentence:hover { background: rgba(255,255,255,0.05); }

.sentence.chosen-correct {
  background: var(--green-soft);
  border-color: var(--green);
}

.sentence.chosen-wrong {
  background: var(--red-soft);
  border-color: var(--red);
}

.sentence.locked { cursor: default; }

/* ---------- Feedback panel ---------- */
.feedback-panel {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.6;
  animation: fadeSlideIn 0.35s ease both;
}

.feedback-panel.good { border-color: var(--green); }
.feedback-panel.bad { border-color: var(--red); }
.feedback-panel .fb-title {
  font-family: var(--sans);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.feedback-panel.good .fb-title { color: var(--green); }
.feedback-panel.bad .fb-title { color: var(--red); }
.feedback-panel ul { margin: 8px 0 0; padding-left: 20px; }
.feedback-panel li { margin-bottom: 4px; }

/* ---------- Final Challenge: hard mode ---------- */
.difficulty-badge {
  flex: none;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #b3455a, #7a3fb0);
  padding: 6px 12px;
  border-radius: 999px;
  height: fit-content;
  white-space: nowrap;
}

.hard-part { margin-top: 4px; }
.hard-part + .hard-part { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }

.principle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .principle-grid { grid-template-columns: 1fr; }
}

.principle-chip {
  font-family: var(--sans);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.principle-chip:hover { transform: translateY(-1px); }

.principle-chip.picked {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.principle-chip.reveal-correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.principle-chip.reveal-missed {
  border-color: var(--red);
  background: var(--red-soft);
  animation: pulseMiss 1s ease 2;
}

.principle-chip.reveal-overpicked {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.principle-chip:disabled { cursor: default; }

/* ---------- Step 3: RAG options ---------- */
.rag-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .rag-row { grid-template-columns: 1fr; }
}

.rag-btn {
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 18px 18px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.rag-btn:hover { transform: translateY(-2px); }

.rag-btn[data-rag="red"] { border-top: 4px solid var(--red); }
.rag-btn[data-rag="amber"] { border-top: 4px solid var(--amber); }
.rag-btn[data-rag="green"] { border-top: 4px solid var(--green); }

.rag-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}
.rag-btn[data-rag="red"] .rag-label { color: var(--red); }
.rag-btn[data-rag="amber"] .rag-label { color: var(--amber); }
.rag-btn[data-rag="green"] .rag-label { color: var(--green); }

.rag-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  font-family: var(--serif);
}

.rag-desc {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  font-family: var(--serif);
}

.rag-btn.selected {
  box-shadow: 0 0 0 2px var(--text);
}

.rag-btn:disabled,
.rag-btn.disabled {
  cursor: default;
  opacity: 0.55;
}

.rag-btn.correct-answer {
  box-shadow: 0 0 0 2px var(--green);
}

/* ---------- Wrap-up ---------- */
.wrapup-card { text-align: center; overflow: visible; }

.score-label {
  font-family: var(--sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 6px 0 10px;
}

.score-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.score-pip {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.score-pip.hit { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.score-pip.miss { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0 0 24px;
  text-align: left;
}

@media (max-width: 640px) {
  .takeaway-grid { grid-template-columns: 1fr; }
}

.takeaway-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 16px;
}

.takeaway-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  color: var(--amber);
}

.takeaway-card h3 {
  font-family: var(--sans);
  font-size: 14.5px;
  margin: 0 0 6px;
  font-weight: 600;
}

.takeaway-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.closing-line {
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
  max-width: 55ch;
  margin: 0 auto 24px;
  color: var(--text);
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(320px) rotate(400deg);
    opacity: 0;
  }
}

/* ---------- Footer ---------- */
.footer-note {
  text-align: center;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0.6;
  padding: 18px 0 6px;
}

.footer-note code {
  background: var(--card-2);
  padding: 1px 5px;
  border-radius: 4px;
}

@media (max-width: 520px) {
  .card { padding: 24px 18px; }
  h1 { font-size: 24px; }
  .plabel { display: none; }
}
