/* Circuit Siege — HUD & interface styles (Tailwind handles layout utilities). */
:root {
  --cyan: #22e6ff; --cyan-d: #0891b2; --pink: #ff2e88; --amber: #ffb020; --lime: #a3e635;
  --bg: #04070e; --panel: rgba(8, 15, 30, 0.82); --line: rgba(34, 230, 255, 0.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: #e2e8f0;
  font-family: 'Rajdhani', ui-sans-serif, system-ui, sans-serif; user-select: none; -webkit-font-smoothing: antialiased; }
input, select, button { font-family: inherit; }
.font-display { font-family: 'Orbitron', 'Rajdhani', sans-serif; letter-spacing: 0.08em; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#scanlines { position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.06) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%); }
#fade-veil { position: fixed; inset: 0; background: #000; z-index: 95; opacity: 1; pointer-events: none; transition: opacity 0.45s ease; }
#fade-veil.clear { opacity: 0; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: none; }
.screen.active { display: block; animation: screenIn 0.5s ease both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- panels ---------- */
.panel { background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 20px 60px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.04);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.panel-title { font-family: 'Orbitron', sans-serif; font-size: 11px; letter-spacing: 0.28em; color: var(--cyan); text-transform: uppercase; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: 'Orbitron', sans-serif; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 13px;
  padding: 12px 22px; cursor: pointer; border: 1px solid var(--cyan); color: #e6fdff; background: rgba(34,230,255,0.08);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background .18s, transform .12s, box-shadow .18s, color .18s; }
.btn:hover { background: rgba(34,230,255,0.22); box-shadow: 0 0 22px rgba(34,230,255,0.35); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, #22e6ff, #0ea5e9); color: #021018; border-color: #7df9ff; }
.btn-primary:hover { background: linear-gradient(135deg, #7df9ff, #22d3ee); box-shadow: 0 0 30px rgba(34,230,255,0.6); }
.btn-danger { border-color: #ff4d6d; color: #ffd6de; background: rgba(255,77,109,0.1); }
.btn-danger:hover { background: rgba(255,77,109,0.25); box-shadow: 0 0 22px rgba(255,77,109,0.4); }
.btn-amber { border-color: var(--amber); color: #fff3d6; background: rgba(255,176,32,0.1); }
.btn-amber:hover { background: rgba(255,176,32,0.25); box-shadow: 0 0 22px rgba(255,176,32,0.4); }
.btn-ghost { border-color: rgba(148,163,184,0.35); color: #cbd5e1; background: rgba(15,23,42,0.5); }
.btn-steam-download {
  background: linear-gradient(135deg, #0284c7, #1e3a8a, #0f172a) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.45) !important;
}
.btn-steam-download:hover {
  background: linear-gradient(135deg, #38bdf8, #2563eb, #1e293b) !important;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.7) !important;
  transform: translateY(-2px) scale(1.03) !important;
}
.btn-sm { padding: 7px 12px; font-size: 10.5px; }
.btn-lg { padding: 16px 34px; font-size: 15px; }

.opt { cursor: pointer; border: 1px solid rgba(148,163,184,0.2); background: rgba(15,23,42,0.55); padding: 8px 10px;
  transition: all .15s; clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.opt:hover { border-color: rgba(34,230,255,0.6); background: rgba(34,230,255,0.08); }
.opt.sel { border-color: var(--cyan); background: rgba(34,230,255,0.16); box-shadow: inset 0 0 18px rgba(34,230,255,0.18); color: #fff; }
.opt.locked { opacity: .45; cursor: not-allowed; }

.field { width: 100%; background: rgba(2,6,15,0.75); border: 1px solid rgba(148,163,184,0.25); color: #f1f5f9; padding: 11px 13px; font-size: 15px; outline: none; transition: border .15s, box-shadow .15s; }
.field:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,230,255,0.15); }
.mod-slot-select {
  width: 100%;
  background: rgba(7, 16, 32, 0.92);
  border: 1px solid rgba(34, 211, 238, 0.42);
  color: #f1f5f9;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  outline: none;
  cursor: pointer;
  border-radius: 3px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.mod-slot-select:hover { border-color: rgba(34, 230, 255, 0.78); background: rgba(10, 22, 42, 0.96); }
.mod-slot-select:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(34, 230, 255, 0.2); }
.mod-slot-select option { background: #071020; color: #f1f5f9; }
.label { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #94a3b8; font-weight: 600; }

input[type=color] { -webkit-appearance: none; appearance: none; border: 1px solid rgba(148,163,184,0.4); width: 100%; height: 34px; padding: 2px; background: transparent; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; }
input[type=range] { accent-color: var(--cyan); }

.stat-bar { height: 6px; background: rgba(148,163,184,0.15); overflow: hidden; }
.stat-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, #22e6ff); box-shadow: 0 0 10px rgba(34,230,255,0.6); transition: width .35s ease; }

/* ---------- tier badges ---------- */
.tier-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 44px; font-family: 'Orbitron'; font-weight: 900; font-size: 11px; color: #0b0f19;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.tier-badge.sm { width: 24px; height: 27px; font-size: 8px; }
.tier-badge.lg { width: 74px; height: 82px; font-size: 16px; }

/* ---------- splash / title ---------- */
.splash-card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity 1s ease; }
.splash-card.show { opacity: 1; }
.studio-logo { width: min(340px, 62vw); height: auto; user-select: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 76%); mask-image: radial-gradient(circle at 50% 50%, #000 60%, transparent 76%);
  transform: scale(.94); transition: transform 2.6s cubic-bezier(.2,.7,.2,1); animation: logoGlow 2.4s ease-in-out infinite; }
.splash-card.show .studio-logo { transform: scale(1); }
@keyframes logoGlow { 0%,100% { filter: drop-shadow(0 0 10px rgba(34,230,255,.35)) brightness(1); } 50% { filter: drop-shadow(0 0 28px rgba(34,230,255,.6)) brightness(1.08); } }
@keyframes hexPulse { 0%,100% { filter: drop-shadow(0 0 12px rgba(34,230,255,.5)); } 50% { filter: drop-shadow(0 0 32px rgba(255,46,136,.7)); } }

.title-logo { font-family: 'Orbitron'; font-weight: 900; line-height: .9; letter-spacing: .06em; text-transform: uppercase;
  font-size: clamp(54px, 9vw, 132px); background: linear-gradient(180deg, #ffffff 0%, #a5f3fc 45%, #22d3ee 55%, #0e7490 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(34,230,255,0.45)); }
.title-logo .siege { display: block; background: linear-gradient(180deg, #ffe4f0 0%, #ff7ab6 45%, #ff2e88 55%, #9d174d 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 30px rgba(255,46,136,0.45)); }
.glitch { animation: glitch 6s infinite steps(1); }
@keyframes glitch { 0%, 92%, 100% { transform: none; } 93% { transform: translate(3px,-1px) skewX(4deg); } 94% { transform: translate(-3px,1px); } 95% { transform: none; } 97% { transform: translate(2px,0) skewX(-3deg); } }
.blink { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2,4,10,0.78);
  backdrop-filter: blur(6px);
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-wrap.open { display: flex; animation: screenIn .25s ease both; }
.modal-wrap > .panel,
.modal-wrap > div {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---------- HUD ---------- */
#hud { pointer-events: none; z-index: 20; }
#hud .interactive { pointer-events: auto; }
body.spectator-ui-hidden #float-layer,
body.spectator-ui-hidden .dmg-float,
body.spectator-ui-hidden .nameplate,
body.spectator-ui-hidden #hud-player-box,
body.spectator-ui-hidden #hud-minimap-box,
body.spectator-ui-hidden #hud-aux-box,
body.spectator-ui-hidden #hud-chat,
body.spectator-ui-hidden #hud-mode,
body.spectator-ui-hidden #hud-spectate,
body.spectator-ui-hidden #hud-reticle,
body.spectator-ui-hidden #hud-hitmarker,
body.spectator-ui-hidden #hud-nameplates,
body.spectator-ui-hidden #hud-ranked-chip,
body.spectator-ui-hidden #hud-toasts,
body.spectator-ui-hidden #hud-surrender,
body.spectator-ui-hidden #hud-mobile-controls,
body.spectator-ui-hidden #hud-spree,
body.spectator-ui-hidden #hud-flash,
body.spectator-ui-hidden #hud-lowhp,
#hud.spectator-ui-hidden #hud-player-box,
#hud.spectator-ui-hidden #hud-minimap-box,
#hud.spectator-ui-hidden #hud-aux-box,
#hud.spectator-ui-hidden #hud-chat,
#hud.spectator-ui-hidden #hud-mode,
#hud.spectator-ui-hidden #hud-spectate,
#hud.spectator-ui-hidden #hud-reticle,
#hud.spectator-ui-hidden #hud-hitmarker,
#hud.spectator-ui-hidden #hud-nameplates,
#hud.spectator-ui-hidden #hud-ranked-chip,
#hud.spectator-ui-hidden #hud-toasts,
#hud.spectator-ui-hidden #hud-surrender,
#hud.spectator-ui-hidden #hud-mobile-controls,
#hud.spectator-ui-hidden #hud-spree,
#hud.spectator-ui-hidden #hud-flash,
#hud.spectator-ui-hidden #hud-lowhp {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#hud.spectator-ui-hidden #hud-spectator-controls {
  opacity: 0;
  transition: opacity 0.25s ease;
}

#hud.spectator-ui-hidden #hud-spectator-controls:hover {
  opacity: 0.85;
}

@media ((hover: none) and (pointer: coarse)) {
  #hud.spectator-ui-hidden #hud-spectator-controls {
    opacity: 0.35 !important;
  }
}
.hp-frame { height: 18px; background: rgba(2,6,15,0.8); border: 1px solid rgba(148,163,184,0.3); position: relative; overflow: hidden;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.hp-fill { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, #10b981, #34d399); transition: transform .12s; }
.hp-ghost { position: absolute; inset: 0; transform-origin: left; background: #fca5a5; transition: transform .6s ease .25s; }
.hp-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 9%, rgba(2,6,15,0.65) 9% 10%); }
.reticle { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; pointer-events: none; z-index: 21; }
.reticle i { position: absolute; background: rgba(230,253,255,0.9); box-shadow: 0 0 6px rgba(34,230,255,0.9); }
.reticle .h { width: 9px; height: 2px; top: 16px; } .reticle .v { width: 2px; height: 9px; left: 16px; }
.reticle .l { left: 0; } .reticle .r { right: 0; } .reticle .t { top: 0; } .reticle .b { bottom: 0; }
.reticle .dot { width: 3px; height: 3px; left: 15.5px; top: 15.5px; border-radius: 50%; }
.hitmarker { position: fixed; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%,-50%) rotate(45deg); opacity: 0; pointer-events: none; z-index: 22; }
.hitmarker.on { animation: hm .25s ease-out; }
.hitmarker i { position: absolute; background: #fff; }
.hitmarker .a { width: 26px; height: 2px; top: 12px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%); }
.hitmarker .b { height: 26px; width: 2px; left: 12px; clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%, 0 65%, 100% 65%, 100% 100%, 0 100%); }
@keyframes hm { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.3); } 100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(1); } }

#hud-banner { position: fixed; left: 0; right: 0; top: 26%; text-align: center; pointer-events: none; z-index: 25; }
#hud-banner .big { font-family: Orbitron; font-weight: 900; font-size: clamp(42px, 7vw, 96px); letter-spacing: .1em; color: #fff;
  text-shadow: 0 0 24px rgba(34,230,255,0.8), 0 0 60px rgba(34,230,255,0.4); }
#hud-banner .sub { font-family: Orbitron; letter-spacing: .4em; font-size: 14px; color: #a5f3fc; margin-top: 6px; }
#hud-banner.pop .big { animation: bannerPop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes bannerPop { from { transform: scale(1.8); opacity: 0; filter: blur(8px); } to { transform: scale(1); opacity: 1; filter: none; } }

/* Killing Spree Red Metallic Graphic & Slam Animation */
#hud-spree {
  position: fixed;
  left: 0;
  right: 0;
  top: 20%;
  text-align: center;
  pointer-events: none;
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#hud-spree .spree-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 36px 12px;
  background: radial-gradient(ellipse at center, rgba(136, 19, 55, 0.45) 0%, rgba(76, 5, 25, 0.25) 45%, rgba(0, 0, 0, 0) 75%);
  border-top: 1px solid rgba(244, 63, 94, 0.4);
  border-bottom: 1px solid rgba(244, 63, 94, 0.4);
  backdrop-filter: blur(2px);
}
#hud-spree .spree-wrap::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff4d6d, #ffffff, #ff4d6d, transparent);
  box-shadow: 0 0 16px #ff1744;
}
#hud-spree .spree-wrap::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e11d48, #ff8080, #e11d48, transparent);
  box-shadow: 0 0 12px #e11d48;
}
#hud-spree .spree-title {
  font-family: Orbitron, sans-serif;
  font-weight: 900;
  font-size: clamp(38px, 6.5vw, 84px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.05;
  background: linear-gradient(180deg, #ffffff 0%, #ff9e9e 15%, #ef4444 38%, #881337 60%, #ff4d6d 80%, #4c0519 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 220, 220, 0.6);
  filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.95)) drop-shadow(0 4px 18px rgba(0, 0, 0, 0.95));
}
#hud-spree .spree-sub {
  font-family: Orbitron, sans-serif;
  font-weight: 700;
  letter-spacing: 0.45em;
  font-size: clamp(12px, 1.8vw, 16px);
  color: #fecdd3;
  margin-top: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(244, 63, 94, 0.9), 0 2px 8px #000;
}
#hud-spree.pop .spree-wrap {
  animation: spreeSlam 2.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes spreeSlam {
  0% {
    transform: scale(2.4);
    opacity: 0;
    filter: blur(14px) brightness(2.2);
  }
  18% {
    transform: scale(0.96);
    opacity: 1;
    filter: blur(0px) brightness(1.5);
  }
  26% {
    transform: scale(1.05);
    filter: brightness(1.1);
  }
  35% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  80% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    transform: scale(1.12) translateY(-12px);
    opacity: 0;
    filter: blur(8px);
  }
}

.module-hex { width: 74px; height: 82px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: rgba(34,230,255,0.25); padding: 2px; position: relative; }
.module-hex > div { width: 100%; height: 100%; clip-path: inherit; background: #050b16; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.module-hex.ready { background: linear-gradient(160deg, #22e6ff, #a78bfa); animation: hexPulse 1.6s infinite; }
.module-hex.used { background: rgba(100,116,139,0.35); opacity: .5; }
.module-hex .fillc { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(34,230,255,0.2); }
.module-hex.small { width: 60px; height: 67px; }
.module-hex.sealed { background: rgba(71,85,105,0.3); opacity: .45; }
.module-hex.sealed > div { background: repeating-linear-gradient(135deg, #050b16 0 6px, #0b1424 6px 12px); }
.module-hex .hex-key { position: relative; font-size: 9px; color: #fbbf24; margin-top: 1px; letter-spacing: .1em; }
.dash-pip { width: 46px; height: 6px; background: rgba(148,163,184,0.2); overflow: hidden; }
.dash-pip > i { display: block; height: 100%; background: #fbbf24; box-shadow: 0 0 10px rgba(251,191,36,.7); }

.feed-item { font-family: 'Rajdhani'; font-weight: 700; font-size: 14px; padding: 4px 10px; background: rgba(2,6,15,0.7); border-right: 2px solid currentColor; margin-bottom: 4px; animation: feedIn .25s ease both; text-align: right; }
.feed-item.hl { background: rgba(255,176,32,0.15); }
.feed-item.spree {
  background: linear-gradient(90deg, rgba(220,38,38,0.2), rgba(153,27,27,0.45));
  border-right: 3px solid #ef4444;
  color: #fca5a5;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 0 10px rgba(239,68,68,0.3);
  text-shadow: 0 0 8px rgba(239,68,68,0.6);
}
.feed-item.shutdown {
  background: linear-gradient(90deg, rgba(245,158,11,0.2), rgba(180,83,9,0.45));
  border-right: 3px solid #f59e0b;
  color: #fde68a;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 0 10px rgba(245,158,11,0.3);
  text-shadow: 0 0 8px rgba(245,158,11,0.6);
}
@keyframes feedIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.nameplate { position: fixed; transform: translate(-50%, -100%); pointer-events: none; text-align: center; z-index: 19; will-change: transform; }
.nameplate .n { font-family: Rajdhani; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.nameplate .b { width: 64px; height: 4px; background: rgba(0,0,0,0.6); margin: 2px auto 0; overflow: hidden; }
.nameplate .b > i { display: block; height: 100%; background: #f43f5e; }
.nameplate .st { font-size: 9px; font-family: 'JetBrains Mono'; color: #fbbf24; }

.dmg-float { position: fixed; transform: translate(-50%, -50%); font-family: 'Orbitron'; font-weight: 900; font-size: 18px; pointer-events: none; z-index: 30;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9); animation: floatUp .9s ease-out forwards; }
.dmg-float.big { font-size: 26px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 0) scale(1.6); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(.9); } }

#hud-flash { position: fixed; inset: 0; pointer-events: none; z-index: 18; opacity: 0; transition: opacity .25s;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,30,60,0.55) 100%); }
#hud-lowhp { position: fixed; inset: 0; pointer-events: none; z-index: 17; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(255,0,40,0.35) 100%); animation: lowhp 1s infinite; }
@keyframes lowhp { 50% { filter: brightness(1.8); } }

/* Fatal System Collapse Heavy Vignette & Catastrophic Blackout Screen */
#hud-collapse {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.35) 0%, rgba(2, 5, 12, 0.65) 50%, rgba(0, 0, 0, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  display: none;
}
body.is-collapsing #hud-collapse {
  display: block !important;
  opacity: 1 !important;
}
body.is-collapsing #game-canvas {
  filter: brightness(0.45) contrast(1.2) grayscale(0.35) !important;
  transition: filter 0.2s ease-out;
}
body.is-collapsing #vignette {
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.75) 100%) !important;
}

.hud-toast { font-family: Orbitron; font-size: 12px; letter-spacing: .2em; color: #fde68a; background: rgba(2,6,15,0.75); border: 1px solid rgba(251,191,36,0.4); padding: 8px 16px; animation: feedIn .3s ease both; }
.toast { pointer-events: auto; padding: 12px 18px; font-weight: 600; background: rgba(8,15,30,0.95); border-left: 3px solid var(--cyan); box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: feedIn .3s ease both; max-width: 380px; }
.toast.err { border-color: #ff4d6d; } .toast.warn { border-color: var(--amber); } .toast.ok { border-color: #34d399; }
.toast.dm { border-color: #d946ef; border-left-width: 4px; background: rgba(15,5,25,0.97); box-shadow: 0 0 18px rgba(217,70,239,0.35), 0 10px 30px rgba(0,0,0,0.5); animation: feedIn .3s ease both, dmPulse 1.8s ease-in-out 3; font-size: 14px; }
@keyframes dmPulse { 0%,100% { box-shadow: 0 0 18px rgba(217,70,239,0.35), 0 10px 30px rgba(0,0,0,0.5); } 50% { box-shadow: 0 0 28px rgba(217,70,239,0.65), 0 10px 30px rgba(0,0,0,0.5); } }

.scroll-thin::-webkit-scrollbar { width: 6px; } .scroll-thin::-webkit-scrollbar-thumb { background: rgba(34,230,255,0.3); }

.radar-ping { animation: radarPing 1s ease-out infinite; }
@keyframes radarPing { 0% { box-shadow: 0 0 0 0 rgba(250,204,21,0.7); } 100% { box-shadow: 0 0 0 16px rgba(250,204,21,0); } }

.mode-card { cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; }
.mode-card:hover { transform: translateY(-4px); }
.mode-card.sel { border-color: var(--cyan); box-shadow: 0 0 40px rgba(34,230,255,0.3); }

.spinner { width: 74px; height: 74px; border: 3px solid rgba(34,230,255,0.15); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.xp-bar { height: 8px; background: rgba(148,163,184,0.15); overflow: hidden; position: relative; }
.xp-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #a78bfa, #f0abfc); box-shadow: 0 0 10px rgba(240,171,252,0.6); transition: width .8s ease; }
.lvl-badge { font-family: Orbitron; font-weight: 900; background: linear-gradient(135deg, #a78bfa, #f0abfc); color: #1e1035; padding: 2px 8px; font-size: 11px; letter-spacing: .1em; }

kbd { font-family: 'JetBrains Mono'; font-size: 11px; padding: 1px 6px; border: 1px solid rgba(148,163,184,0.4); border-bottom-width: 2px; background: rgba(15,23,42,0.8); color: #e2e8f0; }

/* ---------- cleaned transparent tier badge images ---------- */
.tier-badge-img { display: inline-block; width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(34,230,255,0.4)); vertical-align: middle; }
.tier-badge-img.sm { width: 26px; height: 26px; filter: drop-shadow(0 0 4px rgba(34,230,255,0.3)); }
.tier-badge-img.lg { width: 88px; height: 88px; filter: drop-shadow(0 0 16px rgba(34,230,255,0.6)); }


/* ---------- in-game chat & lobby chat ---------- */
.chat-msg { padding: 2px 4px; border-radius: 2px; line-height: 1.35; word-break: break-word; }
.chat-msg.team { background: rgba(34,211,238,0.08); border-left: 2px solid #22d3ee; }
.chat-msg.all { background: rgba(148,163,184,0.06); border-left: 2px solid #94a3b8; }
.chat-msg.dm { background: rgba(217,70,239,0.08); border-left: 2px solid #d946ef; }
.chat-msg .sender { font-weight: 700; }
.chat-msg .time { font-size: 9px; color: #64748b; margin-left: 4px; }

/* ---------- room directory & staging room slots ---------- */
.room-card { transition: border-color .15s, background .15s; }
.room-card:hover { border-color: rgba(34,230,255,0.6); background: rgba(34,230,255,0.05); }
.room-slot { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: rgba(15,23,42,0.6); border: 1px solid rgba(51,65,85,0.5); border-radius: 2px; }
.room-slot.empty { border-style: dashed; border-color: rgba(71,85,105,0.4); background: rgba(2,6,15,0.4); }
.room-slot.host { border-left: 3px solid #22d3ee; }
.room-slot.opp { border-left: 3px solid #f43f5e; }
.room-slot.ally { border-left: 3px solid #22d3ee; }

/* ---------- Mobile Mode & Zero-Latency Touch Controls ---------- */
html, body {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game-canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.touch-enabled,
body.touch-enabled #hud,
body.touch-enabled #game-canvas,
.mobile-controls-layer {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#hud-nameplates,
#hud-flash,
#hud-lowhp {
  pointer-events: none !important;
}

#hud-spectator-controls {
  max-width: 96vw;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 768px) {
  #hud-spectator-controls {
    bottom: 76px !important;
    gap: 5px !important;
  }
  #hud-spectator-controls button {
    padding: 3px 7px !important;
    font-size: 10px !important;
  }
}

body.touch-enabled:not(.spectator-ui-hidden) #hud-mobile-controls,
body.spectator-mode.touch-enabled:not(.spectator-ui-hidden) #hud-mobile-controls,
body.is-spectator.touch-enabled:not(.spectator-ui-hidden) #hud-mobile-controls {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.mobile-controls-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 28;
}

/* Left: Virtual D-Pad Thumbstick */
.mobile-dpad-wrap {
  position: fixed;
  left: 24px;
  bottom: 85px;
  width: 148px;
  height: 148px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  z-index: 30;
}

.mobile-dpad {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.85) 0%, rgba(2, 6, 23, 0.94) 100%);
  border: 2px solid rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.2), inset 0 0 20px rgba(2, 6, 23, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.mobile-dpad-arrow {
  position: absolute;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.55);
  pointer-events: none;
  user-select: none;
  transition: color 0.1s, text-shadow 0.1s;
}

.mobile-dpad-arrow.up { top: 8px; left: 50%; transform: translateX(-50%); }
.mobile-dpad-arrow.down { bottom: 8px; left: 50%; transform: translateX(-50%); }
.mobile-dpad-arrow.left { left: 10px; top: 50%; transform: translateY(-50%); }
.mobile-dpad-arrow.right { right: 10px; top: 50%; transform: translateY(-50%); }
.mobile-dpad-arrow.active {
  color: #22d3ee;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.95);
}

.mobile-dpad-stick {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.45) 0%, rgba(14, 165, 233, 0.2) 100%);
  border: 2px solid #22d3ee;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
  pointer-events: none;
  will-change: transform;
}

/* Right: Action Buttons (Dash, Jump & Attack side-by-side) */
.mobile-actions-wrap {
  position: fixed;
  right: 18px;
  bottom: 105px;
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 30;
  touch-action: none;
}

.mobile-action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 0.08s, background 0.08s, box-shadow 0.08s;
  -webkit-tap-highlight-color: transparent;
}

/* DASH Button (Left of Jump) */
.mobile-action-btn.btn-dash {
  background: radial-gradient(circle, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(245, 158, 11, 0.65);
  color: #fcd34d;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}

.mobile-action-btn.btn-dash:active,
.mobile-action-btn.btn-dash.active {
  transform: scale(0.92);
  background: rgba(245, 158, 11, 0.35);
  border-color: #fbbf24;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.8);
}

.mobile-action-btn.btn-dash .btn-main-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

/* JUMP Button */
.mobile-action-btn.btn-jump {
  background: radial-gradient(circle, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(168, 85, 247, 0.65);
  color: #e9d5ff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}

.mobile-action-btn.btn-jump:active,
.mobile-action-btn.btn-jump.active {
  transform: scale(0.92);
  background: rgba(168, 85, 247, 0.35);
  border-color: #c084fc;
  box-shadow: 0 0 24px rgba(192, 132, 252, 0.8);
}

.mobile-action-btn.btn-jump .btn-main-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

/* ATTACK Button */
.mobile-action-btn.btn-attack {
  background: radial-gradient(circle, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(34, 211, 238, 0.65);
  color: #22d3ee;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.3);
}

.mobile-action-btn.btn-attack:active,
.mobile-action-btn.btn-attack.active {
  transform: scale(0.92);
  background: rgba(34, 211, 238, 0.35);
  border-color: #38bdf8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.8);
}

.mobile-action-btn.btn-attack .btn-main-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

/* Right Edge: Settings / Tactical Pause Button */
.mobile-settings-btn {
  position: fixed;
  right: 18px;
  top: 226px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s, border-color 0.1s, color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.mobile-settings-btn:active {
  transform: scale(0.9);
  border-color: #22d3ee;
  color: #22d3ee;
}

/* Chat & HUD adaptations on touch */
body.touch-enabled #hud-chat {
  bottom: 8px;
  left: 16px;
  width: 240px;
  pointer-events: auto;
}

body.touch-enabled #hud-chat-logs {
  height: 52px;
  font-size: 10px;
}

body.touch-enabled #hud-chat-channel-bar span {
  display: none;
}

body.touch-enabled #hud-modules {
  touch-action: none;
}

body.touch-enabled .module-hex {
  touch-action: none;
  cursor: pointer;
}

/* ================================================================ AUTO SCREEN-SIZE RESPONSIVENESS (DESKTOP PROPORTIONAL SHRINK) */
:root {
  --cs-ui-scale: 1.0;
  --cs-hangar-scale: 1.0;
  --cs-hangar-right-scale: 1.0;
  --cs-chat-scale: 1.0;
  --cs-dpad-size: 104px;
  --cs-action-btn-size: 44px;
  --cs-action-attack-size: 52px;
}

/* Fallback media query presets (JS dynamically calculates exact continuous scale) */
@media (max-height: 580px), (max-width: 960px) {
  :root {
    --cs-ui-scale: 0.50;
    --cs-hangar-scale: 0.54;
    --cs-hangar-right-scale: 0.58;
    --cs-chat-scale: 0.56;
    --cs-dpad-size: 104px;
    --cs-action-btn-size: 44px;
    --cs-action-attack-size: 52px;
  }
}

@media (min-height: 581px) and (max-height: 750px) and ((hover: none) and (pointer: coarse)) {
  :root {
    --cs-ui-scale: 0.78;
    --cs-hangar-scale: 0.82;
    --cs-hangar-right-scale: 0.86;
    --cs-chat-scale: 0.80;
    --cs-dpad-size: 122px;
    --cs-action-btn-size: 50px;
    --cs-action-attack-size: 58px;
  }
}

@media (min-height: 751px) and ((hover: none) and (pointer: coarse)) {
  :root {
    --cs-ui-scale: 0.95;
    --cs-hangar-scale: 0.98;
    --cs-hangar-right-scale: 1.0;
    --cs-chat-scale: 0.95;
    --cs-dpad-size: 134px;
    --cs-action-btn-size: 56px;
    --cs-action-attack-size: 64px;
  }
}

@media (max-height: 580px), (max-height: 700px), (max-width: 960px), ((hover: none) and (pointer: coarse)) {
  #btn-toggle-lobby-chat {
    display: none !important;
  }

  /* All Popups & Modals: Scrollable & comfortably fitted on mobile & tablet landscape */
  .modal-wrap {
    padding: max(6px, calc(var(--cs-ui-scale, 0.50) * 14px)) !important;
    overflow-y: auto !important;
    align-items: flex-start !important;
  }
  .modal-wrap > .panel,
  .modal-wrap > div {
    max-height: calc(100vh - 16px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding: max(10px, calc(var(--cs-ui-scale, 0.50) * 22px)) max(12px, calc(var(--cs-ui-scale, 0.50) * 24px)) !important;
    margin: auto !important;
    max-width: 96vw !important;
  }
  .modal-wrap .panel-title {
    font-size: max(11px, calc(var(--cs-ui-scale, 0.50) * 18px)) !important;
    margin-bottom: 4px !important;
  }
  .modal-wrap .font-display.text-2xl,
  .modal-wrap .font-display.text-3xl {
    font-size: max(16px, calc(var(--cs-ui-scale, 0.50) * 26px)) !important;
    margin-bottom: 4px !important;
  }
  .modal-wrap input,
  .modal-wrap select {
    padding: max(4px, calc(var(--cs-ui-scale, 0.50) * 8px)) max(8px, calc(var(--cs-ui-scale, 0.50) * 12px)) !important;
    font-size: max(11px, calc(var(--cs-ui-scale, 0.50) * 16px)) !important;
  }
  .modal-wrap .gap-4 {
    gap: max(8px, calc(var(--cs-ui-scale, 0.50) * 16px)) !important;
  }
  .modal-wrap .gap-3 {
    gap: max(6px, calc(var(--cs-ui-scale, 0.50) * 12px)) !important;
  }
  .modal-wrap .p-6,
  .modal-wrap .p-7 {
    padding: max(10px, calc(var(--cs-ui-scale, 0.50) * 24px)) max(14px, calc(var(--cs-ui-scale, 0.50) * 28px)) !important;
  }
  .modal-wrap .w-16.h-16 {
    width: max(38px, calc(var(--cs-ui-scale, 0.50) * 64px)) !important;
    height: max(38px, calc(var(--cs-ui-scale, 0.50) * 64px)) !important;
    font-size: max(18px, calc(var(--cs-ui-scale, 0.50) * 28px)) !important;
    margin-bottom: 4px !important;
  }

  /* 1. In-game HUD: Proportional shrinking keeping center 100% open */
  #hud-player-box {
    transform: scale(var(--cs-ui-scale, 0.48)) !important;
    transform-origin: top left !important;
    top: 8px !important;
    left: 8px !important;
  }
  #hud-minimap-box {
    transform: scale(calc(var(--cs-ui-scale, 0.48) * 0.94)) !important;
    transform-origin: top right !important;
    top: 8px !important;
    right: 8px !important;
  }
  #hud-minimap {
    width: 190px !important;
    height: 190px !important;
  }
  #hud-mode {
    top: 6px !important;
    left: 50% !important;
    transform: translateX(-50%) scale(calc(var(--cs-ui-scale, 0.48) * 1.05)) !important;
    transform-origin: top center !important;
  }
  #hud-toasts {
    top: 46px !important;
    left: 50% !important;
    transform: translateX(-50%) scale(calc(var(--cs-ui-scale, 0.48) * 1.10)) !important;
    transform-origin: top center !important;
  }

  /* Combat Chat: Responsive size & placed safely above D-Pad */
  #hud-chat {
    position: fixed !important;
    left: 14px !important;
    bottom: calc(var(--cs-dpad-size, 104px) + 20px) !important;
    width: calc(var(--cs-chat-scale, 0.54) * 140px + 230px) !important;
    transform: scale(var(--cs-chat-scale, 0.54)) !important;
    transform-origin: bottom left !important;
    z-index: 25 !important;
  }
  #hud-chat-logs {
    height: calc(var(--cs-chat-scale, 0.54) * 40px + 50px) !important;
    font-size: max(11px, calc(var(--cs-chat-scale, 0.54) * 15px)) !important;
  }

  /* Virtual Mobile Controls (Adaptive for Phone & Tablet thumb ergonomics) */
  .mobile-dpad-wrap {
    position: fixed !important;
    bottom: 14px !important;
    left: 14px !important;
    width: var(--cs-dpad-size, 104px) !important;
    height: var(--cs-dpad-size, 104px) !important;
    z-index: 30 !important;
  }
  .mobile-dpad-stick {
    width: calc(var(--cs-dpad-size, 104px) * 0.35) !important;
    height: calc(var(--cs-dpad-size, 104px) * 0.35) !important;
  }

  /* Action Buttons (Dash, Jump, Attack) placed cleanly on bottom right */
  .mobile-actions-wrap {
    position: fixed !important;
    bottom: 14px !important;
    right: 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: calc(var(--cs-action-btn-size, 44px) * 0.15) !important;
    z-index: 30 !important;
  }
  .mobile-action-btn {
    width: var(--cs-action-btn-size, 44px) !important;
    height: var(--cs-action-btn-size, 44px) !important;
  }
  .mobile-action-btn.btn-attack {
    width: var(--cs-action-attack-size, 52px) !important;
    height: var(--cs-action-attack-size, 52px) !important;
  }
  .mobile-action-btn .btn-main-label {
    font-size: max(8px, calc(var(--cs-action-btn-size, 44px) * 0.20)) !important;
  }
  .mobile-action-btn svg {
    width: max(14px, calc(var(--cs-action-btn-size, 44px) * 0.34)) !important;
    height: max(14px, calc(var(--cs-action-btn-size, 44px) * 0.34)) !important;
  }

  /* Aux Modules (Powerups) placed directly to the left of Action Buttons - ZERO OVERLAP */
  #hud-aux-box {
    position: fixed !important;
    right: calc(var(--cs-action-btn-size, 44px) * 2 + var(--cs-action-attack-size, 52px) + 36px) !important;
    bottom: 12px !important;
    transform: scale(var(--cs-ui-scale, 0.52)) !important;
    transform-origin: bottom right !important;
    z-index: 25 !important;
  }

  /* Tactical settings button below minimap on right edge */
  .mobile-settings-btn {
    top: calc(var(--cs-ui-scale, 0.48) * 140px + 30px) !important;
    right: 10px !important;
    width: max(30px, calc(var(--cs-action-btn-size, 44px) * 0.70)) !important;
    height: max(30px, calc(var(--cs-action-btn-size, 44px) * 0.70)) !important;
  }

  /* 2. Hangar Screen: Adaptive scaling keeping all panels visible exactly like PC */
  #hangar-top-bar {
    padding: calc(var(--cs-ui-scale, 0.48) * 6px) calc(var(--cs-ui-scale, 0.48) * 14px) !important;
    overflow: visible !important;
  }
  #hangar-top-bar .font-display.font-black {
    font-size: max(12px, calc(var(--cs-ui-scale, 0.48) * 22px)) !important;
    letter-spacing: 0.1em !important;
  }
  #hangar-top-actions {
    gap: calc(var(--cs-ui-scale, 0.48) * 6px) !important;
    max-width: calc(100vw - 120px) !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
  }
  #hangar-top-actions::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  #server-selector-container {
    position: relative !important;
    overflow: visible !important;
  }
  #server-dropdown-menu {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    z-index: 9999 !important;
  }
  #hangar-top-actions .btn-sm,
  #hangar-top-actions .btn {
    padding: max(2px, calc(var(--cs-ui-scale, 0.48) * 5px)) max(5px, calc(var(--cs-ui-scale, 0.48) * 10px)) !important;
    font-size: max(9px, calc(var(--cs-ui-scale, 0.48) * 15px)) !important;
  }

  /* Unified Left Column (Dossier + PWA button + Lobby Chat) scaled adaptively */
  #hangar-left-col {
    position: absolute !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px) !important;
    left: 8px !important;
    width: 320px !important;
    transform: scale(var(--cs-hangar-scale, 0.52)) !important;
    transform-origin: top left !important;
    z-index: 20 !important;
  }
  #btn-pilot-guide {
    left: calc(8px + 320px * var(--cs-hangar-scale, 0.52) + 6px) !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px) !important;
    transform: scale(var(--cs-hangar-scale, 0.52)) !important;
    transform-origin: top left !important;
  }
  #btn-honor-market {
    left: calc(8px + 320px * var(--cs-hangar-scale, 0.52) + 6px) !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px + 42px * var(--cs-hangar-scale, 0.52)) !important;
    transform: scale(var(--cs-hangar-scale, 0.52)) !important;
    transform-origin: top left !important;
  }
  #lobby-chat {
    height: calc(var(--cs-hangar-scale, 0.52) * 120px + 130px) !important;
  }
  #lobby-chat-logs {
    font-size: max(11px, calc(var(--cs-hangar-scale, 0.52) * 16px)) !important;
  }

  /* Chassis / Loadouts panel (Right Column) - Adaptive for Phone & Tablet readability */
  #hangar-right {
    position: absolute !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px) !important;
    right: 8px !important;
    width: 380px !important;
    bottom: 38px !important;
    transform: scale(var(--cs-hangar-right-scale, 0.55)) !important;
    transform-origin: top right !important;
    max-height: calc((100vh - 38px) / var(--cs-hangar-right-scale, 0.55)) !important;
    overflow-y: auto !important;
    z-index: 20 !important;
  }

  /* Deploy button & Toasts */
  #scr-hangar .absolute.bottom-5 {
    bottom: 8px !important;
    z-index: 35 !important;
  }
  #btn-deploy {
    padding: calc(var(--cs-ui-scale, 0.48) * 8px + 2px) calc(var(--cs-ui-scale, 0.48) * 26px + 10px) !important;
    font-size: max(12px, calc(var(--cs-ui-scale, 0.48) * 20px)) !important;
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.4) !important;
    transform: scale(calc(var(--cs-ui-scale, 0.48) * 1.3)) !important;
    transform-origin: bottom center !important;
  }
  #hangar-hint {
    display: none !important;
  }
  #toasts {
    top: 38px !important;
    right: 8px !important;
    bottom: auto !important;
    transform: scale(var(--cs-ui-scale, 0.70)) !important;
    transform-origin: top right !important;
  }

  /* Mode Select Screen Auto-Adjustment */
  #scr-modes .panel-title {
    font-size: max(10px, calc(var(--cs-ui-scale, 0.48) * 16px)) !important;
    margin-bottom: 2px !important;
  }
  #scr-modes .font-display {
    font-size: max(18px, calc(var(--cs-ui-scale, 0.48) * 30px)) !important;
    margin-bottom: 8px !important;
  }
  #scr-modes #mode-cards {
    gap: calc(var(--cs-ui-scale, 0.48) * 14px) !important;
  }
  #scr-modes .mode-card {
    padding: max(8px, calc(var(--cs-ui-scale, 0.48) * 16px)) max(10px, calc(var(--cs-ui-scale, 0.48) * 18px)) !important;
  }
  #scr-modes .mode-card .font-display {
    font-size: max(13px, calc(var(--cs-ui-scale, 0.48) * 20px)) !important;
  }
  #scr-modes .mode-card .text-sm {
    font-size: max(10px, calc(var(--cs-ui-scale, 0.48) * 15px)) !important;
    min-height: 0 !important;
    margin-top: 2px !important;
    line-height: 1.25 !important;
  }
  #scr-modes .mode-card ul {
    margin-top: 4px !important;
    font-size: max(9px, calc(var(--cs-ui-scale, 0.48) * 14px)) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  #scr-modes .mode-card ul li {
    margin-bottom: 1px !important;
  }
  #mode-diff-row {
    margin-top: 6px !important;
  }
  #mode-note {
    font-size: max(10px, calc(var(--cs-ui-scale, 0.48) * 15px)) !important;
    margin-top: 4px !important;
  }
}

/* Mobile Orientation Prompt (Non-blocking floating banner) */
#mobile-rotate-overlay {
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes phoneRock {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-25deg); }
  75% { transform: rotate(65deg); }
}
.rotate-icon-anim {
  display: inline-block;
  animation: phoneRock 2.6s ease-in-out infinite;
  transform-origin: center center;
}

/* ================================================================ SPECIAL BADGES (VIP & WORLD RANKING 1-10) */
.special-badge-img {
  display: inline-block;
  height: 1.5em;
  width: auto;
  max-height: 26px;
  min-height: 18px;
  vertical-align: -0.26em;
  object-fit: contain;
  margin-right: 4px;
  pointer-events: none;
  user-select: none;
}
.special-badge-vip {
  filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.95));
}
.special-badge-gold {
  filter: drop-shadow(0 0 7px rgba(251, 191, 36, 1));
}
.special-badge-silver {
  filter: drop-shadow(0 0 7px rgba(226, 232, 240, 1));
}
.special-badge-bronze {
  filter: drop-shadow(0 0 6px rgba(217, 119, 6, 0.95));
}
.special-badge-top10-star {
  display: inline-block;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  font-size: 0.82em;
  line-height: 1;
  vertical-align: 0.05em;
  margin-right: 4px;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.9), 0 0 10px rgba(226, 232, 240, 0.55);
  pointer-events: none;
  user-select: none;
}

/* --- Top 1 World Ranking: Gold Aura Shine (Reserved for Top 1) --- */
@keyframes rankGoldShimmer {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 0 13px rgba(253, 224, 71, 1)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
}
.rank-gold-name {
  background: linear-gradient(90deg, #fde047 0%, #fffbeb 25%, #f59e0b 50%, #fef08a 75%, #fbbf24 100%);
  background-size: 220% auto;
  color: #fde047 !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  animation: rankGoldShimmer 3s linear infinite;
}

/* --- Top 2 World Ranking: Silver Aura Shine --- */
@keyframes rankSilverShimmer {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(203, 213, 225, 0.8)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 0 13px rgba(255, 255, 255, 1)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(203, 213, 225, 0.8)); }
}
.rank-silver-name {
  background: linear-gradient(90deg, #e2e8f0 0%, #ffffff 25%, #94a3b8 50%, #f8fafc 75%, #cbd5e1 100%);
  background-size: 220% auto;
  color: #e2e8f0 !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  animation: rankSilverShimmer 3s linear infinite;
}

/* --- Top 3 World Ranking: Brownish Bronze Glow --- */
@keyframes rankBronzeShimmer {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 5px rgba(217, 119, 6, 0.8)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 0 11px rgba(245, 158, 11, 0.95)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 5px rgba(217, 119, 6, 0.8)); }
}
.rank-bronze-name {
  background: linear-gradient(90deg, #d97706 0%, #fed7aa 25%, #b45309 50%, #fde68a 75%, #92400e 100%);
  background-size: 220% auto;
  color: #d97706 !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  animation: rankBronzeShimmer 3s linear infinite;
}

/* ================================================================ 30-DAY VIP (RED GLOW) & CASH SHOP */
@keyframes vipRedShimmer {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.8)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 0 12px rgba(251, 113, 133, 1)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.8)); }
}

.vip-red-name {
  background: linear-gradient(90deg, #f43f5e 0%, #ffe4e6 25%, #e11d48 50%, #fecdd3 75%, #fb7185 100%);
  background-size: 220% auto;
  color: #fb7185 !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  animation: vipRedShimmer 3s linear infinite;
}

@keyframes vipGoldShimmer {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 0 12px rgba(253, 224, 71, 0.95)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75)); }
}

.vip-gold-name {
  background: linear-gradient(90deg, #fde047 0%, #fffbeb 25%, #f59e0b 50%, #fef08a 75%, #fbbf24 100%);
  background-size: 220% auto;
  color: #fde047 !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  animation: vipGoldShimmer 3s linear infinite;
}

.vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 55%, #fb7185 100%);
  border: 1px solid #fda4af;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.65);
  vertical-align: middle;
  margin-left: 4px;
}

#dos-vip-chip {
  margin-left: 0;
  max-width: 120px;
}

.vip-gold-hp,
#hud-hp-fill.vip-gold-hp {
  /* Health bar fill strictly maintains team color - zero inner gold tint */
  box-shadow: none !important;
  filter: none !important;
  animation: none !important;
  background-image: none !important;
}

.vip-red-bar,
.vip-gold-bar {
  outline: 1.5px solid rgba(244, 63, 94, 0.85) !important;
  outline-offset: 1px !important;
  box-shadow: 0 0 4px rgba(244, 63, 94, 0.5) !important;
}

.nameplate .b.vip-red-bar,
.nameplate .b.vip-gold-bar {
  outline: 1px solid rgba(244, 63, 94, 0.9) !important;
  outline-offset: 1px !important;
  box-shadow: 0 0 3px rgba(244, 63, 94, 0.5) !important;
  border: none !important;
}

.nameplate .b.vip-gold-bar > i {
  /* Fill remains 100% blue for ally and red for enemy - strictly no gold filter, shadow, or gradient */
  box-shadow: none !important;
  filter: none !important;
  background-image: none !important;
}

.cash-shop-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(9, 13, 24, 0.96) 100%);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.cash-shop-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.cash-shop-card.vip-card {
  background: linear-gradient(180deg, rgba(45, 31, 8, 0.92) 0%, rgba(18, 13, 6, 0.97) 100%);
  border: 1.5px solid rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 26px rgba(251, 191, 36, 0.22);
}
.cash-shop-card.vip-card:hover {
  border-color: #fde047;
  box-shadow: 0 0 34px rgba(251, 191, 36, 0.42);
}

.bag-unbox-anim {
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#modal-cash-shop > .panel {
  width: min(980px, 96vw) !important;
  max-width: 96vw !important;
  max-height: calc(100vh - 16px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

#modal-cash-shop .store-grid {
  overflow: visible !important;
  flex: none !important;
  min-height: min-content !important;
}

#modal-confirm {
  z-index: 88 !important;
}

#modal-honor-market > .panel {
  width: min(920px, 96vw) !important;
  max-width: 96vw !important;
  max-height: calc(100vh - 16px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 680px) {
  #btn-pilot-guide {
    left: 8px !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px + 485px * var(--cs-hangar-scale, 0.52)) !important;
    transform: scale(var(--cs-hangar-scale, 0.52)) !important;
    transform-origin: top left !important;
  }
  #btn-honor-market {
    left: calc(8px + 148px * var(--cs-hangar-scale, 0.52)) !important;
    top: calc(var(--cs-ui-scale, 0.48) * 20px + 24px + 485px * var(--cs-hangar-scale, 0.52)) !important;
    transform: scale(var(--cs-hangar-scale, 0.52)) !important;
    transform-origin: top left !important;
  }
}

@media (max-width: 960px), (max-height: 700px), ((hover: none) and (pointer: coarse)) {
  #modal-honor-market {
    padding: 6px !important;
    align-items: flex-start !important;
  }
  #modal-honor-market > .panel {
    width: 96vw !important;
    max-width: 96vw !important;
    padding: 12px 14px !important;
    margin: 6px auto !important;
    max-height: calc(100vh - 12px) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #modal-honor-market .hm-balances {
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
    margin-bottom: 8px !important;
  }
  #modal-honor-market #honor-market-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 10px !important;
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
    max-height: none !important;
    padding: 10px !important;
  }

  /* Ensure inner scrollable sections in flex modals never collapse on short mobile landscape viewports */
  #modal-trade-tools > .panel,
  #modal-rooms > .panel,
  #modal-create-practice > .panel,
  #modal-friends > .panel,
  #modal-guide > .panel,
  #modal-history > .panel,
  #modal-leaderboard > .panel {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: calc(100vh - 12px) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #trade-tools-body,
  #rooms-list,
  #hist-rows,
  #guide-content-area {
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
    max-height: none !important;
  }
  #modal-guide > .panel > div.flex-1 {
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
  }
  #modal-friends > .panel > div.flex-1 {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important;
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
  }
  #friends-list,
  #dm-chat-logs {
    min-height: 130px !important;
    max-height: 210px !important;
    overflow-y: auto !important;
  }

  /* Waiting / Briefing Room (#scr-room) mobile responsiveness */
  #scr-room #room-main-grid {
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  }
  #scr-room #room-t0-slots,
  #scr-room #room-t1-slots {
    min-height: 110px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
  }

  /* Post-Match Summary (#scr-summary) mobile sizing */
  #scr-summary #sum-outcome {
    font-size: clamp(28px, 6vw, 48px) !important;
  }

  #modal-cash-shop {
    padding: 6px !important;
    align-items: flex-start !important;
  }
  #modal-cash-shop > .panel {
    width: 96vw !important;
    max-width: 96vw !important;
    padding: 12px 14px !important;
    margin: 6px auto !important;
    max-height: calc(100vh - 12px) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #modal-cash-shop .store-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 10px !important;
    overflow: visible !important;
    flex: none !important;
    min-height: min-content !important;
    padding-bottom: 12px !important;
  }
  #modal-cash-shop .cash-shop-card {
    min-height: 230px !important;
    padding: 12px !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }
  #modal-cash-shop .cs-inv-strip {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 6px !important;
    padding: 6px !important;
    margin-bottom: 10px !important;
  }
  #modal-cash-shop .cs-inv-item {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }
  #modal-cash-shop .cs-header {
    margin-bottom: 8px !important;
    padding-bottom: 6px !important;
  }
  #modal-cash-shop .cs-header .font-display.text-2xl {
    font-size: 17px !important;
  }
  #modal-cash-shop .cs-header .text-xs {
    font-size: 11px !important;
  }
}

/* Pilot Field Guide styling */
.guide-topic-btn {
  transition: all 0.15s ease-in-out;
}
.guide-topic-btn.active {
  background: rgba(6, 182, 212, 0.22) !important;
  border-color: rgba(34, 211, 238, 0.8) !important;
  color: #a5f3fc !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.25) !important;
}





