/* ============================================================================
   Counter-Strike 1.6 local shell — menu.css
   Classic VGUI2 look: olive-gray beveled panels, small Tahoma-style type,
   no modern cards, no rounded corners, no shadows-as-decoration.
   Control and border colors are taken from Valve's shipped TrackerScheme.res:
     ControlBG 76,88,68 · WindowBG 62,70,55
     BorderBright 136,145,128 · BorderDark 40,46,34
   ========================================================================= */

:root {
  --cs-base:      #4c5844;
  --cs-light:     #5a6a50;
  --cs-bright:    #889180;
  --cs-dark:      #282e22;
  --cs-darker:    #3e4637;
  --cs-black:     #000000;
  --cs-text:      #d8ded3;
  --cs-dim:       #c2cabd;
  --cs-warn:      #ffd479;
  --cs-error:     #ff9a8a;

  --cs-font: Tahoma, Verdana, "DejaVu Sans", "Liberation Sans", Geneva, sans-serif;
  --cs-mono: "Lucida Console", "DejaVu Sans Mono", Consolas, monospace;

  --bevel-up: inset 1px 1px 0 var(--cs-bright), inset -1px -1px 0 var(--cs-dark);
  --bevel-in: inset 1px 1px 0 var(--cs-dark), inset -1px -1px 0 var(--cs-bright);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0d0e0c;
}

body {
  font-family: var(--cs-font);
  font-size: 12px;
  line-height: 1.35;
  color: var(--cs-text);
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Global keyboard focus: VGUI-style dotted ring, visible on olive. */
:focus-visible {
  outline: 1px dotted #ffffff;
  outline-offset: 1px;
}

/* ------------------------------------------------------------------ canvas */
/* Never hidden or detached: the engine keeps a valid render size while the menu
   is up, and simply gets covered by the overlay layers below. */
#canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 0;
}

.noscript {
  position: fixed;
  z-index: 100;
  inset: auto 0 0 0;
  margin: 0;
  padding: 10px 14px;
  background: var(--cs-darker);
  border-top: 2px solid #000;
  color: var(--cs-warn);
  font-size: 12px;
}

/* ============================================================== main menu */
.menu-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  background-color: #2b2c27;
  /* Layer order: readability wash, optional Valve menu art, muted gradient fallback.
     If assets/menu-background.jpg is absent the browser drops that layer and the
     gradient below it is what the user sees — no error, no broken state. */
  background-image:
    linear-gradient(180deg, rgba(14,15,12,.34) 0%, rgba(14,15,12,.62) 100%),
    url("assets/menu-background.jpg"),
    radial-gradient(135% 105% at 16% 4%, #96978a 0%, #6b6c60 42%, #34352d 100%);
  background-size: cover, cover, cover, cover;
  background-position: center, center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
}

.menu-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 95% at 50% 45%, rgba(0,0,0,0) 48%, rgba(0,0,0,.44) 100%);
  pointer-events: none;
}

.menu-shell {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.menu-main {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  min-height: 0;
  overflow: auto;
  padding: clamp(14px, 3vw, 34px) clamp(14px, 4vw, 46px) 6px;
}

.menu-column {
  width: min(364px, 100%);
}

.brand {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(199,197,190,.35);
}

.brand-title {
  margin: 0;
  font-family: "Arial Narrow", "Liberation Sans Narrow", "DejaVu Sans Condensed",
    "Helvetica Neue Condensed", Tahoma, Verdana, sans-serif;
  font-stretch: condensed;
  font-size: clamp(22px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: .005em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  color: #f4f2ea;
  text-shadow: 2px 2px 0 rgba(0,0,0,.85), 0 0 26px rgba(0,0,0,.6);
}

.brand-meta {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--cs-dim);
  text-shadow: 1px 1px 0 rgba(0,0,0,.8);
}

.brand-version { font-weight: 700; color: #ffffff; }
.brand-sep { color: rgba(216,214,207,.5); }

.menu-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: min(232px, 100%);
}

.menu-divider {
  display: block;
  height: 1px;
  margin: 5px 0;
  background: rgba(199,197,190,.35);
  border-bottom: 1px solid rgba(0,0,0,.6);
}

.input-warning {
  width: min(320px, 100%);
  margin: 12px 0 0;
  padding: 6px 8px;
  background: rgba(40,39,36,.85);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  color: var(--cs-warn);
  font-size: 11px;
}

.input-warning strong { color: #fff; }

/* In-menu notice: compact status line under the navigation (runtime messages). */
.menu-notice {
  width: min(320px, 100%);
  margin: 10px 0 0;
  padding: 6px 8px;
  background: rgba(40,39,36,.85);
  border: 1px solid #000;
  border-left: 3px solid var(--cs-warn);
  box-shadow: var(--bevel-in);
  color: var(--cs-warn);
  font-size: 11px;
  line-height: 1.35;
}

.menu-footer {
  flex: 0 0 auto;
  padding: 8px clamp(14px, 4vw, 46px) 12px;
  border-top: 1px solid rgba(199,197,190,.25);
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.6));
}

.engine-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  color: var(--cs-dim);
  text-shadow: 1px 1px 0 rgba(0,0,0,.8);
}

.engine-line-sub { margin-top: 2px; color: rgba(216,214,207,.7); }

.engine-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  background: var(--cs-light);
  border: 1px solid #000;
}

.menu-root[data-engine="starting"] .engine-dot { background: var(--cs-warn); }
.menu-root[data-engine="running"] .engine-dot { background: #8fd07a; }
.menu-root[data-engine="failed"] .engine-dot { background: var(--cs-error); }

/* ------------------------------------------------------------- buttons */
/* Beveled buttons belong to dialogs; the main nav is plain text, as in the
   original Counter-Strike menu. */
.vgui-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 12px;
  background: var(--cs-base);
  border: 1px solid #000;
  box-shadow: var(--bevel-up);
  color: var(--cs-text);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(0,0,0,.75);
  cursor: pointer;
}

.vgui-button:hover:not(:disabled) {
  background: var(--cs-light);
}

.vgui-button:active:not(:disabled),
.vgui-button[aria-pressed="true"] {
  background: var(--cs-darker);
  box-shadow: var(--bevel-in);
}

.vgui-button:disabled {
  color: rgba(255,255,255,.4);
  background: #5c5b53;
  box-shadow: var(--bevel-up);
  cursor: default;
  text-shadow: none;
}

.vgui-button-primary { font-weight: 700; }

.menu-button {
  text-decoration: none;
  justify-content: flex-start;
  width: auto;
  min-width: 132px;
  min-height: 22px;
  padding: 1px 2px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--cs-bright);
  font-size: 13px;
  text-align: left;
  text-shadow: 1px 1px 0 rgba(0,0,0,.85);
}

.menu-button:hover:not(:disabled) {
  background: transparent;
  color: #ffffff;
}

.menu-button:active:not(:disabled) { color: #ffffff; }

.menu-button:focus-visible { outline: 1px dotted #ffffff; outline-offset: 2px; }

.menu-button:disabled { color: rgba(199,197,190,.4); }

/* -------------------------------------------------------- play hint strip */
.play-hint {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  max-width: min(520px, calc(100vw - 24px));
  padding: 6px 12px;
  background: rgba(40,39,36,.92);
  border: 1px solid #000;
  box-shadow: var(--bevel-up);
  color: var(--cs-dim);
  font-size: 11px;
  text-align: center;
  pointer-events: none;
}

/* Variant identity complements the native ammo HUD without covering it. */
.weapon-variant {
  position: fixed;
  z-index: 14;
  right: 16px;
  bottom: 104px;
  margin: 0;
  padding: 6px 9px;
  border: 1px solid #777955;
  background: rgba(25, 29, 22, .9);
  color: #f0d781;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
}
.weapon-variant span { display: block; color: #c6c8b4; font-size: 10px; }

/* =============================================================== dialogs */
.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 12px;
  pointer-events: none;
}

.vgui-dialog {
  pointer-events: auto;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  min-height: 0;
}

/* Modal wash: painted inside .dialog-layer's stacking context (z-index 20), so it
   covers the menu behind without hiding the dialog itself, and it swallows clicks
   meant for the menu behind the dialog. */
.vgui-dialog::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, .55);
}

.vgui-dialog-wide { width: min(760px, calc(100vw - 24px)); }

@supports (height: 100dvh) {
  .vgui-dialog { max-height: calc(100dvh - 24px); }
}

.dialog-frame {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  width: 100%;
  background: var(--cs-base);
  border: 2px solid #000;
  box-shadow: var(--bevel-up), 0 10px 30px rgba(0,0,0,.6);
}

.dialog-titlebar {
  flex: 0 0 auto;
  padding: 3px 7px;
  background: var(--cs-darker);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 -1px 0 rgba(199,197,190,.35);
}

.dialog-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--cs-text);
  text-shadow: 1px 1px 0 rgba(0,0,0,.8);
}

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.dialog-lead {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--cs-dim);
}

.dialog-note {
  margin: 12px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,.35);
  box-shadow: inset 0 1px 0 rgba(199,197,190,.18);
  font-size: 11px;
  color: var(--cs-dim);
}

.dialog-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(0,0,0,.5);
  box-shadow: inset 0 1px 0 rgba(199,197,190,.2);
}

/* -------------------------------------------------------- key/value rows */
.kv { margin: 0; }

.kv-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,.28);
  box-shadow: inset 0 -1px 0 rgba(199,197,190,.14);
  font-size: 12px;
}

.kv-row:last-child { border-bottom: 0; box-shadow: none; }

.kv dt {
  flex: 0 0 96px;
  color: var(--cs-dim);
}

.kv dd { margin: 0; flex: 1 1 auto; color: var(--cs-text); }

.kv-credits dt { flex-basis: 84px; }

/* ---------------------------------------------------------------- tabs */
.tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--cs-darker);
}

.vgui-tab {
  appearance: none;
  padding: 4px 14px;
  background: var(--cs-dark);
  border: 1px solid #000;
  border-bottom: 0;
  color: var(--cs-dim);
  font-family: inherit;
  font-size: 12px;
  text-shadow: 1px 1px 0 rgba(0,0,0,.7);
  cursor: pointer;
}

.vgui-tab:hover { color: var(--cs-text); background: var(--cs-light); }

.vgui-tab[aria-selected="true"] {
  background: var(--cs-base);
  color: var(--cs-text);
  box-shadow: inset 1px 1px 0 var(--cs-bright);
}

.tabpanels { padding-top: 4px; }

.tabpanel:focus-visible { outline-offset: -2px; }

/* ------------------------------------------------------- settings rows */
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.28);
  box-shadow: inset 0 -1px 0 rgba(199,197,190,.14);
}

.setting-label {
  flex: 0 0 130px;
  font-size: 12px;
  color: var(--cs-text);
  text-shadow: 1px 1px 0 rgba(0,0,0,.6);
}

.setting-control {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.setting-number,
.sensitivity-number {
  flex: 0 0 78px;
  width: 78px;
  min-width: 0;
  padding: 5px 6px;
  color: var(--cs-text);
  background: var(--cs-darker);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  font: 13px var(--cs-mono);
}
.sensitivity-help { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.sensitivity-help .setting-hint { flex: 1 1 200px; margin: 0; }
#sensitivity-error { color: var(--cs-warn); }

/* In-game nickname field: the same bevelled look as the numeric fields, but it
   takes the remaining width and can shrink on narrow screens. */
.setting-text {
  flex: 1 1 220px;
  min-width: 0;
  padding: 5px 6px;
  color: var(--cs-text);
  background: var(--cs-darker);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  font: 13px var(--cs-mono);
}

/* The nickname field carries its own specific inline error, which appears next to
   the field instead of replacing the dialog. */
#player-name-error { color: var(--cs-warn); }

/* The enemy AC-130 chance field's own inline error, next to its numeric field. */
#enemy-ac130-chance-error { color: var(--cs-warn); }

/* A trailing unit for a numeric field, kept with the field it explains. */
.setting-unit {
  flex: 0 0 auto;
  font-family: var(--cs-mono);
  font-size: 12px;
  color: var(--cs-dim);
}

.setting-value {
  flex: 0 0 auto;
  min-width: 42px;
  font-family: var(--cs-mono);
  font-size: 11px;
  color: var(--cs-bright);
  text-align: right;
}

.setting-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--cs-dim);
}

/* Keep capture-mode and fallback guidance readable against the olive panel. */
#raw-input-status {
  color: var(--cs-text);
  font-size: 12px;
  line-height: 1.4;
}

.radio-group { flex-wrap: wrap; }

.vgui-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
}

/* ------------------------------------------------------------- range */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 auto;
  width: 100%;
  max-width: 300px;
  height: 14px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--cs-darker);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 16px;
  margin-top: -6px;
  background: var(--cs-light);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 var(--cs-bright), inset -1px -1px 0 var(--cs-dark);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--cs-darker);
  border: 1px solid #000;
}

input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 14px;
  border-radius: 0;
  background: var(--cs-light);
  border: 1px solid #000;
}

input[type="range"]:focus-visible { outline: 1px dotted #fff; outline-offset: 2px; }

/* --------------------------------------------------- checkbox / radio */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
  background: var(--cs-darker);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  cursor: pointer;
}

input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]:hover,
input[type="radio"]:hover { background: #33322e; }

input[type="checkbox"]:checked {
  background-color: var(--cs-darker);
  /* Font-independent cross mark, in the VGUI2 checkbox style. */
  background-image:
    linear-gradient(45deg, transparent 43%, #fff 43%, #fff 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, #fff 43%, #fff 57%, transparent 57%);
  background-size: 12px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

input[type="radio"]:checked {
  background-image: radial-gradient(circle at center, #fff 0 3px, transparent 3px);
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled { opacity: .5; cursor: default; }

/* ------------------------------------------------------- controls table */
.controls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.controls-table th,
.controls-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(0,0,0,.28);
  box-shadow: inset 0 -1px 0 rgba(199,197,190,.12);
  vertical-align: top;
}

.controls-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--cs-dark);
  color: var(--cs-text);
  border-bottom: 1px solid #000;
  box-shadow: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.controls-table td:first-child { color: var(--cs-text); }
.controls-table td:last-child { width: 42%; }

.controls-table .group-row th {
  padding-top: 8px;
  background: transparent;
  color: var(--cs-bright);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid rgba(0,0,0,.4);
  box-shadow: none;
}

kbd {
  display: inline-block;
  margin: 0 3px 3px 0;
  padding: 1px 5px;
  background: var(--cs-dark);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 var(--cs-light), inset -1px -1px 0 var(--cs-darker);
  color: var(--cs-text);
  font-family: var(--cs-mono);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}

.or {
  display: inline-block;
  margin: 0 4px 3px 0;
  font-size: 10px;
  color: var(--cs-dim);
}

/* --------------------------------------------------- status / progress */
.status-message {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--cs-text);
}

.status-detail {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--cs-dim);
}

.status-note {
  margin: 8px 0 0;
  padding: 6px 8px;
  background: rgba(40,39,36,.75);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  font-size: 11px;
  color: var(--cs-dim);
}

.progress {
  position: relative;
  height: 16px;
  background: var(--cs-darker);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--cs-light);
  box-shadow: inset 1px 1px 0 var(--cs-bright), inset -1px -1px 0 var(--cs-dark);
  transition: width .18s linear;
}

.progress[data-indeterminate="true"] .progress-fill {
  width: 100%;
  background-image: repeating-linear-gradient(
    115deg,
    var(--cs-light) 0 8px,
    var(--cs-dark) 8px 16px
  );
  background-size: 32px 100%;
  animation: cs-progress-sweep 1.1s linear infinite;
}

@keyframes cs-progress-sweep {
  from { background-position: 0 0; }
  to   { background-position: 32px 0; }
}

/* ----------------------------------------------------------- status modes */
#dialog-status { width: min(520px, calc(100vw - 24px)); }

#dialog-status[data-mode="error"] .dialog-titlebar { background: #5a2a26; }
#dialog-status[data-mode="error"] .status-message { color: var(--cs-error); }
#dialog-status[data-mode="error"] .progress { display: none; }

/* ============================================================ responsive */
@media (max-width: 720px) {
  .menu-main { align-items: center; padding: 12px 12px 4px; }
  .menu-column { width: 100%; }
  .menu-nav { width: 100%; }
  .brand-title { font-size: clamp(20px, 7.4vw, 30px); }
  .menu-footer { padding: 8px 12px 10px; }
  .dialog-layer { padding: 8px; }
  .vgui-dialog, .vgui-dialog-wide { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .setting-row { flex-wrap: wrap; }
  .setting-label { flex: 1 1 100%; }
  .setting-control { flex: 1 1 100%; }
  .controls-table td:last-child { width: auto; }
  .controls-table th, .controls-table td { padding: 4px 6px; }
  .dialog-footer { flex-wrap: wrap; }
  .dialog-footer .vgui-button { flex: 1 1 auto; }
}

@supports (height: 100dvh) {
  @media (max-width: 720px) {
    .vgui-dialog, .vgui-dialog-wide { max-height: calc(100dvh - 16px); }
  }
}

@media (max-height: 460px) {
  .brand { margin-bottom: 8px; }
  .brand-title { font-size: clamp(22px, 6vh, 30px); }
  .menu-main { padding-top: 8px; }
}

/* --------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
  .progress[data-indeterminate="true"] .progress-fill { animation: none; }
}

/* ------------------------------------------- advanced local asset import */
.advanced {
  margin: 12px 0 0;
  border: 1px solid #000;
  box-shadow: var(--bevel-up);
  background: var(--cs-dark);
}

.advanced > summary {
  padding: 4px 8px;
  background: var(--cs-dark);
  color: var(--cs-text);
  font-size: 12px;
  text-shadow: 1px 1px 0 rgba(0,0,0,.7);
  cursor: pointer;
}

.advanced > summary:hover { background: #55544e; }
.advanced[open] > summary { background: var(--cs-base); }

.advanced-body {
  padding: 8px 10px 10px;
  background: var(--cs-base);
  border-top: 1px solid #000;
}

.advanced code {
  font-family: var(--cs-mono);
  font-size: 11px;
  color: var(--cs-bright);
}

.file-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.file-button { flex: 0 0 auto; }

/* The real input stays focusable but visually hidden; its label is the control. */
#asset-file:focus-visible + .file-button {
  outline: 1px dotted #ffffff;
  outline-offset: 1px;
}

.file-name {
  margin: 6px 0 0;
  font-family: var(--cs-mono);
  font-size: 11px;
  color: var(--cs-bright);
  overflow-wrap: anywhere;
}

.file-warning { color: var(--cs-warn); }

.dialog-link {
  color: var(--cs-bright);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dialog-link:hover { color: #ffffff; }

.dialog-link:focus-visible { outline: 1px dotted #ffffff; outline-offset: 2px; }

.kv-credits dt { flex-basis: 110px; }

/* ================================================== New Game: map picker */
/* A paged card grid rather than 13 stacked rows: 3 x 2 on desktop, 2 x 2 on
   narrow screens, with one scroll container (the dialog body) at most. */
.vgui-dialog-maps { width: min(880px, calc(100vw - 24px)); }

.picker { margin: 0; }

.picker-head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--cs-darker);
  box-shadow: inset 0 -1px 0 rgba(199,197,190,.2);
}

.picker-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cs-bright);
  text-shadow: 1px 1px 0 rgba(0,0,0,.7);
}

.picker-tabs {
  flex: 1 1 auto;
  padding: 0;
  border-bottom: 0;
}

.picker-tabs .vgui-tab { padding: 3px 10px; }

.picker-panel:focus-visible { outline-offset: -2px; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0 0;
}

.map-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 3px;
  background: var(--cs-dark);
  border: 1px solid #000;
  box-shadow: var(--bevel-up);
  color: var(--cs-text);
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.map-card:hover { background: var(--cs-light); }

.map-card:active { box-shadow: var(--bevel-in); }

/* Selection is shown three ways: a bright bevel, a warm border and a text flag,
   so it never depends on colour alone. */
.map-card[aria-checked="true"] {
  background: var(--cs-base);
  border-color: var(--cs-warn);
  box-shadow: inset 1px 1px 0 var(--cs-bright), inset -1px -1px 0 var(--cs-dark);
}

.map-card:focus-visible { outline: 1px dotted #ffffff; outline-offset: 1px; }

.map-card-preview {
  position: relative;
  display: block;
  width: 100%;
  min-height: 72px;
  aspect-ratio: 16 / 9;
  background: #1c1e19;
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  overflow: hidden;
}

.map-card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-card-preview.is-missing::after {
  content: "No preview";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(216,214,207,.5);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.map-card-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1px 6px;
  min-width: 0;
}

.map-card-name {
  flex: 1 1 100%;
  font-size: 12px;
  font-weight: 700;
  color: var(--cs-text);
  overflow-wrap: anywhere;
}

.map-card-id {
  font-family: var(--cs-mono);
  font-size: 10px;
  color: var(--cs-bright);
  overflow-wrap: anywhere;
}

.map-card-flag {
  display: none;
  margin-left: auto;
  color: var(--cs-warn);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.map-card[aria-checked="true"] .map-card-flag { display: inline-block; }

.picker-empty {
  margin: 8px 0 0;
  padding: 8px;
  background: rgba(40,39,36,.75);
  border: 1px solid #000;
  box-shadow: var(--bevel-in);
  font-size: 11px;
  color: var(--cs-dim);
}

.picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 6px 0 0;
}

.picker-page {
  margin: 0;
  font-family: var(--cs-mono);
  font-size: 11px;
  color: var(--cs-dim);
}

.picker-pager { display: flex; gap: 4px; }

.picker-selected {
  margin: 6px 0 0;
  padding: 4px 8px;
  background: rgba(40,39,36,.75);
  border: 1px solid #000;
  border-left: 3px solid var(--cs-bright);
  box-shadow: var(--bevel-in);
  font-size: 11px;
  color: var(--cs-text);
  overflow-wrap: anywhere;
}

.picker-note {
  margin: 8px 0 0;
  padding: 5px 8px;
  background: rgba(40,39,36,.85);
  border: 1px solid #000;
  border-left: 3px solid var(--cs-warn);
  box-shadow: var(--bevel-in);
  font-size: 11px;
  color: var(--cs-warn);
}

/* --------------------------------------------- New Game: enemy bot count */
.bot-row { margin-top: 12px; }

/* Default player side: the same row in New Game and in Options > Game. */
.side-row { margin-top: 12px; }

/* Enemy-bot difficulty: the same row in New Game and in Options > Game. Each
   option carries its own concise description, so the group stacks in a column
   instead of wrapping into a ragged line, and it stays readable at 390px. */
.difficulty-row { margin-top: 12px; align-items: flex-start; }

.difficulty-group {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.difficulty-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 4px;
}

.difficulty-option-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.difficulty-option-name { flex: 0 0 58px; }

.difficulty-option-note {
  font-size: 11px;
  color: var(--cs-dim);
}

/* The live description of the current pick, in both dialogs. */
.difficulty-status { color: var(--cs-bright); }
/* New gameplay controls include fault text: keep their status readable. */
#aggressive-pursuit-status, #no-hit-slowdown-status, #enemy-ac130-chance-status { color: var(--cs-dim); }
.input-shortcut { white-space: nowrap; }

.bot-count { gap: 6px; }

.stepper {
  flex: 0 0 auto;
  min-width: 26px;
  min-height: 24px;
  padding: 1px 5px;
  font-family: var(--cs-mono);
  font-size: 14px;
  line-height: 1;
}

.bot-count input[type="range"] { flex: 1 1 120px; max-width: 240px; }

.bot-count .setting-number { flex: 0 0 66px; width: 66px; }

.bot-count .setting-value { min-width: 26px; }

.setting-solo { color: var(--cs-bright); }

.setting-error { color: var(--cs-warn); }

/* Narrow picker: must come after the base picker rules above to win on order.
   2 x 2 map pages, and the bot controls stack so nothing overflows. */
@media (max-width: 720px) {
  .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .map-card-name { font-size: 11px; }
  .picker-tabs .vgui-tab { padding: 3px 8px; font-size: 11px; }
  .picker-foot { justify-content: flex-start; }
  .picker-page { flex: 1 1 100%; }
  .bot-count { flex-wrap: wrap; }
  .bot-count .stepper { order: 1; }
  .bot-count .setting-number { order: 2; flex: 0 1 76px; width: 76px; }
  .bot-count input[type="range"] { order: 3; flex: 1 1 100%; max-width: none; }
}
