:root {
  --amber: #ffb35c;
  --amber-dim: #b97a3c;
  --blood: #c0452b;
  --ash: #1a120d;
  --panel: rgba(18, 11, 8, 0.78);
  --line: rgba(255, 179, 92, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120a07;
  color: var(--amber);
  font-family: "Consolas", "Courier New", ui-monospace, monospace;
  user-select: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
}

#scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    rgba(255, 255, 255, 0.012) 2px,
    rgba(255, 255, 255, 0.012) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.42;
  z-index: 5;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(20, 6, 2, 0.72) 100%);
  z-index: 6;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------- login ---- */

#login {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 108%, rgba(255, 126, 48, 0.42), transparent 58%),
    radial-gradient(circle at 50% 40%, rgba(80, 30, 10, 0.55), transparent 70%),
    #0d0705;
}

.login-card {
  position: relative;
  width: min(520px, 86vw);
  padding: 44px 36px 34px;
  text-align: center;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 14, 9, 0.92), rgba(12, 7, 5, 0.96));
  box-shadow: 0 0 80px rgba(255, 120, 40, 0.12), inset 0 0 60px rgba(255, 120, 40, 0.05);
}

.login-card::before,
.login-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--amber-dim);
}
.login-card::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.login-card::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.login-card h1 {
  margin: 0;
  font-size: clamp(44px, 9vw, 74px);
  letter-spacing: 0.16em;
  font-weight: 700;
  color: #ffd7a3;
  text-shadow: 0 0 26px rgba(255, 140, 50, 0.55), 0 2px 0 #5c2a10;
}

.login-card .sub {
  margin: 6px 0 0;
  letter-spacing: 0.34em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--amber-dim);
}

.sun {
  width: 118px;
  height: 59px;
  margin: 26px auto 22px;
  border-radius: 118px 118px 0 0;
  background: linear-gradient(180deg, #ffd08a, #ff8a2b 55%, #c0452b);
  box-shadow: 0 0 46px rgba(255, 130, 40, 0.55);
  position: relative;
  overflow: hidden;
}
.sun::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 7px,
    rgba(13, 7, 5, 0.92) 7px 9px
  );
}

#name {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-align: center;
  color: #ffe2bd;
  background: rgba(255, 179, 92, 0.05);
  border: 1px solid var(--line);
  outline: none;
}
#name:focus { border-color: var(--amber); box-shadow: 0 0 22px rgba(255, 150, 60, 0.22); }
#name::placeholder { color: rgba(185, 122, 60, 0.6); }

#play {
  width: 100%;
  padding: 15px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.28em;
  cursor: pointer;
  color: #1b0f08;
  background: linear-gradient(180deg, #ffc178, #e08a3c);
  border: 0;
  box-shadow: 0 0 34px rgba(255, 140, 50, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#play:hover { transform: translateY(-1px); box-shadow: 0 0 48px rgba(255, 150, 60, 0.55); }
#play:disabled { opacity: 0.5; cursor: wait; }

.login-card .tip {
  margin: 22px 0 0;
  font-size: 12px;
  color: rgba(185, 122, 60, 0.85);
  font-style: italic;
}

/* --------------------------------------------------------------- hud ----- */

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

.panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(2px);
}

.stats {
  left: 18px;
  bottom: 18px;
  padding: 11px 14px;
  width: 288px;
}

.row { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 12px; }
.row.bottom { margin: 9px 0 0; justify-content: space-between; letter-spacing: 0.08em; }
.lbl { width: 30px; color: var(--amber-dim); font-size: 11px; letter-spacing: 0.12em; }
.row b { width: 34px; text-align: right; font-size: 12px; }

.bar {
  flex: 1;
  height: 9px;
  background: rgba(255, 179, 92, 0.1);
  border: 1px solid rgba(255, 179, 92, 0.22);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d9603a, #ffb35c);
  transition: width 0.18s linear;
}
.bar.rad i { background: linear-gradient(90deg, #7a8f2e, #d9e04a); width: 0; }

.caps { color: #ffd7a3; }
.ammo { color: var(--amber-dim); font-size: 11px; }
.ammo b { color: #ffd7a3; width: auto; }

.hint {
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 200, 150, 0.75);
  white-space: nowrap;
}
.hint b { color: var(--amber); }

.online {
  position: absolute;
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(185, 122, 60, 0.85);
}
.online b { color: var(--amber); }

#minimap {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 168px;
  height: 168px;
  border: 1px solid var(--line);
  background: rgba(10, 6, 4, 0.85);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

/* -------------------------------------------------------------- chat ----- */

#chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 330px;
  z-index: 12;
}

#chatLog {
  max-height: 176px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  background: linear-gradient(180deg, transparent, rgba(12, 7, 5, 0.72) 55%);
  text-shadow: 0 1px 2px #000;
}

#chatLog .msg { color: #ffd7a3; word-wrap: break-word; }
#chatLog .msg b { color: #ffb35c; }
#chatLog .sys { color: rgba(185, 122, 60, 0.85); font-style: italic; }
#chatLog .fade { opacity: 0.45; }

#chatInput {
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  font: inherit;
  font-size: 12px;
  color: #ffe2bd;
  background: rgba(18, 11, 8, 0.9);
  border: 1px solid var(--line);
  outline: none;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
#chatInput:focus { opacity: 1; border-color: var(--amber); }
#chatInput::placeholder { color: rgba(185, 122, 60, 0.55); }

/* -------------------------------------------------------------- dead ----- */

#dead {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(120, 20, 8, 0.34), rgba(10, 3, 2, 0.9));
  pointer-events: none;
}
.dead-card { text-align: center; }
.dead-card h2 {
  margin: 0;
  font-size: clamp(20px, 4vw, 34px);
  letter-spacing: 0.2em;
  color: #ff8a6a;
  text-shadow: 0 0 34px rgba(255, 60, 20, 0.6);
}
.dead-card p { color: rgba(255, 179, 92, 0.8); letter-spacing: 0.14em; font-size: 12px; }
