:root {
  color-scheme: dark;
  --background: #111a24;
  --surface: #192634;
  --line: #394b5e;
  --ink: #edf5f5;
  --muted: #b6c8d3;
  --accent: #9af0d7;
  --button-text: #132d29;
  font-family: system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
button, select, textarea { font: inherit; }
button, select, a { touch-action: manipulation; }
a { color: var(--accent); }
a, button, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1:focus, h2:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
p, li { line-height: 1.55; }

.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner, .shell {
  width: min(100%, 58rem);
  margin: 0 auto;
  padding-inline: max(1.25rem, env(safe-area-inset-left)) max(1.25rem, env(safe-area-inset-right));
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-block: .9rem;
}
.mark {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--accent);
  border-radius: .2rem .55rem;
  transform: rotate(-12deg);
}
.brand { font-size: 1.05rem; font-weight: 720; }
.mode { display: none; margin-left: auto; font-size: .79rem; color: var(--accent); }
body[data-mode="development"] .mode { display: block; }
.shell { padding-top: clamp(1.65rem, 5vw, 3.75rem); padding-bottom: max(2rem, env(safe-area-inset-bottom)); }

.hero { border-bottom: 1px solid var(--line); padding-bottom: clamp(1.5rem, 4vw, 3rem); }
.hero h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(2.85rem, 8vw, 5rem); letter-spacing: -.05em; }
.hero p { margin-top: .55rem; color: var(--muted); font-size: 1.025rem; max-width: 35em; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; margin-block: 1.35rem 1rem; }
.toolbar h2 { font-size: 1.15rem; }
select { background: var(--surface); color: var(--ink); min-height: 2.75rem; border: 1px solid var(--line); border-radius: .5rem; padding: .5rem; }
.paper-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.paper-card, .question, .results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  padding: clamp(1rem, 3.5vw, 1.6rem);
}
.paper-card { display: flex; flex-direction: column; border-top: 2px solid #639e96; }
.paper-card:nth-child(2) { border-top-color: #9a92d1; }
.eyebrow { color: var(--accent); font-size: .8rem; font-weight: 720; letter-spacing: .055em; }
.paper-card h3 { margin-top: .5rem; font-size: clamp(1.17rem, 3vw, 1.48rem); line-height: 1.25; }
.description { margin-block: .65rem 1.1rem; color: var(--muted); flex: 1; }
.progress-label { color: var(--muted); font-size: .83rem; }
progress { display: block; width: 100%; height: .45rem; margin-block: .32rem .15rem; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #394c5d; border-radius: 1rem; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 1rem; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin-top: .95rem; }
.button, .back {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: .55rem;
  min-height: 2.75rem;
  padding: .55rem .85rem;
  font-weight: 710;
}
.button { background: var(--accent); color: var(--button-text); }
.button:hover { background: #b4f7e5; }
.button:disabled, .back:disabled { opacity: .6; cursor: wait; }
.source { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .88rem; text-underline-offset: .22em; }
.back { color: var(--accent); background: transparent; border-color: var(--line); margin-bottom: 1rem; }

.quiz-title { margin-bottom: 1.2rem; }
.quiz-title h1 { font-size: clamp(1.3rem, 4vw, 2rem); line-height: 1.25; }
.quiz-title .progress-label { margin-top: .65rem; }
.skill-map { margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.skill-map summary { cursor: pointer; min-height: 2rem; }
.skill-map ul { margin-top: .25rem; padding-left: 1.25rem; }
.question h2 { font-size: clamp(1.22rem, 4vw, 1.7rem); line-height: 1.35; margin-block: .32rem .3rem; }
form { display: grid; gap: .55rem; margin-top: .75rem; }
label { font-weight: 650; }
textarea {
  width: 100%;
  min-height: 7rem;
  border: 1px solid #627887;
  border-radius: .55rem;
  background: var(--background);
  color: var(--ink);
  padding: .75rem;
  resize: vertical;
  line-height: 1.42;
  font-size: 1rem;
}
form .button { justify-self: start; }
.feedback, .notice { margin-bottom: 1rem; border-left: 3px solid var(--accent); background: #182e37; padding: .65rem .85rem; border-radius: .25rem .55rem .55rem .25rem; }
.feedback p + p { margin-top: .4rem; }
.feedback h2 { font-size: .9rem; margin-bottom: .2rem; }
.error { color: #ffcabf; }
.error:empty { display: none; }
.results > p { color: var(--muted); margin-block: .4rem .8rem; }
.result { border-top: 1px solid var(--line); }
.result summary { cursor: pointer; min-height: 2.75rem; padding-block: .65rem; }
.result h3 { margin-top: .7rem; font-size: .97rem; }
.result ul { padding-left: 1.25rem; }
.result blockquote { margin: .25rem 0 .65rem; padding-left: .65rem; border-left: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }

@media (max-width: 36rem) {
  .paper-list { grid-template-columns: 1fr; }
  form .button { justify-self: stretch; }
}
