/* ==========================================================================
   qport — Q3DM17 FFA
   Quake-flavoured UI: dark, angular, high contrast.
   ========================================================================== */

:root {
  --bg: #0b0b10;
  --panel: #14141c;
  --panel-2: #1c1c26;
  --line: #2e2e3c;
  --text: #d8dae0;
  --dim: #8b8f9a;
  --accent: #ff5544;
  --accent-2: #4fa8ff;
  --good: #58d06a;
  --warn: #ffb020;
  --font: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

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

#app { position: fixed; inset: 0; }
#app canvas { display: block; width: 100%; height: 100%; }

#overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 20;
}
#overlay .menu { pointer-events: auto; }

/* ---------------------------------------------------------------- boot --- */
#boot {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #16161f 0%, #08080c 100%);
  transition: opacity .5s ease, visibility .5s;
}
#boot.gone { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-logo {
  font-size: 64px; font-weight: 700; letter-spacing: 10px;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 85, 68, .45);
  margin-bottom: 18px;
}
.boot-bar {
  width: 260px; height: 4px; background: #22222c;
  border-radius: 2px; overflow: hidden; margin: 0 auto 14px;
}
.boot-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.boot-msg { color: var(--dim); font-size: 14px; letter-spacing: 2px; }

/* ----------------------------------------------------------------- HUD --- */
.hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: var(--font);
  user-select: none;
}

.crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  --spread: 6px;
}
.ch-dot {
  position: absolute; left: -1.5px; top: -1.5px;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 0 3px rgba(0, 0, 0, .9);
}
.ch-arm {
  position: absolute; background: rgba(255, 255, 255, .82);
  box-shadow: 0 0 3px rgba(0, 0, 0, .9);
  transition: transform .05s linear;
}
.ch-t { width: 2px; height: 7px; left: -1px; top: calc(-1 * var(--spread) - 7px); }
.ch-b { width: 2px; height: 7px; left: -1px; top: var(--spread); }
.ch-l { width: 7px; height: 2px; top: -1px; left: calc(-1 * var(--spread) - 7px); }
.ch-r { width: 7px; height: 2px; top: -1px; left: var(--spread); }
.hitmark {
  position: absolute; left: -9px; top: -9px;
  font-size: 18px; color: #fff;
  opacity: 0; transform: scale(.6);
  transition: opacity .12s, transform .12s;
  text-shadow: 0 0 6px rgba(0, 0, 0, .9);
}
.hitmark.kill { color: var(--accent); }

.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 18px 26px 20px;
  background: linear-gradient(to top, rgba(6, 6, 10, .75), transparent);
}
.hud-left { min-width: 150px; }
.hud-name {
  font-size: 15px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--dim);
}
.hud-score { font-size: 30px; font-weight: 700; line-height: 1; color: var(--text); }

.hud-center { text-align: center; }
.hud-weapon {
  font-size: 17px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--text);
}
.hud-ammo {
  font-family: var(--mono); font-size: 22px; color: var(--warn);
  margin-top: 2px; min-height: 26px;
}
.hud-ammo b { color: #fff; font-size: 27px; }
.hud-ammo:empty { display: none; }

.hud-right { text-align: right; min-width: 150px; }
.hud-health, .hud-armor {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  font-family: var(--mono); font-size: 26px; line-height: 1.1;
}
.hud-health { color: #fff; }
.hud-armor { color: var(--accent-2); font-size: 20px; }
.hud-health.hit { animation: healthflash .3s ease; }
@keyframes healthflash {
  0% { color: var(--accent); transform: scale(1.18); }
  100% { color: #fff; transform: scale(1); }
}
.stat-ico { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }
.stat-ico.health { background: linear-gradient(135deg, #ff6b5a, #c02a1c); }
.stat-ico.armor { background: linear-gradient(135deg, #7cc0ff, #2a5c9c); }

/* killfeed / pickups / messages */
.killfeed {
  position: absolute; right: 20px; top: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.kf-row {
  background: rgba(10, 10, 16, .72);
  border-right: 2px solid var(--accent);
  padding: 4px 9px; font-size: 13px; letter-spacing: .5px;
  transition: opacity .6s;
  display: flex; gap: 8px; align-items: center;
}
.kf-a { color: var(--text); }
.kf-w { color: var(--dim); font-size: 11px; text-transform: uppercase; }
.kf-v { color: var(--accent); }
.kf-row.fade { opacity: 0; }

.pickup-log {
  position: absolute; left: 20px; top: 16px;
  display: flex; flex-direction: column; gap: 3px;
}
.pk-row {
  background: rgba(10, 10, 16, .6);
  padding: 3px 9px; font-size: 12px; color: var(--good);
  letter-spacing: 1px; text-transform: uppercase;
  transition: opacity .5s;
}
.pk-row.fade { opacity: 0; }

.center-msg {
  position: absolute; left: 50%; top: 30%;
  transform: translate(-50%, -50%) scale(.9);
  font-size: 40px; font-weight: 700; letter-spacing: 6px;
  color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, .9);
  opacity: 0; transition: opacity .25s, transform .25s;
  text-align: center; white-space: pre-line;
}
.center-msg.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* scoreboard */
.scoreboard {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  background: rgba(10, 10, 16, .9);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7);
  transition: opacity .12s;
}
.scoreboard.hidden { display: none; }
.sb-head {
  display: flex; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(255, 85, 68, .18), transparent);
  border-bottom: 1px solid var(--line);
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--dim);
}
.sb-head span:last-child { color: var(--text); font-family: var(--mono); }
.scoreboard table { width: 100%; border-collapse: collapse; }
.scoreboard th {
  text-align: left; padding: 7px 16px;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.scoreboard td {
  padding: 5px 16px; font-size: 14px; font-family: var(--mono);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.scoreboard tr.me td { background: rgba(255, 85, 68, .1); color: #fff; }
.sb-name { font-family: var(--font); letter-spacing: .5px; }
.sb-name .bot { color: var(--dim); font-size: 10px; font-style: normal; letter-spacing: 1px; }
.sb-foot {
  padding: 8px 16px; font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- menu --- */
.menu {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 20, 30, .82), rgba(6, 6, 10, .95));
  backdrop-filter: blur(3px);
  z-index: 30;
  transition: opacity .2s;
}
.menu.hidden { display: none; }

.menu-card {
  width: min(560px, 94vw);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .8);
}
.menu-title {
  padding: 26px 30px 18px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 85, 68, .05) 0 12px, transparent 12px 24px),
    linear-gradient(90deg, rgba(255, 85, 68, .14), transparent 60%);
  border-bottom: 1px solid var(--line);
}
.menu-title h1 {
  margin: 0; font-size: 46px; font-weight: 700; letter-spacing: 8px;
  color: var(--accent);
  text-shadow: 0 0 26px rgba(255, 85, 68, .35);
}
.menu-title p {
  margin: 4px 0 0; font-size: 12px; letter-spacing: 3px;
  color: var(--dim); text-transform: uppercase;
}

.menu-tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 11px 0; background: none; border: none;
  color: var(--dim); font-family: var(--font);
  font-size: 13px; letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-body { padding: 20px 30px 26px; }
.tab-body.hidden { display: none; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block; font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--dim); margin-bottom: 6px;
}
.field input[type="text"], .field input:not([type]), .field select {
  width: 100%; padding: 9px 12px;
  background: #0e0e14; border: 1px solid var(--line);
  color: var(--text); font-family: var(--font); font-size: 15px;
  letter-spacing: 1px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input[type="range"] {
  width: calc(100% - 46px); vertical-align: middle;
  accent-color: var(--accent);
}
.field output {
  display: inline-block; min-width: 38px; text-align: right;
  font-family: var(--mono); font-size: 14px; color: var(--text);
}
.field.checkbox { display: flex; align-items: center; gap: 9px; }
.field.checkbox span { margin: 0; }
.field.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.menu-row { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  flex: 1; padding: 12px 0;
  background: #1a1a24; border: 1px solid var(--line);
  color: var(--text); font-family: var(--font);
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; transition: all .15s;
}
.btn:hover { background: #23232f; border-color: #44445a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff6a5a; }

.hint { margin: 14px 0 0; font-size: 12px; color: var(--dim); line-height: 1.6; }
.status { margin-top: 10px; font-size: 12px; min-height: 16px; color: var(--dim); }
.status.err { color: var(--accent); }
.status.ok { color: var(--good); }

.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 5px 0; font-size: 13px; }
.keys td:first-child { color: var(--dim); width: 40%; }
.keys kbd {
  display: inline-block; padding: 2px 7px; margin-right: 3px;
  background: #0e0e14; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 3px;
  font-family: var(--mono); font-size: 11px; color: var(--text);
}

/* ---------------------------------------------------------------- misc --- */
.stats {
  position: fixed; left: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  background: rgba(0, 0, 0, .5); padding: 3px 8px;
  z-index: 15; pointer-events: none;
}

@media (max-width: 620px) {
  .menu-title h1 { font-size: 32px; letter-spacing: 4px; }
  .center-msg { font-size: 26px; }
  .hud-bottom { padding: 12px 14px 14px; }
  .hud-score { font-size: 22px; }
}

/* ------------------------------------------------------- touch controls --- */
.touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.touch.hidden { display: none; }

.tc-stick {
  position: absolute; left: 4vw; bottom: 6vh;
  width: 132px; height: 132px; pointer-events: auto;
  touch-action: none;
}
.tc-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .05);
  border: 2px solid rgba(255, 255, 255, .16);
}
.tc-knob {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  border: 2px solid rgba(255, 255, 255, .4);
}

.tc-look { position: absolute; right: 0; top: 0; width: 60%; height: 100%; pointer-events: auto; touch-action: none; }

.tc-buttons { position: absolute; right: 4vw; bottom: 6vh; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.tc-btn {
  pointer-events: auto; touch-action: none;
  min-width: 74px; height: 74px; padding: 0 12px;
  border-radius: 50%;
  background: rgba(20, 20, 28, .6);
  border: 2px solid rgba(255, 255, 255, .2);
  color: #fff; font-family: var(--font); font-size: 13px; font-weight: 700; letter-spacing: 1px;
}
.tc-btn.active { background: rgba(255, 85, 68, .55); border-color: #ff5544; }
.tc-fire { min-width: 96px; height: 96px; font-size: 15px; }
.tc-menu { min-width: 48px; height: 48px; font-size: 20px; }

.tc-weapons {
  position: absolute; right: 4vw; bottom: calc(6vh + 210px);
  display: flex; gap: 6px; pointer-events: auto;
}
.tc-wbtn {
  width: 38px; height: 38px; border-radius: 6px;
  background: rgba(20, 20, 28, .6);
  border: 2px solid rgba(255, 255, 255, .16);
  color: #cfd3da; font-family: var(--mono); font-size: 13px;
}
.tc-wbtn.active { background: rgba(79, 168, 255, .4); border-color: #4fa8ff; color: #fff; }
