:root {
  --ink: #090909;
  --panel: #121212;
  --panel-raised: #181818;
  --paper: #f0eee5;
  --muted: #aaa89f;
  --acid: #d8ff3e;
  --red: #ff4f42;
  --line: #373737;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--acid);
  color: var(--ink);
}

.loading-screen,
.fatal-error {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px;
}

.loading-card,
.fatal-error > div {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.loading-card p,
.fatal-error p {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.fatal-error h1 {
  margin: 0;
  color: var(--red);
  font-family: Impact, "Arial Narrow Bold", sans-serif;
  font-size: 2.8rem;
  text-transform: uppercase;
}

.fatal-error code {
  color: var(--acid);
}

.eyebrow,
.location,
.scene-art__warning,
.case-code,
.callback__label,
.topbar__status,
.saved-status,
.game-footer,
.save-note {
  font-family: "Arial Narrow", "Roboto Condensed", ui-sans-serif, sans-serif;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
}

.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--paper);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(3.8rem, 8vw, 6.6rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.78;
  text-transform: uppercase;
}

.wordmark strong {
  margin-left: 0.22em;
  color: var(--acid);
  font: inherit;
  transform: rotate(-2deg);
}

.wordmark--compact {
  font-size: 1.25rem;
  letter-spacing: 0;
  line-height: 0.78;
}

.wordmark--compact strong {
  margin-left: 0.18em;
}

.action {
  min-height: 58px;
  padding: 16px 22px;
  border: 2px solid var(--paper);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0.015em;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.action:hover:not(:disabled) {
  transform: translate(-3px, -3px);
  box-shadow: 4px 4px 0 var(--paper);
}

.action:focus-visible,
.choice:focus-visible,
.reset-link:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

.action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.action--primary {
  border-color: var(--acid);
  background: var(--acid);
  color: var(--ink);
}

.action--primary:hover:not(:disabled) {
  box-shadow: 4px 4px 0 var(--red);
}

.action--quiet {
  border-color: var(--line);
  color: var(--muted);
}

/* Intro */

.intro-screen {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(320px, 46vw) 1fr;
  background: var(--ink);
}

.intro-art {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #222;
}

.intro-art::after {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, 0.16);
  content: "";
  pointer-events: none;
}

.intro-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro-art__case {
  position: absolute;
  z-index: 1;
  top: 26px;
  left: 26px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  background: var(--acid);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  transform: rotate(-2deg);
}

.intro-copy {
  display: flex;
  width: min(760px, 100%);
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 6vw, 92px);
}

.intro-copy > .eyebrow {
  margin-bottom: 34px;
  color: var(--red);
}

.intro-lead {
  max-width: 660px;
  margin: 44px 0 0;
  color: #d0cec5;
  font-size: clamp(1.14rem, 1.3vw, 1.4rem);
  font-weight: 500;
  line-height: 1.58;
}

.intro-facts {
  display: flex;
  max-width: 650px;
  margin: 36px 0;
  border-block: 1px solid var(--line);
}

.intro-facts span {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  padding: 18px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.intro-facts span + span {
  border-left: 1px solid var(--line);
}

.intro-facts b {
  color: var(--paper);
  font-size: 1.45rem;
}

.intro-actions {
  display: flex;
  max-width: 650px;
  gap: 12px;
}

.intro-actions .action--primary {
  flex: 1.5;
}

.intro-actions .action--quiet {
  flex: 1;
}

.save-note {
  margin: 22px 0 0;
  color: #77766f;
}

.download-link {
  display: flex;
  width: min(650px, 100%);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 15px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.download-link:hover {
  border-color: var(--acid);
  color: var(--acid);
  transform: translateX(3px);
}

.download-link:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

.download-link small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Shared game chrome */

.game-screen,
.result-screen {
  width: min(1180px, calc(100% - 48px));
  min-height: 100svh;
  margin: 0 auto;
  padding-bottom: 48px;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.reset-link {
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid #686861;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.reset-link:hover {
  border-color: var(--red);
  color: var(--paper);
}

.progress {
  padding: 22px 0 30px;
}

.progress__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-family: "Arial Narrow", ui-sans-serif, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.progress__label b {
  color: var(--paper);
}

.progress__ticks {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 4px;
}

.progress__ticks span {
  height: 4px;
  background: #292929;
}

.progress__ticks .is-done {
  background: #77776f;
}

.progress__ticks .is-current {
  background: var(--acid);
}

/* Situation */

.scene-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(390px, 0.98fr);
  gap: clamp(30px, 5vw, 72px);
  align-items: start;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

.is-transitioning .scene-layout,
.is-transitioning .result-hero {
  opacity: 0;
  transform: translateY(12px);
}

.scene-art {
  position: sticky;
  top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 10px 10px 0 #1d1d1d;
}

.scene-art img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.scene-art__number,
.scene-art__warning {
  position: absolute;
}

.scene-art__number {
  top: 16px;
  left: 16px;
  padding: 7px 9px;
  background: var(--acid);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
}

.scene-art__warning {
  right: 14px;
  bottom: 14px;
  padding: 7px 9px;
  background: var(--red);
  color: var(--ink);
  transform: rotate(-1deg);
}

.scene-copy {
  padding: 4px 0 14px;
}

.location {
  display: inline-block;
  margin-bottom: 20px;
  padding: 8px 10px;
  border-left: 4px solid var(--red);
  background: var(--panel-raised);
  color: #d5d2c8;
}

.scene-copy h1,
.result-hero h1,
.section-heading h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-weight: 900;
  letter-spacing: -0.018em;
  line-height: 0.98;
  text-transform: uppercase;
}

.scene-copy h1 {
  max-width: 620px;
  font-size: clamp(2.65rem, 4.4vw, 4.7rem);
}

.scene-text {
  margin: 26px 0 32px;
  color: #d5d3ca;
  font-size: clamp(1.12rem, 1.3vw, 1.28rem);
  font-weight: 510;
  line-height: 1.62;
}

.choice-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.choice-heading small {
  color: #686861;
  font: inherit;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  display: grid;
  width: 100%;
  min-height: 68px;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 17px;
  border: 1px solid #454545;
  border-radius: 0;
  background: var(--panel);
  color: var(--paper);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 690;
  line-height: 1.38;
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.choice:hover:not(:disabled) {
  border-color: var(--acid);
  background: #1a1a1a;
  transform: translateX(5px);
}

.choice:disabled {
  cursor: default;
}

.choice.is-selected {
  border-color: var(--acid);
  background: var(--acid);
  color: var(--ink);
}

.choice__mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #62625c;
  color: var(--acid);
  font-size: 0.8rem;
  font-weight: 950;
}

.choice.is-selected .choice__mark {
  border-color: var(--ink);
  color: var(--ink);
}

.game-footer {
  margin-top: 46px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #62615b;
  text-align: center;
}

/* Result */

.topbar--result {
  margin-bottom: 40px;
}

.topbar__status {
  color: var(--red);
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(350px, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(34px, 6vw, 82px);
  align-items: center;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--line);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

.result-hero__image {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 10px 10px 0 #1d1d1d;
}

.result-hero__image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.result-stamp {
  position: absolute;
  right: -18px;
  bottom: 28px;
  max-width: 88%;
  padding: 10px 14px;
  border: 4px solid var(--red);
  color: var(--red);
  font-family: Impact, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.1rem, 2.1vw, 2rem);
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-5deg);
}

.result-hero__copy > .eyebrow {
  margin-bottom: 18px;
  color: var(--red);
}

.result-hero h1 {
  margin-bottom: 20px;
  font-size: clamp(3rem, 5.4vw, 5.8rem);
}

.case-code {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 24px;
  padding: 8px 10px;
  background: var(--acid);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.result-hero__copy p {
  margin: 0 0 18px;
  color: #d2d0c7;
  font-size: 1.1rem;
  line-height: 1.62;
}

.trait-report,
.callback-report {
  padding: 64px 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 34px;
}

.section-heading > span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 2px solid var(--acid);
  color: var(--acid);
  font-weight: 900;
}

.section-heading .eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 36px;
}

.trait__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
  color: #d9d7ce;
  font-size: 0.88rem;
  font-weight: 760;
  text-transform: uppercase;
}

.trait__label b {
  color: var(--acid);
}

.trait__track {
  height: 11px;
  padding: 2px;
  border: 1px solid #4c4c48;
}

.trait__track span {
  display: block;
  height: 100%;
  background: var(--acid);
}

.callback-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.callback {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.callback:nth-child(3n) {
  border-color: #5e302d;
}

.callback__label {
  display: inline-block;
  margin-bottom: 13px;
  padding: 5px 7px;
  background: var(--red);
  color: var(--ink);
}

.callback p {
  margin: 0;
  color: #d1cfc6;
  font-size: 1rem;
  line-height: 1.55;
}

.postscript {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  margin: 54px 0 34px;
  padding: 26px;
  border: 2px solid var(--paper);
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-0.4deg);
}

.postscript span {
  color: var(--red);
  font-family: Impact, "Arial Narrow Bold", sans-serif;
  font-size: 2rem;
}

.postscript p {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 740;
  line-height: 1.45;
}

.result-actions {
  display: flex;
  justify-content: center;
  padding: 12px 0 34px;
}

.result-actions .action {
  width: min(520px, 100%);
}

@media (max-width: 820px) {
  .intro-screen {
    display: block;
  }

  .intro-art {
    min-height: 340px;
    height: 40svh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .intro-copy {
    width: 100%;
    padding: 38px 22px 56px;
  }

  .intro-copy > .eyebrow {
    margin-bottom: 26px;
  }

  .intro-lead {
    margin-top: 36px;
    font-size: 1.2rem;
  }

  .scene-layout,
  .result-hero {
    grid-template-columns: 1fr;
  }

  .scene-art {
    position: relative;
    top: auto;
  }

  .scene-copy h1 {
    font-size: clamp(2.7rem, 11vw, 4.1rem);
  }

  .scene-text {
    font-size: 1.24rem;
    line-height: 1.58;
  }

  .choice {
    min-height: 76px;
    padding: 16px 17px;
    font-size: 1.07rem;
  }

  .result-hero {
    padding-bottom: 52px;
  }

  .result-hero__image img {
    aspect-ratio: 3 / 2;
  }

  .result-stamp {
    right: 12px;
  }
}

@media (max-width: 620px) {
  .wordmark {
    font-size: clamp(3.3rem, 16vw, 5rem);
  }

  .wordmark--compact {
    font-size: 1.05rem;
  }

  .intro-facts span {
    flex-direction: column;
    gap: 2px;
    padding: 15px 9px;
  }

  .intro-actions {
    flex-direction: column;
  }

  .download-link {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .game-screen,
  .result-screen {
    width: calc(100% - 24px);
  }

  .topbar {
    min-height: 66px;
  }

  .saved-status {
    display: none;
  }

  .progress {
    padding: 18px 0 23px;
  }

  .progress__ticks {
    gap: 2px;
  }

  .scene-layout {
    gap: 30px;
  }

  .scene-art {
    box-shadow: 6px 6px 0 #1d1d1d;
  }

  .scene-art__warning {
    right: 8px;
    bottom: 8px;
    font-size: 0.61rem;
  }

  .scene-copy {
    padding-inline: 3px;
  }

  .location {
    margin-bottom: 17px;
  }

  .scene-text {
    margin: 23px 0 29px;
  }

  .choice-heading small {
    display: none;
  }

  .topbar--result {
    margin-bottom: 28px;
  }

  .topbar__status {
    max-width: 190px;
    font-size: 0.62rem;
    text-align: right;
  }

  .result-hero {
    gap: 34px;
  }

  .result-hero h1 {
    font-size: clamp(2.8rem, 13vw, 4.6rem);
  }

  .result-hero__copy p {
    font-size: 1.12rem;
  }

  .trait-report,
  .callback-report {
    padding: 52px 0;
  }

  .section-heading {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }

  .section-heading > span {
    width: 40px;
    height: 40px;
  }

  .trait-grid,
  .callback-list {
    grid-template-columns: 1fr;
  }

  .postscript {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 22px;
  }
}

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