/* =============================================================================
   Death Viper — HUD and menu chrome.
   Design tokens from the handoff: flat panels, 2px borders, square corners
   (this is a pixel game), 4px base grid, no shadows.
   ========================================================================== */

:root {
  --void:    #1B2436;
  --deep:    #0D1420;
  --panel:   #0F1420;
  --border:  #1C2331;
  --keyline: #060A12;

  --o1: #FFE9B0; --o2: #FFD23F; --o3: #FFA02B; --o4: #F47B20; --o5: #C2521A;
  --red: #D8352A; --red-lt: #FF6B5A;
  --steel1: #C3CEDD; --steel2: #8E9CB0; --steel3: #6B7A90; --steel4: #4B5768; --steel6: #232C3A;
  --green: #7FD84F;
  --violet: #C77DFF;
  --cyan: #22E8FF;

  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --copy: 'Lato', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--deep);
  color: var(--steel1);
  font-family: var(--copy);
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background-image:
    radial-gradient(circle at 50% 0%, #16202f 0%, #0D1420 60%);
}

#cabinet {
  width: 100%;
  max-width: 1500px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- HUD ----------------------------------------------------------------- */

#hud {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 8px 12px;
  flex: 0 0 auto;
}

.hud-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  border-right: 2px solid var(--border);
  min-width: 0;
}
.hud-block:last-child { border-right: 0; }
.hud-block.grow { flex: 1 1 auto; }
.hud-block.wide { flex: 1 1 34%; }

.label {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: .06em;
  color: var(--steel3);
  white-space: nowrap;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 13px;
  color: var(--steel1);
}
.num.big { font-size: 22px; line-height: 1; }

#kills { color: var(--o2); }
#best  { color: var(--steel2); }
#clock { color: var(--steel1); }

#lives { color: var(--green); transition: none; }
#lives.flash { color: var(--red-lt); }

.bar {
  display: block;
  height: 4px;
  background: var(--keyline);
  border: 1px solid var(--border);
  margin-top: 2px;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--o4);
}

.weapon-name {
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--o2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blurb {
  font-size: 12px;
  line-height: 1.4;
  color: var(--steel3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Play field ---------------------------------------------------------- */

#stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#field {
  display: block;
  background: var(--void);
  border: 2px solid var(--border);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  outline: none;
}

/* ---- Field overlays ------------------------------------------------------ */

.toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(13, 20, 32, .88);
  border: 2px solid var(--o4);
  padding: 8px 20px;
  pointer-events: none;
}
.toast.on { display: flex; }
#toast-main { font-family: var(--pixel); font-size: 12px; color: var(--o2); }
#toast-sub  { font-family: var(--pixel); font-size: 8px; color: var(--steel2); }

.fieldflags {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.flag {
  display: none;
  font-family: var(--pixel);
  font-size: 8px;
  padding: 5px 9px;
  background: rgba(13, 20, 32, .9);
}
.flag.on { display: block; }
.flag.nuke { color: var(--o2); border: 1px solid #7B3FF255; }
.flag.emp  { color: var(--cyan); border: 1px solid #22E8FF33; }

.banner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel);
  font-size: 24px;
  color: var(--o2);
  background: rgba(13, 20, 32, .7);
}
.banner.on { display: flex; }
.banner { cursor: pointer; }
@media (pointer: coarse) { .banner { font-size: 14px; } }

/* ---- Overlay panels ------------------------------------------------------ */

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 18, .86);
  padding: 16px;
}
.overlay.on { display: flex; }

.panel {
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 32px 40px;
  max-width: 620px;
  text-align: center;
  /* The game-over panel carries the tally plus the creator note, which can
     outrun a short viewport — scroll inside the panel, never the page. */
  max-height: 100%;
  overflow-y: auto;
}

/* The results screens carry two columns, so they get more room than the
   single-column title screen. */
.overlay.over .panel,
.overlay.won .panel { max-width: 800px; }

.panel h1 {
  font-family: var(--pixel);
  font-size: 26px;
  line-height: 1.35;
  color: var(--o3);
  text-shadow: 3px 3px 0 var(--keyline);
  margin-bottom: 12px;
}
.overlay.won .panel h1 { color: var(--o2); font-size: 22px; }
.overlay.over .panel h1 { color: var(--red); }

.panel .sub {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--steel3);
  letter-spacing: .08em;
  margin-bottom: 24px;
}

.panel .body { font-size: 16px; line-height: 1.6; color: var(--steel2); }
.panel .body p { margin-bottom: 12px; }
.panel .body b { color: var(--steel1); }
.panel .body .fine { font-size: 13px; color: var(--steel3); margin-top: 16px; }

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 8px;
}
.keys span {
  font-size: 12px;
  color: var(--steel3);
  border: 1px solid rgba(255, 255, 255, .10);
  padding: 5px 9px;
}
.keys b { color: var(--o2); font-family: var(--mono); }

.tally { margin: 8px 0 4px; }
.tally div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.tally span { font-family: var(--pixel); font-size: 9px; color: var(--steel3); }
.tally b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  color: var(--o2);
}
.record {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--green);
  margin-top: 16px;
}

/* ---- Results: your run beside the global board --------------------------- */

.result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  text-align: left;
}
.result-cols > .col { min-width: 0; }
@media (max-width: 620px) {
  .result-cols { grid-template-columns: 1fr; gap: 16px; }
}

.board-label {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: .06em;
  color: var(--o3);
  margin-bottom: 10px;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.board-list li {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.board-list .rank {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--steel4);
  text-align: right;
}
.board-list .who {
  font-size: 13px;
  color: var(--steel2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-list .tally-kills {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--steel1);
}
.board-list li.me .who,
.board-list li.me .tally-kills,
.board-list li.me .rank { color: var(--o2); }

.board-note {
  display: block !important;
  font-size: 12px;
  line-height: 1.5;
  color: var(--steel4);
  border-bottom: 0 !important;
}

.board-submit { margin-top: 12px; }
.board-hooray {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--green);
  margin-bottom: 8px;
}
.board-form { display: flex; gap: 6px; }
.board-form[hidden] { display: none; }
.board-form input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--steel1);
  background: var(--keyline);
  border: 2px solid var(--border);
  padding: 8px 10px;
}
.board-form input:focus {
  outline: none;
  border-color: var(--o4);
}
.board-form input::placeholder { color: var(--steel4); }
.board-form button {
  font-family: var(--pixel);
  font-size: 9px;
  white-space: nowrap;
  color: var(--keyline);
  background: var(--o2);
  border: 2px solid var(--o4);
  padding: 8px 12px;
  cursor: pointer;
}
.board-form button:hover:not(:disabled) { background: var(--o1); }
.board-form button:disabled { opacity: .5; cursor: default; }
.board-msg {
  font-size: 12px;
  color: var(--steel3);
  margin-top: 8px;
  min-height: 1em;
}

/* ---- Creator note (game-over screen) ------------------------------------- */

.creator {
  margin-top: 24px;
  padding: 20px;
  border: 2px solid var(--border);
  background: var(--deep);
  text-align: left;
}
.creator-label {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--o3);
  margin-bottom: 12px;
}
.creator p:not(.creator-label) {
  font-size: 15px;
  line-height: 1.6;
  color: var(--steel2);
  margin-bottom: 16px;
}

.contribute {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--keyline);
  background: var(--o2);
  border: 2px solid var(--o4);
  padding: 12px 20px;
  text-decoration: none;
  cursor: pointer;
}
.contribute:hover,
.contribute:focus-visible {
  background: var(--o1);
  border-color: var(--o2);
  outline: none;
}
.contribute:active { background: var(--o3); }

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex: 0 0 auto;
}

/* Square icon button (full screen), matching the flat pixel chrome. */
.iconbtn {
  font-family: var(--copy);
  font-size: 15px;
  line-height: 1;
  color: var(--steel2);
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 9px 11px;
  cursor: pointer;
}
.iconbtn:hover { color: var(--o2); border-color: var(--o4); }
.iconbtn.on { color: var(--o2); border-color: var(--o4); }
.iconbtn[hidden] { display: none; }

/* Permanent Contribute button, pinned to the right end of the HUD so it is
   always on screen without ever overlapping the play field. */
.contribute-hud {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 8px;
  font-size: 9px;
  padding: 10px 14px;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .contribute-hud { font-size: 8px; padding: 8px 10px; }
}
@media (max-width: 700px) {
  .contribute-hud { padding: 7px 8px; margin-left: 4px; }
}

.panel .action {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--o2);
  margin-top: 24px;
  animation: blink 1.1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: .25; } }

/* ---- Weapon rack --------------------------------------------------------- */

#rackwrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
}

/* "TAP TO SHOOT" only makes sense where there is something to tap. */
.rack-hint { display: none; }

#rack {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  min-width: 0;
  min-height: 0;
}

.slot {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 8px;
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 8px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.slot-key {
  grid-row: 1 / 3;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--steel4);
  width: 12px;
  text-align: center;
}
.slot-icon {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}
.slot-icon canvas {
  image-rendering: pixelated;
  transform: scale(1.6);
  transform-origin: center;
}
.slot-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.slot-name {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--steel2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-ammo {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--steel1);
}
.slot-bar {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--keyline);
  margin-top: 4px;
}
.slot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--o4);
}
.slot-bar i.ready { background: var(--steel4); }

.slot.active {
  border-color: var(--o4);
  background: #16130E;
}
.slot.active .slot-key { color: var(--o2); }
.slot.active .slot-name { color: var(--o1); }
.slot.active .slot-bar i.ready { background: var(--o2); }

.slot.locked { opacity: .35; cursor: default; }
.slot.locked .slot-icon { filter: grayscale(1) brightness(.5); }
.slot.locked .slot-ammo { color: var(--steel4); font-size: 10px; }

.slot.empty .slot-ammo { color: var(--red); }
.slot.empty .slot-icon { filter: grayscale(1); opacity: .5; }

.slot.fresh { border-color: var(--green); }
.slot.fresh .slot-name { color: var(--green); }

@media (max-width: 1100px) {
  #rack { grid-template-columns: repeat(5, 1fr); }
  .hud-block.wide { display: none; }
}

/* =============================================================================
   Small screens and touch
   ========================================================================== */

/* The HUD was a fixed-width flex row, so on a narrow screen the blocks ran
   into each other rather than shrinking. Let them shrink and ellipsise, and
   drop the least important readouts first. */
#hud { min-width: 0; }
.hud-block { flex-shrink: 1; overflow: hidden; }
.hud-block .num,
.hud-block .label { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
  #hud { padding: 6px 8px; gap: 4px; }
  .hud-block { padding: 0 6px; }
  .num.big { font-size: 17px; }
  .label { font-size: 7px; }
}

/* Below this the row simply cannot hold every readout legibly — keep the three
   that matter mid-run (kills, clock, lives) and the Contribute button. */
@media (max-width: 620px) {
  #hud-best, #hud-score { display: none; }
  .num.big { font-size: 15px; }
  .hud-block { padding: 0 4px; border-right-width: 1px; }
}

/* Touch: bigger tap targets, and no browser gestures stealing the drag. */
@media (pointer: coarse) {
  /* Every surface a thumb can land on refuses browser gestures. Guarding only
     the canvas was not enough: with one thumb dragging and the other on a
     weapon tile, the pair reads as a pinch and zooms the page. */
  html, body, #cabinet, #hud, #stage, #field,
  #rackwrap, #rack, .slot, .rack-hint, .hud-actions {
    touch-action: none;
  }
  /* The results panel is the one thing that genuinely needs to scroll. */
  .panel { touch-action: pan-y; }
  body { overscroll-behavior: none; }
  .slot { padding: 6px 4px; min-height: 46px; cursor: default; }
  .slot-key { font-size: 13px; }
  .slot-name { font-size: 7px; }
  .slot-ammo { font-size: 11px; }
  .slot-icon { width: 16px; }
  .slot-icon canvas { transform: scale(1.3); }
  /* Feedback on tap, since a weapon fires the moment its tile is pressed. */
  .slot:active:not(.locked) { background: #16130E; border-color: var(--o2); }

  .rack-hint {
    display: block;
    flex: 0 0 auto;
    font-family: var(--pixel);
    font-size: 7px;
    letter-spacing: .04em;
    color: var(--o2);
    background: var(--panel);
    border: 2px solid var(--o4);
    padding: 6px 2px;
    text-align: center;
    white-space: nowrap;
  }

  /* Only this restarts a run on touch, so it has to look and behave like a
     button rather than a blinking caption — and it sits directly under the
     subtitle, because at the bottom of a long panel you had to scroll to find
     out how to start. */
  .panel { display: flex; flex-direction: column; }
  .panel h1 { order: 1; }
  .panel .sub { order: 2; margin-bottom: 10px; }
  .panel .action {
    order: 3;
    align-self: center;
    display: inline-block;
    border: 2px solid var(--o4);
    padding: 10px 18px;
    margin: 0 0 12px;
    animation: none;
  }
  .panel .action:active { background: var(--o2); color: var(--keyline); }
  .panel .body { order: 4; }
}

/* Short screens generally (landscape phone included): shrink the overlays so
   the panel is readable without becoming a scroll box. */
@media (pointer: coarse) and (max-height: 520px) {
  #cabinet { gap: 3px; }
  body { padding: 3px; }

  #hud { padding: 3px 6px; gap: 2px; }
  .label { font-size: 6px; }
  .num.big { font-size: 13px; line-height: 1.1; }
  .num { font-size: 10px; }
  .bar { height: 3px; margin-top: 1px; }
  .contribute-hud { font-size: 7px; padding: 6px 8px; margin-left: 4px; }

  #rack { grid-template-columns: repeat(10, 1fr); gap: 2px; }
  .slot {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto;
    gap: 0 4px;
    padding: 4px 3px;
    min-height: 0;
  }
  .slot-name { display: none; }          /* the icon carries the identity here */
  .slot-key { grid-row: 1; font-size: 11px; width: 8px; }
  .slot-icon { grid-row: 1; width: 14px; }
  .slot-icon canvas { transform: scale(1.1); }
  .slot-meta { gap: 0; }
  .slot-ammo { font-size: 10px; }
  .slot-bar { grid-column: 1 / -1; height: 2px; margin-top: 3px; }

  /* Overlays have to fit a 360px-tall screen without becoming a scroll box. */
  .panel { padding: 10px 16px; }
  .panel h1 { font-size: 15px; margin-bottom: 4px; }
  .overlay.won .panel h1 { font-size: 13px; }
  .panel .sub { font-size: 7px; margin-bottom: 8px; }
  .panel .body { font-size: 12px; line-height: 1.45; }
  .panel .body p { margin-bottom: 5px; }
  .panel .body .fine { font-size: 10px; margin-top: 6px; }
  .keys { margin: 8px 0 2px; gap: 4px; }
  .keys span { font-size: 10px; padding: 3px 6px; }
  .panel .action { font-size: 9px; margin-top: 8px; }
  .tally div { padding: 2px 0; }
  .tally span { font-size: 7px; }
  .tally b { font-size: 12px; }
  .board-list li { padding: 1px 0; }
  .board-list .who, .board-list .tally-kills { font-size: 11px; }
  .creator { margin-top: 6px; padding: 8px 10px; }
  .creator p:not(.creator-label) { font-size: 11px; margin-bottom: 6px; }
  .contribute { font-size: 9px; padding: 8px 12px; }
}

/* ---- Transient hint ------------------------------------------------------ */

.hint {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 900;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--deep);
  border: 2px solid var(--o4);
  color: var(--steel1);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  text-align: center;
  display: none;
}
.hint.on { display: block; }

/* ---- Rotate prompt ------------------------------------------------------- */

.rotate { display: none; }

@media (pointer: coarse) and (orientation: portrait) {
  .rotate {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep);
    padding: 24px;
    text-align: center;
  }
  .rotate-icon {
    display: block;
    font-size: 44px;
    color: var(--o3);
    margin-bottom: 20px;
  }
  .rotate-main {
    font-family: var(--pixel);
    font-size: 14px;
    line-height: 1.6;
    color: var(--o2);
    margin-bottom: 12px;
  }
  .rotate-sub { font-size: 15px; color: var(--steel3); }
}

/* On a short viewport the game-over panel is the tallest thing in the game —
   tally, record line, creator note and button. Tighten the vertical rhythm so
   the Contribute button stays above the fold instead of needing a scroll. */
@media (max-height: 880px) {
  .panel { padding: 16px 32px; }
  .panel h1 { font-size: 18px; margin-bottom: 8px; }
  .overlay.won .panel h1 { font-size: 16px; }
  .panel .sub { margin-bottom: 12px; }
  .tally div { padding: 4px 0; }
  .tally b { font-size: 15px; }
  .record { margin-top: 8px; }
  .creator { margin-top: 12px; padding: 12px 16px; }
  .creator-label { margin-bottom: 8px; }
  .creator p:not(.creator-label) { font-size: 14px; margin-bottom: 10px; }
  .contribute { padding: 10px 18px; }
  .panel .action { margin-top: 12px; }
  .keys { margin: 12px 0 4px; }
  .panel .body { font-size: 14px; }
  .panel .body p { margin-bottom: 8px; }
}

/* =============================================================================
   Landscape phone: chrome down the sides, field gets the full height.

   Stacked horizontally the HUD and rack cost ~75px of a 360px screen, which
   caps the field at ~1.3x. Moved to the flanks they cost width instead, which
   a landscape phone has to spare, and the field gets the whole height — enough
   to reach a clean 2x on most handsets.
   ========================================================================== */
@media (pointer: coarse) and (orientation: landscape) {
  /* viewport-fit=cover puts the page under the notch / Dynamic Island, so the
     insets have to be paid back here — otherwise the camera housing sits on
     top of the weapon rack and swallows taps. */
  body {
    padding:
      max(1px, env(safe-area-inset-top))
      max(1px, env(safe-area-inset-right))
      max(1px, env(safe-area-inset-bottom))
      max(1px, env(safe-area-inset-left));
  }
  #cabinet { flex-direction: row; gap: 1px; align-items: stretch; }

  /* min-width:0 matters: without it a flex item refuses to shrink below its
     content width, the columns bloat, and the field loses the width it needs
     to reach the next crisp scale step. */
  #hud {
    flex: 0 0 60px;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    padding: 4px;
    overflow: hidden;
  }
  .hud-block {
    width: 100%;
    padding: 3px 2px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
  }
  .hud-block:last-of-type { border-bottom: 0; }
  .label { overflow: hidden; white-space: nowrap; font-size: 5px; }
  /* "TIME REMAINING" is 89px at 6px type and the column is 76px — swap in the
     short form rather than clipping it mid-word. */
  .label[data-short] { font-size: 0; }
  .label[data-short]::after {
    content: attr(data-short);
    font-size: 5px;
    letter-spacing: .06em;
  }
  #hud-best, #hud-score { display: none; }   /* no room, and least useful mid-run */
  .hud-block.wide { display: none; }
  .hud-block.grow { flex: 0 0 auto; }
  .label { font-size: 6px; }
  .num.big { font-size: 15px; }

  .hud-actions {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: auto 0 0;               /* pinned to the bottom of the column */
    width: 100%;
    min-width: 0;
  }
  .contribute-hud {
    margin-left: 0;
    width: 100%;
    min-width: 0;
    text-align: center;
    padding: 8px 0;
    letter-spacing: 0;
    white-space: nowrap;
  }
  /* "CONTRIBUTE" cannot fit a 60px column at a legible size — swap in the
     short form rather than shrinking it to 5px or clipping it. */
  .contribute-hud[data-short] { font-size: 0; }
  .contribute-hud[data-short]::after { content: attr(data-short); font-size: 6px; }
  .iconbtn { width: 100%; padding: 6px 2px; font-size: 13px; }

  /* Two columns of five, so each tile is roughly double the area of the old
     single-column strip — these are fired mid-dodge with a thumb. */
  #rackwrap { flex: 0 0 96px; min-width: 0; gap: 2px; }
  #rack {
    flex: 1 1 auto;
    min-width: 0;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
    gap: 2px;
  }
  .rack-hint { font-size: 6px; padding: 4px 1px; }
  .slot {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    align-content: center;
    gap: 1px;
    padding: 2px;
  }
  .slot-name { display: none; }
  .slot-key { grid-row: 1; grid-column: 1; font-size: 10px; width: auto; text-align: center; }
  .slot-icon { grid-row: 2; grid-column: 1; width: auto; }
  .slot-icon canvas { transform: scale(1.2); }
  .slot-meta { grid-row: 3; grid-column: 1; align-items: center; }
  .slot-ammo { font-size: 10px; }
  .slot-bar { grid-row: 4; grid-column: 1; width: 100%; height: 2px; margin-top: 2px; }

  #stage { min-width: 0; min-height: 0; }
}
