:root {
  --ink: #101310;
  --ink-soft: #171b17;
  --panel: #1d211d;
  --paper: #f3eedb;
  --paper-dim: #c8c4b4;
  --acid: #d8ff3e;
  --acid-dark: #8ea820;
  --orange: #ff7043;
  --cyan: #73e6db;
  --line: #3b4139;
  --danger: #ff5f56;
  --shadow: 0 18px 50px rgb(0 0 0 / 28%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 80% 10%, rgb(216 255 62 / 5%), transparent 32rem),
    var(--ink);
  color: var(--paper);
  font-family:
    Inter, "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

code,
pre,
.project-label,
.panel-kicker,
.mission-meta,
.eyebrow,
.challenge-label,
.game-footer,
.mission-rail,
.system-stats,
.terminal-form small {
  font-family: "IBM Plex Mono", "Cascadia Code", "SFMono-Regular", Consolas,
    monospace;
}

a {
  color: inherit;
}

.loading-screen {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background:
    linear-gradient(rgb(216 255 62 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(216 255 62 / 5%) 1px, transparent 1px),
    var(--ink);
  background-size: 32px 32px;
  color: var(--acid);
  font: 700 0.78rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.14em;
}

/* Start */

.start-screen {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: clamp(1.4rem, 5vw, 5rem);
  isolation: isolate;
}

.start-screen::before {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 0 55%, rgb(216 255 62 / 6%) 55% 56%, transparent 56%),
    radial-gradient(circle at 78% 32%, rgb(216 255 62 / 12%), transparent 24rem),
    linear-gradient(150deg, #151915, #0c0f0c 62%);
  content: "";
}

.start-screen::after {
  position: absolute;
  z-index: -1;
  top: -18vh;
  right: -9vw;
  width: min(55vw, 44rem);
  aspect-ratio: 1;
  border: 1px solid rgb(216 255 62 / 24%);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgb(216 255 62 / 2%),
    0 0 0 9rem rgb(216 255 62 / 2%);
  content: "";
}

.start-grid {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(rgb(216 255 62 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(216 255 62 / 5%) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.start-shell {
  width: min(100%, 73rem);
}

.start-terminal {
  display: flex;
  max-width: 42rem;
  margin-bottom: clamp(2rem, 6vw, 5rem);
  flex-direction: column;
  padding-left: 1rem;
  border-left: 3px solid var(--acid);
  color: var(--paper-dim);
  font: 600 clamp(0.68rem, 1.4vw, 0.82rem) / 1.7 "Cascadia Code",
    monospace;
}

.start-warning {
  color: var(--orange);
}

.project-label {
  margin: 0 0 0.8rem;
  color: var(--acid);
  font-size: clamp(0.68rem, 1.4vw, 0.8rem);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.start-shell h1,
.completion h1 {
  max-width: 10ch;
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(5.5rem, 16vw, 12.5rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.72;
  text-transform: uppercase;
}

.start-shell h1 em,
.completion h1 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 2px var(--acid);
  text-shadow: 0 0 28px rgb(216 255 62 / 20%);
}

.start-lead {
  max-width: 42rem;
  margin: clamp(2rem, 5vw, 3.6rem) 0 2rem;
  color: var(--paper);
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  line-height: 1.55;
}

.start-specs {
  display: flex;
  max-width: 42rem;
  margin: 0 0 2rem;
  border-block: 1px solid var(--line);
}

.start-specs div {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  padding: 1rem clamp(0.5rem, 2vw, 1.4rem);
  border-right: 1px solid var(--line);
}

.start-specs div:first-child {
  padding-left: 0;
}

.start-specs div:last-child {
  border-right: 0;
}

.start-specs strong {
  color: var(--acid);
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.start-specs span {
  margin-top: 0.25rem;
  color: var(--paper-dim);
  font-size: 0.75rem;
}

.start-button {
  display: flex;
  width: min(100%, 30rem);
  justify-content: space-between;
  border: 0;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 1.15rem 1.25rem;
  box-shadow: 8px 8px 0 var(--acid-dark);
  font-weight: 900;
  letter-spacing: 0.02em;
  transition:
    translate 150ms ease,
    box-shadow 150ms ease;
}

.start-button:hover {
  translate: 3px 3px;
  box-shadow: 5px 5px 0 var(--acid-dark);
}

.start-button span:last-child {
  font-size: 1.3rem;
}

.mode-selection {
  display: grid;
  max-width: 38rem;
  gap: 0.8rem;
}

.start-button > span:first-child {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
}

.start-button strong {
  font-size: 0.92rem;
}

.start-button small {
  color: #30361f;
  font: 0.65rem/1.4 "Cascadia Code", monospace;
  font-weight: 600;
}

.start-button.secondary {
  border: 1px solid var(--acid);
  background: transparent;
  color: var(--paper);
  box-shadow: 8px 8px 0 #31362c;
}

.start-button.secondary small {
  color: #858b80;
}

.start-note {
  margin: 1.2rem 0 0;
  color: #8e9488;
  font: 0.7rem/1.5 "Cascadia Code", monospace;
}

.start-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.65rem;
  font: 0.68rem/1.5 "Cascadia Code", monospace;
}

.start-resources a {
  color: var(--paper-dim);
  text-decoration-color: var(--acid-dark);
  text-underline-offset: 0.22rem;
}

.start-resources a:hover {
  color: var(--acid);
}

/* Header and layout */

.game-shell {
  min-height: 100svh;
}

.game-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgb(16 19 16 / 93%);
  backdrop-filter: blur(16px);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  padding: 0 1.2rem;
  text-align: left;
}

.brand-mark {
  color: var(--acid);
  font: 800 1.15rem/1 "Cascadia Code", monospace;
}

.brand-button strong,
.brand-button small {
  display: block;
}

.brand-button strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.035em;
}

.brand-button small {
  color: #8e9488;
  font: 0.58rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.12em;
}

.system-stats {
  display: flex;
  align-items: stretch;
}

.system-stats div {
  display: flex;
  min-width: 92px;
  justify-content: center;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding: 0 1rem;
}

.system-stats span {
  color: #858b80;
  font-size: 0.57rem;
  letter-spacing: 0.09em;
}

.system-stats strong {
  margin-top: 0.15rem;
  color: var(--acid);
  font-size: 0.95rem;
}

.system-stats button {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: #90958b;
  cursor: pointer;
  padding: 0 1.2rem;
  font-size: 0.7rem;
}

.system-stats button:hover {
  background: var(--orange);
  color: var(--ink);
}

.progress-track {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--acid);
  box-shadow: 0 0 12px var(--acid);
  transition: width 400ms ease;
}

.game-layout {
  display: grid;
  min-height: calc(100svh - 74px);
  grid-template-columns: 238px minmax(500px, 1fr) minmax(360px, 440px);
}

/* Mission rail */

.mission-rail {
  position: sticky;
  top: 74px;
  height: calc(100svh - 74px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #121512;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem;
  border-bottom: 1px solid var(--line);
  color: #8a9085;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

.rail-heading strong {
  color: var(--paper);
}

.mission-rail ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mission-rail li {
  border-bottom: 1px solid #292e28;
}

.mission-rail button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 72px;
  align-items: center;
  grid-template-columns: 34px 1fr 14px;
  gap: 0.65rem;
  border: 0;
  background: transparent;
  color: #858b80;
  cursor: pointer;
  padding: 0.8rem 0.8rem 0.8rem 1rem;
  text-align: left;
}

.mission-rail button:hover:not(:disabled) {
  background: #1a1e19;
  color: var(--paper);
}

.mission-rail button.current {
  background:
    linear-gradient(90deg, rgb(216 255 62 / 12%), transparent),
    #191d18;
  color: var(--paper);
}

.mission-rail button.current::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--acid);
  content: "";
}

.mission-rail button.done .mission-number {
  border-color: var(--acid);
  color: var(--acid);
}

.mission-rail button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.mission-number {
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #555b50;
  border-radius: 50%;
  font-size: 0.66rem;
}

.mission-nav-copy {
  min-width: 0;
}

.mission-nav-copy strong,
.mission-nav-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-nav-copy strong {
  font-size: 0.72rem;
}

.mission-nav-copy small {
  margin-top: 0.25rem;
  color: #62685f;
  font-size: 0.58rem;
}

.lock-glyph {
  color: #555b50;
}

/* Puzzle */

.puzzle-panel {
  min-width: 0;
  padding: clamp(1.4rem, 3vw, 3.4rem);
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.mission-meta span {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  color: #9da396;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}

.mission-meta span:first-child {
  border-color: var(--acid-dark);
  color: var(--acid);
}

.mission-title-row {
  display: flex;
  align-items: flex-start;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.mission-title-row > div {
  min-width: 0;
}

.huge-number {
  color: transparent;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4rem, 8vw, 7.2rem);
  letter-spacing: -0.05em;
  line-height: 0.78;
  -webkit-text-stroke: 1px #555c50;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--acid);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mission-title-row h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  overflow-wrap: anywhere;
  font-size: clamp(2.35rem, 4vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.94;
  text-transform: uppercase;
}

.mission-subtitle {
  margin: 0.6rem 0 0;
  color: #aeb3a7;
  font-size: 0.9rem;
}

.briefing {
  max-width: 70ch;
  margin: 2rem 0;
  color: var(--paper-dim);
  font-size: 0.96rem;
  line-height: 1.7;
}

.terminal-output {
  overflow: hidden;
  border: 1px solid #3c4239;
  border-radius: 8px;
  background: #080b08;
  box-shadow: var(--shadow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  border-bottom: 1px solid #292e28;
  background: #171b17;
  padding: 0 0.8rem;
}

.terminal-bar span {
  width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #586054;
}

.terminal-bar span:first-child {
  background: var(--danger);
}

.terminal-bar span:nth-child(2) {
  background: #ffbd2e;
}

.terminal-bar span:nth-child(3) {
  background: #28c840;
}

.terminal-bar strong {
  margin-left: 0.35rem;
  color: #777e72;
  font: 600 0.65rem/1 "Cascadia Code", monospace;
}

.terminal-output pre {
  min-height: 124px;
  margin: 0;
  overflow-x: auto;
  padding: 1.1rem;
  color: #b9c7b0;
  font-size: clamp(0.72rem, 1.25vw, 0.84rem);
  line-height: 1.65;
  white-space: pre-wrap;
}

.terminal-output pre::before {
  color: var(--acid);
  content: "● ";
}

.challenge {
  margin-top: 2rem;
  border-top: 4px solid var(--acid);
  background: var(--paper);
  color: var(--ink);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.challenge-label {
  margin: 0 0 0.55rem;
  color: #617017;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.challenge h2 {
  max-width: 44rem;
  margin: 0 0 1.4rem;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.35;
}

.choice-list {
  display: grid;
  gap: 0.65rem;
}

.choice-list button {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid #aaa797;
  background: #e7e2cf;
  color: var(--ink);
  cursor: pointer;
  padding: 0.9rem;
  text-align: left;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    translate 120ms ease;
}

.choice-list button:hover:not(:disabled) {
  border-color: var(--ink);
  background: white;
  translate: 4px 0;
}

.choice-list button:disabled {
  cursor: default;
  opacity: 0.6;
}

.prompt-glyph {
  color: #637219;
  font: 900 1.1rem/1 "Cascadia Code", monospace;
}

.choice-list code {
  font-size: clamp(0.74rem, 1.4vw, 0.9rem);
  font-weight: 700;
}

.terminal-form label {
  display: block;
  margin-bottom: 0.5rem;
  font: 800 0.66rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terminal-input-row {
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 2px solid var(--ink);
  background: var(--ink);
}

.terminal-input-row > span {
  color: var(--acid);
  padding-left: 0.85rem;
  font: 900 1rem/1 "Cascadia Code", monospace;
}

.terminal-input-row input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.95rem 0.65rem;
  font: 0.86rem/1.4 "Cascadia Code", monospace;
}

.terminal-input-row input::placeholder {
  color: #656b61;
}

.terminal-input-row button,
.verify-button {
  align-self: stretch;
  border: 0;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 900;
}

.terminal-input-row button:disabled,
.verify-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.terminal-form small {
  display: block;
  margin-top: 0.5rem;
  color: #6d6a60;
  font-size: 0.62rem;
}

.sequence-builder {
  display: grid;
  gap: 0.8rem;
}

.sequence-target {
  display: flex;
  min-height: 76px;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  border: 2px dashed #777466;
  background: #ded9c7;
  padding: 0.7rem;
}

.sequence-placeholder {
  color: #777466;
  font: 0.74rem/1.4 "Cascadia Code", monospace;
}

.sequence-target button,
.token-pool button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  font: 700 0.68rem/1.3 "Cascadia Code", monospace;
}

.sequence-target button:hover {
  background: var(--orange);
  color: var(--ink);
}

.token-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.token-pool button {
  border-color: #858174;
  background: transparent;
  color: var(--ink);
}

.token-pool button:hover:not(:disabled) {
  border-color: var(--ink);
  background: white;
}

.token-pool button:disabled {
  opacity: 0.22;
}

.verify-button {
  min-height: 44px;
  justify-self: start;
  background: var(--ink);
  color: var(--acid);
}

.puzzle-actions {
  margin-top: 1rem;
}

.hint-button {
  border: 0;
  border-bottom: 1px solid #817e71;
  background: transparent;
  color: #5d5a51;
  cursor: pointer;
  padding: 0.3rem 0;
  font: 700 0.68rem/1.4 "Cascadia Code", monospace;
}

.hint-button:disabled {
  cursor: default;
}

.hint-copy {
  margin: 0.8rem 0 0;
  border-left: 3px solid #a6b52f;
  background: #ddd8c4;
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.feedback {
  margin-top: 1rem;
}

.feedback-box {
  border: 2px solid var(--ink);
  padding: 1rem;
}

.feedback-box.success {
  border-color: #4b6010;
  background: #d8ff3e;
}

.feedback-box.wrong {
  border-color: #9a311c;
  background: #ffd5ca;
}

.feedback-box.recap {
  border-color: #587c77;
  background: #cceae5;
}

.feedback-box strong {
  display: block;
  margin-bottom: 0.35rem;
  font: 900 0.66rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.1em;
}

.feedback-box p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.feedback-box button {
  margin-top: 0.8rem;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  font-weight: 800;
}

.learning-debrief {
  margin-top: 2rem;
  border: 1px solid var(--line);
  background: #151815;
}

.learning-debrief summary {
  cursor: pointer;
  padding: 1rem;
  color: var(--acid);
  font-size: 0.85rem;
  font-weight: 800;
}

.learning-debrief dl {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.learning-debrief dl div {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 1rem;
}

.learning-debrief dl div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.learning-debrief dt {
  margin-bottom: 0.35rem;
  color: #7f867b;
  font: 700 0.62rem/1.3 "Cascadia Code", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.learning-debrief dd {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.8rem;
  line-height: 1.55;
}

.learning-debrief code {
  color: var(--acid);
}

/* Blueprint */

.blueprint-panel {
  position: sticky;
  top: 74px;
  height: calc(100svh - 74px);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #121512;
  padding: 1.4rem;
}

.panel-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7f867b;
  font-size: 0.59rem;
  letter-spacing: 0.08em;
}

.status-assembling {
  color: var(--orange);
}

.status-online {
  color: var(--acid);
}

.blueprint-panel h2 {
  margin: 1.2rem 0 0.3rem;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.blueprint-copy {
  margin: 0 0 1rem;
  color: #82887e;
  font-size: 0.75rem;
  line-height: 1.5;
}

.blueprint {
  overflow: hidden;
  border: 1px solid #30362f;
  border-radius: 18px;
}

.blueprint svg {
  display: block;
  width: 100%;
  height: auto;
}

.blueprint-bg {
  fill: #0b0e0b;
}

.grid-line {
  fill: none;
  stroke: #2b3129;
  stroke-width: 0.6;
}

.wire {
  fill: none;
  stroke: #31372f;
  stroke-dasharray: 5 8;
  stroke-width: 2;
}

.wire.active {
  stroke: var(--acid);
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px rgb(216 255 62 / 80%));
}

.module-case {
  fill: #161a16;
  stroke: #444b41;
  stroke-width: 1.5;
}

.module-led {
  fill: #474d44;
}

.module-number {
  fill: #666d62;
  font: 8px "Cascadia Code", monospace;
  letter-spacing: 1px;
}

.module-label {
  fill: #777f72;
  font: 700 11px "Cascadia Code", monospace;
  letter-spacing: 1px;
}

.module-lock {
  fill: none;
  stroke: #555c51;
  stroke-width: 1.5;
}

.system-module.done .module-case {
  fill: #1e2915;
  stroke: var(--acid);
}

.system-module.done .module-led {
  fill: var(--acid);
  filter: drop-shadow(0 0 5px var(--acid));
}

.system-module.done .module-number {
  fill: #9bb428;
}

.system-module.done .module-label {
  fill: var(--paper);
}

.system-module.current:not(.done) .module-case {
  stroke: var(--orange);
  stroke-dasharray: 5 4;
  stroke-width: 2;
  animation: module-pulse 1.6s ease-in-out infinite;
}

.core-mark text {
  fill: #62695f;
  font: 8px "Cascadia Code", monospace;
  letter-spacing: 1.2px;
}

.blueprint.is-online {
  border-color: var(--acid);
  box-shadow: 0 0 32px rgb(216 255 62 / 13%);
}

.blueprint.is-online .core-mark text {
  fill: var(--acid);
}

@keyframes module-pulse {
  50% {
    stroke-opacity: 0.35;
  }
}

/* Chapter success */

.chapter-success {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  background:
    radial-gradient(circle at 50% 42%, rgb(216 255 62 / 20%), transparent 24rem),
    var(--ink);
  isolation: isolate;
}

.success-grid {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(rgb(216 255 62 / 6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(216 255 62 / 6%) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
  animation: success-grid-in 900ms ease-out both;
}

.success-particles {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.success-particles span {
  position: absolute;
  top: 78%;
  left: var(--particle-x);
  width: 7px;
  height: 24px;
  background: var(--acid);
  box-shadow: 0 0 14px rgb(216 255 62 / 55%);
  opacity: 0;
  rotate: var(--particle-rotate);
  animation: particle-rise 1.6s ease-out var(--particle-delay) both;
}

.success-particles span:nth-child(3n) {
  height: 10px;
  background: var(--cyan);
}

.success-particles span:nth-child(4n) {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--orange);
}

.chapter-success-card {
  width: min(100%, 49rem);
  border: 1px solid #718514;
  background: rgb(16 19 16 / 94%);
  box-shadow:
    0 0 0 1px rgb(216 255 62 / 8%),
    0 30px 90px rgb(0 0 0 / 45%),
    0 0 70px rgb(216 255 62 / 10%);
  padding: clamp(1.5rem, 5vw, 3.5rem);
  text-align: center;
  animation: success-card-in 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.success-orbit {
  position: relative;
  display: grid;
  width: 6rem;
  height: 6rem;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--acid);
  border-radius: 50%;
  place-items: center;
  box-shadow: 0 0 30px rgb(216 255 62 / 24%);
}

.success-orbit::before,
.success-orbit::after {
  position: absolute;
  border: 1px solid rgb(216 255 62 / 34%);
  border-radius: 50%;
  content: "";
  animation: orbit-pulse 1.4s ease-out infinite;
}

.success-orbit::before {
  inset: -0.75rem;
}

.success-orbit::after {
  inset: -1.55rem;
  animation-delay: 180ms;
}

.success-orbit span {
  color: var(--acid);
  font-size: 3rem;
  font-weight: 900;
  animation: success-check-in 700ms 180ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.chapter-success-card h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.7rem, 8vw, 5.8rem);
  letter-spacing: -0.035em;
  line-height: 0.92;
  text-transform: uppercase;
}

.chapter-success-summary {
  max-width: 39rem;
  margin: 1.4rem auto;
  color: var(--paper-dim);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  line-height: 1.6;
}

.success-skills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.5rem 0;
}

.success-skills span {
  border: 1px solid #505b32;
  background: #181d16;
  color: var(--acid);
  padding: 0.55rem 0.75rem;
  font: 700 0.7rem/1.35 "Cascadia Code", monospace;
}

.chapter-success-stats {
  display: grid;
  margin: 1.5rem 0;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
}

.chapter-success-stats div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0.9rem 0.5rem;
  border-right: 1px solid var(--line);
}

.chapter-success-stats div:last-child {
  border: 0;
}

.chapter-success-stats span {
  color: #858b81;
  font: 0.58rem/1.4 "Cascadia Code", monospace;
  text-transform: uppercase;
}

.chapter-success-stats strong {
  margin-top: 0.25rem;
  color: var(--paper);
  font-size: 1.2rem;
}

.chapter-success-card > button {
  border: 1px solid var(--acid);
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.chapter-success-card > button:hover {
  box-shadow: 0 0 28px rgb(216 255 62 / 25%);
  transform: translateY(-2px);
}

@keyframes success-card-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
}

@keyframes success-check-in {
  from {
    opacity: 0;
    transform: scale(0.15) rotate(-25deg);
  }
}

@keyframes orbit-pulse {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  45% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes particle-rise {
  0% {
    opacity: 0;
    transform: translateY(8vh) rotate(0);
  }
  22% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translateY(-70vh) rotate(220deg);
  }
}

@keyframes success-grid-in {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
}

/* Completion */

.completion {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-content: center;
  padding: clamp(1.5rem, 6vw, 6rem);
  background:
    radial-gradient(circle at 70% 30%, rgb(216 255 62 / 16%), transparent 26rem),
    var(--ink);
}

.completion::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(216 255 62 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(216 255 62 / 5%) 1px, transparent 1px);
  background-size: 40px 40px;
  content: "";
  mask-image: radial-gradient(circle at center, black, transparent 82%);
  pointer-events: none;
}

.completion > * {
  position: relative;
}

.completion-scan {
  position: absolute;
  z-index: 2;
  inset: -20% 0 auto;
  height: 20%;
  background: linear-gradient(transparent, rgb(216 255 62 / 10%), transparent);
  pointer-events: none;
  animation: completion-scan 2.4s ease-out both;
}

.completion-fireworks {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.completion-fireworks span {
  position: absolute;
  top: 26%;
  left: 72%;
  width: 4px;
  height: 28px;
  border-radius: 4px;
  background: var(--acid);
  box-shadow: 0 0 10px rgb(216 255 62 / 70%);
  opacity: 0;
  transform-origin: 50% 12rem;
  rotate: var(--spark-rotate);
  animation: spark-burst 1.25s ease-out var(--spark-delay) both;
}

.completion-fireworks span:nth-child(3n) {
  background: var(--cyan);
}

.completion-fireworks span:nth-child(4n) {
  background: var(--orange);
}

.completion-badge {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  border: 1px solid var(--acid);
  background: rgb(216 255 62 / 8%);
  color: var(--acid);
  padding: 0.45rem 0.7rem;
  font: 800 0.7rem/1.3 "Cascadia Code", monospace;
  letter-spacing: 0.1em;
  animation: success-card-in 620ms ease-out both;
}

.completion-badge span {
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--acid);
  color: var(--ink);
  place-items: center;
}

.completion h1 {
  max-width: 8ch;
  font-size: clamp(4.3rem, 13vw, 10rem);
  line-height: 0.82;
}

.completion > p:not(.project-label, .completion-footnote) {
  max-width: 42rem;
  margin: 2rem 0;
  color: var(--paper-dim);
  font-size: 1rem;
  line-height: 1.65;
}

.completion-stats {
  display: grid;
  max-width: 44rem;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line);
}

.completion-stats div {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-right: 1px solid var(--line);
}

.completion-stats div:first-child {
  padding-left: 0;
}

.completion-stats div:last-child {
  border: 0;
}

.completion-stats span {
  color: #82887d;
  font: 0.62rem/1.4 "Cascadia Code", monospace;
  text-transform: uppercase;
}

.completion-stats strong {
  margin-top: 0.25rem;
  color: var(--acid);
  font-size: 1.35rem;
}

.completion-recap {
  max-width: 44rem;
  margin-top: 1.3rem;
  border-left: 4px solid var(--acid);
  background: rgb(216 255 62 / 7%);
  padding: 1rem 1.1rem;
}

.completion-recap > strong {
  color: var(--acid);
  font: 900 0.68rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.1em;
}

.completion-recap p {
  margin: 0.5rem 0 0.75rem;
  color: var(--paper);
  line-height: 1.5;
}

.completion-recap > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.completion-recap span {
  border: 1px solid #4e5837;
  color: var(--paper-dim);
  padding: 0.35rem 0.55rem;
  font: 0.62rem/1.3 "Cascadia Code", monospace;
}

@keyframes completion-scan {
  to {
    transform: translateY(650%);
  }
}

@keyframes spark-burst {
  0% {
    opacity: 0;
    transform: translateY(0) scaleY(0.2);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-12rem) scaleY(1);
  }
}

.chapter-results {
  display: grid;
  width: min(64rem, 90vw);
  margin-top: 1.4rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.chapter-results div {
  display: grid;
  align-items: center;
  grid-template-columns: 2rem minmax(0, 1fr);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
}

.chapter-results span {
  color: var(--acid);
  font: 0.68rem/1.4 "Cascadia Code", monospace;
}

.chapter-results strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-results small {
  grid-column: 2;
  margin-top: 0.18rem;
  color: #777d73;
  font: 0.58rem/1.4 "Cascadia Code", monospace;
}

.scoreboard {
  width: min(64rem, 90vw);
  margin-top: 1.8rem;
  border: 1px solid var(--line);
  background: #121512;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.scoreboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.scoreboard-heading h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  letter-spacing: -0.025em;
  line-height: 0.9;
  text-transform: uppercase;
}

.your-score {
  display: grid;
  min-width: 7rem;
  text-align: right;
}

.your-score span,
.your-score small {
  color: #858b81;
  font: 0.58rem/1.3 "Cascadia Code", monospace;
  text-transform: uppercase;
}

.your-score strong {
  color: var(--acid);
  font-size: 2rem;
  line-height: 1;
}

.score-entry {
  margin-top: 1.3rem;
}

.score-entry > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 800;
}

.score-entry label small {
  color: #777d73;
  font: 0.58rem/1.4 "Cascadia Code", monospace;
  font-weight: 400;
}

.score-entry > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 1px solid #4c5447;
  background: #090b09;
}

.score-entry > div > span {
  align-self: center;
  color: var(--acid);
  padding-left: 0.8rem;
  font-family: "Cascadia Code", monospace;
}

.score-entry input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  padding: 0.85rem 0.65rem;
  font-family: "Cascadia Code", monospace;
}

.score-entry button {
  border: 0;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 900;
}

.score-entry button:disabled {
  cursor: default;
  opacity: 0.65;
}

.score-message {
  margin: 0.6rem 0 0;
  color: var(--orange);
  font-size: 0.75rem;
}

.score-message.success {
  color: var(--acid);
}

.score-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.score-list li {
  display: grid;
  align-items: center;
  grid-template-columns: 2.2rem minmax(7rem, 1fr) minmax(9rem, 1fr) 4rem;
  border-top: 1px solid #2f352e;
  padding: 0.55rem 0;
}

.score-list li > span {
  color: #6e756b;
  font: 0.64rem/1.3 "Cascadia Code", monospace;
}

.score-list li > strong {
  overflow: hidden;
  color: var(--paper);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-list li > small {
  color: #747b72;
  font: 0.58rem/1.3 "Cascadia Code", monospace;
}

.score-list li > b {
  color: var(--acid);
  text-align: right;
  font: 800 0.9rem/1.3 "Cascadia Code", monospace;
}

.score-empty {
  margin: 1rem 0 0;
  border-top: 1px solid #2f352e;
  color: #777d73;
  padding-top: 0.8rem;
  font-size: 0.75rem;
}

.score-privacy {
  margin: 1rem 0 0;
  color: #656b62;
  font: 0.58rem/1.5 "Cascadia Code", monospace;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.completion-actions button,
.completion-actions a {
  border: 1px solid var(--acid);
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.completion-actions button.quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--paper-dim);
}

.completion-footnote {
  margin: 1.4rem 0 0;
  color: #676d64;
  font: 0.65rem/1.5 "Cascadia Code", monospace;
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 1rem 1.2rem;
  color: #6f756c;
  font-size: 0.62rem;
}

.game-footer > span:last-child {
  display: flex;
  gap: 1rem;
}

.game-footer a:hover {
  color: var(--acid);
}

@media (max-width: 1280px) {
  .game-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .blueprint-panel {
    position: relative;
    top: auto;
    height: auto;
    grid-column: 2;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .blueprint {
    max-width: 680px;
  }
}

@media (max-width: 820px) {
  .game-header {
    min-height: 66px;
  }

  .brand-button {
    padding: 0 0.75rem;
  }

  .brand-button strong {
    font-size: 1.05rem;
  }

  .brand-button small,
  .system-stats div:nth-child(2),
  .system-stats div:nth-child(3) {
    display: none;
  }

  .system-stats div {
    min-width: 66px;
    padding: 0 0.65rem;
  }

  .system-stats button {
    padding: 0 0.7rem;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
  }

  .mission-rail {
    position: sticky;
    z-index: 20;
    top: 66px;
    width: 100%;
    height: auto;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-heading {
    display: none;
  }

  .mission-rail ol {
    display: flex;
    width: max-content;
  }

  .mission-rail li {
    width: 72px;
    border-right: 1px solid #292e28;
    border-bottom: 0;
  }

  .mission-rail button {
    display: grid;
    min-height: 58px;
    place-items: center;
    grid-template-columns: 1fr;
    padding: 0.55rem;
  }

  .mission-nav-copy,
  .lock-glyph {
    display: none;
  }

  .mission-number {
    width: 29px;
  }

  .puzzle-panel {
    padding: 1.3rem 1rem 2.5rem;
  }

  .mission-meta {
    margin-bottom: 1.4rem;
  }

  .huge-number {
    font-size: 3.8rem;
  }

  .mission-title-row h1 {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .learning-debrief dl {
    grid-template-columns: 1fr;
  }

  .learning-debrief dl div:nth-child(odd) {
    border-right: 0;
  }

  .blueprint-panel {
    padding: 1rem;
  }

  .game-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }
}

@media (max-width: 540px) {
  .start-screen {
    place-items: start;
    padding: 1.25rem;
  }

  .start-terminal {
    margin-bottom: 3rem;
  }

  .start-shell h1 {
    margin-left: -0.05em;
    font-size: clamp(4.5rem, 24vw, 7rem);
  }

  .start-specs {
    flex-wrap: wrap;
  }

  .start-specs div {
    min-width: 33%;
    padding: 0.8rem 0.45rem;
  }

  .start-specs span {
    font-size: 0.64rem;
  }

  .brand-mark {
    display: none;
  }

  .system-stats button {
    font-size: 0.62rem;
  }

  .mission-title-row {
    gap: 0.8rem;
  }

  .huge-number {
    font-size: 3.1rem;
  }

  .mission-subtitle {
    font-size: 0.8rem;
  }

  .terminal-output pre {
    min-height: 112px;
    padding: 0.85rem;
  }

  .challenge {
    margin-inline: -0.25rem;
    padding: 1rem;
  }

  .terminal-input-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .terminal-input-row button {
    min-height: 44px;
    grid-column: 1 / -1;
  }

  .chapter-success {
    place-items: start center;
    padding: 1rem;
  }

  .chapter-success-card {
    padding: 1.5rem 1rem;
  }

  .success-orbit {
    width: 4.5rem;
    height: 4.5rem;
  }

  .success-orbit span {
    font-size: 2.2rem;
  }

  .chapter-success-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .chapter-success-stats div:nth-child(2) {
    border-right: 0;
  }

  .chapter-success-stats div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .completion {
    place-content: start center;
    padding: 2rem 1.2rem;
  }

  .completion h1 {
    font-size: clamp(4rem, 22vw, 6.4rem);
  }

  .completion-stats strong {
    font-size: 1rem;
  }

  .completion-fireworks span {
    top: 18%;
    left: 70%;
  }

  .completion-recap > div {
    align-items: stretch;
    flex-direction: column;
  }

  .chapter-results {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .scoreboard {
    width: 100%;
  }

  .scoreboard-heading {
    align-items: flex-end;
  }

  .score-entry > label {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .score-entry > div {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .score-entry button {
    min-height: 44px;
    grid-column: 1 / -1;
  }

  .score-list li {
    grid-template-columns: 1.7rem minmax(0, 1fr) 3.5rem;
  }

  .score-list li > small {
    display: none;
  }

  .completion-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .completion-actions button,
  .completion-actions a {
    text-align: center;
  }
}

.feedback-box.wrong {
  animation: error-shake 420ms ease-out both;
}

.feedback-box.wrong .penalty-line {
  margin-top: 0.6rem;
  font: 900 0.72rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.06em;
  color: #9a311c;
}

.feedback-box.wrong .solution-line {
  margin-top: 0.5rem;
}

.feedback-box.wrong .solution-line code {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.feedback-box.wrong .strike-line {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  opacity: 0.8;
}

.feedback-box.wrong .advance-note {
  margin-top: 0.5rem;
  font: 700 0.72rem/1.4 "Cascadia Code", monospace;
  letter-spacing: 0.04em;
}

.auto-advance-bar {
  display: block;
  height: 3px;
  margin-top: 0.8rem;
  background: #9a311c;
  transform-origin: left center;
  animation: auto-advance linear forwards;
}

@keyframes error-shake {
  0%,
  100% {
    translate: 0 0;
  }

  20% {
    translate: -6px 0;
  }

  40% {
    translate: 5px 0;
  }

  60% {
    translate: -3px 0;
  }

  80% {
    translate: 2px 0;
  }
}

@keyframes auto-advance {
  from {
    scale: 1 1;
  }

  to {
    scale: 0 1;
  }
}

.strike-reset {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  background:
    radial-gradient(circle at 50% 42%, rgb(255 95 86 / 18%), transparent 24rem),
    var(--ink);
  isolation: isolate;
}

.strike-scan {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image: linear-gradient(
    rgb(255 95 86 / 7%) 1px,
    transparent 1px
  );
  background-size: 100% 6px;
}

.strike-reset-card {
  width: min(100%, 44rem);
  border: 1px solid #9a311c;
  background: rgb(16 19 16 / 94%);
  box-shadow:
    0 0 0 1px rgb(255 95 86 / 10%),
    0 30px 90px rgb(0 0 0 / 45%);
  padding: clamp(1.5rem, 5vw, 3.5rem);
  text-align: center;
  animation: success-card-in 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.strike-orbit {
  display: grid;
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--danger);
  border-radius: 50%;
  place-items: center;
  font: 900 2.2rem/1 "Cascadia Code", monospace;
  color: var(--danger);
  animation: strike-pulse 1.6s ease-in-out infinite;
}

.strike-reset-card h1 {
  margin: 0.6rem 0 0;
  color: var(--paper);
}

.strike-reset-summary {
  margin: 1rem auto 0;
  max-width: 34rem;
  color: var(--paper-dim);
  line-height: 1.6;
}

.strike-reset-card > button {
  margin-top: 2rem;
  border: 0;
  background: var(--danger);
  color: var(--ink);
  cursor: pointer;
  padding: 0.9rem 1.4rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.strike-reset-card > button:hover {
  background: var(--orange);
}

@keyframes strike-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(255 95 86 / 40%);
  }

  50% {
    box-shadow: 0 0 0 14px rgb(255 95 86 / 0%);
  }
}

.study-sheet {
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 1.25rem 4rem;
  color: var(--paper);
}

.study-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.study-sheet-actions button {
  border: 0;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  padding: 0.8rem 1.1rem;
  font-weight: 800;
}

.study-sheet-actions button.quiet {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper-dim);
}

.study-sheet-meta {
  margin: 0.6rem 0 2.5rem;
  color: var(--paper-dim);
  font: 700 0.78rem/1.6 "Cascadia Code", monospace;
}

.study-sheet h2 {
  margin: 2.5rem 0 1rem;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.study-sheet-entry {
  margin: 1.25rem 0;
  border-left: 3px solid var(--danger);
  padding: 0.9rem 1.25rem;
  background: rgb(29 33 29 / 60%);
}

.study-sheet-entry h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.study-sheet-entry dl {
  margin: 0;
}

.study-sheet-entry dl > div {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

.study-sheet-entry dt {
  color: var(--paper-dim);
  font: 700 0.7rem/1.6 "Cascadia Code", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.study-sheet-entry dd {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.study-sheet-entry code {
  color: var(--acid);
  overflow-wrap: anywhere;
}

.study-sheet-balance {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--paper-dim);
  font-size: 0.85rem;
  line-height: 1.9;
}

@media (max-width: 40rem) {
  .study-sheet-entry dl > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

@media print {
  .study-sheet-actions,
  .game-header,
  .game-footer,
  .mission-rail {
    display: none !important;
  }

  body,
  .study-sheet {
    width: auto;
    max-width: none;
    padding: 0;
    background: #fff;
    color: #000;
  }

  .study-sheet-meta,
  .study-sheet-entry dt,
  .study-sheet-balance {
    color: #333;
  }

  .study-sheet-entry {
    break-inside: avoid;
    border-left: 2px solid #666;
    background: transparent;
  }

  .study-sheet-entry code {
    color: #000;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
