:root {
  --bg: #0e1311;
  --panel: rgba(14, 19, 17, 0.86);
  --line: #34443a;
  --text: #e9efe9;
  --muted: #9aa99f;
  --accent: #ffd76a;
  --xp: #5fd3ff;
  --hp: #e5484d;
  --good: #7dff9a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button {
  background: #2c3b31; border: 1px solid #4f6656; border-radius: 6px; padding: 8px 16px; cursor: pointer;
}
button:hover { background: #36493c; }
button:disabled { opacity: 0.5; cursor: default; }
input { background: #18201b; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; background: radial-gradient(ellipse at center, rgba(20, 30, 24, 0.92), rgba(8, 10, 9, 0.97));
  text-align: center;
}
.screen h1 { font-size: clamp(36px, 8vw, 64px); margin: 0 0 4px; letter-spacing: 2px; color: var(--accent); }
.tagline { color: var(--muted); max-width: 460px; margin: 0 0 12px; }
.row { display: flex; gap: 8px; }
#account b { color: var(--accent); }
#login-needed a { color: var(--accent); }
#code { width: 90px; text-transform: uppercase; text-align: center; letter-spacing: 3px; }
.error { color: #ff8a8a; min-height: 1.2em; margin: 0; }
.fame-link a { color: var(--accent); }
.hint { color: var(--muted); font-size: 14px; max-width: 480px; }

#members { list-style: none; padding: 0; margin: 4px 0; min-width: 260px; }
#members li { padding: 6px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
#members .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
#starters, #options { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.card {
  width: 190px; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: #151d18; text-align: left; cursor: pointer;
}
.card:hover { border-color: #6f8f78; }
.card.chosen { border-color: var(--accent); }
.card .title { font-weight: 700; margin-bottom: 4px; }
.card .tag { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
.card .text { font-size: 14px; color: var(--muted); }
.card .key { float: right; color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

#over-table { border-collapse: collapse; margin: 6px 0; }
#over-table td, #over-table th { padding: 6px 14px; border-bottom: 1px solid var(--line); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
#xp { position: absolute; top: 0; left: 0; right: 0; height: 18px; background: rgba(0, 0, 0, 0.55); }
#xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #2b8fbf, var(--xp)); transition: width 0.15s; }
#xp-level { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#topline { position: absolute; top: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 24px; font-size: 22px; font-weight: 700; text-shadow: 0 2px 3px #000; }
#kills::before { content: "☠ "; color: var(--muted); }
#run { position: absolute; top: 52px; left: 0; right: 0; text-align: center; font-size: 13px; color: var(--muted); text-shadow: 0 1px 2px #000; }
#run b { color: var(--accent); }
#minimap { position: absolute; top: 52px; right: 10px; width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 50%; background: #0b0f0d; opacity: 0.9; }
#tether { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 4px 12px; border-radius: 6px; font-size: 13px; color: var(--accent); }
#markers { position: absolute; inset: 0; }
.marker { position: absolute; transform: translate(-50%, -50%); font-size: 12px; font-weight: 700; text-align: center; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.marker .icon { display: block; font-size: 18px; line-height: 1; }
.marker .arrow { display: block; font-size: 14px; line-height: 1; }
#boss { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: min(520px, 80vw); text-align: center; font-weight: 700; text-shadow: 0 1px 2px #000; }
#boss-bar { height: 12px; background: rgba(0, 0, 0, 0.6); border: 1px solid #000; margin-top: 4px; }
#boss-fill { height: 100%; background: linear-gradient(90deg, #6a9a10, #c6ff66); }

#team { position: absolute; top: 30px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.mate { background: var(--panel); border-radius: 6px; padding: 5px 8px; width: 170px; font-size: 13px; }
.mate .name { display: flex; justify-content: space-between; font-weight: 700; }
.mate .bar { height: 5px; background: #000; margin-top: 3px; }
.mate .bar div { height: 100%; background: var(--hp); }
.mate .status { color: var(--muted); font-size: 11px; }
.mate.down .bar div { background: #666; }

#me { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(420px, 90vw); }
#hp { position: relative; height: 16px; background: rgba(0, 0, 0, 0.6); border: 1px solid #000; border-radius: 3px; overflow: hidden; }
#hp-fill { height: 100%; background: linear-gradient(90deg, #a51d22, var(--hp)); transition: width 0.1s; }
#hp-text { position: absolute; inset: 0; font-size: 11px; line-height: 16px; text-align: center; font-weight: 700; text-shadow: 0 1px 2px #000; }
#loadout { display: flex; gap: 4px; justify-content: center; margin-top: 5px; flex-wrap: wrap; }
.slot { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-size: 11px; white-space: nowrap; }
.slot b { color: var(--accent); }
.slot.passive { border-style: dashed; }

#downed { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); background: var(--panel); padding: 12px 18px; border-radius: 8px; font-weight: 700; text-align: center; }
#revive-bar { height: 8px; background: #000; margin-top: 8px; }
#revive-fill { height: 100%; width: 0; background: var(--good); }
#banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-size: clamp(22px, 4vw, 34px); font-weight: 800; color: var(--accent); text-shadow: 0 3px 6px #000; white-space: nowrap; }
#corner { position: absolute; top: 24px; right: 10px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
#corner button { padding: 2px 8px; }

#joystick { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.05); pointer-events: none; }
#stick { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }

#levelup {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; text-align: center; width: min(900px, calc(100vw - 32px));
}
#levelup h2 { margin: 0 0 10px; color: var(--accent); font-size: 20px; }
#levelup-left { color: var(--muted); font-size: 14px; font-weight: 400; }
#levelup .hint { margin: 10px auto 0; }
@media (max-width: 640px) {
  .card { width: 100%; }
  #minimap { width: 110px; height: 110px; top: 70px; }
  #team { top: 50px; }
  .mate { width: 130px; }
}

/* Labels over the 3D view */
.label { position: absolute; transform: translate(-50%, -100%); font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000, 0 0 3px #000; text-align: center; white-space: nowrap; }
.label .bar { width: 46px; height: 4px; background: #000; margin: 2px auto 0; }
.label .bar div { height: 100%; background: var(--hp); }
.label .revive { width: 46px; height: 4px; background: #000; margin: 2px auto 0; }
.label .revive div { height: 100%; background: var(--good); }
.label.edge { opacity: 0.85; }
.damage { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); font-size: 13px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; will-change: transform, opacity; }
.damage.big { font-size: 17px; color: var(--accent); }

#connection { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #5a2020; padding: 8px 14px; border-radius: 6px; }
