/* ===================== START SCREEN ===================== */
/* Brand accent trio - reused across the start screen (background, play
   button, rays, connection-status accent). Flat brand green in both themes
   now (no gradient, no dark/light split) - --ink-rgb/--ink still exist for
   the menu text/panels below, but since the backdrop no longer goes light in
   either theme, they're a single (white) value rather than flipped per
   theme like the rest of the app's chrome. */
#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 0 calc(36px + 24px);
  background: var(--accent-red);
  overflow: hidden;
  z-index: 10;
  --accent-green: #36f62d;
  --accent-red: #dd2137;
  --accent-orange: #ff9321;
  --ink-rgb: 255, 255, 255;
  --ink: #fff;
}

/* Background animation: a slow-spinning ray burst behind the tank, restored
   from before the impact-hole version (see git history) but re-targeted at
   the current layout - nested inside .logo-wrap (position:relative) instead
   of #start-screen, so top/left 50% centers on the tank's own flex-centered
   spot instead of the raw viewport center. Square sized off the larger
   viewport dimension so its inscribed circle (radius = half the side) still
   covers every screen corner at any aspect ratio, and z-index:-1 keeps it
   behind the tank canvas within .logo-wrap's own stacking context. */
.rays {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  margin: -100vmax 0 0 -100vmax;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255,255,255,0.05) 0deg 6deg,
    rgba(255,255,255,0.0) 6deg 12deg
  );
  animation: spin 90s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rays { animation: none; }
}

/* Fills the whole vertical run above .menu-box (which stays pinned to the
   bottom via margin-top:auto) and centers the tank stage inside that run,
   instead of leaving it stuck to the top with all the leftover space
   falling below it. */
.logo-wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* The tank/wordmark doubles as the page logo - clicking it behaves like a
   normal site logo and returns to home. display:contents keeps it from
   affecting .logo-wrap's centered flex layout (its children become direct
   flex items instead of being boxed by the anchor). */
.logo-link {
  display: contents;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* Sized off viewport HEIGHT (clamped) since the hero has to fit the upper
   third of the screen on any device; aspect-ratio derives the width from
   that, with a vw cap as a safety net on narrow-but-tall screens. This
   scales generously on tablets/desktop instead of maxing out at a small
   fixed pixel size like a phone-only layout would. */
.tank-stage {
  aspect-ratio: 6/4;
  height: 85%;
  min-height: 400px;
}
.tank-stage canvas {
  width: 100%; height: 100%; display: block;
  background: transparent;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.tank-stage canvas.ready { opacity: 1; }

/* The "Panzer.li" wordmark isn't rendered visually anywhere on the start
   screen (the tank canvas is zoomed in on the tank alone - see menu-tank.js)
   - #title stays in the DOM only for document structure / screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-box {
  position: relative;
  z-index: 2;
  margin-top: auto; /* pins the menu to the bottom, tank+title stay up top */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(92vw, 340px);
}

/* Transparent box + fine translucent border - same treatment as
   .settings-list, so every menu panel reads as one consistent system. */
#nickname {
  width: 100%;
  padding: 10px 16px;
  border-radius: 4px;
  border: none;
  outline: none;
  font-size: 14px;
  text-align: center;
  background: rgba(var(--ink-rgb), 0.08);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(var(--ink-rgb), 0.12);
}
#nickname::placeholder { color: rgba(var(--ink-rgb), 0.7); }
#nickname:focus { background: rgba(var(--ink-rgb), 0.14); }

.play-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vw, 30px);
  width: 100%;
}

.side-stats {
  flex: 0 1 92px;
  min-width: 0;
  text-align: center;
}
.side-stats-title {
  font-size: 9px;
  color: rgba(var(--ink-rgb), 0.55);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-bottom: 3px;
  margin-bottom: 3px;
  border-bottom: 1px solid rgba(var(--ink-rgb), 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  line-height: 1.15;
  margin-top: 4px;
  white-space: nowrap;
}
.side-stat-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  flex: 0 0 auto;
}
.side-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  flex: 0 0 auto;
}

.play-btn {
  width: 100%;
  border: none;
  cursor: pointer;
  padding: 12px 0;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--accent-green) 0%, var(--accent-green) 55%);
  box-shadow: 0 4px 0 #34b02e, 0 8px 14px rgba(0,0,0,0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  transition: transform 0.06s ease;
}
.play-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #34b02e, 0 4px 10px rgba(0,0,0,0.35); }
.play-btn { display: flex; align-items: center; justify-content: center; }
.play-row .play-btn {
  width: auto;
  flex: 1 1 110px;
  max-width: 138px;
  padding: 12px 6px;
  font-size: 15px;
}

.play-btn .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.play-btn.loading { cursor: default; opacity: 0.9; }
.play-btn.loading .btn-label { display: none; }
.play-btn.loading .btn-spinner { display: inline-block; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Connection status - same transparent-box treatment as the rest of the menu,
   but with an orange-tinted border so it reads as a warning/transient state.
   Empty most of the time (only "Connecting.../Disconnected...", etc actually
   set text) - :empty collapses it out of the layout entirely so it doesn't
   leave a dangling box + gap when there's nothing to show. */
.conn-status {
  width: 100%;
  margin: 0;
  padding: 8px 14px;
  border-radius: 4px;
  background: rgba(var(--ink-rgb), 0.08);
  box-shadow: inset 0 0 0 2px rgba(255,147,33,0.4);
  color: var(--accent-orange);
  font-size: 13px;
  text-align: center;
}
#conn-status:empty { display: none; }
.reconnect-btn {
  margin-left: 6px;
  padding: 3px 10px;
  border: none;
  border-radius: 999px;
  background: rgba(var(--ink-rgb), 0.18);
  color: var(--accent-orange);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
}
.reconnect-btn:hover { background: rgba(var(--ink-rgb), 0.28); }
.reconnect-btn:active { transform: translateY(1px); }

/* Per-device control reminder - touch and mouse/keyboard hints each sit on
   their own line (.hint-line) when both show on a hybrid device, instead of
   wrapping unpredictably in one flex row. */
.controls-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: rgba(var(--ink-rgb), 0.75);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.hint-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
.controls-hint .hint-group { display: flex; align-items: center; gap: 5px; white-space: nowrap; }

/* Top-3 Hall of Fame preview, shown right under the play row - stays
   hidden (see .hidden on the element) until a first fetch actually returns
   at least one entry, since a fresh server has none yet. Same transparent
   box + fine border as .settings-list, so it reads as one system with the
   rest of the menu - the medal/score badges below carry the "plaque" look
   instead. */
.hof-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  background: rgba(var(--ink-rgb), 0.08);
  border-radius: 4px;
  padding: 4px 12px;
  box-shadow: inset 0 0 0 2px rgba(var(--ink-rgb), 0.12);
}
.hof-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(var(--ink-rgb), 0.1);
  font-size: 12px;
  color: var(--ink);
}
.hof-preview-row:last-child { border-bottom: none; }
/* .icon.hof-preview-medal (two classes) beats the plain .icon rule below
   (also one class) on specificity regardless of source order - without it,
   the trophy rendered at .icon's 18px instead of this smaller size. */
.icon.hof-preview-medal { width: 10px; height: 10px; }
.hof-preview-rank { flex: 0 0 auto; opacity: 0.6; font-weight: 700; }
.hof-preview-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 700; }

/* Score "pill" - trophy (medal ranks only) + score number together, shared
   between the menu preview (.hof-preview-row) and the full list (.hof-list
   li), so they always pop against the now-transparent row background
   regardless of size. Plain white by default (ranks 4+ in the full list);
   medal ranks get their gold/silver/bronze treatment further down. */
.hof-score-badge {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(var(--ink-rgb), 0.12);
  box-shadow: inset 0 0 0 2px rgba(var(--ink-rgb), 0.12);
  font-weight: 700;
}
