:root {
  color-scheme: dark;
  --ink: #090b09;
  --ink-soft: #161b15;
  --paper: #eadfbe;
  --paper-dim: #cbbf9d;
  --acid: #d9ff43;
  --acid-deep: #83a713;
  --swamp: #5c9862;
  --swamp-dark: #253b28;
  --danger: #ff5b4f;
  --danger-dark: #8d241f;
  --gold: #f1bd55;
  --blue: #7bd7d7;
  --muted: #84907e;
  --line: #090b09;
  --shadow: 7px 7px 0 #050705;
  --radius: 2px;
  --font-small: 0.875rem;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 10% 0%, rgba(122, 190, 99, 0.16), transparent 31rem),
    radial-gradient(circle at 90% 38%, rgba(217, 255, 67, 0.09), transparent 28rem),
    #10140f;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

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

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.44;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--acid);
  font-weight: 900;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only,
.skip-link:not(:focus) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.page-noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.app-shell {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--paper);
  text-decoration: none;
}

.brand-lockup img {
  flex: 0 0 auto;
  border: 3px solid var(--paper);
  box-shadow: 4px 4px 0 var(--acid-deep);
}

.brand-lockup > span {
  display: grid;
  line-height: 1;
}

.brand-lockup strong {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1.8rem, 3.6vw, 3.2rem);
  letter-spacing: 0.035em;
  color: var(--acid);
  text-shadow: 3px 3px 0 #000;
}

.brand-lockup small {
  margin-top: 4px;
  font-family: "Courier New", monospace;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--paper-dim);
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--acid);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.16em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 14px;
  border: 2px solid #3c4938;
  color: var(--paper);
  background: #181f16;
  text-decoration: none;
  font-weight: 900;
}

.token-pill small {
  display: block;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  letter-spacing: 0.12em;
}

.status-light {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 2px var(--acid-deep), 0 0 15px var(--acid);
}

.icon-button,
.text-button {
  min-height: 52px;
  border: 2px solid var(--paper-dim);
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  font-family: Impact, sans-serif;
  font-size: 1.5rem;
  text-decoration: none;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
  background: var(--acid);
}

.text-button {
  padding: 0 16px;
  font-size: var(--font-small);
  letter-spacing: 0.08em;
}

.status-deck {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.status-card {
  position: relative;
  min-width: 0;
  padding: 13px 15px 12px;
  border: 2px solid #394036;
  background: rgba(19, 24, 18, 0.94);
  overflow: hidden;
}

.status-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 5px;
  background: var(--swamp);
}

.status-card--day {
  border-color: var(--acid-deep);
  background: #242d1e;
}

.status-card--day::after {
  background: var(--acid);
}

.status-card--danger::after {
  background: var(--danger);
}

.status-card span,
.status-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-card strong {
  display: block;
  margin: 2px 0 1px;
  overflow: hidden;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1.3rem, 2.1vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-card strong[data-negative="true"] {
  color: var(--danger);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(540px, 1.75fr) minmax(270px, 0.9fr);
  align-items: start;
  gap: 15px;
}

.briefing-column,
.market-column,
.operations-column {
  display: grid;
  gap: 15px;
  min-width: 0;
}

.comic-panel {
  position: relative;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.1) 1px, transparent 1.5px) 0 0 / 8px 8px,
    var(--paper);
  box-shadow: var(--shadow);
}

.panel-tab {
  position: absolute;
  z-index: 2;
  top: -12px;
  left: 12px;
  padding: 6px 11px 5px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--acid);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.12em;
  transform: rotate(-1.5deg);
}

.panel-tab--gold {
  background: var(--gold);
}

.portrait-panel {
  padding: 12px;
}

.portrait-wrap {
  position: relative;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  background: var(--swamp-dark);
  overflow: hidden;
}

.portrait-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 32%, rgba(4, 7, 4, 0.38) 100%);
  mix-blend-mode: multiply;
}

.portrait-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.88) contrast(1.1) sepia(0.08);
}

.portrait-stamp {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 8px;
  padding: 5px 7px;
  border: 3px solid var(--danger-dark);
  color: var(--danger-dark);
  font-family: Impact, sans-serif;
  font-size: var(--font-small);
  line-height: 0.85;
  text-align: center;
  transform: rotate(8deg);
}

.portrait-caption {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 7px;
  color: var(--paper);
  background: rgba(9, 11, 9, 0.9);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.location-heading {
  padding: 13px 4px 2px;
}

.location-heading span,
.location-heading small {
  display: block;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.1em;
}

.location-heading strong {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.location-heading small {
  margin-top: 5px;
  color: #56604e;
  letter-spacing: 0;
}

.rumor-panel,
.vitals-panel,
.route-panel,
.mission-panel,
.debt-panel,
.contacts-panel,
.ledger-panel {
  padding: 17px;
}

.panel-heading,
.market-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading--compact {
  align-items: center;
}

.panel-heading h2,
.mission-panel h2,
.debt-panel h2,
.contacts-panel h2,
.ledger-panel h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  line-height: 1;
  text-transform: uppercase;
}

.signal-bars {
  color: var(--acid-deep);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.rumor-panel p {
  min-height: 3.8em;
  margin: 14px 0 12px;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.48;
}

.rumor-tag,
.risk-stamp {
  display: inline-flex;
  padding: 5px 8px;
  border: 2px solid currentColor;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.rumor-tag--up {
  color: #345c18;
  background: rgba(119, 194, 47, 0.16);
}

.rumor-tag--down {
  color: var(--danger-dark);
  background: rgba(255, 91, 79, 0.13);
}

.rumor-tag--flat {
  color: #51594c;
}

.risk-stamp[data-level="critical"],
.risk-stamp[data-level="high"] {
  color: var(--danger-dark);
}

.meter-row {
  margin-top: 13px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.meter-track {
  height: 15px;
  padding: 2px;
  border: 2px solid var(--ink);
  background: rgba(9, 11, 9, 0.14);
}

.meter-fill {
  display: block;
  width: 0;
  height: 100%;
  transition: width 240ms ease;
}

.meter-fill--health {
  background: repeating-linear-gradient(90deg, var(--swamp-dark) 0 8px, var(--swamp) 8px 11px);
}

.meter-fill--heat {
  background: repeating-linear-gradient(90deg, var(--danger-dark) 0 8px, var(--danger) 8px 11px);
}

.route-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.route-button {
  min-height: 68px;
  padding: 9px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  text-align: left;
}

.route-button:not(:disabled):hover {
  color: var(--paper);
  background: var(--swamp-dark);
}

.route-button > span {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.route-button small {
  display: block;
  margin-top: 7px;
  font-size: var(--font-small);
  letter-spacing: 0.05em;
}

.route-button small b,
.route-button small i {
  display: block;
  font-style: normal;
}

.route-button small i {
  margin-top: 3px;
  color: var(--danger-dark);
  letter-spacing: 0;
}

.route-button--active {
  color: var(--ink);
  background: var(--acid);
  opacity: 1 !important;
  filter: none !important;
}

.microcopy {
  margin: 11px 0 0;
  color: #596051;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.4;
}

.market-panel {
  padding: clamp(18px, 2.2vw, 30px);
}

.market-title-row {
  align-items: flex-end;
  margin-bottom: 18px;
}

.market-title-row h1 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.82;
  text-transform: uppercase;
}

.market-location-stamp {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 3px solid var(--ink);
  text-align: right;
  transform: rotate(1.5deg);
}

.market-location-stamp span,
.market-location-stamp strong {
  display: block;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  letter-spacing: 0.08em;
}

.market-location-stamp strong {
  max-width: 16ch;
  font-size: var(--font-small);
}

.market-legend,
.good-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(80px, 0.6fr) minmax(65px, 0.42fr) minmax(90px, 0.64fr);
  gap: 10px;
  align-items: center;
}

.market-legend {
  padding: 0 13px 7px;
  color: #697060;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.1em;
}

.market-legend span:not(:first-child) {
  text-align: right;
}

.goods-list {
  display: grid;
  gap: 7px;
}

.good-row {
  position: relative;
  width: 100%;
  min-height: 76px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.17);
  cursor: pointer;
  text-align: left;
}

.good-row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: transparent;
}

.good-row:hover {
  background: rgba(217, 255, 67, 0.2);
}

.good-row--selected {
  border-width: 3px;
  background: var(--ink-soft);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--acid-deep);
  transform: translate(-2px, -2px);
}

.good-row--selected::before {
  background: var(--acid);
}

.good-identity {
  display: grid;
  grid-template-columns: 22px 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.good-index {
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
}

.good-identity > i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid currentColor;
  color: var(--ink);
  background: var(--acid);
  font-family: Impact, sans-serif;
  font-size: 1rem;
  font-style: normal;
}

.good-identity > span,
.good-owned {
  display: block;
  min-width: 0;
}

.good-identity strong,
.good-identity small,
.good-owned strong,
.good-owned small {
  display: block;
}

.good-identity strong {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.08rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.good-identity small {
  margin-top: 2px;
  overflow: hidden;
  color: #5e6658;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.good-row--selected .good-identity small {
  color: #adb4a2;
}

.good-price,
.good-owned,
.good-signal {
  text-align: right;
}

.good-price {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1.08rem, 2vw, 1.5rem);
  font-weight: 500;
}

.good-owned strong {
  font-family: Impact, sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
}

.good-owned small {
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  text-transform: uppercase;
}

.good-signal {
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.good-signal--up {
  color: #4b7119;
}

.good-row--selected .good-signal--up {
  color: var(--acid);
}

.good-signal--down {
  color: var(--danger-dark);
}

.good-row--selected .good-signal--down {
  color: var(--danger);
}

.good-signal--flat {
  color: #687061;
}

.deal-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(150px, 0.7fr);
  gap: 18px 24px;
  padding: clamp(18px, 2vw, 26px);
  color: var(--paper);
  background:
    linear-gradient(115deg, transparent 0 62%, rgba(217, 255, 67, 0.06) 62% 100%),
    var(--ink-soft);
}

.deal-copy {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.deal-symbol {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 3px solid var(--paper);
  color: var(--ink);
  background: var(--acid);
  box-shadow: 5px 5px 0 var(--swamp-dark);
  font-family: Impact, sans-serif;
  font-size: 1.55rem;
}

.deal-copy h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.deal-copy p {
  max-width: 52ch;
  margin: 5px 0 0;
  color: #aeb7a6;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.4;
}

.deal-math {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-column: 2;
  grid-row: 1 / span 2;
  gap: 1px;
  border: 2px solid #3b4439;
  background: #3b4439;
}

.deal-math div {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 10px;
  background: #20271e;
}

.deal-math span,
.quantity-desk label {
  color: #82907c;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.09em;
}

.deal-math strong {
  overflow: hidden;
  margin-top: 4px;
  font-family: Impact, sans-serif;
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quantity-desk {
  min-width: 0;
}

.quantity-control {
  display: grid;
  grid-template-columns: 48px minmax(76px, 1fr) 48px 58px;
  gap: 5px;
  margin-top: 5px;
}

.quantity-control button,
.quantity-control input {
  min-width: 0;
  min-height: 50px;
  border: 2px solid #65705f;
  color: var(--paper);
  background: #0c0f0b;
  font-weight: 900;
  text-align: center;
}

.quantity-control button {
  cursor: pointer;
  font-size: 1.2rem;
}

.quantity-control .max-button {
  color: var(--acid);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
}

.deal-total {
  display: block;
  margin-top: 6px;
  color: #9ba794;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
}

.deal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 67px;
  border: 3px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.45rem;
  text-align: left;
  box-shadow: 4px 4px 0 #000;
}

.action-button--buy {
  background: var(--acid);
}

.action-button--sell {
  background: var(--danger);
}

.action-button small {
  display: block;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  letter-spacing: 0.08em;
}

.keycap {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid currentColor;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
}

.keyboard-strip {
  display: flex;
  justify-content: center;
  gap: 17px;
  padding: 8px 12px;
  color: #84907e;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 800;
  text-transform: uppercase;
}

kbd {
  padding: 1px 4px;
  border: 1px solid #4d5949;
  color: var(--paper);
  background: #171d16;
}

.mission-panel {
  padding-top: 27px;
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.15) 1px, transparent 1.5px) 0 0 / 7px 7px,
    var(--gold);
}

.mission-panel p {
  margin: 10px 0 16px;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.45;
}

.mission-panel .eyebrow {
  color: #6e4b0c;
}

.mission-score,
.debt-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 11px;
  border-top: 3px solid var(--ink);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.mission-score strong {
  font-family: Impact, sans-serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: 0.07em;
}

.mission-best {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.mission-best strong {
  font-family: Impact, sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.07em;
}

.debt-panel {
  color: var(--paper);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.5px) 0 0 / 8px 8px,
    #4d1917;
}

.debt-panel .eyebrow {
  color: var(--danger);
}

.debt-skull {
  color: var(--danger);
  font-size: 1.55rem;
}

.debt-amount {
  margin-top: 14px;
  border-color: #a3443e;
}

.debt-amount strong {
  font-family: Impact, sans-serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.debt-control {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 54px;
  align-items: center;
  margin-top: 11px;
  border: 2px solid #b95049;
  background: #1b0b0a;
}

.debt-control span {
  text-align: center;
  font-weight: 900;
}

.debt-control input {
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-right: 1px solid #a3443e;
  border-left: 1px solid #a3443e;
  color: var(--paper);
  background: transparent;
  font-weight: 900;
}

.debt-control button {
  min-height: 48px;
  border: 0;
  color: var(--danger);
  background: transparent;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.wide-button,
.dialog-primary {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--danger);
  cursor: pointer;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 #000;
}

.services-list {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.services-list button {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 7px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  text-align: left;
}

.services-list button:not(:disabled):hover {
  background: rgba(217, 255, 67, 0.25);
}

.service-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--paper);
  background: var(--swamp-dark);
}

.service-mark strong,
.service-mark small,
.services-list button > span > strong,
.services-list button > span > small {
  display: block;
}

.service-mark strong {
  font-family: Impact, sans-serif;
  font-size: 1rem;
  font-weight: 500;
}

.service-mark small {
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.services-list button > span > strong {
  font-size: var(--font-small);
  font-weight: 900;
  text-transform: uppercase;
}

.services-list button > span > small {
  margin-top: 2px;
  color: #596051;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
}

.services-list button > b {
  font-family: Impact, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
}

.ledger-panel {
  max-height: 505px;
  overflow: hidden;
}

.activity-log {
  display: grid;
  gap: 0;
  max-height: 410px;
  margin: 13px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--swamp-dark) transparent;
}

.log-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 3px;
  border-top: 1px dashed #6e7567;
}

.log-entry > span {
  color: #6b7364;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
}

.log-entry p {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.38;
}

.log-entry--danger p {
  color: #852c26;
}

.log-entry--good p {
  color: #315b2e;
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 15px 2px 0;
  border-top: 1px solid #394136;
  color: #7d8978;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
}

.game-footer strong {
  color: var(--paper-dim);
  letter-spacing: 0.08em;
}

.game-footer p {
  margin: 3px 0 0;
}

.contract-block {
  display: grid;
  gap: 4px;
  text-align: right;
}

.contract-block button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #4b5647;
  color: var(--paper-dim);
  background: #161b15;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
}

.contract-block b {
  margin-left: 7px;
  color: var(--acid);
}

.toast {
  position: fixed;
  z-index: 90;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 18px;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 #000;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast[data-tone="good"] {
  background: var(--acid);
}

.toast[data-tone="danger"] {
  background: var(--danger);
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.game-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 4px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 12px 12px 0 #000;
}

.game-dialog::backdrop {
  background:
    radial-gradient(circle, rgba(217, 255, 67, 0.08) 1px, transparent 1.5px) 0 0 / 9px 9px,
    rgba(5, 8, 5, 0.88);
  backdrop-filter: blur(4px);
}

.game-dialog:not(.game-dialog--help):not(.game-dialog--end) {
  display: none;
  grid-template-columns: 190px minmax(0, 1fr);
}

.game-dialog[open]:not(.game-dialog--help):not(.game-dialog--end) {
  display: grid;
}

.dialog-art {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 100%;
  padding: 24px;
  color: var(--acid);
  background:
    repeating-linear-gradient(135deg, rgba(217, 255, 67, 0.05) 0 10px, transparent 10px 20px),
    var(--ink-soft);
  font-family: Impact, sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

.dialog-art img {
  width: 116px;
  height: 116px;
  border: 4px solid var(--paper);
  writing-mode: initial;
}

.dialog-content {
  padding: clamp(24px, 5vw, 44px);
  overflow-y: auto;
}

.dialog-content h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-transform: uppercase;
}

.dialog-content > p {
  margin: 18px 0;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.55;
}

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

.how-list li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 52px;
  border: 2px solid var(--ink);
}

.how-list b {
  display: grid;
  place-items: center;
  align-self: stretch;
  color: var(--ink);
  background: var(--acid);
  font-family: Impact, sans-serif;
  font-size: 1rem;
}

.how-list span {
  padding-right: 9px;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
}

.dialog-primary {
  margin-top: 16px;
  background: var(--acid);
}

.dialog-content > small {
  display: block;
  margin-top: 9px;
  color: #596152;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  text-align: center;
}

.game-dialog--help,
.game-dialog--end {
  width: min(760px, calc(100vw - 28px));
}

.game-dialog--help .dialog-content h2,
.game-dialog--end .dialog-content h2 {
  font-size: clamp(2rem, 6vw, 4rem);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.help-grid article {
  position: relative;
  min-height: 160px;
  padding: 18px;
  border: 2px solid var(--ink);
}

.help-grid article > b {
  position: absolute;
  top: 8px;
  right: 10px;
  color: #a99e80;
  font-family: Impact, sans-serif;
  font-size: 2rem;
}

.help-grid h3 {
  max-width: 70%;
  margin: 0 0 9px;
  font-family: Impact, sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  text-transform: uppercase;
}

.help-grid p {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.5;
}

.game-dialog--end .dialog-content {
  text-align: center;
}

.personal-best-badge {
  width: fit-content;
  margin: 0 auto 18px;
  padding: 7px 12px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--gold);
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.05em;
}

.grade-badge {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin: 0 auto 22px;
  border: 5px solid var(--ink);
  color: var(--ink);
  background: var(--acid);
  box-shadow: 7px 7px 0 var(--swamp-dark);
  font-family: Impact, sans-serif;
  font-size: 4.3rem;
  transform: rotate(-4deg);
}

.final-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0 0;
  border: 2px solid var(--ink);
}

.final-stats div {
  padding: 13px 8px;
  border-right: 1px solid var(--ink);
}

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

.final-stats dt {
  color: #646c5c;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  text-transform: uppercase;
}

.final-stats dd {
  margin: 5px 0 0;
  font-family: Impact, sans-serif;
  font-size: 1.3rem;
}

.score-ticket {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
  border: 2px solid var(--ink);
  background: #e5dcc2;
}

.score-ticket div {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.score-ticket div + div {
  border-left: 1px solid var(--ink);
}

.score-ticket span,
.score-handle > span {
  color: #596152;
  font-family: "Courier New", monospace;
  font-size: var(--font-small);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.score-ticket strong {
  font-family: Impact, sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.score-handle {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  text-align: left;
}

.score-handle small {
  color: #818877;
}

.score-handle input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: #fffaf0;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  font-weight: 900;
}

.score-share-copy {
  margin: 12px 0 !important;
  color: #535b4d;
  text-align: left;
}

.score-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.score-actions .dialog-primary {
  margin-top: 0;
}

.dialog-secondary,
.dialog-link {
  min-height: 52px;
  border: 3px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dialog-secondary {
  background: var(--paper);
  box-shadow: 3px 3px 0 #000;
}

.dialog-link {
  width: 100%;
  margin-top: 12px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.dialog-secondary:hover,
.dialog-secondary:focus-visible,
.dialog-link:hover,
.dialog-link:focus-visible {
  background: #e6ddc3;
}

@media (max-width: 1240px) {
  .game-grid {
    grid-template-columns: minmax(250px, 0.72fr) minmax(520px, 1.5fr);
  }

  .operations-column {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ledger-panel {
    grid-column: span 3;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding-inline: 14px;
  }

  .game-header {
    align-items: flex-start;
  }

  .token-pill {
    display: none;
  }

  .status-deck {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .status-card {
    grid-column: span 2;
  }

  .status-card:nth-child(4),
  .status-card:nth-child(5) {
    grid-column: span 3;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .briefing-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portrait-panel,
  .route-panel {
    grid-row: span 2;
  }

  .market-column,
  .operations-column {
    grid-column: 1;
  }

  .operations-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-panel {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .game-header {
    gap: 8px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-lockup img {
    width: 48px;
    height: 48px;
  }

  .brand-lockup strong {
    font-size: clamp(1.35rem, 7.3vw, 2rem);
  }

  .brand-lockup small,
  .brand-lockup .eyebrow {
    font-size: var(--font-small);
  }

  .text-button {
    display: none;
  }

  .status-deck {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-card,
  .status-card:nth-child(4),
  .status-card:nth-child(5) {
    grid-column: span 1;
  }

  .status-card:nth-child(5) {
    grid-column: 1 / -1;
  }

  .briefing-column,
  .operations-column {
    grid-template-columns: 1fr;
  }

  .portrait-panel,
  .route-panel,
  .ledger-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .market-panel,
  .deal-panel {
    padding: 14px;
  }

  .market-title-row {
    align-items: flex-start;
  }

  .market-location-stamp {
    padding: 6px;
  }

  .market-legend {
    display: none;
  }

  .good-row {
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 5px 9px;
    min-height: 82px;
  }

  .good-identity {
    grid-row: span 2;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .good-index {
    display: none;
  }

  .good-identity > i {
    width: 36px;
    height: 36px;
  }

  .good-price {
    font-size: 1.18rem;
  }

  .good-owned {
    display: none;
  }

  .good-signal {
    font-size: var(--font-small);
  }

  .deal-panel {
    grid-template-columns: 1fr;
  }

  .deal-math {
    grid-column: 1;
    grid-row: auto;
  }

  .keyboard-strip {
    display: none;
  }

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

  .contract-block {
    width: 100%;
    text-align: left;
  }

  .contract-block button {
    width: 100%;
  }

  .game-dialog[open]:not(.game-dialog--help):not(.game-dialog--end) {
    display: block;
  }

  .dialog-art {
    display: none;
  }

  .help-grid,
  .score-actions {
    grid-template-columns: 1fr;
  }

  .final-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-grid article {
    min-height: auto;
  }

  .final-stats div {
    border-right: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
  }

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

  .final-stats div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .score-ticket {
    grid-template-columns: 1fr;
  }

  .score-ticket div + div {
    border-top: 1px solid var(--ink);
    border-left: 0;
  }
}

@media (max-width: 410px) {
  .route-map,
  .deal-actions {
    grid-template-columns: 1fr;
  }

  .deal-copy {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .deal-symbol {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }
}

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