/* =============================================================================
 * Counter-Strike 1.6 (WebGL2) — page shell + 3D canvas
 * HUD and menus live in ui.css.
 * ========================================================================== */

:root {
  --ct: #5aa8ff;
  --t: #ffa03c;
  --accent: #39ff6a;
  --bg: #0b0e11;
  --panel: rgba(14, 18, 22, 0.92);
  --panel-b: rgba(120, 140, 150, 0.22);
  --text: #dfe7ec;
  --dim: #8a97a0;
  --money: #7de07d;
  --danger: #ff4a3d;
  --font: "Segoe UI", Roboto, "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #05070a;
  cursor: none;
}

#viewport:not(.locked) { cursor: crosshair; }

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  user-select: none;
}

#ui .clickable,
#main-menu,
#fatal-error,
.pause-overlay,
.buy-menu,
.scoreboard,
.radio-menu { pointer-events: auto; }

/* ------------------------------- loading -------------------------------- */

#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 700px at 50% 18%, rgba(57, 255, 106, 0.06), transparent 70%),
    linear-gradient(160deg, #0a0d10 0%, #11161b 55%, #0a0d10 100%);
}

.loading-inner {
  width: min(560px, 86vw);
  text-align: center;
}

.logo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  letter-spacing: 0.16em;
}

.logo .cs {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  color: #eef4f8;
  text-shadow: 0 0 26px rgba(57, 255, 106, 0.25);
}

.logo .ver {
  font-family: var(--mono);
  font-size: clamp(16px, 2.6vw, 22px);
  color: var(--accent);
  border: 1px solid rgba(57, 255, 106, 0.4);
  border-radius: 4px;
  padding: 1px 7px;
}

.loading-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#loading-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2fd45e, #7bff9e);
  box-shadow: 0 0 18px rgba(57, 255, 106, 0.5);
  transition: width 0.35s ease;
}

#loading-msg {
  margin-top: 14px;
  font-size: 13px;
  color: var(--dim);
  font-family: var(--mono);
  min-height: 18px;
}

.loading-note {
  margin-top: 22px;
  font-size: 11.5px;
  line-height: 1.6;
  color: rgba(138, 151, 160, 0.75);
}

/* ------------------------------ main menu ------------------------------- */

#main-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 22% 12%, rgba(90, 168, 255, 0.10), transparent 62%),
    radial-gradient(900px 520px at 80% 84%, rgba(255, 160, 60, 0.09), transparent 62%),
    linear-gradient(155deg, #090c0f 0%, #12181d 50%, #090c0f 100%);
  overflow-y: auto;
}

.menu-card {
  width: min(720px, 94vw);
  background: var(--panel);
  border: 1px solid var(--panel-b);
  border-radius: 14px;
  padding: 30px 32px 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}

.menu-card h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4.4vw, 40px);
  letter-spacing: 0.02em;
  font-weight: 800;
}

.menu-card h1 .cs { color: #f2f7fa; }
.menu-card h1 .ver {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.52em;
  border: 1px solid rgba(57, 255, 106, 0.4);
  border-radius: 5px;
  padding: 2px 8px;
  vertical-align: middle;
}

.menu-sub {
  margin: 0 0 22px;
  color: var(--dim);
  font-size: 13.5px;
  line-height: 1.6;
}

.menu-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.menu-row label {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.menu-row select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--panel-b);
  background: #151b21;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.menu-row select:focus { border-color: rgba(57, 255, 106, 0.55); }

.menu-buttons {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--panel-b);
  background: #171e24;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 11px 22px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:hover { background: #1e272f; border-color: rgba(255, 255, 255, 0.28); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(180deg, #2fbf58, #229a45);
  border-color: rgba(120, 255, 160, 0.45);
  color: #05130a;
}

.btn.primary:hover { background: linear-gradient(180deg, #3ad066, #28ab4d); }

.menu-help {
  margin-top: 20px;
  border-top: 1px solid var(--panel-b);
  padding-top: 16px;
}

.menu-help h3 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  font-size: 13px;
}

.help-grid span { color: var(--dim); }
.help-grid b { font-family: var(--mono); color: #eaf2f7; font-weight: 500; }

.help-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
}

.help-note.important {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  color: #b8c6ce;
}

.help-note code {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------------------------- pause overlay ----------------------------- */

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 11, 0.72);
  backdrop-filter: blur(3px);
}

.pause-overlay .menu-card h2 { margin: 0 0 18px; font-size: 24px; }

.settings-grid {
  margin-top: 22px;
  border-top: 1px solid var(--panel-b);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.settings-grid label {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--dim);
}

.settings-grid input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.settings-grid label.chk {
  grid-template-columns: auto 1fr;
  color: var(--text);
  cursor: pointer;
}

.settings-grid input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ------------------------------- errors --------------------------------- */

#fatal-error {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 4, 4, 0.94);
  padding: 24px;
}

.err-card {
  width: min(680px, 92vw);
  background: #171012;
  border: 1px solid rgba(255, 90, 70, 0.35);
  border-radius: 12px;
  padding: 26px 28px;
}

.err-card h2 { margin: 0 0 10px; color: #ff7a6a; font-size: 20px; }
.err-msg { font-family: var(--mono); font-size: 13px; color: #ffd8d2; word-break: break-word; }
.err-card details { margin: 14px 0; }
.err-card summary { cursor: pointer; color: var(--dim); font-size: 12.5px; }
.err-detail {
  max-height: 240px;
  overflow: auto;
  font-size: 11.5px;
  line-height: 1.5;
  color: #b5a4a2;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px;
  border-radius: 6px;
  white-space: pre-wrap;
}
.err-hint { font-size: 12.5px; line-height: 1.65; color: #c9b6b3; }
.err-hint code {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ------------------------------ fps counter ----------------------------- */

#fps-counter {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 50;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #9fe8b4;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(120, 255, 160, 0.18);
  border-radius: 5px;
  padding: 3px 8px;
  pointer-events: none;
}
