:root {
  color-scheme: dark;
  --background: #0c131a;
  --surface: #101b24;
  --surface-raised: #14232d;
  --border: #293c48;
  --border-soft: #22323d;
  --text: #edf6f2;
  --muted: #a9bac1;
  --subtle: #99aeb7;
  --green: #88e6b2;
  --amber: #f0c785;
  --blue: #9ec5f0;
  --red: #f3a8a5;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(ellipse 62rem 33rem at 62% 0, #13252b 0%, transparent 73%), var(--background);
  color: var(--text);
  font: 1rem/1.55 var(--sans);
  min-width: 17.5rem;
}

a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
p, h1, h2, h3, dl, dd, figure, blockquote { margin: 0; }
code { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
[id][tabindex="-1"]:focus { outline: none; }

.shell { width: min(100% - 3rem, 67rem); margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 1;
  top: .75rem;
  left: .75rem;
  transform: translateY(calc(-100% - 1rem));
  padding: .5rem 1rem;
  border-radius: .35rem;
  background: var(--green);
  color: #0b1d14;
}
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--border-soft); }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 4.25rem; gap: 1.25rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.035em;
  text-decoration: none;
  white-space: nowrap;
}
.brand b { color: var(--green); font-weight: inherit; }

.brand-mark {
  display: flex;
  align-items: end;
  gap: .13rem;
  border: 1px solid #397451;
  border-radius: .43rem;
  background: #122820;
  padding: .39rem .41rem;
}
.brand-mark i {
  display: block;
  width: .16rem;
  height: .25rem;
  border-radius: .12rem;
  background: var(--green);
}
.brand-mark i:nth-child(2) { height: .43rem; }
.brand-mark i:nth-child(3) { height: .61rem; }

.nav-links { display: flex; align-items: center; gap: clamp(.7rem, 2.8vw, 1.8rem); font-size: .84rem; font-weight: 635; }
.nav-links a { text-decoration: none; }
.nav-current { color: var(--green); }
.nav-join { color: var(--muted); }
.nav-join span { margin-left: .13rem; }
.nav-join:hover { color: var(--text); }

.main { padding-top: clamp(3rem, 7vw, 5rem); }
.intro { margin-bottom: clamp(2rem, 5vw, 3.4rem); }

.eyebrow,
.section-label,
.progress-label,
.progress-count {
  color: var(--subtle);
  font: 700 .72rem/1.45 var(--mono);
  letter-spacing: .075em;
}

.eyebrow { display: flex; align-items: center; gap: .58rem; color: var(--green); }
.signal-dot { display: inline-block; flex: none; width: .44rem; height: .44rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 .19rem #24463a; }

.intro h1 {
  margin-top: .9rem;
  font-size: clamp(2.65rem, 7vw, 5.15rem);
  font-weight: 680;
  line-height: .98;
  letter-spacing: -.068em;
}
.intro em { color: var(--green); font-style: normal; }
.intro > p { max-width: 35rem; margin-top: 1.23rem; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.12rem); }

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, .35fr);
  gap: 1.2rem;
  align-items: start;
}

.lab-panel, .guide, .resources {
  border: 1px solid var(--border);
  border-radius: .88rem;
  background: var(--surface);
}
.lab-panel {
  min-height: 24rem;
  overflow: hidden;
  box-shadow: 0 .85rem 2.8rem #070d124a;
}
#quiz, .message-state, .result-summary, .result-review { padding: clamp(1.18rem, 4vw, 2.1rem); }
.message-state { display: flex; align-items: center; gap: .75rem; color: var(--muted); }
#load-error { align-items: flex-start; flex-direction: column; }
#load-error p { color: var(--red); }

.quiz-meta { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .57rem; }
.progress-label { color: var(--green); }
.progress-count { letter-spacing: 0; }

progress {
  display: block;
  appearance: none;
  width: 100%;
  height: .25rem;
  color: var(--green);
  background: #29404a;
  border: 0;
  border-radius: 1rem;
  overflow: hidden;
}
progress::-webkit-progress-bar { background: #29404a; }
progress::-webkit-progress-value { background: var(--green); border-radius: 1rem; }
progress::-moz-progress-bar { background: var(--green); border-radius: 1rem; }

.scenario { margin-top: 1.9rem; }
.context { margin-top: .4rem; font-size: 1.05rem; line-height: 1.55; font-weight: 535; overflow-wrap: anywhere; }
.utterance {
  margin-top: 1.1rem;
  padding: .78rem 1rem .84rem;
  background: #162830;
  border: 1px solid #2b4650;
  border-left: 2px solid var(--green);
  border-radius: .4rem .58rem .58rem .4rem;
}
.utterance figcaption { color: var(--green); }
.utterance blockquote { margin-top: .26rem; font-size: 1.12rem; font-weight: 595; overflow-wrap: anywhere; }

.choices { min-width: 0; padding: 0; margin: 1.5rem 0 0; border: 0; }
.choices legend { padding: 0; margin-bottom: .63rem; font-size: .91rem; font-weight: 675; }
.choices-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.choice { position: relative; cursor: pointer; }
.choice-wait { --choice-color: var(--blue); }
.choice-clarify { --choice-color: var(--amber); }
.choice-proceed { --choice-color: var(--green); }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  min-height: 4.4rem;
  gap: .23rem;
  background: #11202a;
  border: 1px solid var(--border);
  border-radius: .62rem;
  padding: .62rem .67rem;
  transition: background .15s, border-color .15s;
}
.choice:hover .choice-content { border-color: #698894; background: #192c37; }
.choice input:checked + .choice-content { border-color: var(--choice-color); background: #203740; }
.choice input:focus-visible + .choice-content { outline: 2px solid var(--choice-color); outline-offset: 2px; }
.choice-top { display: flex; align-items: center; gap: .43rem; }
.choice-key {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  background: #1d303b;
  border: 1px solid #34505d;
  border-radius: .24rem;
  color: var(--text);
  font: 600 .63rem/1 var(--mono);
}
.choice-code { color: var(--choice-color); font: 700 .7rem/1.1 var(--mono); }
.choice-name { font-size: .88rem; font-weight: 630; }

.quiz-actions, .result-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.quiz-actions { margin-top: 1.27rem; justify-content: space-between; }
#next { margin-left: auto; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.55rem;
  gap: .48rem;
  border: 1px solid transparent;
  border-radius: .48rem;
  padding: .45rem .85rem;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 700;
}
.button-primary { background: var(--green); color: #0d2318; }
.button-primary:not(:disabled):hover { background: #aff4cc; }
.button-primary:disabled { background: #29433d; color: #bbcec4; cursor: default; }
.button-secondary { background: #172632; border-color: #354c59; color: var(--text); }
.button-secondary:not(:disabled):hover { background: #263a48; }
.quiz-actions .button:disabled { cursor: default; }
.error-text { margin-top: .8rem; color: var(--red); font-size: .88rem; }

.lab-sidebar { display: grid; gap: .8rem; }
.guide, .resources { padding: 1.05rem; }
.guide h2, .resources h2 { font-size: .89rem; font-weight: 720; }
.guide dl { margin-top: .7rem; }
.guide-item + .guide-item { margin-top: .74rem; padding-top: .73rem; border-top: 1px solid var(--border-soft); }
.guide dt { display: flex; align-items: center; gap: .44rem; font: 700 .73rem/1.25 var(--mono); }
.guide dt span { width: .33rem; height: .33rem; border-radius: 50%; background: currentColor; }
.guide-wait { color: var(--blue); }
.guide-clarify { color: var(--amber); }
.guide-proceed { color: var(--green); }
.guide dd { margin-top: .28rem; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.resources h2 { margin-bottom: .45rem; }
.resources a { display: flex; justify-content: space-between; align-items: center; gap: .45rem; padding-block: .33rem; color: var(--muted); text-decoration: none; font-size: .82rem; }
.resources a:hover { color: var(--green); }
.resources a small { margin-left: auto; color: var(--subtle); font: 650 .62rem/1 var(--mono); }
.resources a span { color: var(--green); }

.result-summary { background: linear-gradient(130deg, #162f29, var(--surface)); }
.result-summary .section-label { color: var(--green); }
.result-summary h2 { margin-top: .35rem; font-size: clamp(2rem, 8vw, 3.7rem); letter-spacing: -.064em; line-height: 1.1; }
#result-score { color: var(--green); }
.result-summary > p:not(.section-label) { color: var(--muted); }
#result-note { margin: .65rem 0 1rem; }
.copy-status:not(:empty) { margin-top: .65rem; font-size: .84rem; }
.result-review { border-top: 1px solid var(--border); }
.result-review h3 { font-size: 1.03rem; font-weight: 700; }
#review-list { list-style: none; padding: 0; margin: .65rem 0 0; }
.review-item { border-top: 1px solid var(--border-soft); padding: .58rem 0; }
.review-item summary { padding-block: .2rem; cursor: pointer; overflow-wrap: anywhere; }
.review-status { margin-right: .36rem; font: 700 .7rem/1.2 var(--mono); color: var(--red); }
.review-status.is-correct { color: var(--green); }
.review-detail { margin: .4rem 0 .5rem; padding-left: .8rem; border-left: 1px solid var(--border); color: var(--muted); font-size: .89rem; overflow-wrap: anywhere; }
.review-detail p + p { margin-top: .36rem; }
.review-detail strong { color: var(--text); }

.protocol {
  max-width: 45rem;
  margin-top: 2.65rem;
  color: var(--muted);
  font-size: .84rem;
}
.protocol h2 { margin-bottom: .27rem; color: var(--text); font-size: .9rem; font-weight: 700; }
.protocol code { color: var(--green); font-size: .8em; }
.protocol a { text-underline-offset: .18em; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  margin-top: 2.3rem;
  padding: 1.05rem 0 1.5rem;
  border-top: 1px solid var(--border-soft);
  color: var(--subtle);
  font-size: .77rem;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media (max-width: 46rem) {
  .lab-layout { grid-template-columns: minmax(0, 1fr); }
  .lab-sidebar { grid-template-columns: 1fr 1fr; }
  .lab-panel { min-height: 0; }
}

@media (max-width: 32rem) {
  .shell { width: calc(100% - 2rem); }
  .nav { min-height: 3.7rem; }
  .lab-sidebar { grid-template-columns: 1fr; }
  .scenario { margin-top: 1.32rem; }
  .choices-grid { gap: .35rem; }
  .choice-content { padding: .5rem .39rem; min-height: 3.55rem; }
  .choice-top { gap: .23rem; }
  .choice-key { display: none; }
  .choice-code { font-size: .67rem; }
  .choice-name { font-size: .81rem; }
}

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