:root {
  --bg: #0d1016;
  --bg2: #141922;
  --panel: #171d28;
  --panel2: #1f2735;
  --line: #2a3446;
  --text: #e6ebf3;
  --muted: #8b97ab;
  --accent: #ff7a3d;
  --accent2: #ffb547;
  --good: #3ecf6e;
  --bad: #ff5468;
  --gold: #ffd257;
  --radius: 10px;
  font-family: 'Chakra Petch', system-ui, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font-size: 15px; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: 0.02em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-top: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0; font-size: 14px; }
.row { display: flex; gap: 10px; }

button {
  background: var(--accent); border: none; border-radius: 8px; padding: 10px 16px;
  font-weight: 600; cursor: pointer; color: #1a0e06; transition: filter 0.15s, transform 0.05s;
}
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
button.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
.small-btn { padding: 6px 10px; font-size: 13px; }

input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-top: 6px; outline: none;
}
input:focus { border-color: var(--accent); }
label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.screen { position: fixed; inset: 0; }

/* ---------- auth ---------- */
#screen-auth {
  display: flex; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 30% 30%, #2a1a12 0%, var(--bg) 60%);
}
/* margin: auto centers without clipping the top when the page is taller than the window. */
.auth-wrap {
  width: 100%; max-width: 900px; margin: auto;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
}
.auth-wrap noscript { grid-column: 1 / -1; text-align: center; }
.logo { font-size: 46px; letter-spacing: 0.08em; margin-bottom: 4px; }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); margin: 0 0 22px; font-size: 16px; }
.features { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.features li { padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); font-size: 14px; }
.features b { display: block; color: var(--text); font-size: 15px; }
.auth-card h2 { margin-bottom: 16px; }
.auth-card .row button { flex: 1; }
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; max-width: 420px; gap: 24px; }
  .intro .logo { font-size: 38px; }
}

/* ---------- lobby ---------- */
#screen-lobby { display: flex; flex-direction: column; background: var(--bg); }
/* One row on desktop; on narrow screens the tabs drop to their own scrollable row. */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 8px 20px;
  background: var(--bg2); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.small-logo { font-size: 22px; font-weight: 700; letter-spacing: 0.08em; flex: none; }
.tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: transparent; color: var(--muted); padding: 8px 14px; white-space: nowrap; }
.tab.active { background: var(--panel2); color: var(--text); }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.user-name { font-weight: 700; }
.level-box { display: flex; align-items: center; gap: 8px; }
.level-badge { background: var(--accent2); color: #1a0e06; font-weight: 700; border-radius: 6px; padding: 2px 8px; font-size: 13px; white-space: nowrap; }
.level-badge.elite { background: var(--aug); color: #1a0826; }
.xp-bar { width: 100px; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.account { position: relative; }
.account > button { color: var(--text); display: flex; align-items: center; gap: 6px; max-width: 180px; }
.account .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 270px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.55);
}
.settings-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.settings-menu .audio-controls { flex-direction: column; align-items: stretch; gap: 10px; }
.settings-menu .vol { justify-content: space-between; font-size: 13px; }
.settings-menu .vol input { width: 150px; }
.settings-menu .audio-controls button, .settings-menu #logout-btn { align-self: flex-start; }
.settings-menu .menu-link { color: var(--muted); font-size: 13px; }
.settings-menu .menu-link:hover, .site-links a:hover { color: var(--text); }
.settings-menu #delete-open { align-self: flex-start; color: var(--bad); border-color: transparent; padding-left: 0; }
.delete-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.delete-form p { margin: 0; color: var(--muted); }
.delete-form .error { color: var(--bad); min-height: 0; }
.site-links a { color: var(--muted); }
@media (max-width: 1280px) { #lobby-xp-text { display: none; } }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px 0; }
  .tabs { order: 3; width: 100%; padding-bottom: 6px; }
}
@media (max-width: 520px) {
  .small-logo { display: none; }
  .user-box { margin-left: 0; width: 100%; justify-content: space-between; gap: 8px; }
  .xp-bar { width: 56px; }
  .account > button { max-width: 120px; }
}
.xp-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.gold { color: var(--gold); font-weight: 700; white-space: nowrap; }

.lobby-main { flex: 1; overflow-y: auto; padding: 20px; }
.tab-page { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr); gap: 20px; max-width: 1400px; margin: 0 auto; }
.panel-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .tab-page { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 10px 16px; }
  .lobby-main { padding: 16px; }
}

.class-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.class-card {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer;
  background: var(--panel2); position: relative; overflow: hidden; transition: border-color 0.15s;
}
.class-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.class-card:hover { border-color: #3a475e; }
.class-card.selected { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.class-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.class-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
.class-name { font-weight: 700; font-size: 17px; }
.class-role { color: var(--muted); font-size: 13px; margin-left: auto; }
.class-blurb { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.class-meta { font-size: 13px; margin-bottom: 6px; }
.class-abilities { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.class-abilities li { margin: 3px 0; }
.key { display: inline-block; min-width: 20px; text-align: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 6px; font-size: 12px; }

.map-list { display: flex; flex-direction: column; gap: 10px; }
.map-card { display: flex; gap: 14px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.map-thumb { width: 150px; height: auto; border-radius: 6px; flex: none; border: 1px solid rgba(255,255,255,0.1); }
@media (max-width: 520px) {
  .map-card { flex-wrap: wrap; }
  .map-thumb { width: 100%; }
}
.notice { margin: 0; padding: 10px 14px; border: 1px solid var(--accent2); border-radius: var(--radius); background: rgba(255,181,71,0.08); color: var(--accent2); font-size: 14px; }
.map-info { flex: 1; min-width: 0; }
.map-title { font-weight: 700; }
.map-sub { font-size: 13px; color: var(--muted); }
.tier { color: var(--accent2); font-size: 13px; margin-left: 6px; }

.room-list { display: flex; flex-direction: column; gap: 8px; }
.room { display: flex; align-items: center; gap: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; flex-wrap: wrap; }
.room-info { flex: 1; min-width: 160px; }
.room-players { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--bg2); border-radius: 20px; padding: 2px 8px 2px 4px; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.empty { color: var(--muted); font-size: 14px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- gear ---------- */
.equip-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.slot { background: var(--panel2); border: 1px solid var(--line); border-top: 3px solid var(--rc, var(--line)); border-radius: var(--radius); padding: 12px; min-height: 120px; display: flex; flex-direction: column; }
.slot-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.slot .stat-lines { flex: 1; }
.stat-lines { list-style: none; padding: 0; margin: 6px 0; font-size: 13px; color: #b9f0c9; }
.stat-lines li { margin: 2px 0; }
.item-name { font-weight: 700; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.hero-stat { background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.hero-stat b { display: block; font-size: 17px; }
.hero-stat span { font-size: 12px; color: var(--muted); }

.inv-layout { display: grid; grid-template-columns: 1fr 240px; gap: 14px; }
@media (max-width: 1100px) { .inv-layout { grid-template-columns: 1fr; } }
.inventory { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; align-content: start; }
.item-tile {
  aspect-ratio: 1; background: var(--panel2); border: 2px solid var(--rc); border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; padding: 4px;
  box-shadow: 0 0 10px -4px var(--rc) inset;
}
.item-tile.selected { outline: 2px solid #fff; outline-offset: 2px; }
.item-tile .glyph { font-size: 22px; font-weight: 700; color: var(--rc); line-height: 1; }
.item-tile .tier-tag { font-size: 10px; color: var(--muted); }
.item-tile .eq { position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #0d1016; background: var(--good); }
.hero-class { margin: 0 0 10px; }
.item-detail { background: var(--panel2); border-radius: var(--radius); padding: 14px; min-height: 160px; }
.item-detail .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.diff-up { color: var(--good); }
.diff-down { color: var(--bad); }
.shop { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.shop h2 { margin-bottom: 4px; }
.shop p { margin: 0; }

/* ---------- armory ---------- */
.panel-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip-btn { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }
.chip-btn.active { color: var(--text); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.weapon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.weapon-card { display: flex; gap: 14px; background: var(--panel2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
.weapon-card.equipped { border-color: var(--c); }
.weapon-card.locked { opacity: 0.6; }
.weapon-art { flex: none; width: 112px; height: 112px; border-radius: 8px; display: grid; place-items: center; background: radial-gradient(circle, rgba(255,255,255,0.08), rgba(0,0,0,0.25)); }
/* Pixel-doubled so the weapon reads clearly instead of a blurry upscale. */
.weapon-art img { transform: scale(2); image-rendering: pixelated; }
.weapon-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.weapon-title { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.weapon-title b { font-size: 16px; }
.weapon-desc { margin: 0 0 4px; }
.wbar { display: grid; grid-template-columns: 64px 1fr 52px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.wbar b { color: var(--text); text-align: right; font-weight: 600; }
.wbar-track { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.wbar-fill { height: 100%; background: var(--c); }
.traits { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12px; color: #b9f0c9; }
.weapon-action { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; color: var(--c); border: 1px solid var(--c); border-radius: 6px; padding: 4px 10px; }

/* ---------- workshop / exosuit ---------- */
:root { --aug: #c77dff; }
.cores { color: var(--aug); font-weight: 700; white-space: nowrap; }
.workshop-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.workshop-head > button { align-self: center; }
.workshop-title { flex: 1; min-width: 220px; }
.workshop-title h2 { margin-bottom: 2px; }
.wallet { text-align: right; display: flex; flex-direction: column; gap: 4px; align-self: center; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 16px 0; }
.stat-strip div { background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.stat-strip b { display: block; font-size: 16px; }
.stat-strip span { font-size: 12px; color: var(--muted); }
.element-box { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; background: var(--panel2); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; }
@media (max-width: 860px) { .element-box { grid-template-columns: 1fr; } }
.element-box h3 { margin-top: 0; }
.elem-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.elem-btn { background: var(--bg2); color: var(--c); border: 1px solid var(--c); padding: 6px 14px; }
.elem-btn.active { background: var(--c); color: #111; }
.affinity { border-collapse: collapse; font-size: 13px; width: 100%; }
.affinity th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 8px 4px 0; }
.affinity td { padding: 3px 8px 3px 0; border-top: 1px solid var(--line); }
.affinity td.weak { color: #ffb347; }
.affinity td.resist { color: var(--muted); }
.part-group h3 { margin: 16px 0 8px; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.part-card { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.part-card.maxed { border-color: var(--accent2); }
.part-card.augmented { border-color: var(--aug); box-shadow: 0 0 12px -4px var(--aug); }
.part-card button, .part-card .badge { margin-top: 6px; align-self: flex-start; }
.pips i.aug { transform: rotate(45deg); width: 8px; height: 8px; border-radius: 2px; margin: 0 3px; }
.pips i.aug.on { background: var(--aug); border-color: var(--aug); }
.augment-btn { background: var(--aug); color: #1a0826; }
.aug-badge { color: var(--aug); border-color: var(--aug); }
.core-found { color: var(--aug); font-weight: 700; }
#hud-ammo { position: relative; width: 240px; height: 16px; background: rgba(10,13,19,0.85); border: 1px solid #3c4658; border-radius: 8px; overflow: hidden; }
#hud-ammo-fill { height: 100%; background: linear-gradient(90deg, #8a6a22, #c99a30); }
#hud-ammo.reloading #hud-ammo-fill { background: linear-gradient(90deg, #2f5a96, #4f86cc); }
#hud-ammo.empty { border-color: var(--bad); animation: flash 0.8s infinite; }
#hud-ammo-text { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 16px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }

/* ---------- skills ---------- */
.skill-points { color: var(--accent2); font-weight: 600; margin-left: auto; }
.skill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.skill-card { display: flex; align-items: center; gap: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.skill-card.maxed { border-color: var(--accent2); }
.skill-card.elite .skill-icon { color: var(--aug); }
.skill-card.elite .pips i { width: 9px; }
.skill-card.elite .pips i.on { background: var(--aug); border-color: var(--aug); }
.skill-card.elite.maxed { border-color: var(--aug); }
.skill-card.locked { opacity: 0.55; }
.skill-section { grid-column: 1 / -1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }
.skill-section h3 { margin: 0; color: var(--aug); }
.skill-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 20px; font-weight: 700; background: var(--bg2); color: var(--accent2); }
.skill-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pips { display: flex; gap: 4px; margin: 3px 0; }
.pips i { width: 16px; height: 6px; border-radius: 3px; background: var(--bg2); border: 1px solid var(--line); }
.pips i.on { background: var(--accent2); border-color: var(--accent2); }

/* ---------- stats ---------- */
.stats-grid, .map-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.stat-card { background: var(--panel2); border-radius: var(--radius); padding: 14px; }
.stat-card b { display: block; font-size: 24px; }
.stat-card span { color: var(--muted); font-size: 13px; }

/* ---------- audio ---------- */
.audio-controls { display: flex; align-items: center; gap: 10px; }
.vol { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--muted); }
.vol input { width: 70px; margin: 0; padding: 0; accent-color: var(--accent); background: none; border: none; }
.menu-card .audio-controls { justify-content: center; flex-wrap: wrap; margin: 4px 0 6px; }
.menu-card .vol input { width: 100px; }

/* ---------- toasts / status ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; animation: toast-in 0.2s ease-out; }
.toast.bad { border-color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
#conn-status { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: #6b1d28; text-align: center; padding: 6px; font-size: 14px; }

/* ---------- game ---------- */
#screen-game { background: #000; cursor: crosshair; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; user-select: none; }
#hud-team { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 6px; }
.team-row { display: flex; align-items: center; gap: 8px; background: rgba(10,13,19,0.72); border-radius: 8px; padding: 6px 10px; min-width: 210px; }
.team-row.dead { opacity: 0.5; }
.team-row .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.team-row .nm { font-size: 13px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-row .lv { font-size: 11px; color: var(--muted); }
.mini-hp { width: 70px; height: 6px; background: #2b1015; border-radius: 3px; overflow: hidden; }
.mini-hp > div { height: 100%; background: var(--good); }

#hud-wave { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); text-align: center; background: rgba(10,13,19,0.72); border-radius: 10px; padding: 8px 22px; }
#hud-wave-title { font-size: 20px; font-weight: 700; }
#hud-minimap { position: absolute; top: 14px; right: 14px; border-radius: 8px; background: rgba(10,13,19,0.72); width: 220px; height: 160px; }
#hud-boss { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); width: min(520px, 70vw); text-align: center; }
#hud-boss-name { font-weight: 700; color: #ff8a8a; text-shadow: 0 1px 4px #000; margin-bottom: 4px; }
.boss-bar { height: 14px; background: rgba(40,8,12,0.85); border: 1px solid #7a2630; border-radius: 7px; overflow: hidden; }
#hud-boss-fill { height: 100%; background: linear-gradient(90deg, #d63031, #ff7675); transition: width 0.15s; }

#hud-banner { position: absolute; top: 32%; left: 0; right: 0; text-align: center; font-size: 46px; font-weight: 700; letter-spacing: 0.04em; text-shadow: 0 3px 16px rgba(0,0,0,0.8); opacity: 0; }
#hud-banner.show { animation: banner 2.6s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(0.9); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

#hud-feed { position: absolute; left: 14px; bottom: 120px; display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.feed-item { background: rgba(10,13,19,0.72); border-radius: 6px; padding: 5px 10px; font-size: 13px; animation: toast-in 0.2s ease-out; transition: opacity 0.5s; }

#hud-down { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); background: rgba(60,10,18,0.85); border: 1px solid #a83246; border-radius: 10px; padding: 14px 22px; text-align: center; display: flex; flex-direction: column; gap: 4px; max-width: 90vw; }
#hud-down strong { font-size: 22px; }

/* A dark backing keeps the bars and text readable over bright floors. */
#hud-bottom {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: rgba(10,13,19,0.6); border-radius: 12px; padding: 8px 14px 7px;
}
#hud-run { color: #c8d0dc; }
#hud-hp { position: relative; width: 340px; max-width: 80vw; height: 18px; background: rgba(40,8,12,0.85); border: 1px solid #3c4658; border-radius: 9px; overflow: hidden; }
#hud-hp-fill { height: 100%; background: linear-gradient(90deg, #2fb55c, #5be88a); transition: width 0.1s; }
#hud-hp-text { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#hud-abilities { display: flex; gap: 10px; }
.ability { position: relative; width: 64px; height: 64px; border-radius: 10px; background: rgba(23,29,40,0.9); border: 2px solid var(--c); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; pointer-events: auto; }
.ability .ab-key { position: absolute; top: 3px; left: 6px; font-weight: 700; font-size: 14px; }
.ability .ab-name { font-size: 10.5px; text-align: center; padding: 0 2px 4px; line-height: 1.1; z-index: 1; }
.ability .ab-icon { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 22px; line-height: 1; color: var(--c); }
.ability.cooling .ab-icon { opacity: 0.25; }
.ability .ab-cd { position: absolute; inset: 0; }
.ability .ab-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.ability.flash { animation: flash 0.3s; }
@keyframes flash { 50% { border-color: var(--bad); } }
#hud-hint { background: rgba(10,13,19,0.6); border-radius: 6px; padding: 3px 10px; transition: opacity 1s; }

.overlay { position: absolute; inset: 0; background: rgba(5,7,10,0.6); display: grid; place-items: center; cursor: default; padding: 16px; }
.menu-card { display: flex; flex-direction: column; gap: 10px; min-width: 280px; text-align: center; }
.controls { list-style: none; padding: 0; margin: 2px 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; text-align: left; font-size: 13px; color: var(--muted); }
kbd { display: inline-block; min-width: 70px; margin-right: 6px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--bg2); color: var(--text); font: 600 12px 'Chakra Petch', system-ui, sans-serif; text-align: center; }
.results-card { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; text-align: center; }
.results-card h1 { font-size: 40px; margin-bottom: 4px; }
.results-card h1.win { color: var(--good); }
.results-card h1.lose { color: var(--bad); }
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.results-grid div { background: var(--panel2); border-radius: 8px; padding: 10px; }
.results-grid b { display: block; font-size: 20px; }
.results-grid span { font-size: 12px; color: var(--muted); }
.results-items { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; }
.results-items li { background: var(--panel2); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; font-size: 14px; }
@media (max-width: 600px) {
  #hud-minimap { width: 140px; height: 102px; }
  .team-row { min-width: 0; }
  #hud-banner { font-size: 30px; }
}

/* ---------- ads ---------- */
/* Lobby banner (public/js/ads.js). Fixed sizes so the lobby doesn't jump when an ad loads. */
.ad-banner { flex: none; display: flex; justify-content: center; padding: 6px 0; background: var(--bg2); border-top: 1px solid var(--line); }
.ad-banner ins { display: inline-block; width: 728px; height: 90px; }
.ad-banner:has(ins[data-ad-status="unfilled"]) { display: none; }
body:has(#screen-lobby:not(.hidden) .ad-banner) #toasts { bottom: 116px; }
@media (max-width: 760px) {
  .ad-banner ins { width: 320px; height: 50px; }
  body:has(#screen-lobby:not(.hidden) .ad-banner) #toasts { bottom: 76px; }
}
#ad-reward { white-space: nowrap; }
