:root {
  /* Shared STF Arcade tokens */
  --bg: #081a28;
  --panel: rgba(9, 28, 44, 0.94);
  --line: #215273;
  --amber: #ffd23f;
  --cyan: #5ee6ff;
  --coral: #ff6b57;
  --sand: #f4d694;
  --text: #eef6fc;
  --dim: #92b4cc;
  --mono: "Courier New", ui-monospace, Menlo, Consolas, monospace;
  --head: Impact, "Arial Black", "Trebuchet MS", sans-serif;

  /* Kaiju Brawl 1950s B-movie theme additions */
  --film-red: #c1272d;
  --atomic: #7dff4f;
  --atomic-dim: #3d7f2a;
  --ink: #1b1209;
  --paper: #f1e3b9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overflow: hidden;
  overscroll-behavior: none;
}

body.playing { touch-action: none; }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: #061521;
  border-bottom: 2px solid var(--line);
  flex: 0 0 auto;
  z-index: 20;
}

.btn-back {
  flex: 0 0 auto;
  color: var(--amber);
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
  border: 2px solid var(--amber);
  padding: 6px 10px;
  border-radius: 5px;
  background: rgba(255, 210, 63, 0.1);
  white-space: nowrap;
}
.btn-back:hover, .btn-back:focus-visible {
  background: var(--amber);
  color: #061521;
  outline: none;
}

#stats {
  display: flex;
  gap: 6px 16px;
  flex: 1 1 auto;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  min-width: 50px;
}

.stat .lbl {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--dim);
}

.stat .val {
  font-size: 19px;
  font-weight: bold;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

#toggles {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.chip {
  font: bold 11px var(--mono);
  color: var(--cyan);
  background: rgba(94, 230, 255, 0.06);
  border: 2px solid #2b6f8a;
  border-radius: 5px;
  padding: 6px 8px;
  cursor: pointer;
  min-width: 42px;
  min-height: 34px;
  white-space: nowrap;
}
.chip.off {
  color: #638299;
  border-color: #1f445c;
  text-decoration: line-through;
}
.chip.on {
  background: rgba(94, 230, 255, 0.22);
  border-color: var(--cyan);
  color: #fff;
}
.chip:hover, .chip:focus-visible {
  background: rgba(94, 230, 255, 0.16);
  outline: none;
}

/* ---------- Stage ---------- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at center, #0e334d 0%, #061420 100%);
}

#game {
  display: block;
  border-radius: 4px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

@media (max-width: 780px) {
  #hud { gap: 6px; padding: 5px 6px; flex-wrap: wrap; }
  .btn-back { font-size: 12px; padding: 5px 7px; }
  #stats { order: 3; flex: 1 1 100%; gap: 4px 12px; }
  .stat .val { font-size: 16px; }
  #toggles { margin-left: auto; }
  .chip { padding: 5px 7px; font-size: 10px; }
  .hide-sm { display: none; }
}

/* ---------- In-stage Fighter HUD (stubbed for M3/M6) ---------- */
#fighterHud {
  position: absolute;
  top: 10px;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}
body.playing #fighterHud { display: flex; }

.fighter-col {
  flex: 1 1 0;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fighter-col.right { align-items: flex-end; }
.fighter-name {
  font-family: var(--head);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--amber);
  text-shadow: 2px 2px 0 var(--ink);
}
.bar-track {
  width: 100%;
  height: 12px;
  background: rgba(6, 21, 33, 0.85);
  border: 2px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bar-track.fuel {
  height: 8px;
  border-color: var(--atomic-dim);
}
.bar-track.guard {
  height: 6px;
  border-color: #2b6f8a;
  width: 72%;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4d5a, #ff8b57);
  transition: width 0.08s linear;
}
.bar-fill.enemy {
  background: linear-gradient(90deg, #ff8b57, #ffd23f);
  margin-left: auto;
}
.bar-track.fuel .bar-fill {
  background: repeating-linear-gradient(
    -55deg,
    #45c428 0px,
    #45c428 6px,
    #7dff4f 6px,
    #7dff4f 12px
  );
  background-size: 24px 24px;
  box-shadow: 0 0 8px rgba(125, 255, 79, 0.55);
  animation: fuelFlow 1.1s linear infinite;
}
.bar-track.fuel.overcharge {
  border-color: var(--atomic);
  box-shadow: 0 0 12px rgba(125, 255, 79, 0.85);
}
.bar-track.fuel.overcharge .bar-fill {
  filter: brightness(1.25);
  box-shadow: 0 0 14px var(--atomic);
}
.bar-track.fuel.fuel-shake {
  border-color: var(--coral);
  animation: fuelShake 0.28s linear;
}
@keyframes fuelFlow {
  from { background-position: 0 0; }
  to { background-position: 24px 0; }
}
@keyframes fuelShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.bar-track.guard .bar-fill {
  background: linear-gradient(90deg, #2b9eb3, var(--cyan));
}
.bar-track.guard.broken {
  border-color: var(--coral);
}
.bar-track.guard.broken .bar-fill {
  background: var(--coral);
}
.fighter-center {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.dummy-chip {
  pointer-events: auto;
  font-size: 10px;
  padding: 4px 8px;
  min-height: 28px;
  background: rgba(6, 21, 33, 0.85);
}
.combo-badge {
  font-family: var(--head);
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--amber);
  text-shadow: 2px 2px 0 var(--film-red), 3px 3px 0 var(--ink);
  min-height: 22px;
}
.combo-badge:empty { display: none; }
.round-pill {
  flex: 0 0 auto;
  font-family: var(--head);
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--paper);
  background: rgba(27, 18, 9, 0.85);
  border: 2px solid var(--amber);
  padding: 4px 12px;
  border-radius: 999px;
}

#stage.orient-portrait #fighterHud {
  gap: 8px;
}
#stage.orient-portrait .bar-track { height: 9px; }
#stage.orient-portrait .bar-track.fuel { height: 6px; }
#stage.orient-portrait .bar-track.guard { height: 5px; }

/* ---------- Mobile Touch Controls Overlay (wired in M2) ---------- */
#touchControls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  display: none;
  padding: 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
body.touch.playing #touchControls,
body.force-touch.playing #touchControls {
  display: block;
}

#joyZone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45%;
  height: 75%;
  pointer-events: auto;
  touch-action: none;
}
#joyBase {
  position: absolute;
  left: max(26px, env(safe-area-inset-left));
  bottom: max(28px, env(safe-area-inset-bottom));
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid rgba(94, 230, 255, 0.5);
  background: rgba(6, 21, 33, 0.4);
  opacity: 0.35;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
#joyBase.active {
  opacity: 0.92;
  border-color: var(--cyan);
}
#joyKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 210, 63, 0.72);
  border: 2px solid var(--amber);
  pointer-events: none;
}

#btnCluster {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 8px;
  justify-items: center;
  align-items: center;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
#stage.orient-landscape #btnCluster {
  grid-template-areas:
    "spec melt ."
    "grab hvy  ."
    "blk  lgt  jmp"
    ".    roll .";
}
#stage.orient-portrait #btnCluster {
  grid-template-areas:
    ".    spec melt"
    "jmp  grab hvy"
    "blk  roll lgt";
}
.act-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font: bold 11px var(--mono);
  letter-spacing: 1px;
  color: var(--text);
  background: rgba(9, 28, 44, 0.76);
  border: 2px solid var(--cyan);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.act-btn.pressed {
  transform: scale(0.92);
  background: rgba(94, 230, 255, 0.28);
  filter: brightness(1.25);
}
.act-btn.act-special { grid-area: spec; border-color: var(--atomic); color: var(--atomic); }
.act-btn.act-special.dim { opacity: 0.48; }
.act-btn.act-meltdown { grid-area: melt; border-color: var(--film-red); color: var(--amber); background: rgba(193, 39, 45, 0.8); }
.act-btn.act-meltdown.ready {
  box-shadow: 0 0 14px rgba(125, 255, 79, 0.9), 0 0 6px var(--amber);
  border-color: var(--atomic);
  animation: meltPulse 0.8s ease-in-out infinite alternate;
}
@keyframes meltPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@media (max-height: 440px) {
  #joyZone { height: 66%; }
  #joyBase { width: 92px; height: 92px; bottom: max(14px, env(safe-area-inset-bottom)); }
  #btnCluster {
    grid-template-columns: repeat(3, 54px);
    gap: 6px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  .act-btn {
    width: 50px;
    height: 50px;
    font-size: 10px;
  }
}
.act-btn.act-grab { grid-area: grab; }
.act-btn.act-heavy { grid-area: hvy; border-color: var(--coral); color: var(--coral); }
.act-btn.act-jump { grid-area: jmp; }
.act-btn.act-block { grid-area: blk; }
.act-btn.act-dodge { grid-area: roll; }
.act-btn.act-light {
  grid-area: lgt;
  width: 72px;
  height: 72px;
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(255, 210, 63, 0.14);
}
.act-btn.act-light.pressed {
  background: rgba(255, 210, 63, 0.42);
}
.act-btn.hidden { visibility: hidden; pointer-events: none; }
.hidden:not(.act-btn) { display: none !important; }

/* ---------- Screens ---------- */
#screens {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: auto;
  background: rgba(5, 18, 30, 0.68);
  pointer-events: auto;
}
.screen.active { display: flex; }

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 0 0 0 2px #030d15, 0 0 38px rgba(94, 230, 255, 0.15);
  border-radius: 10px;
  padding: 20px 24px;
  text-align: center;
  width: min(470px, 100%);
  margin: auto;
}
.panel.wide { width: min(820px, 100%); }
.panel.over-panel { width: min(640px, 100%); padding: 18px 22px; }

/* 1950s Matinee filmstrip sprocket accent along top/bottom of panels */
.matinee-panel {
  position: relative;
  border-top: 8px solid var(--ink);
  border-bottom: 8px solid var(--ink);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(241, 227, 185, 0.22) 10px 16px, transparent 16px 26px),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(241, 227, 185, 0.22) 10px 16px, transparent 16px 26px);
  background-size: 100% 4px, 100% 4px;
  background-position: 0 2px, 0 calc(100% - 2px);
  background-repeat: no-repeat;
}

.brand {
  font-size: 11px;
  letter-spacing: 3.5px;
  color: var(--cyan);
}

.title {
  font-family: var(--head);
  font-size: clamp(48px, 11vw, 92px);
  line-height: 0.9;
  margin: 10px 0 8px;
  color: var(--amber);
  letter-spacing: 3px;
  transform: rotate(-2deg);
  text-shadow:
    3px 3px 0 var(--film-red),
    6px 6px 0 var(--ink),
    0 0 24px rgba(255, 210, 63, 0.38);
}

.subtitle {
  font-family: var(--head);
  font-size: clamp(14px, 2.5vw, 19px);
  letter-spacing: 3px;
  color: var(--paper);
  margin: 0 0 12px;
  text-shadow: 2px 2px 0 var(--ink);
}

.tier-preview {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.tier-pill {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.tier-pill.common { background: rgba(241, 227, 185, 0.14); color: var(--paper); }
.tier-pill.medium { background: rgba(94, 230, 255, 0.14); color: var(--cyan); border-color: rgba(94, 230, 255, 0.4); }
.tier-pill.pearl { background: rgba(125, 255, 79, 0.18); color: var(--atomic); border-color: var(--atomic); }

h2 {
  font-family: var(--head);
  letter-spacing: 3px;
  color: var(--amber);
  margin: 0 0 10px;
  font-size: clamp(22px, 4.2vw, 32px);
  font-weight: normal;
  text-shadow: 2px 2px 0 var(--ink);
}
h2.red { color: var(--coral); }
h3 {
  margin: 10px 0 6px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-align: left;
  text-transform: uppercase;
}
.tag { color: var(--dim); font-size: 13px; margin: 4px 0 14px; }

.menu-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.menu-btns.row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

.btn {
  font: bold 15px var(--mono);
  letter-spacing: 2px;
  color: var(--text);
  background: #0e2d45;
  border: 2px solid #2e678c;
  border-radius: 6px;
  padding: 11px 16px;
  cursor: pointer;
  min-height: 44px;
}
.btn.small { font-size: 12px; padding: 8px 14px; min-height: 44px; }
.btn:hover, .btn:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}
.btn.primary {
  background: var(--amber);
  color: #081a28;
  border-color: #fff2b2;
}
.btn.primary:hover, .btn.primary:focus-visible {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.btn.active {
  border-color: var(--cyan);
  background: rgba(94, 230, 255, 0.18);
  color: #fff;
}
.btn:disabled { opacity: 0.55; cursor: default; }

.hi-line { margin-top: 14px; font-size: 13px; color: var(--dim); letter-spacing: 2px; }
.hi-line b { color: var(--amber); }
.hint { font-size: 12px; color: var(--dim); margin: 10px 0 0; }
.foot { margin: 10px 0 0; font-size: 10px; letter-spacing: 3px; color: #5f87a3; }

/* ---------- How To Play ---------- */
.how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  text-align: left;
}
@media (max-width: 660px) {
  .how-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
}
.how-grid ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: #d6e7f5;
}
.how-grid li { margin-bottom: 5px; }
.controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-bottom: 8px;
}
.ctrl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d6e7f5;
  padding: 3px 6px;
  background: rgba(6, 20, 32, 0.55);
  border-radius: 4px;
}
.ctrl-act { font-weight: bold; color: #fff; }
.key-pair {
  white-space: nowrap;
  color: var(--dim);
}
kbd {
  display: inline-block;
  font: bold 11px var(--mono);
  border: 1px solid #497899;
  border-bottom-width: 3px;
  border-radius: 3px;
  padding: 0 4px;
  margin: 0 1px;
  background: #10324c;
}
.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin: 7px 0;
  color: #cfe3f2;
  text-align: left;
}
.legend b { color: #fff; }
.legend canvas { flex: 0 0 auto; }
.legend b.loot-health { color: #ff6b7a; }
.legend b.loot-fuel { color: var(--atomic); }
.legend b.loot-girder { color: #c4d0db; }
.legend b.loot-tanker { color: var(--amber); }

.bldg-states {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
}
.state-pill {
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid #2b6285;
  background: rgba(12, 38, 59, 0.8);
  color: #d6e7f5;
}
.state-pill.intact { border-color: var(--cyan); }
.state-pill.damaged { border-color: var(--amber); }
.state-pill.rubble { border-color: var(--coral); }
.state-arrow { color: var(--amber); font-weight: bold; }

/* ---------- Pause Orientation Controls ---------- */
.pause-section {
  margin: 12px 0;
  padding: 10px;
  background: rgba(6, 20, 32, 0.72);
  border: 1px solid #1d4a68;
  border-radius: 6px;
}
.seg-group {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.seg-btn {
  font: bold 11px var(--mono);
  color: var(--dim);
  background: #0c263b;
  border: 1px solid #2b6285;
  border-radius: 4px;
  padding: 7px 10px;
  min-height: 44px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--cyan);
  color: #061521;
  border-color: #fff;
}
.seg-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* ---------- Leaderboard Tables ---------- */
.board-filters { margin-top: 4px; margin-bottom: 10px; }
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}
.chip.small { font-size: 10px; padding: 4px 8px; min-height: 30px; }
.chip.active {
  background: var(--cyan);
  color: #061521;
  border-color: #fff;
}

.table-wrap {
  max-height: min(52vh, 460px);
  max-inline-size: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #061624;
  container-type: inline-size;
}
.table-wrap.compact { max-height: 210px; }
.board-mode-notice {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(94, 230, 255, 0.1);
  border: 1px dashed rgba(94, 230, 255, 0.45);
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}
.board-mode-notice.global {
  color: var(--atomic);
  background: rgba(125, 255, 79, 0.1);
  border-color: rgba(125, 255, 79, 0.45);
}
.board-mode-notice:empty { display: none; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead { position: sticky; inset-block-start: 0; z-index: 1; }
th {
  background: #0d2b42;
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 7px 6px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 6px;
  border-top: 1px solid #13314a;
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td:first-child, th:first-child { width: 34px; text-align: right; color: var(--dim); }
tr.me td { background: rgba(255, 210, 63, 0.16); color: var(--amber); font-weight: bold; }
tr.top1 td:nth-child(2) { color: #ffd23f; }
tr.top2 td:nth-child(2) { color: #e2eef7; }
tr.top3 td:nth-child(2) { color: #f4a261; }
.board-msg { padding: 14px; color: var(--dim); font-size: 12px; }
.board-msg:empty { display: none; }

/* ---------- Game Over & Submission ---------- */
.results {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 4px 0 6px;
  flex-wrap: wrap;
}
.results div { display: flex; flex-direction: column; }
.results b { font-size: 26px; color: #fff; }
.go-meta {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  margin-bottom: 8px;
}
.lbl {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--dim);
  display: block;
}
.field-hint {
  display: block;
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
}
.newhigh {
  display: none;
  color: var(--amber);
  letter-spacing: 3px;
  font-size: 13px;
  margin-bottom: 6px;
  animation: blink 0.8s steps(2) infinite;
}
.newhigh.show { display: block; }
@keyframes blink { 50% { opacity: 0.25; } }

#submitForm { margin-top: 4px; }
.name-badge-wrapper {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
  justify-content: center;
}
.badge-panel {
  flex: 1;
  min-width: 0;
  background: #05131f;
  border: 2px solid var(--amber);
  border-radius: 6px;
  padding: 5px 12px 7px;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.badge-panel:has(:is(:user-invalid, .user-invalid-fallback)) {
  border-color: var(--coral);
  background: rgba(193, 39, 45, 0.14);
}
.badge-caption {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--amber);
  font-weight: bold;
}
#nameInput {
  width: 100%;
  font: bold 19px var(--mono);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--amber);
  background: transparent;
  border: none;
  padding: 2px 0;
}
#nameInput:focus { outline: none; }
.name-badge-wrapper .btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 480px) {
  .name-badge-wrapper { flex-direction: column; gap: 8px; }
  .name-badge-wrapper .btn { width: 100%; }
}

.submit-msg { min-height: 18px; margin-top: 6px; font-size: 12px; color: var(--dim); }
.submit-msg.ok { color: #67f2a8; }
.submit-msg.err { color: var(--coral); }

.over-board { margin-top: 10px; text-align: left; }
.over-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.over-board-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.over-board-notice {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-transform: uppercase;
}

/* ---------- M7 Monster & City Select Screen ---------- */
.panel.select-panel {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  text-align: left;
  padding: 14px 18px;
}
.select-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.select-head h2 {
  margin-bottom: 0;
  text-align: left;
}
.select-section-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan);
  margin: 6px 0 5px;
}
.carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.carousel-btn {
  flex: 0 0 32px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: rgba(16, 22, 34, 0.92);
  color: var(--amber);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.12s ease, transform 0.12s ease, background 0.12s ease;
}
.carousel-btn:hover {
  border-color: var(--cyan);
  background: rgba(28, 36, 52, 0.96);
}
.carousel-btn:active {
  transform: scale(0.94);
}
.monster-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--amber) rgba(255, 255, 255, 0.08);
}
.monster-grid::-webkit-scrollbar,
.city-grid::-webkit-scrollbar {
  height: 6px;
}
.monster-grid::-webkit-scrollbar-track,
.city-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}
.monster-grid::-webkit-scrollbar-thumb,
.city-grid::-webkit-scrollbar-thumb {
  background: var(--amber);
  border-radius: 999px;
}
.monster-card {
  flex: 0 0 215px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(16, 22, 34, 0.92);
  border: 2px solid var(--line);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.monster-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}
.monster-card.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255, 210, 63, 0.35), 0 8px 18px rgba(0, 0, 0, 0.5);
  background: rgba(28, 36, 52, 0.96);
}
.select-preview-wrap {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0d121c;
}
.select-preview {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: contain;
}
.select-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  background: var(--amber);
  color: var(--ink);
  opacity: 0;
}
.monster-card.selected .select-badge,
.city-card.selected .select-badge {
  opacity: 1;
}
.monster-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--amber);
}
.monster-sub {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  margin-top: -3px;
}
.monster-blurb {
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--dim);
  min-height: 26px;
}
.stat-bars {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
}
.stat-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--atomic));
}
.monster-kit {
  font-size: 10px;
  color: var(--sand);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 5px;
  line-height: 1.35;
}
.city-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--amber) rgba(255, 255, 255, 0.08);
}
.city-card {
  position: relative;
  flex: 0 0 250px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px;
  border-radius: 10px;
  background: rgba(16, 22, 34, 0.92);
  border: 2px solid var(--line);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.city-card:hover { border-color: var(--cyan); }
.city-card.selected {
  border-color: var(--atomic);
  box-shadow: 0 0 0 2px rgba(125, 255, 79, 0.3);
  background: rgba(24, 34, 46, 0.96);
}
.city-preview {
  width: 100%;
  height: 48px;
  border-radius: 6px;
  display: block;
}
.city-name {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--amber);
}
.city-sub {
  font-size: 11px;
  color: var(--dim);
}
.select-cta-row {
  margin-top: 8px;
}
.select-cta-row .btn {
  min-width: 240px;
}

@media (max-width: 780px) {
  .panel.select-panel { padding: 12px; }
  .carousel-btn { flex: 0 0 26px; height: 40px; font-size: 18px; }
  .monster-card {
    flex: 0 0 205px;
    scroll-snap-align: center;
  }
  .city-card {
    flex: 0 0 230px;
    scroll-snap-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title { transform: none; }
  .newhigh,
  .act-btn.act-meltdown.ready { animation: none; }
  .monster-card,
  .city-card { transition: none; }
}
