:root {
  --ink: #151718;
  --muted: #667075;
  --paper: #f6f2e8;
  --panel: #fffaf0;
  --line: #d9cbb5;
  --red: #c84f4b;
  --blue: #3267a8;
  --green: #3a7d55;
  --gold: #b87a22;
  --charcoal: #232629;
  --shadow: 0 18px 50px rgba(34, 31, 27, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 23, 24, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(21, 23, 24, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  color: #fff;
  background: var(--charcoal);
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
  touch-action: manipulation;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.24);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--charcoal);
  background: #fffdf8;
  border-color: var(--line);
  box-shadow: none;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  border-bottom: 2px solid var(--charcoal);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 0.95;
}

.topbar p,
.setup-copy p,
#hintText {
  color: var(--muted);
}

.run-meter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.run-meter span {
  min-width: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px 12px;
  text-align: center;
  font-weight: 800;
}

#timerLabel {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.hidden {
  display: none !important;
}

.setup-screen,
.end-screen,
.reward-screen {
  display: grid;
  gap: 24px;
  align-items: start;
  padding: 32px 0;
}

.setup-screen {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
}

.setup-copy {
  display: grid;
  gap: 14px;
  padding-right: 24px;
}

.setup-copy h2,
.end-screen h2,
.reward-screen h2 {
  font-size: clamp(2.1rem, 5vw, 5rem);
  line-height: 0.95;
  max-width: 11ch;
}

.setup-form {
  display: grid;
  gap: 10px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.advanced-setup {
  display: grid;
  gap: 10px;
}

.advanced-setup[open] {
  display: grid;
}

.advanced-setup summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  padding: 0 12px;
  color: var(--charcoal);
  font-weight: 900;
  cursor: pointer;
}

.advanced-setup summary::after {
  content: "+";
  font-size: 1.2rem;
}

.advanced-setup[open] summary::after {
  content: "-";
}

.advanced-setup > * + * {
  margin-top: 10px;
}

.setup-field {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.setup-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-field p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.mode-list,
.route-draft {
  display: grid;
  gap: 7px;
}

.memory-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.memory-panel h3 {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-panel p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.memory-panel ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.memory-panel li {
  color: var(--charcoal);
  font-size: 0.88rem;
  line-height: 1.3;
}

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

.mode-option,
.route-option {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
}

.mode-option:has(input:checked),
.route-option:has(input:checked) {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(58, 125, 85, 0.18);
}

.mode-option input,
.route-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option strong,
.route-option strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.15;
}

.mode-option span,
.route-option span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.mode-option small,
.route-option small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.setup-form > label,
.label,
.panel-heading {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field-help {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.3;
}

.setup-form .mode-option,
.setup-form .route-option {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
}

.setup-form .mode-option strong,
.setup-form .route-option strong {
  color: var(--ink);
  font-size: 0.98rem;
  text-transform: none;
}

.setup-form .mode-option small,
.setup-form .route-option small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: none;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fffdf8;
  padding: 12px;
  line-height: 1.45;
}

.game-screen {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.stat-card,
.stat-grid,
.skill-list,
.log-panel,
.decision-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 0 10px 28px rgba(34, 31, 27, 0.08);
}

.stat-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.stat-card strong {
  font-size: 1.7rem;
}

.bar {
  overflow: hidden;
  height: 12px;
  border: 1px solid var(--charcoal);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--green);
  transition: width 160ms ease;
}

.enemy-bar span {
  background: var(--red);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.stat-grid div {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

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

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

.stat-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.stat-grid strong {
  font-size: 1.55rem;
}

.skill-list,
.route-list,
.market-list,
.log-panel {
  padding: 14px;
}

.skill-list ul,
.route-list ul,
.market-list ul,
.log-panel ol {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.skill-list li {
  font-weight: 800;
}

.route-list,
.market-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 0 10px 28px rgba(34, 31, 27, 0.08);
}

.route-list li,
.market-list li {
  line-height: 1.25;
}

.market-list ul {
  padding-left: 0;
}

.market-list li {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 203, 181, 0.8);
  border-radius: 6px;
  background: #fffdf8;
  padding: 8px;
}

.route-list p,
.market-list p {
  color: var(--charcoal);
  font-size: 0.82rem;
  line-height: 1.25;
}

.route-list .route-payoff {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.route-list li.done {
  color: var(--green);
  font-weight: 900;
}

.route-progress,
.market-tag {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.log-panel {
  max-height: 330px;
  overflow: auto;
}

.log-panel li {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.battle-column {
  display: grid;
  grid-template-rows: auto auto auto minmax(230px, auto) auto;
  gap: 14px;
}

.run-help {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.35;
}

.run-help strong {
  color: var(--ink);
  text-transform: uppercase;
}

.combat-stat-strip {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fire-summary {
  display: none;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.96);
  padding: 10px 12px;
}

.fire-summary div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.fire-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  line-height: 1.05;
}

.fire-summary p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.combat-stat-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.combat-stat-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.combat-stat-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
  line-height: 1;
}

.battlefield {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  min-height: 262px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(50, 103, 168, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(200, 79, 75, 0.18), transparent 38%),
    #f3eadb;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.battlefield::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 72px;
  background:
    linear-gradient(90deg, rgba(35, 38, 41, 0.18), transparent 30%),
    repeating-linear-gradient(90deg, rgba(35, 38, 41, 0.14) 0 2px, transparent 2px 28px);
}

.combatant {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

.combatant h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  line-height: 1;
}

.combatant p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
}

.portrait span {
  position: absolute;
  display: block;
}

.core {
  width: 58px;
  aspect-ratio: 1;
  border: 3px solid var(--charcoal);
  border-radius: 16px;
  background: var(--blue);
  transform: rotate(45deg);
}

.ring {
  border: 3px solid var(--charcoal);
  border-radius: 999px;
}

.ring-one {
  width: 108px;
  height: 54px;
  transform: rotate(-24deg);
}

.ring-two {
  width: 92px;
  height: 46px;
  transform: rotate(28deg);
}

.enemy {
  justify-content: space-between;
}

.enemy-figure {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  min-width: 116px;
  min-height: 150px;
}

.enemy-figure span {
  display: block;
  width: 32px;
  border: 3px solid var(--charcoal);
  border-radius: 18px 18px 6px 6px;
  background: var(--red);
  box-shadow: inset -7px 0 rgba(0, 0, 0, 0.16);
}

.enemy-figure span:nth-child(1) {
  height: 72px;
  background: var(--gold);
}

.enemy-figure span:nth-child(2) {
  height: 132px;
}

.enemy-figure span:nth-child(3) {
  height: 98px;
  background: var(--blue);
}

.enemy-health {
  position: absolute;
  right: 20px;
  bottom: 18px;
  width: min(230px, calc(100% - 40px));
}

.enemy-health span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.enemy-health strong {
  display: block;
  margin: 2px 0 8px;
  text-align: right;
}

.decision-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.decision-panel h3 {
  margin-top: 4px;
  font-size: 1.15rem;
  line-height: 1.2;
}

.decision-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.decision-options button {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 62px;
  padding: 8px;
  color: var(--ink);
  background: #fffdf8;
  border-color: var(--line);
  box-shadow: none;
  font-weight: 850;
}

.decision-options button span,
.decision-options button small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.decision-options button small {
  color: inherit;
  opacity: 0.76;
  font-size: 0.72rem;
  font-weight: 800;
}

.decision-options button.clean {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.decision-options button.costly {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.hand-row,
.reward-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 226px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  color: var(--ink);
  background: #fffdf8;
  padding: 12px;
  box-shadow: 0 8px 0 rgba(35, 38, 41, 0.18);
  text-align: left;
}

.card.attack {
  border-color: var(--red);
}

.card.block {
  border-color: var(--blue);
}

.card.utility {
  border-color: var(--green);
}

.card.utility-reward {
  border-color: var(--green);
  border-style: dashed;
}

.card.recovery {
  border-color: var(--gold);
}

.card.progress {
  border-color: var(--green);
}

.card.commit {
  border-color: var(--red);
}

.card.buffer,
.card.reset {
  border-color: var(--blue);
}

.card.junk {
  border-color: var(--charcoal);
  background: #eee8dc;
}

.card:disabled {
  filter: grayscale(0.65);
}

.card-disabled-note {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.86);
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
}

.card-cost {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border: 2px solid var(--charcoal);
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 950;
}

.card h3 {
  max-width: calc(100% - 42px);
  font-size: 1rem;
  line-height: 1.08;
}

.card-art {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, currentColor 0 18%, transparent 18% 100%),
    repeating-linear-gradient(90deg, rgba(21, 23, 24, 0.16) 0 2px, transparent 2px 11px),
    #f4ead8;
  opacity: 0.75;
}

.card.attack .card-art {
  color: var(--red);
}

.card.block .card-art {
  color: var(--blue);
}

.card.utility .card-art {
  color: var(--green);
}

.card.utility-reward .card-art {
  color: var(--green);
}

.card.utility-reward .card-cost {
  background: var(--green);
}

.card.recovery .card-art {
  color: var(--gold);
}

.card.progress .card-art,
.card.commit .card-art {
  color: var(--green);
}

.card.buffer .card-art,
.card.reset .card-art {
  color: var(--blue);
}

.card.junk .card-art {
  color: var(--charcoal);
}

.card p {
  color: var(--charcoal);
  font-size: 0.92rem;
  line-height: 1.32;
}

.card footer {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reward-screen {
  align-items: start;
}

.reward-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.end-screen {
  max-width: 680px;
}

.end-screen p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.run-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.run-stats span,
.bridge-field span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.run-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
}

.bridge-field {
  display: grid;
  gap: 8px;
}

.end-readout {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.end-readout h3 {
  font-size: 1rem;
}

.end-readout div {
  display: grid;
  gap: 5px;
}

.end-readout span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.end-readout strong {
  font-size: 1rem;
  line-height: 1.35;
}

.end-readout ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.end-readout li {
  color: var(--muted);
  line-height: 1.35;
}

.arcade-screen {
  display: grid;
  gap: 18px;
  padding: 24px 0;
}

.arcade-lead {
  display: grid;
  gap: 8px;
  min-height: 120px;
  border-bottom: 2px solid var(--charcoal);
  padding-bottom: 18px;
}

.arcade-lead h2 {
  margin-top: 8px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.96;
  max-width: 13ch;
}

.arcade-lead p,
.lane-panel p,
.section-heading p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
}

.primary-run-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(200, 79, 75, 0.14), transparent 42%),
    var(--panel);
  padding: 16px;
  box-shadow: 0 8px 0 rgba(35, 38, 41, 0.14);
}

.primary-run-card h2 {
  margin-top: 4px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 0.96;
}

.primary-run-card p {
  margin-top: 8px;
  color: var(--charcoal);
  font-weight: 800;
  line-height: 1.35;
}

.primary-run-card button {
  min-width: 178px;
}

.section-heading {
  display: grid;
  gap: 2px;
}

.lane-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
  border-top: 2px solid var(--charcoal);
  padding-top: 18px;
}

.lane-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lane-switch button,
.game-tile,
.spark-token {
  color: var(--ink);
  background: #fffdf8;
  text-align: left;
}

.lane-switch button {
  display: grid;
  gap: 5px;
  min-height: 84px;
  border-color: var(--line);
  box-shadow: none;
}

.lane-switch button.selected {
  color: #fff;
  background: var(--charcoal);
  border-color: var(--charcoal);
}

.lane-switch strong {
  font-size: 1rem;
  line-height: 1.1;
}

.lane-switch span {
  color: inherit;
  opacity: 0.78;
  font-size: 0.82rem;
  line-height: 1.25;
}

.game-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.game-tile {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 206px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 0 rgba(35, 38, 41, 0.16);
}

.game-tile.green {
  border-color: var(--green);
}

.game-tile.blue {
  border-color: var(--blue);
}

.game-tile.red {
  border-color: var(--red);
}

.game-tile.gold {
  border-color: var(--gold);
}

.game-tile.ink {
  border-color: var(--charcoal);
}

.game-glyph {
  display: block;
  width: 54px;
  aspect-ratio: 1;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(21, 23, 24, 0.3) 46% 54%, transparent 54%),
    linear-gradient(transparent 46%, rgba(21, 23, 24, 0.3) 46% 54%, transparent 54%),
    #eaf4ef;
}

.game-tile.blue .game-glyph {
  background:
    radial-gradient(circle at center, #fffdf8 0 18%, transparent 19%),
    linear-gradient(90deg, var(--blue) 0 52%, #fffdf8 52% 100%);
}

.game-tile.red .game-glyph {
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(21, 23, 24, 0.32) 42% 58%, transparent 58%),
    #f6dfdc;
}

.game-tile.gold .game-glyph {
  background:
    repeating-linear-gradient(90deg, rgba(21, 23, 24, 0.18) 0 3px, transparent 3px 11px),
    #f7edcd;
}

.game-tile.ink .game-glyph {
  background:
    linear-gradient(135deg, #fffdf8 0 42%, rgba(21, 23, 24, 0.28) 42% 58%, #fffdf8 58% 100%),
    linear-gradient(90deg, var(--green) 0 34%, var(--blue) 34% 67%, var(--gold) 67% 100%);
}

.game-tile strong {
  font-size: 1.25rem;
  line-height: 1.05;
}

.game-tile small {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

.game-tile em {
  color: var(--charcoal);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.arcade-memory {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  padding: 14px;
}

.arcade-memory p {
  color: var(--muted);
  line-height: 1.35;
}

.memory-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.memory-row div,
.quick-finish div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.memory-row span,
.quick-finish span,
.quick-stat-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-row strong,
.quick-finish strong,
.quick-stat-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
  line-height: 1.1;
}

.quick-game-screen {
  display: grid;
  gap: 14px;
  padding: 18px 0;
}

.quick-header {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: center;
}

.quick-header h2 {
  margin-top: 4px;
  font-size: clamp(1.7rem, 4vw, 3.2rem);
  line-height: 0.95;
}

.icon-button {
  width: 46px;
  min-height: 46px;
  padding: 0;
  text-align: center;
  font-size: 2rem;
  line-height: 1;
}

.quick-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick-stat-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.quick-stat-strip strong {
  font-size: 1.4rem;
}

.quick-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  padding: 12px;
}

.quick-prompt p {
  color: var(--charcoal);
  font-weight: 800;
  line-height: 1.25;
}

.prompt-item {
  display: grid;
  gap: 5px;
  min-width: min(290px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px 12px;
}

.prompt-item span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.prompt-item strong {
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.05;
}

.compact-arena {
  display: none;
}

.target-chip,
.boost-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: fit-content;
}

.target-chip span {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  color: #fff;
  background: var(--charcoal);
  font-weight: 950;
}

.target-chip.move span,
.target-chip.done span {
  background: var(--green);
}

.target-chip.park span,
.target-chip.pulse span {
  background: var(--blue);
}

.target-chip.ask span,
.target-chip.locker span {
  background: var(--gold);
}

.target-chip.drop span {
  background: var(--charcoal);
}

.target-chip.reset span {
  background: var(--red);
}

.boost-chip {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.boost-chip button {
  min-height: 44px;
  padding: 0 10px;
  box-shadow: none;
}

.quick-arena {
  min-height: 390px;
}

.sweep-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.spark-token {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 84px;
  border-color: var(--line);
  box-shadow: 0 5px 0 rgba(35, 38, 41, 0.12);
}

.spark-token span {
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 8px;
  font-weight: 950;
}

.spark-token strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.1;
}

.spark-token.move {
  color: var(--green);
}

.spark-token.park {
  color: var(--blue);
}

.spark-token.ask {
  color: var(--gold);
}

.spark-token.reset {
  color: var(--red);
}

.spark-token.static {
  color: var(--charcoal);
  background: #ece5d9;
}

.pulse-stage {
  display: grid;
  place-items: center;
  gap: 24px;
  min-height: 390px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(50, 103, 168, 0.12), transparent 34%, rgba(58, 125, 85, 0.15) 34% 55%, transparent 55%),
    #eef3f2;
  padding: 24px;
}

.pulse-track {
  position: relative;
  width: min(640px, 100%);
  height: 76px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background: #fffdf8;
  overflow: hidden;
}

.pulse-window {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38%;
  width: 16%;
  background: rgba(58, 125, 85, 0.24);
  border-inline: 2px solid var(--green);
}

.pulse-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 42px;
  aspect-ratio: 1;
  border: 3px solid var(--charcoal);
  border-radius: 8px;
  background: var(--blue);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: pulseTravel var(--cycle) linear infinite;
  animation-delay: var(--offset);
}

@keyframes pulseTravel {
  from {
    left: 0;
  }
  to {
    left: 100%;
  }
}

.pulse-readout {
  display: grid;
  place-items: center;
  gap: 4px;
}

.pulse-readout strong {
  font-size: 4rem;
  line-height: 0.9;
}

.pulse-readout span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.pulse-hit {
  min-height: 76px;
  font-size: 1.4rem;
  font-weight: 950;
}

.loop-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 390px;
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  background: #f7eee2;
  padding: 24px;
  text-align: center;
}

.loop-card h3 {
  max-width: 14ch;
  font-size: clamp(2.4rem, 8vw, 5.2rem);
  line-height: 0.92;
}

.loop-signal {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.loop-pips {
  display: flex;
  gap: 8px;
}

.loop-pips span {
  width: 38px;
  height: 10px;
  border: 1px solid var(--charcoal);
  border-radius: 999px;
  background: var(--gold);
}

.drop-card {
  background:
    linear-gradient(180deg, rgba(58, 125, 85, 0.12), transparent 42%),
    #f7eee2;
}

.drop-pips span:nth-child(1) {
  background: var(--green);
}

.drop-pips span:nth-child(2) {
  background: var(--blue);
}

.drop-pips span:nth-child(3) {
  background: var(--red);
}

.quick-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.quick-controls button {
  min-height: 56px;
  font-weight: 900;
}

.quick-finish {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-finish div {
  min-height: 120px;
}

.quick-finish strong {
  font-size: 2rem;
}

@media (max-width: 980px) {
  .setup-screen,
  .game-screen,
  .battlefield,
  .decision-panel,
  .lane-panel,
  .quick-header {
    grid-template-columns: 1fr;
  }

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

  .side-panel {
    order: 2;
  }

  .run-help {
    order: 0;
  }

  .combat-stat-strip {
    display: grid;
    order: 1;
  }

  .fire-summary {
    display: grid;
    order: 2;
  }

  .decision-panel {
    order: 3;
  }

  .hand-row {
    order: 4;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .actions {
    position: sticky;
    z-index: 6;
    bottom: 8px;
    order: 5;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.96);
    padding: 8px;
  }

  .battlefield {
    order: 6;
    min-height: 220px;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding-bottom: 8px;
  }

  .topbar p {
    display: none;
  }

  h1 {
    font-size: 1.65rem;
    line-height: 0.98;
  }

  .run-meter span {
    min-width: 0;
    padding: 6px 8px;
  }

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

  .run-meter {
    justify-content: stretch;
  }

  .run-meter span,
  .run-meter button {
    flex: 1;
  }

  .combatant,
  .enemy {
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
  }

  .decision-options,
  .reward-grid,
  .hand-row,
  .run-stats,
  .mode-list,
  .quick-controls,
  .quick-finish,
  .memory-row {
    grid-template-columns: 1fr;
  }

  .game-picks,
  .sweep-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lane-panel {
    gap: 10px;
  }

  .primary-run-card {
    grid-template-columns: 1fr;
  }

  .primary-run-card button {
    width: 100%;
  }

  .lane-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .lane-switch button {
    min-height: 58px;
    padding: 8px;
  }

  .lane-switch span {
    display: none;
  }

  .arcade-lead {
    min-height: auto;
  }

  .quick-prompt {
    order: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 10px;
  }

  .quick-prompt p {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .prompt-item {
    padding: 8px 10px;
  }

  .prompt-item strong {
    font-size: 1.15rem;
  }

  .quick-stat-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-stat-strip div {
    padding: 8px 6px;
  }

  .quick-stat-strip span {
    font-size: 0.62rem;
  }

  .quick-stat-strip strong {
    font-size: 1.12rem;
  }

  .quick-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .quick-header > .quick-stat-strip {
    grid-column: 1 / -1;
  }

  .quick-header h2 {
    font-size: 2rem;
  }

  .quick-arena {
    order: 2;
    min-height: 240px;
  }

  .quick-controls {
    order: 1;
  }

  .pulse-stage,
  .loop-card {
    min-height: 300px;
    padding: 18px;
  }

  .loop-card h3 {
    font-size: clamp(2rem, 11vw, 3.4rem);
  }

  .boost-chip {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    padding-left: 0;
  }

  .card {
    min-height: 190px;
  }
}
