:root {
  color-scheme: dark;
  --ink: #f6f2d8;
  --shadow: #101018;
  --cabinet: #242227;
  --cabinet-edge: #0b0b10;
  --red: #d43d3d;
  --amber: #f4c951;
  --mint: #5bdb9d;
  --cyan: #66d9ef;
  --violet: #9b6bff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  align-items: flex-start;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #141318;
  background-size: 16px 16px;
  color: var(--ink);
  display: flex;
  font-family: "Courier New", Courier, monospace;
  justify-content: center;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

body.playing {
  overflow-x: hidden;
}

button {
  font: inherit;
  touch-action: manipulation;
}

.shell {
  width: min(100%, 900px);
}

.cabinet {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 32%),
    var(--cabinet);
  border: 10px solid var(--cabinet-edge);
  box-shadow:
    inset 0 0 0 4px #3b3741,
    0 22px 0 #07070a,
    0 24px 38px rgba(0, 0, 0, 0.55);
  padding: 18px;
}

.insert {
  color: var(--amber);
  font-size: 13px;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

h2 {
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.screen-wrap {
  background: #050609;
  border: 8px solid #0a0b10;
  overflow: hidden;
  position: relative;
}

canvas {
  aspect-ratio: 4 / 3;
  display: block;
  image-rendering: pixelated;
  width: 100%;
}

.game-hud {
  display: none;
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

body.playing .game-hud {
  display: block;
}

.game-bars {
  background: rgba(7, 16, 25, 0.9);
  border-bottom: 2px solid rgba(246, 242, 216, 0.12);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  left: 0;
  padding: 7px 10px 8px;
  position: absolute;
  right: 0;
  top: 0;
}

.game-bar {
  min-width: 0;
  text-transform: uppercase;
}

.game-bar div {
  align-items: center;
  display: flex;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.04em;
  line-height: 1;
}

.game-bar span {
  color: #f6f2d8;
}

.game-bar b {
  color: #fff4b4;
  font-size: 12px;
}

.game-bar i {
  background: rgba(5, 6, 9, 0.9);
  border: 1px solid rgba(246, 242, 216, 0.2);
  display: block;
  height: 9px;
  margin-top: 5px;
  overflow: hidden;
}

.game-bar em {
  display: block;
  height: 100%;
  transition: width 120ms linear;
  width: 0;
}

.vigor-bar em {
  background: var(--mint);
}

.mutation-bar em {
  background: var(--amber);
}

.special-bar em {
  background: var(--cyan);
}

.xp-hud {
  align-items: center;
  background: rgba(5, 6, 9, 0.74);
  color: var(--ink);
  display: grid;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  grid-template-columns: auto minmax(80px, 1fr) auto auto;
  left: 9px;
  letter-spacing: 0.03em;
  padding: 4px 7px;
  position: absolute;
  right: 9px;
  text-transform: uppercase;
  top: 45px;
}

.xp-hud b {
  color: var(--amber);
}

.xp-hud i {
  background: rgba(5, 6, 9, 0.9);
  border: 1px solid rgba(246, 242, 216, 0.18);
  display: block;
  height: 8px;
  overflow: hidden;
}

.xp-hud em {
  background: var(--violet);
  display: block;
  height: 100%;
  transition: width 120ms linear;
  width: 0;
}

.hud-special-hint,
.hud-status {
  background: rgba(5, 6, 9, 0.74);
  color: var(--cyan);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 800;
  left: 9px;
  letter-spacing: 0.03em;
  max-width: calc(100% - 18px);
  overflow: hidden;
  padding: 4px 7px;
  position: absolute;
  text-overflow: ellipsis;
  text-transform: uppercase;
  top: 72px;
  white-space: nowrap;
}

.hud-status {
  color: var(--amber);
  left: 50%;
  text-align: center;
  top: 96px;
  transform: translateX(-50%);
}

.hud-status:empty {
  display: none;
}

.combo-hud {
  align-items: center;
  background: rgba(5, 6, 9, 0.74);
  color: var(--amber);
  display: grid;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  grid-template-columns: auto minmax(70px, 160px);
  letter-spacing: 0.03em;
  padding: 4px 7px;
  position: absolute;
  right: 9px;
  text-transform: uppercase;
  top: 123px;
}

.combo-hud i {
  background: rgba(5, 6, 9, 0.9);
  border: 1px solid rgba(246, 242, 216, 0.18);
  display: block;
  height: 8px;
  overflow: hidden;
}

.combo-hud em {
  background: var(--amber);
  display: block;
  height: 100%;
  transition: width 80ms linear;
  width: 0;
}

.tutorial-card {
  background: rgba(5, 6, 9, 0.9);
  border: 3px solid var(--amber);
  color: var(--ink);
  display: none;
  font-family: Arial, Helvetica, sans-serif;
  left: 50%;
  max-width: min(72%, 520px);
  padding: 18px 20px;
  pointer-events: none;
  position: absolute;
  text-align: center;
  text-transform: uppercase;
  top: 27%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

body.playing .tutorial-card.active {
  display: grid;
  gap: 9px;
}

.tutorial-card b {
  color: var(--amber);
  font-size: 20px;
  line-height: 1.05;
}

.tutorial-card span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.tutorial-card small {
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.mobile-settings-button,
.mobile-settings-panel {
  display: none;
}

.mobile-settings-button {
  background: rgba(5, 6, 9, 0.78);
  border: 2px solid rgba(246, 242, 216, 0.45);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 800;
  height: 42px;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 8px;
  top: 6px;
  width: 42px;
  z-index: 3;
}

.mobile-settings-panel {
  background: rgba(5, 6, 9, 0.92);
  border: 2px solid rgba(246, 242, 216, 0.28);
  gap: 8px;
  padding: 8px;
  position: absolute;
  right: 8px;
  top: 52px;
  width: min(210px, calc(100% - 16px));
  z-index: 4;
}

.mobile-settings-panel.active {
  display: grid;
}

.mobile-panel-button {
  background: #343241;
  border: 2px solid #09090d;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.45), inset 2px 2px 0 rgba(255, 255, 255, 0.13);
  color: var(--cyan);
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-height: 38px;
  padding: 7px 8px;
  text-transform: uppercase;
}

.mobile-volume {
  align-items: center;
  color: var(--ink);
  display: grid;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  grid-template-columns: 1fr 38px 46px 38px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mobile-volume b {
  color: var(--amber);
  text-align: center;
}

.screen-wrap::after {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 4px
  );
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.touch-hud {
  display: none;
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.touch-actions {
  bottom: 10px;
  display: flex;
  gap: 8px;
  left: 10px;
  position: absolute;
}

.touch-action {
  background: rgba(20, 18, 28, 0.72);
  border: 3px solid rgba(246, 242, 216, 0.42);
  box-shadow:
    inset -3px -3px 0 rgba(0, 0, 0, 0.42),
    inset 3px 3px 0 rgba(255, 255, 255, 0.18);
  color: var(--mint);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-height: 46px;
  min-width: 76px;
  padding: 0 8px;
  pointer-events: auto;
  text-transform: uppercase;
  touch-action: none;
}

.touch-burst {
  color: var(--red);
}

.move-stick {
  background: rgba(20, 18, 28, 0.58);
  border: 3px solid rgba(102, 217, 239, 0.46);
  bottom: 10px;
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.35),
    inset 4px 4px 0 rgba(255, 255, 255, 0.08);
  height: 92px;
  pointer-events: auto;
  position: absolute;
  right: 10px;
  touch-action: none;
  width: 92px;
}

.move-stick::before,
.move-stick::after {
  background: rgba(102, 217, 239, 0.34);
  content: "";
  position: absolute;
}

.move-stick::before {
  height: 4px;
  left: 18px;
  right: 18px;
  top: calc(50% - 2px);
}

.move-stick::after {
  bottom: 18px;
  left: calc(50% - 2px);
  top: 18px;
  width: 4px;
}

.move-stick span {
  background: rgba(102, 217, 239, 0.78);
  border: 3px solid rgba(246, 242, 216, 0.48);
  box-shadow: 0 0 0 4px rgba(102, 217, 239, 0.12);
  display: block;
  height: 28px;
  left: calc(50% - 14px);
  position: absolute;
  top: calc(50% - 14px);
  transform: translate(0, 0);
  width: 28px;
}

body.playing[data-input="touch"] .touch-hud {
  display: block;
}

.overlay,
.upgrade-overlay {
  align-items: center;
  background: rgba(4, 5, 9, 0.88);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: absolute;
  text-align: center;
  touch-action: manipulation;
  z-index: 2;
}

.overlay.hidden,
.upgrade-overlay.hidden,
.account-card.hidden,
.manual-card.hidden,
.leaderboard-card.hidden,
.title-card.hidden {
  display: none;
}

.title-card,
.account-card,
.manual-card,
.leaderboard-card,
.upgrade-card {
  max-width: 680px;
  width: 100%;
}

.title-card h2,
.account-card h2,
.manual-card h2,
.leaderboard-card h2,
.upgrade-card h2 {
  color: var(--cyan);
  font-size: clamp(22px, 4vw, 38px);
  text-shadow: 3px 3px 0 #000;
}

.upgrade-overlay {
  background: rgba(4, 5, 9, 0.72);
}

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

.upgrade-option {
  background: #1f2230;
  border: 3px solid #09090d;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.45), inset 3px 3px 0 rgba(255, 255, 255, 0.13);
  color: var(--ink);
  cursor: pointer;
  min-height: 132px;
  padding: 12px;
  text-align: left;
  text-transform: uppercase;
}

.skill-point-readout {
  background: rgba(5, 6, 9, 0.68);
  color: var(--amber);
  font-size: 13px;
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 10px;
  text-align: center;
  text-transform: uppercase;
}

.upgrade-option:disabled {
  cursor: default;
  filter: grayscale(0.4);
  opacity: 0.48;
}

.continue-sector {
  border-color: var(--cyan);
}

.continue-sector b {
  color: var(--cyan);
}

.upgrade-option b {
  color: var(--mint);
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.upgrade-option span {
  color: #c7c2a3;
  display: block;
  font-size: 12px;
  line-height: 1.3;
}

.upgrade-option small {
  color: var(--amber);
  display: block;
  margin-top: 10px;
}

.recap-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px auto;
  max-width: 560px;
}

.recap-grid p {
  background: #151824;
  border: 3px solid #08080b;
  color: #cfc9a7;
  margin: 0;
  padding: 10px;
  text-align: left;
  text-transform: uppercase;
}

.recap-grid b {
  color: var(--amber);
  float: right;
}

.recap-tip {
  background: rgba(5, 6, 9, 0.66);
  border: 2px solid rgba(244, 201, 81, 0.45);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0 auto 14px;
  max-width: 560px;
  padding: 9px 11px;
  text-transform: uppercase;
}

.recap-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.recap-actions .manual-button {
  margin-right: 0;
  min-width: 130px;
}

.pathogen-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0 16px;
}

.special-info {
  background: #10121b;
  border: 3px solid #08080b;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.45), inset 3px 3px 0 rgba(255, 255, 255, 0.09);
  color: #cfc9a7;
  display: grid;
  gap: 4px;
  line-height: 1.3;
  margin: 0 auto 14px;
  max-width: 620px;
  padding: 10px 12px;
  text-align: left;
  text-transform: uppercase;
}

.special-info b {
  color: var(--amber);
}

.special-info span {
  color: #c7c2a3;
  font-size: 13px;
}

.pathogen-card,
.difficulty-button,
.manual-button,
.start-button,
.profile-actions input,
.fire,
.pad button {
  border: 3px solid #09090d;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.45), inset 3px 3px 0 rgba(255, 255, 255, 0.13);
  color: var(--ink);
  cursor: pointer;
  text-transform: uppercase;
}

.profile-panel {
  background: #10121b;
  border: 3px solid #08080b;
  display: grid;
  gap: 8px;
  margin: 14px auto 0;
  max-width: 620px;
  padding: 10px;
  text-align: left;
  text-transform: uppercase;
}

.account-note {
  color: #c7c2a3;
  line-height: 1.35;
  margin: 14px auto 16px;
  max-width: 560px;
  text-transform: uppercase;
}

.profile-readout {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
}

.profile-readout span,
.profile-readout small {
  color: #b8b39a;
  font-size: 12px;
}

.profile-readout b {
  color: var(--mint);
}

.profile-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto auto;
}

.profile-actions input {
  background: #050609;
  color: var(--ink);
  cursor: text;
  min-width: 0;
  padding: 8px 10px;
  text-transform: uppercase;
}

.profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-chip {
  background: #24283a;
  border: 3px solid #09090d;
  color: #cfc9a7;
  cursor: pointer;
  min-height: 34px;
  padding: 5px 9px;
  text-transform: uppercase;
}

.profile-chip.active {
  background: #1e3a35;
  border-color: var(--mint);
  color: var(--mint);
}

.leaderboard-head,
.leaderboard-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 54px minmax(0, 1.4fr) minmax(72px, 0.8fr) minmax(64px, 0.7fr) minmax(88px, 0.9fr);
}

.leaderboard-head {
  color: var(--amber);
  font-size: 12px;
  margin: 20px auto 8px;
  max-width: 620px;
  text-align: left;
  text-transform: uppercase;
}

.leaderboard-list {
  display: grid;
  gap: 7px;
  margin: 0 auto 18px;
  max-width: 620px;
}

.leaderboard-row {
  background: #151824;
  border: 3px solid #08080b;
  color: #cfc9a7;
  min-height: 42px;
  padding: 9px;
  text-align: left;
  text-transform: uppercase;
}

.leaderboard-row b {
  color: var(--mint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row.active {
  border-color: var(--amber);
}

.leaderboard-empty {
  background: #151824;
  border: 3px solid #08080b;
  color: #cfc9a7;
  margin: 20px auto;
  max-width: 520px;
  padding: 14px;
  text-transform: uppercase;
}

.pathogen-card {
  align-items: center;
  background: #1f2230;
  display: grid;
  gap: 7px;
  min-height: 136px;
  padding: 12px 8px;
}

.pathogen-card span:not(.sprite) {
  color: var(--mint);
  font-size: 18px;
  font-weight: 700;
}

.pathogen-card small {
  color: #c7c2a3;
  font-size: 12px;
  line-height: 1.25;
  min-height: 32px;
}

.pathogen-card.active {
  background: #322a3e;
  border-color: var(--amber);
}

.pathogen-card.locked {
  cursor: not-allowed;
  filter: grayscale(0.85);
  opacity: 0.55;
}

.pathogen-card.locked span:not(.sprite) {
  color: #8e8a78;
}

.sprite {
  display: block;
  height: 42px;
  margin: 0 auto;
  position: relative;
  width: 42px;
}

.virus-icon {
  background:
    linear-gradient(var(--red), var(--red)) 7px 20px / 28px 4px no-repeat,
    linear-gradient(var(--red), var(--red)) 20px 7px / 4px 28px no-repeat,
    linear-gradient(var(--violet), var(--violet)) 11px 11px / 20px 20px no-repeat;
}

.fungus-icon {
  background:
    linear-gradient(#d97df8, #d97df8) 10px 10px / 22px 12px no-repeat,
    linear-gradient(#a85ad5, #a85ad5) 17px 20px / 9px 16px no-repeat,
    linear-gradient(#e3bdff, #e3bdff) 7px 30px / 28px 5px no-repeat;
}

.spyrochete-icon {
  background:
    linear-gradient(#4effd0, #4effd0) 5px 9px / 9px 5px no-repeat,
    linear-gradient(#4effd0, #4effd0) 12px 14px / 9px 5px no-repeat,
    linear-gradient(#4effd0, #4effd0) 19px 19px / 9px 5px no-repeat,
    linear-gradient(#4effd0, #4effd0) 26px 24px / 9px 5px no-repeat,
    linear-gradient(#d6fff5, #d6fff5) 9px 11px / 5px 3px no-repeat,
    linear-gradient(#d6fff5, #d6fff5) 23px 21px / 5px 3px no-repeat;
}

.nanophage-icon {
  background:
    linear-gradient(#6bff6b, #6bff6b) 18px 5px / 7px 32px no-repeat,
    linear-gradient(#6bff6b, #6bff6b) 5px 18px / 32px 7px no-repeat,
    linear-gradient(#101018, #101018) 19px 19px / 5px 5px no-repeat,
    linear-gradient(#eaff9b, #eaff9b) 11px 11px / 6px 6px no-repeat,
    linear-gradient(#eaff9b, #eaff9b) 26px 26px / 6px 6px no-repeat;
}

.difficulty-select {
  display: inline-grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  margin: 0 0 14px;
}

.difficulty-button {
  background: #24283a;
  color: #cfc9a7;
  min-height: 38px;
  padding: 8px 12px;
}

.difficulty-button.active {
  background: #1e3a35;
  border-color: var(--mint);
  color: var(--mint);
}

.manual-button {
  background: #343241;
  color: var(--cyan);
  margin-right: 8px;
  min-height: 42px;
  padding: 8px 14px;
}

.manual-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px auto;
  max-width: 620px;
  text-align: left;
}

.manual-grid p {
  background: #151824;
  border: 3px solid #08080b;
  color: #cfc9a7;
  line-height: 1.3;
  margin: 0;
  min-height: 78px;
  padding: 10px;
}

.manual-grid b {
  color: var(--mint);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.start-button {
  background: var(--red);
  color: #fff9da;
  font-size: 20px;
  min-height: 48px;
  min-width: 190px;
  padding: 10px 18px;
}

.continue-button {
  background: #1e3a35;
  color: var(--mint);
  margin-right: 8px;
}

.continue-button.hidden {
  display: none;
}

.hud-panel {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.meter.resource-meter,
.meter.removed-meter {
  display: none;
}

.progress-panel {
  background: #10121b;
  border: 3px solid #08080b;
  color: #cfc9a7;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-top: 10px;
  padding: 8px;
  text-transform: uppercase;
}

.progress-panel > div:first-child {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.progress-panel b {
  color: var(--amber);
}

.progress-track {
  background: #050609;
  height: 10px;
  margin-top: 7px;
}

.progress-track span {
  background: var(--mint);
  display: block;
  height: 100%;
  transition: width 120ms linear;
  width: 0;
}

.meter {
  background: #10121b;
  border: 3px solid #08080b;
  display: flex;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.02em;
  min-width: 0;
  padding: 8px;
  text-transform: uppercase;
}

.meter span {
  color: #b8b39a;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meter b {
  color: var(--amber);
}

.controls {
  align-items: center;
  display: none;
  gap: 14px;
  grid-template-columns: 104px 1fr repeat(2, 84px);
}

.pad {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
}

.pad button,
.fire {
  background: #343241;
}

.pad button,
.fire[data-touch] {
  touch-action: none;
}

.pad button {
  color: var(--cyan);
  min-height: 32px;
  padding: 0;
}

.pad button:nth-child(1) {
  grid-column: 2;
}

.pad button:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.pad button:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.pad button:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.control-copy {
  color: #cfc9a7;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.control-copy p {
  margin: 3px 0;
}

.control-copy b {
  color: var(--mint);
}

.fire {
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-height: 76px;
  width: 100%;
}

.special-fire {
  color: var(--mint);
}

.music-fire {
  color: var(--cyan);
}

.quit-fire {
  color: var(--amber);
}

.save-fire {
  color: var(--mint);
}

.burst-fire {
  color: var(--red);
}

.volume-panel {
  align-items: center;
  background: #10121b;
  border: 3px solid #08080b;
  color: #cfc9a7;
  display: none;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  gap: 10px;
  grid-template-columns: auto 42px minmax(120px, 1fr) 42px 58px;
  letter-spacing: 0.02em;
  margin-top: 12px;
  padding: 8px;
  text-transform: uppercase;
}

.volume-panel span {
  color: var(--cyan);
}

.volume-panel b {
  color: var(--amber);
  text-align: right;
}

.volume-step {
  background: #343241;
  border: 3px solid #09090d;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.45), inset 3px 3px 0 rgba(255, 255, 255, 0.13);
  color: var(--mint);
  cursor: pointer;
  min-height: 38px;
  padding: 0;
}

.volume-panel input {
  accent-color: var(--mint);
  cursor: pointer;
  min-width: 0;
  width: 100%;
}

@media (min-width: 900px) and (min-height: 900px) and (pointer: fine) {
  body {
    align-items: center;
  }
}

@media (min-width: 1100px) and (pointer: fine) {
  .shell {
    width: min(100%, 940px);
  }

  .controls {
    grid-template-columns: 112px minmax(160px, 1fr) repeat(2, 90px);
  }
}

@media (max-width: 860px) and (pointer: fine) {
  .controls {
    gap: 10px;
    grid-template-areas:
      "copy copy copy"
      "pad special burst";
    grid-template-columns: 112px repeat(2, minmax(0, 1fr));
  }

  .pad {
    grid-area: pad;
    justify-self: center;
  }

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

  .special-fire {
    grid-area: special;
  }

  .burst-fire {
    grid-area: burst;
  }

  .fire {
    min-height: 56px;
  }
}

@media (pointer: coarse) {
  body {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .shell {
    width: min(100%, 980px);
  }

  .cabinet {
    border-width: 8px;
    padding: 12px;
  }

  .screen-wrap {
    border-width: 6px;
  }

  .pathogen-card,
  .difficulty-button,
  .manual-button,
  .start-button,
  .fire,
  .pad button {
    min-height: 48px;
  }

  .controls {
    gap: 10px;
    grid-template-areas: "pad copy special burst";
    grid-template-columns: 150px minmax(160px, 1fr) repeat(2, minmax(84px, 1fr));
  }

  .pad {
    gap: 6px;
    grid-area: pad;
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
  }

  .pad button {
    font-size: 20px;
    min-height: 46px;
  }

  .fire {
    min-height: 70px;
  }

  .control-copy {
    grid-area: copy;
  }

  .special-fire {
    grid-area: special;
  }

  .burst-fire {
    grid-area: burst;
  }

  .volume-panel {
    grid-template-columns: auto 48px minmax(120px, 1fr) 48px 58px;
  }
}

@media (pointer: coarse) and (min-width: 900px) and (orientation: landscape) {
  .controls {
    grid-template-areas: "pad copy special burst";
    grid-template-columns: 152px minmax(150px, 1fr) repeat(2, minmax(82px, 1fr));
  }

  .fire {
    min-height: 66px;
  }

  .hud-panel {
    margin: 10px 0;
  }

  .meter {
    padding: 7px;
  }
}

@media (max-width: 700px) {
  body {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .cabinet {
    border-width: 5px;
    box-shadow:
      inset 0 0 0 3px #3b3741,
      0 12px 0 #07070a,
      0 16px 24px rgba(0, 0, 0, 0.45);
    padding: 8px;
  }

  .screen-wrap {
    border-width: 5px;
  }

  body:not(.playing) .screen-wrap,
  body:not(.playing) canvas {
    min-height: min(540px, calc(100dvh - 18px));
  }

  .overlay,
  .upgrade-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 10px;
  }

  .title-card h2,
  .account-card h2,
  .manual-card h2,
  .leaderboard-card h2,
  .upgrade-card h2 {
    font-size: 24px;
  }

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

  .title-card h2 {
    grid-column: 1 / -1;
    order: 1;
  }

  .pathogen-grid {
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 6px 0;
    order: 2;
  }

  .special-info {
    margin: 0;
    grid-column: 1 / -1;
    order: 6;
    padding: 7px 8px;
  }

  .special-info span {
    font-size: 12px;
  }

  .difficulty-select {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    order: 3;
    width: 100%;
  }

  .manual-button,
  .start-button,
  .continue-button {
    margin: 5px 0;
    width: 100%;
  }

  #start,
  #continue {
    font-size: 18px;
    grid-column: 1 / -1;
    margin: 0;
    min-height: 52px;
    order: 4;
  }

  #account,
  #manual,
  #leaderboard {
    font-size: 13px;
    margin: 0;
    min-height: 34px;
  }

  #account {
    grid-column: 1;
    order: 7;
  }

  #manual {
    grid-column: 2;
    order: 8;
  }

  #leaderboard {
    grid-column: 1 / -1;
    order: 9;
  }

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

  .profile-readout,
  .profile-actions {
    grid-template-columns: 1fr;
  }

  .leaderboard-head,
  .leaderboard-row {
    grid-template-columns: 42px minmax(0, 1.4fr) minmax(58px, 0.8fr);
  }

  .leaderboard-head span:nth-child(4),
  .leaderboard-head span:nth-child(5),
  .leaderboard-row span:nth-child(4),
  .leaderboard-row span:nth-child(5) {
    display: none;
  }

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

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

  .recap-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .recap-actions .manual-button {
    min-width: 0;
  }

  .pathogen-card {
    gap: 4px;
    min-height: 76px;
    padding: 7px 5px;
    text-align: center;
  }

  .pathogen-card span:not(.sprite) {
    font-size: 16px;
  }

  .pathogen-card small {
    display: none;
  }

  .sprite {
    height: 30px;
    grid-row: auto;
    transform: scale(0.86);
    width: 34px;
  }

  .progress-panel {
    font-size: 13px;
  }

  .hud-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 10px 0;
  }

  .meter {
    font-size: 13px;
    padding: 7px;
  }

  .controls {
    gap: 8px;
    grid-template-areas:
      "copy copy copy"
      "pad special burst";
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pad {
    grid-area: pad;
    justify-self: center;
  }

  .control-copy {
    display: grid;
    font-size: 12px;
    gap: 4px 8px;
    grid-area: copy;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .special-fire {
    grid-area: special;
  }

  .burst-fire {
    grid-area: burst;
  }

  .fire {
    min-height: 52px;
    padding: 6px;
  }

  .touch-actions {
    bottom: 8px;
    gap: 6px;
    left: 8px;
  }

  .touch-action {
    font-size: 13px;
    min-height: 42px;
    min-width: 66px;
  }

  .move-stick {
    bottom: 8px;
    height: 82px;
    right: 8px;
    width: 82px;
  }

  .game-bars {
    gap: 6px;
    padding: 5px 6px 6px;
  }

  .game-bar div,
  .game-bar b {
    font-size: 10px;
  }

  .game-bar i {
    height: 7px;
    margin-top: 4px;
  }

  .xp-hud {
    font-size: 10px;
    gap: 5px;
    grid-template-columns: auto minmax(44px, 1fr) auto auto;
    padding: 3px 5px;
    right: 48px;
    top: 36px;
  }

  .hud-special-hint,
  .hud-status {
    font-size: 10px;
    padding: 3px 5px;
    top: 58px;
  }

  .hud-status {
    top: 80px;
  }

  .combo-hud {
    font-size: 10px;
    gap: 5px;
    grid-template-columns: auto minmax(46px, 96px);
    padding: 3px 5px;
    right: 8px;
    top: 102px;
  }

  .tutorial-card {
    max-width: 86%;
    padding: 12px 14px;
  }

  .tutorial-card b {
    font-size: 16px;
  }

  .tutorial-card span {
    font-size: 12px;
  }

  .volume-panel {
    grid-template-columns: 1fr 44px 44px 58px;
  }

  .volume-panel input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.playing[data-input="touch"] {
    align-items: stretch;
    height: 100dvh;
    overflow: hidden;
    padding: 0;
  }

  body.playing[data-input="touch"] .shell,
  body.playing[data-input="touch"] .cabinet,
  body.playing[data-input="touch"] .screen-wrap {
    height: 100dvh;
    width: 100vw;
  }

  body.playing[data-input="touch"] .shell {
    max-width: none;
  }

  body.playing[data-input="touch"] .cabinet {
    background: #050609;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  body.playing[data-input="touch"] .screen-wrap {
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.playing[data-input="touch"] canvas {
    aspect-ratio: 4 / 3;
    height: min(100dvh, 75vw);
    width: min(100vw, 133.333dvh);
  }

  body.playing[data-input="touch"] .progress-panel,
  body.playing[data-input="touch"] .hud-panel,
  body.playing[data-input="touch"] .controls,
  body.playing[data-input="touch"] .volume-panel {
    display: none;
  }

  body.playing[data-input="touch"] .mobile-settings-button {
    display: block;
  }

  body.playing[data-input="touch"] .game-bars {
    padding-right: 58px;
  }

  body.playing[data-input="touch"] .touch-actions {
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
  }

  body.playing[data-input="touch"] .move-stick {
    bottom: max(12px, env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
  }
}

@media (max-width: 900px) and (max-height: 520px) and (pointer: coarse) and (orientation: landscape) {
  body {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .cabinet {
    border-width: 4px;
    padding: 6px;
  }

  .screen-wrap {
    border-width: 4px;
  }

  .hud-panel {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 8px 0;
  }

  .meter {
    font-size: 12px;
    padding: 6px;
  }

  .controls {
    grid-template-areas: "pad special burst";
    grid-template-columns: 112px repeat(2, minmax(0, 1fr));
  }

  .control-copy {
    display: none;
  }

  .pad {
    gap: 4px;
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: repeat(3, 34px);
  }

  .pad button {
    min-height: 34px;
  }

  .fire {
    min-height: 44px;
  }

  .touch-action {
    min-height: 38px;
    min-width: 62px;
  }

  .move-stick {
    height: 74px;
    width: 74px;
  }

  .volume-panel {
    margin-top: 8px;
  }

  body.playing[data-input="touch"] {
    align-items: stretch;
    height: 100dvh;
    overflow: hidden;
    padding: 0;
  }

  body.playing[data-input="touch"] .shell,
  body.playing[data-input="touch"] .cabinet,
  body.playing[data-input="touch"] .screen-wrap {
    height: 100dvh;
    width: 100vw;
  }

  body.playing[data-input="touch"] .cabinet {
    background: #050609;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  body.playing[data-input="touch"] .screen-wrap {
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.playing[data-input="touch"] canvas {
    aspect-ratio: 4 / 3;
    height: min(100dvh, 75vw);
    width: min(100vw, 133.333dvh);
  }

  body.playing[data-input="touch"] .progress-panel,
  body.playing[data-input="touch"] .hud-panel,
  body.playing[data-input="touch"] .controls,
  body.playing[data-input="touch"] .volume-panel {
    display: none;
  }

  body.playing[data-input="touch"] .mobile-settings-button {
    display: block;
  }
}

body[data-input="touch"] .controls .pad,
body[data-input="touch"] .controls .special-fire,
body[data-input="touch"] .controls .burst-fire {
  display: none;
}

body[data-input="touch"] .controls {
  grid-template-areas: none;
  grid-template-columns: 1fr;
}

body[data-input="touch"] .control-copy {
  display: none;
}

body.playing .mobile-settings-button {
  display: block;
}

body.playing .game-bars {
  padding-right: 58px;
}

body.playing .volume-panel,
body.playing .music-fire,
body.playing .save-fire,
body.playing .quit-fire {
  display: none;
}

body.playing .controls {
  display: none;
  grid-template-columns: 104px minmax(160px, 1fr) repeat(2, 84px);
}

body.playing[data-input="touch"] .controls {
  display: none;
}
