@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --hud-green: #39ff8f;
  --hud-green-dim: #1c8a52;
  --hud-orange: #ff9130;
  --hud-red: #ff4655;
  --bg-deep: #050b10;
  --bg-panel: rgba(12, 26, 22, 0.85);
  --panel-border: rgba(57, 255, 143, 0.35);
  --text-main: #d9fbe8;
  --text-dim: #7fa695;
  --tiltx: 0;
  --tilty: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
}

body {
  font-family: "Consolas", "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
  color: var(--text-main);
  background: radial-gradient(circle at 50% 0%, #0e2a22, var(--bg-deep) 65%);
  min-height: 100vh;
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
}

/* The sitewide privacy link is position:fixed at the foot of every template and
   reserves no space of its own, so it painted over whatever sat at the bottom of
   the viewport -- on /admin that was the last roster row, leaving its Reset
   button half-covered and unclickable. */
body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

/* ---- moving space backdrop ---- */

.starfield {
  position: fixed;
  inset: -400px;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 50% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 15% 85%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 60% 90%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 25%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 5% 55%, #fff 50%, transparent 51%);
  background-repeat: repeat;
  background-size: 340px 340px;
  opacity: 0.8;
  animation: starfield-fly 16s linear infinite;
  transform: translate3d(calc(var(--tiltx) * -10px), calc(var(--tilty) * -10px), 0);
  transition: transform 0.25s ease-out;
  will-change: transform, background-position;
}

.starfield.boosting {
  animation-duration: 2.6s;
}

@keyframes starfield-fly {
  from { transform: translate(0, 0); }
  to   { transform: translate(-340px, 340px); }
}

.starfox-horizon {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translate3d(calc(var(--tiltx) * -16px), calc(var(--tilty) * -10px), 0);
  transition: transform 0.25s ease-out;
}

.asteroid {
  position: absolute;
  left: -80px;
  width: var(--size, 40px);
  height: var(--size, 40px);
  opacity: var(--opacity, 0.45);
  animation: asteroid-drift var(--duration, 26s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.asteroid-spin {
  width: 100%;
  height: 100%;
  animation: asteroid-tumble var(--spin, 11s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.asteroid-spin svg { display: block; width: 100%; height: 100%; }

.asteroid-spin polygon {
  fill: rgba(12, 26, 22, 0.6);
  stroke: var(--hud-green-dim);
  stroke-width: 1.4;
}

@keyframes asteroid-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 160px)); }
}

@keyframes asteroid-tumble {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.starfox-horizon.boosting .asteroid {
  animation-duration: calc(var(--duration, 26s) / 6);
}

.warp-flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle at 50% 55%, rgba(57,255,143,0.28), transparent 60%);
  opacity: 0;
}

.warp-flash.active {
  animation: warp-pulse 0.4s ease-out;
}

@keyframes warp-pulse {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.boost-hint {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.65;
}

.boost-hint kbd {
  border: 1px solid var(--panel-border);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--hud-green);
  font-family: inherit;
}

@media (max-width: 700px), (hover: none) {
  .boost-hint { display: none; }
}

/* ---- Arwing + weapons ---- */

.arwing {
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 0 6px rgba(57, 255, 143, 0.55));
  will-change: transform;
}

.arwing svg { display: block; width: 100%; height: 100%; }

.arwing polygon {
  fill: rgba(12, 26, 22, 0.55);
  stroke: var(--hud-green);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.laser-bolt {
  position: fixed;
  width: 4px;
  height: 18px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(57, 255, 143, 0), var(--hud-green) 60%, #fff);
  box-shadow: 0 0 8px rgba(57, 255, 143, 0.8);
  border-radius: 2px;
}

.explosion {
  position: fixed;
  z-index: 1;
  width: 0;
  height: 0;
  pointer-events: none;
}

.explosion .spark {
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 5px;
  margin: -2.5px;
  border-radius: 50%;
  background: var(--hud-orange);
  box-shadow: 0 0 6px var(--hud-orange);
  animation: spark-burst 0.4s ease-out forwards;
}

@keyframes spark-burst {
  from { transform: rotate(var(--angle)) translateX(0); opacity: 1; }
  to   { transform: rotate(var(--angle)) translateX(26px); opacity: 0; }
}

.score-pop {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  font-family: "Press Start 2P", "Consolas", monospace;
  font-size: 0.7rem;
  color: var(--hud-orange);
  text-shadow: 0 0 8px rgba(255, 145, 48, 0.6);
  animation: score-pop-rise 0.9s ease-out forwards;
  white-space: nowrap;
}

@keyframes score-pop-rise {
  0%   { transform: translate(-50%, 0); opacity: 0; }
  15%  { transform: translate(-50%, -6px); opacity: 1; }
  100% { transform: translate(-50%, -46px); opacity: 0; }
}

.hit-counter {
  position: fixed;
  right: 22px;
  bottom: 122px;
  z-index: 5;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  pointer-events: none;
  text-align: right;
}

.hit-counter .count {
  display: block;
  font-family: "Press Start 2P", "Consolas", monospace;
  font-size: 0.85rem;
  color: var(--hud-orange);
  text-shadow: 0 0 8px rgba(255, 145, 48, 0.5);
}

@media (max-width: 860px) {
  .hit-counter { display: none; }
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(57, 255, 143, 0.03),
    rgba(57, 255, 143, 0.03) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.hud-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  max-width: 460px;
  background: var(--bg-panel);
  border: 1px solid var(--panel-border);
  padding: 36px 32px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 40px rgba(57, 255, 143, 0.08), inset 0 0 60px rgba(0,0,0,0.4);
}

.hud-panel.wide {
  max-width: 720px;
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--hud-green);
}
.corner.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner.tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corner.bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corner.br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.callsign-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

.toad-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
}

.toad-avatar {
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(57, 255, 143, 0.5));
}

.lock-reticle {
  position: absolute;
  inset: -6px;
  border: 1px dashed rgba(57, 255, 143, 0.5);
  border-radius: 50%;
  animation: reticle-spin 6s linear infinite;
}
.lock-reticle::before, .lock-reticle::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--hud-green);
}
.lock-reticle::before { top: -3px; left: -3px; border-right: none; border-bottom: none; }
.lock-reticle::after { bottom: -3px; right: -3px; border-left: none; border-top: none; }
@keyframes reticle-spin { to { transform: rotate(360deg); } }

.callsign {
  font-family: "Press Start 2P", "Consolas", monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  line-height: 1.6;
  color: var(--hud-orange);
  text-transform: uppercase;
  flex: 1;
}

.home-link {
  margin-left: auto;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--panel-border);
  padding: 5px 10px;
  flex-shrink: 0;
}
.home-link:hover { color: var(--hud-green); border-color: var(--hud-green); }

h1 {
  font-family: "Press Start 2P", "Consolas", monospace;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 10px 0 8px;
  letter-spacing: 0.02em;
  color: var(--hud-green);
  text-shadow: 0 0 12px rgba(57, 255, 143, 0.45);
}

p.subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 24px;
  letter-spacing: 0.03em;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hud-green-dim);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--hud-green);
  box-shadow: 0 0 0 2px rgba(57, 255, 143, 0.15);
}

.code-gen-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.code-gen-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.code-gen-form input[type="text"]:focus {
  border-color: var(--hud-green);
  box-shadow: 0 0 0 2px rgba(57, 255, 143, 0.15);
}
.code-gen-form button.hud-btn { width: auto; flex-shrink: 0; }

button.hud-btn {
  width: 100%;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(57,255,143,0.18), rgba(57,255,143,0.06));
  border: 1px solid var(--hud-green);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), inset 0 -3px 0 rgba(0,0,0,0.35);
  color: var(--hud-green);
  font-family: "Press Start 2P", "Consolas", monospace;
  font-weight: normal;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.62rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

button.hud-btn:hover {
  background: rgba(57, 255, 143, 0.28);
}

button.hud-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), inset 0 -1px 0 rgba(0,0,0,0.35);
}

.alert {
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid var(--hud-red);
  color: var(--hud-red);
  background: rgba(255, 70, 85, 0.08);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  animation: klaxon-flash 1.4s ease-in-out infinite;
}

@keyframes klaxon-flash {
  0%, 100% { box-shadow: 0 0 0 rgba(255,70,85,0); }
  50% { box-shadow: 0 0 16px rgba(255,70,85,0.45); }
}

.alert.good {
  animation: none;
}

.flavor {
  margin-top: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ---- comm-link transmission window ---- */

.comm-window {
  margin-top: 26px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.comm-portrait {
  flex-shrink: 0;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(57, 255, 143, 0.06);
  border-right: 1px solid var(--panel-border);
}

.comm-portrait svg {
  filter: drop-shadow(0 0 6px rgba(57, 255, 143, 0.5));
}

.comm-body {
  padding: 10px 12px;
  flex: 1;
  min-width: 0;
}

.comm-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hud-orange);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.comm-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hud-red);
  flex-shrink: 0;
  animation: comm-blink 1s steps(1) infinite;
}
@keyframes comm-blink { 50% { opacity: 0; } }

.comm-body p {
  margin: 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-main);
  line-height: 1.4;
}

.comm-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.06) 0 1px, transparent 1px 3px);
  opacity: 0;
  animation: comm-flicker 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes comm-flicker {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: 0.5; }
  95% { opacity: 0.05; }
  97% { opacity: 0.4; }
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--panel-border);
}

.top-bar .who {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.top-bar a.logout {
  color: var(--hud-orange);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--hud-orange);
  padding: 6px 10px;
}

.top-bar a.logout:hover {
  background: rgba(255, 145, 48, 0.12);
}

table.cargo {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.cargo th {
  text-align: left;
  color: var(--hud-green-dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 8px 6px;
  border-bottom: 1px solid var(--panel-border);
}

table.cargo td {
  padding: 10px 6px;
  border-bottom: 1px solid rgba(57, 255, 143, 0.12);
}

table.cargo a.dl {
  color: var(--hud-green);
  text-decoration: none;
  border: 1px solid var(--hud-green-dim);
  padding: 4px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

table.cargo a.dl:hover {
  background: rgba(57, 255, 143, 0.14);
}

.empty-bay {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  font-size: 0.9rem;
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.console-card {
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.console-card.empty {
  opacity: 0.55;
}

.console-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dashed var(--panel-border);
  padding-bottom: 8px;
}

.console-name {
  font-weight: bold;
  letter-spacing: 0.04em;
  color: var(--hud-green);
  font-size: 0.95rem;
}

.console-count {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

a.hud-btn.download-all {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 10px 6px;
  background: linear-gradient(180deg, rgba(57,255,143,0.18), rgba(57,255,143,0.06));
  border: 1px solid var(--hud-green);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), inset 0 -3px 0 rgba(0,0,0,0.35);
  color: var(--hud-green);
  font-family: "Press Start 2P", "Consolas", monospace;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-size: 0.55rem;
  line-height: 1.6;
}

a.hud-btn.download-all:hover {
  background: rgba(57, 255, 143, 0.28);
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(57, 255, 143, 0.08);
  font-size: 0.78rem;
}

.file-list .fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.file-list .fsize {
  color: var(--text-dim);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.file-list a.dl-small {
  color: var(--hud-orange);
  text-decoration: none;
  border: 1px solid var(--hud-orange);
  padding: 2px 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.file-list a.dl-small:hover {
  background: rgba(255, 145, 48, 0.12);
}

.empty-bay.small {
  padding: 10px 0;
  font-size: 0.78rem;
  text-align: left;
  color: var(--text-dim);
}

.signup-link {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.signup-link-big {
  font-size: 1.05rem;
}

.signup-link a {
  color: var(--hud-green);
}

.console-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.upload-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--panel-border);
  flex-wrap: wrap;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 145, 48, 0.1);
  border: 1px solid var(--hud-orange);
  color: var(--hud-orange);
  padding: 7px 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.file-trigger:hover {
  background: rgba(255, 145, 48, 0.22);
}

.file-input-hidden:focus-visible + .file-trigger {
  box-shadow: 0 0 0 2px rgba(255, 145, 48, 0.4);
}

.file-name-display {
  flex: 1 1 90px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, rgba(255,145,48,0.9), rgba(224,110,20,0.9));
  border: 1px solid var(--hud-orange);
  color: var(--bg-deep);
  font-weight: bold;
  padding: 8px 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s, box-shadow 0.15s;
}

.upload-btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 12px rgba(255, 145, 48, 0.45);
}

.upload-btn:active {
  filter: brightness(0.95);
}

.top-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.alert.good {
  border-color: var(--hud-green);
  color: var(--hud-green);
  background: rgba(57, 255, 143, 0.08);
}

/* A standing condition rather than something that just went wrong -- the plain
   .alert flashes red on a loop, which is far too loud for "this is switched
   off". Amber, and still. */
.alert.note {
  border-color: var(--hud-orange);
  color: var(--hud-orange);
  background: rgba(255, 145, 48, 0.08);
  animation: none;
}

/* .dim is used for explanatory paragraphs and some of them carry a link. There
   is no generic anchor rule in this stylesheet, so without this one they render
   as default browser blue against the HUD green. */
.dim a { color: var(--hud-green); }
.dim a:hover { color: var(--text-main); }

.code-flash {
  font-size: 1.1rem;
  letter-spacing: 0.15em;
}

.section-heading {
  margin: 26px 0 12px;
  font-size: 0.95rem;
  color: var(--hud-orange);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--panel-border);
  padding-bottom: 8px;
}

.page-links { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
a.page-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(57,255,143,0.18), rgba(57,255,143,0.06));
  border: 1px solid var(--hud-green);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), inset 0 -3px 0 rgba(0,0,0,0.35);
  color: var(--hud-green);
  font-family: "Press Start 2P", "Consolas", monospace;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-size: 0.6rem;
  transition: background 0.15s;
}
a.page-link:hover { background: rgba(57, 255, 143, 0.28); }

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) rgba(0, 0, 0, 0.4);
}
.table-scroll::-webkit-scrollbar {
  height: 6px;
}
.table-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
}
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--hud-green);
}

.mono {
  font-family: inherit;
  letter-spacing: 0.1em;
}

.dim {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid currentColor;
}

.tag.open {
  color: var(--hud-green);
}

.tag.used {
  color: var(--text-dim);
}

.tag.admin {
  color: var(--hud-orange);
}

.reset-btn {
  padding: 4px 10px;
  background: rgba(57, 255, 143, 0.08);
  border: 1px solid var(--hud-green);
  color: var(--hud-green);
  font-family: inherit;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.reset-btn:hover {
  background: rgba(57, 255, 143, 0.22);
}

.remove-btn {
  padding: 4px 10px;
  background: rgba(255, 70, 85, 0.08);
  border: 1px solid var(--hud-red);
  color: var(--hud-red);
  font-family: inherit;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.remove-btn:hover {
  background: rgba(255, 70, 85, 0.22);
}

.inline-form {
  display: inline;
  margin: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  vertical-align: middle;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  transition: background 0.15s, border-color 0.15s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text-dim);
  transition: transform 0.15s, background 0.15s;
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(57, 255, 143, 0.15);
  border-color: var(--hud-green);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--hud-green);
  box-shadow: 0 0 6px var(--hud-green);
}
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 2px rgba(57, 255, 143, 0.4);
}

/* ===================================================================
   Luck Games admin (casino.html / casino_player.html / casino_live.html)
   =================================================================== */

.small { font-size: 0.78rem; }

/* Inputs on the casino pages sit inline in forms rather than inside a
   labelled .field wrapper, so they need their own styling -- .field input
   above only matches inputs nested in that wrapper. */
.casino-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 7px 10px;
  width: 100%;
}

.casino-input:focus {
  outline: none;
  border-color: var(--hud-green);
  box-shadow: 0 0 8px rgba(57, 255, 143, 0.25);
}

.casino-input::placeholder { color: var(--text-dim); }

.casino-input.tiny { width: 60px; padding: 4px 6px; font-size: 0.78rem; }

.nowrap { white-space: nowrap; }

/* The roster carries nine columns; the base .cargo padding plus .mono's
   0.1em letter-spacing pushes it past the panel and buries the action
   column behind a horizontal scroll. */
table.cargo.compact td { padding: 6px 5px; vertical-align: middle; }
table.cargo.compact th { padding: 6px 5px; }
table.cargo.compact .mono { letter-spacing: 0.03em; }
table.cargo.compact { font-size: 0.82rem; }

/* button.hud-btn is width:100% by design (the login/signup forms stack
   full-width buttons). Every casino button sits inline next to something
   else, so opt out of that here rather than fighting it per-element. */
.casino-filter button.hud-btn,
.inline-form button.hud-btn,
.inline-form .reset-btn,
.inline-form .remove-btn,
.action-row button.hud-btn,
.action-row .reset-btn,
.action-row .remove-btn { width: auto; }

button.hud-btn.tiny { padding: 5px 9px; font-size: 0.8rem; line-height: 1; }

/* Anchors get no button styling from the base sheet -- it only defines
   a.hud-btn.download-all / a.hud-btn.page-link -- so the sort links need
   their own rule to look like buttons at all. */
a.hud-btn.sort-btn {
  display: inline-block;
  text-decoration: none;
  padding: 5px 11px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.3);
}

a.hud-btn.sort-btn:hover { color: var(--text-main); border-color: var(--hud-green); }

/* Stat strip ------------------------------------------------------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 6px;
}

.stat-tile {
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 14px;
}

.stat-value {
  font-size: 1.15rem;
  color: var(--hud-green);
  letter-spacing: 0.02em;
  word-break: break-word;
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 4px;
}

.stat-up { color: var(--hud-green); }
.stat-down { color: var(--hud-red); }

/* Roster filter bar ------------------------------------------------ */

.casino-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.casino-filter .casino-input { width: auto; min-width: 200px; flex: 0 1 260px; }

.sort-by {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-left: 8px;
}

a.hud-btn.sort-btn.active {
  border-color: var(--hud-green);
  color: var(--hud-green);
  background: rgba(57, 255, 143, 0.14);
}

.player-link { color: var(--hud-green); text-decoration: none; border-bottom: 1px dotted currentColor; }
.player-link:hover { color: var(--text-main); }

/* Action cards ----------------------------------------------------- */

.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.action-card {
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hud-green-dim);
}

.action-card p { margin: 0; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; align-items: center; }

/* Guest housekeeping is the only action card whose row mixes a label in with
   its controls, and the only one whose button can be disabled (nothing to
   purge). Centring is a no-op on the rows that hold buttons alone. */
.action-card button[disabled] { opacity: 0.45; cursor: not-allowed; }

.skin-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* Live floor ------------------------------------------------------- */

.seat-table { width: 100%; font-size: 0.82rem; }
.seat-table td { padding: 4px 6px; vertical-align: middle; }

/* Give/take and Kick sit as a single row of controls inside a table cell;
   the base .inline-form is display:inline, which lets the 100%-wide
   buttons wrap onto their own lines. */
.inline-form.controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* The base .hud-panel.wide caps at 720px, which is right for the invite
   codes / roster tables it was built for but too narrow for the casino
   roster's nine columns -- the action buttons fell off the right edge.
   Scoped to the casino pages so admin.html and cloud_media.html keep the
   width they were designed at. */
.hud-panel.wide.casino-panel { max-width: 1180px; }

/* Same story one table over: v1.2.0 grew the squadron roster to twelve columns
   -- six service toggles plus the new password and remove actions -- which
   pushed those action columns past the 720px the base .wide was drawn at. */
.hud-panel.wide.roster-panel { max-width: 1180px; }

/* Table cards carry a seat list with names, stacks and a kick button, so
   240px columns (right for the dashboard's service tiles) squeeze player
   names into mid-word wraps. */
.casino-panel .console-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.seat-table .player-link { white-space: nowrap; }
.seat-table td:last-child { text-align: right; }

/* ---- perf-lite -------------------------------------------------------------
   Toggled on <html> by the inline perf-lite snippet (low-power devices) or by
   the user's "reduce effects" preference. The starfield itself stays: it is a
   compositor transform now and costs essentially nothing. What this drops are
   the two effects that force full-viewport work every frame -- mix-blend-mode
   compositing and backdrop-filter blur. */
.perf-lite { --bg-panel: rgba(12, 26, 22, 0.95); }
.perf-lite .scanlines { mix-blend-mode: normal; opacity: 0.4; }
.perf-lite .starfield,
.perf-lite .asteroid,
.perf-lite .asteroid-spin { animation: none; }
.perf-lite *,
.perf-lite *::before,
.perf-lite *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ---- project archive -------------------------------------------------------
   /admin/projects and /admin/projects/<slug>. Same precedent as the casino
   panel above: 720px is too narrow for a thumbnail grid and a four-column
   commit table, so these two pages opt into the wider shell.

   Nothing else in this sheet styles a raster image, so everything about the
   thumbnails is new here. ---------------------------------------------------*/

.hud-panel.wide.projects-panel { max-width: 1180px; }

/* 300px keeps a 16:9 thumbnail large enough to recognise the site in it;
   the dashboard's 240px turns them into unreadable strips. */
.projects-panel .console-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

a.console-card.project-card {
  padding: 0;
  gap: 0;
  overflow: hidden;                 /* the thumbnail bleeds to the card edge */
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.console-card.project-card:hover {
  border-color: var(--hud-green);
  transform: translateY(-2px);
}

/* .console-card is display:flex, which beats the [hidden] attribute the
   filter script sets -- without this, filtered-out cards stay on screen. */
.project-card[hidden] { display: none; }

.project-thumb {
  width: 100%;
  /* The width/height attributes on the <img> (there to reserve layout space)
     resolve to a real CSS height, and aspect-ratio only applies when one axis
     is auto -- without this the cards render square. */
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--panel-border);
}

.project-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.project-blurb {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;            /* keeps every card the same height */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  margin-top: auto;                 /* pin to the bottom of an uneven card */
}

.project-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 18px;
}

.project-controls .casino-input { flex: 1 1 240px; }

.project-tabs { display: flex; flex-wrap: wrap; gap: 6px; }

/* button.hud-btn is width:100% by design; the tabs sit inline, same opt-out
   the casino filter row takes. */
.project-tabs button.hud-btn {
  width: auto;
  padding: 6px 12px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.project-tabs button.hud-btn:hover { color: var(--text-main); border-color: var(--hud-green); }
.project-tabs button.hud-btn.active { color: var(--hud-green); border-color: var(--hud-green); }

.build-stamp { margin-top: 20px; font-size: 0.72rem; }

/* ---- detail page ---- */

.project-hero {
  margin: 18px 0 14px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.35);
}

.project-hero img { width: 100%; height: auto; display: block; }

.project-hero figcaption {
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px dashed var(--panel-border);
}

.project-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 4px; }

.project-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.76rem;
  margin: 14px 0 4px;
}

.project-facts .mono { word-break: break-all; }

.stat-value.small { font-size: 0.9rem; }

.version-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 24px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--panel-border);
  font-size: 0.78rem;
}

.version-tag {
  color: var(--hud-orange);
  font-weight: bold;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

details.commit summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  list-style: none;                 /* display:flex already drops the marker in
                                       Chrome; this drops it in Safari too, so
                                       the arrow below is the only one drawn */
}

details.commit summary::-webkit-details-marker { display: none; }

details.commit summary::before {
  content: "\25B8";                 /* the rows look inert without an arrow */
  color: var(--hud-green-dim);
  flex: none;
}

details.commit[open] summary::before { content: "\25BE"; color: var(--hud-green); }
details.commit summary:hover { color: var(--hud-green); }
details.commit summary:hover::before { color: var(--hud-green); }

.commit-subject { color: var(--text-main); }
details.commit[open] summary .commit-subject { color: var(--hud-green); }

.commit-body {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-left: 2px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.3);
}

/* The commit body is already hard-wrapped by git; pre-wrap keeps the author's
   paragraph breaks without forcing a horizontal scroll on a narrow screen. */
.commit-body pre {
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
}

table.cargo.compact.filelist { margin: 4px 0 8px; font-size: 0.75rem; }
table.cargo.compact.filelist td { border-bottom: none; padding: 3px 5px; }

.diffstat .add { color: var(--hud-green); }
.diffstat .del { color: var(--hud-red); }

/* Sitewide mobile rule: every tappable control clears 44px. */
@media (max-width: 700px), (hover: none) {
  .project-tabs button.hud-btn { min-height: 44px; padding: 6px 14px; }
  .project-controls .casino-input { min-height: 44px; }
  details.commit summary { min-height: 44px; align-items: center; }
  .action-row .casino-input,
  .action-row .remove-btn { min-height: 44px; }
}

/* --- two-factor auth ------------------------------------------------------
   The QR has to sit on white: SvgPathImage draws a black path and this theme's
   panel is near-black, so an unpadded QR is literally invisible. The quiet zone
   is part of the spec, hence the padding as well as the background. */
.qr-box {
  display: inline-block;
  background: #fff;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--hud-green);
  line-height: 0;
  margin: 4px 0 14px;
}
.qr-box svg { width: 208px; height: 208px; display: block; }

.secret-key {
  display: inline-block;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  word-break: break-all;
  user-select: all;
  margin: 2px 0 18px;
}

/* Stacked single-column forms; button.hud-btn is width:100% by design and that
   is what we want here, so the cap goes on the form instead of the button. */
.totp-form { max-width: 340px; margin-bottom: 6px; }

.backup-codes {
  list-style: none;
  padding: 0;
  margin: 10px 0 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-width: 480px;
}
.backup-codes li {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 8px 10px;
  text-align: center;
  font-size: 1rem;
  letter-spacing: 0.08em;
  user-select: all;
}

button.hud-btn.danger { border-color: var(--hud-red); color: var(--hud-red); }
button.hud-btn.danger:hover { background: rgba(255, 60, 60, 0.12); }

/* The login challenge page's "use a backup code" disclosure. There is no
   generic details rule in this stylesheet -- details.commit is scoped to the
   project browser -- so this needs its own. */
details.backup-toggle { margin: 14px 0 4px; text-align: left; }
details.backup-toggle summary {
  cursor: pointer;
  list-style: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 6px 0;
}
details.backup-toggle summary::-webkit-details-marker { display: none; }
details.backup-toggle summary::before { content: "\25B8"; margin-right: 7px; }
details.backup-toggle[open] summary::before { content: "\25BE"; color: var(--hud-green); }
details.backup-toggle summary:hover { color: var(--hud-green); }

@media (max-width: 700px), (hover: none) {
  details.backup-toggle summary { min-height: 44px; display: flex; align-items: center; }
  .backup-codes li { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

/* ===================================================================
   Sitewide mobile-safe & touch responsive rules
   =================================================================== */

@media (max-width: 700px) {
  body {
    padding: 12px 10px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    align-items: flex-start;
  }
  .hud-panel {
    padding: 22px 14px;
  }
  h1 {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  p.subtitle {
    font-size: 0.8rem;
    margin-bottom: 18px;
  }
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .top-bar-actions {
    gap: 8px;
    width: 100%;
  }
  .code-gen-form {
    flex-direction: column;
    gap: 8px;
  }
  .code-gen-form input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 16px; /* 16px prevents iOS automatic zoom on input focus */
  }
  .code-gen-form button.hud-btn {
    width: 100%;
    min-height: 44px;
  }
  .page-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }
  a.page-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
  }
}

@media (max-width: 700px), (hover: none) {
  .top-bar a.logout {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
  }
  .field input,
  .casino-input {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS auto-zoom */
  }
  button.hud-btn {
    min-height: 44px;
  }
  .reset-btn,
  .remove-btn {
    min-height: 36px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .toggle-switch {
    width: 44px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .toggle-slider {
    position: relative;
    width: 38px;
    height: 20px;
  }
}


/* ---------------------------------------------------------------------------
   The Lab pages. A cloud save is a JSON blob that can run to hundreds of
   lines, so each one collapses behind its own <details> rather than turning
   the page into a wall of text.
   --------------------------------------------------------------------------- */
.save-block {
  border: 1px solid rgba(57, 255, 143, 0.25);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(5, 11, 16, 0.5);
}
.save-block summary {
  cursor: pointer;
  /* The default marker is a filled triangle that reads as a bullet against
     this theme; a caret matches the HUD's own arrow glyphs. */
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 44px;
}
.save-block summary::-webkit-details-marker { display: none; }
.save-block summary::before {
  content: "\25B8";
  color: var(--hud-orange, #ffb347);
  transition: transform 0.12s ease;
}
.save-block[open] summary::before { transform: rotate(90deg); }

.save-json {
  width: 100%;
  box-sizing: border-box;
  margin: 10px 0 8px;
  padding: 8px;
  font-family: "Consolas", "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-main, #d9fbe8);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(57, 255, 143, 0.3);
  border-radius: 3px;
  resize: vertical;
}
.save-json:focus {
  outline: none;
  border-color: var(--hud-green, #39ff8f);
}

.row-actions { display: flex; gap: 8px; margin-bottom: 8px; }
/* button.hud-btn is width:100% for the stacked login forms, so any button
   sitting inline with others has to opt out -- same rule the casino filter
   and .inline-form already follow. */
.row-actions button.hud-btn,
button.hud-btn.inline { width: auto; flex-shrink: 0; }

/* A link inside a data row. Not .logout -- that is the top-bar nav chip, and
   borrowing it here left these rendering as default-blue browser links that
   wrapped mid-arrow. */
.cargo .row-link {
  color: var(--hud-green, #39ff8f);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.cargo .row-link:hover,
.cargo .row-link:focus-visible { text-decoration: underline; }
