:root {
  --cyan: #5ff6ff; --violet: #c77dff; --gold: #ffcc33; --red: #ff4d5e; --green: #4dff88;
  --ink: #e9f6ff; --panel: rgba(8, 10, 20, 0.92);
  --display: "Orbitron", "Arial Black", sans-serif;
  --body: "Rajdhani", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #07060d; color: var(--ink); font-family: var(--body); user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 20, 40, 0.65) 100%); transition: opacity 0.1s; }
#hurtdir { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; opacity: 0; }
#hurtdir::before { content: ""; position: absolute; left: 50%; top: 0; width: 70px; height: 18px; margin-left: -35px; background: radial-gradient(ellipse at center, rgba(255, 60, 70, 0.95), rgba(255, 0, 0, 0)); border-radius: 50%; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: rgba(230, 255, 255, 0.9); box-shadow: 0 0 3px #000; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { width: 9px; height: 2px; top: -1px; }
#hitmark { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; opacity: 0;
  background: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmark.crit { background: linear-gradient(45deg, transparent 42%, var(--red) 42%, var(--red) 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--red) 42%, var(--red) 58%, transparent 58%); }

#top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 32px)); text-align: center; }
#raid { font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: 3px; text-shadow: 0 0 12px rgba(95, 246, 255, 0.5); }
#left { font-size: 15px; opacity: 0.8; margin-bottom: 6px; letter-spacing: 1px; }
.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; font-weight: 700; letter-spacing: 2px; }
.bar span { width: 120px; text-align: right; }
.bar > div { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.12); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); }
.bar b { display: block; height: 100%; width: 100%; transition: width 0.2s; }
.crystal b { background: linear-gradient(90deg, #2bb7ff, var(--cyan)); box-shadow: 0 0 10px var(--cyan); }
.crystal.hit b { background: linear-gradient(90deg, #ff2b4a, #ff8a8a); }
.decode b { background: linear-gradient(90deg, #ff9d00, var(--gold)); }
#boss { position: absolute; top: 132px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); text-align: center; font-family: var(--display); font-size: 13px; letter-spacing: 3px; color: var(--gold); }
#boss > div { height: 12px; margin-top: 4px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 204, 51, 0.6); border-radius: 6px; overflow: hidden; }
#boss b { display: block; height: 100%; background: linear-gradient(90deg, #ff6a00, var(--gold)); }
#warn { position: absolute; top: 30%; width: 100%; text-align: center; font-family: var(--display); font-size: 20px; color: var(--red); letter-spacing: 3px; text-shadow: 0 0 14px rgba(255, 0, 40, 0.8); animation: blink 0.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

#radio { position: absolute; left: 16px; top: 34%; width: min(340px, calc(100% - 32px)); background: rgba(6, 14, 22, 0.82); border-left: 3px solid var(--cyan); padding: 10px 12px; border-radius: 4px; font-size: 17px; line-height: 1.3; font-weight: 600; }
#radio .who { font-family: var(--display); font-size: 11px; letter-spacing: 3px; color: var(--cyan); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
#radio .who i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: blink 0.5s steps(2) infinite; }

#center { position: absolute; top: 22%; width: 100%; text-align: center; opacity: 0; transition: opacity 0.4s; }
#center-big { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 5vw, 56px); letter-spacing: 6px; text-shadow: 0 0 24px rgba(95, 246, 255, 0.6); }
#center-sub { font-size: 20px; font-weight: 600; letter-spacing: 1px; opacity: 0.9; margin-top: 4px; }
#center.red #center-big { color: #ff6b77; text-shadow: 0 0 24px rgba(255, 30, 60, 0.7); }
#center.green #center-big { color: var(--green); text-shadow: 0 0 24px rgba(40, 255, 120, 0.5); }
#center.gold #center-big { color: var(--gold); text-shadow: 0 0 24px rgba(255, 200, 40, 0.7); }

#health { position: absolute; left: 18px; bottom: 18px; width: 240px; }
#health .lbl { font-family: var(--display); font-size: 11px; letter-spacing: 3px; opacity: 0.8; }
.hbar { height: 14px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; overflow: hidden; margin: 4px 0 6px; }
.hbar b { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #a3e635); transition: width 0.15s; }
.hbar b.low { background: linear-gradient(90deg, #dc2626, #f97316); }
#grenades { font-size: 14px; font-weight: 700; letter-spacing: 1px; display: flex; gap: 5px; align-items: center; }
#grenades i { width: 12px; height: 14px; border-radius: 5px 5px 6px 6px; background: #8aa35a; box-shadow: inset 0 -3px 0 #4a5a2a; display: inline-block; }
#grenades i.empty { background: rgba(255, 255, 255, 0.15); box-shadow: none; }

#ammo { position: absolute; right: 18px; bottom: 18px; text-align: right; }
#wname { font-family: var(--display); font-size: 13px; letter-spacing: 3px; color: var(--cyan); }
#count b { font-family: var(--display); font-size: 44px; font-weight: 700; }
#count span { font-size: 22px; opacity: 0.7; margin-left: 6px; font-weight: 600; }
#count.empty b { color: var(--red); }
#slots { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
#slots div { font-size: 12px; font-weight: 700; padding: 2px 7px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; opacity: 0.6; }
#slots div.on { border-color: var(--cyan); color: var(--cyan); opacity: 1; }
#slots div.locked { opacity: 0.2; }
#reloading { font-family: var(--display); font-size: 13px; letter-spacing: 3px; color: var(--gold); margin-top: 4px; animation: blink 0.4s steps(2) infinite; }
#radar { position: absolute; left: 50%; bottom: 14px; width: 150px; height: 150px; margin-left: -75px; border-radius: 50%; opacity: 0.9; }
#hints { position: absolute; right: 18px; top: 16px; font-size: 13px; text-align: right; opacity: 0.7; line-height: 1.6; font-weight: 600; }
#hints b { color: var(--gold); font-weight: 700; }
#down { position: absolute; top: 40%; width: 100%; text-align: center; font-family: var(--display); font-size: 34px; color: var(--red); letter-spacing: 4px; }
#down-t { font-size: 64px; color: #fff; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.screen.dim { background: rgba(4, 3, 10, 0.68); backdrop-filter: blur(3px); }
#title { background: radial-gradient(ellipse at center, rgba(4, 3, 10, 0.1), rgba(4, 3, 10, 0.75)); }
#loading { background: #07060d; }
.logo { font-family: var(--display); font-weight: 900; font-size: clamp(44px, 9vw, 108px); letter-spacing: 6px; line-height: 1; display: flex; gap: 0.3em; text-shadow: 0 0 30px rgba(95, 246, 255, 0.55); }
.logo span { color: var(--cyan); }
.tag { margin: 14px 0 24px; font-size: 20px; font-weight: 600; opacity: 0.9; text-align: center; letter-spacing: 1px; }
.foot { position: absolute; bottom: 12px; font-size: 14px; opacity: 0.65; text-align: center; padding: 0 16px; }
.panel { background: var(--panel); border: 1px solid rgba(95, 246, 255, 0.25); border-radius: 14px; padding: 24px 28px; min-width: min(420px, 100%); max-width: 100%; max-height: 100%; overflow: auto; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(95, 246, 255, 0.08); }
.panel.wide { width: min(680px, 100%); text-align: left; }
.panel h2 { margin: 0 0 14px; font-family: var(--display); font-size: 30px; letter-spacing: 5px; text-align: center; }
.panel p { font-size: 18px; opacity: 0.85; }
.menu { display: flex; flex-direction: column; gap: 6px; width: min(380px, 100%); margin: 0 auto; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px; border-radius: 6px; font-family: var(--display); font-size: 15px; letter-spacing: 2px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.item.button { justify-content: center; }
.item.focus { background: rgba(95, 246, 255, 0.14); border-color: var(--cyan); box-shadow: 0 0 16px rgba(95, 246, 255, 0.25); }
.item .val { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.item .arrow { opacity: 0.6; padding: 0 4px; }
#over-sub { font-size: 20px; margin: -4px 0 14px; opacity: 0.9; }
#over-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 0 auto 18px; width: min(360px, 100%); font-size: 18px; font-weight: 600; text-align: left; }
#over-stats b { color: var(--gold); float: right; }
#info-body { font-size: 17px; line-height: 1.5; margin-bottom: 16px; }
#info-body h3 { font-family: var(--display); font-size: 14px; letter-spacing: 3px; color: var(--cyan); margin: 14px 0 4px; }
#info-body b { color: var(--gold); }
#info-body table { width: 100%; border-collapse: collapse; }
#info-body td { padding: 2px 6px; vertical-align: top; }
#info-body td:first-child { color: var(--gold); white-space: nowrap; font-weight: 700; }

@media (max-width: 700px) {
  #radio { top: auto; bottom: 190px; font-size: 15px; }
  #radar { width: 110px; height: 110px; margin-left: -55px; }
  #hints { display: none; }
  .bar span { width: 92px; font-size: 11px; }
}
@media (max-height: 760px) { .tag { margin: 8px 0 14px; font-size: 17px; } .item { padding: 7px 14px; font-size: 14px; } }

/* ---------- Defeat ---------- */
#defeat { background: radial-gradient(ellipse at center, rgba(70, 0, 10, 0.55), rgba(8, 0, 2, 0.94) 70%); overflow: hidden; animation: def-in 0.4s ease-out; }
#def-cracks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#def-cracks polyline { fill: none; stroke: rgba(255, 210, 220, 0.55); stroke-width: 2; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: crack 0.5s 0.15s ease-out forwards; }
.def-word { font-family: var(--display); font-weight: 900; font-size: clamp(72px, 17vw, 220px); letter-spacing: 0.08em; line-height: 1; color: #ff2d45;
  text-shadow: 0 0 40px rgba(255, 0, 40, 0.8), 0 0 120px rgba(255, 0, 40, 0.5), 0 10px 0 #4a0010; animation: slam 0.55s cubic-bezier(.2, 1.6, .4, 1) both, shake 0.5s 0.5s; }
.def-sub { font-family: var(--display); font-size: clamp(16px, 2.4vw, 26px); letter-spacing: 6px; margin-top: 10px; color: #ffd0d6; opacity: 0; animation: fade 0.6s 0.6s forwards; }
.def-info { font-size: 20px; font-weight: 600; margin: 10px 0 30px; opacity: 0; animation: fade 0.6s 0.9s forwards; text-align: center; }
.def-menu { opacity: 0; animation: fade 0.5s 1.3s forwards; }
.def-menu .item.focus { background: rgba(255, 45, 69, 0.2); border-color: #ff2d45; box-shadow: 0 0 18px rgba(255, 45, 69, 0.4); }
@keyframes def-in { from { background-color: rgba(255, 255, 255, 0.6); } }
@keyframes slam { 0% { transform: scale(3.2); opacity: 0; filter: blur(12px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-10px, 4px); } 40% { transform: translate(8px, -6px); } 60% { transform: translate(-6px, 2px); } 80% { transform: translate(4px, -2px); } }
@keyframes crack { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* ---------- Building ---------- */
#scrap { margin-top: 6px; font-family: var(--display); font-size: 12px; letter-spacing: 2px; color: #ffd27a; }
#scrap b { font-size: 16px; }
#buildhint { position: absolute; left: 50%; bottom: 178px; transform: translateX(-50%); font-family: var(--display); font-size: 14px; letter-spacing: 2px; color: #ffd27a;
  background: rgba(10, 8, 4, 0.7); border: 1px solid rgba(255, 210, 122, 0.5); border-radius: 6px; padding: 7px 14px; white-space: nowrap; animation: blink 1.2s steps(2) infinite; }
#buildbar { position: absolute; left: 50%; bottom: 172px; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); text-align: center;
  background: rgba(8, 10, 18, 0.85); border: 1px solid rgba(255, 210, 122, 0.45); border-radius: 10px; padding: 10px 12px; }
.bb-title { font-family: var(--display); font-size: 13px; letter-spacing: 3px; color: #ffd27a; margin-bottom: 8px; }
.bb-title span { color: #fff; margin-left: 10px; }
#bb-items { display: flex; gap: 8px; justify-content: center; }
#bb-items div { flex: 1; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 6px 4px; font-family: var(--display); font-size: 11px; letter-spacing: 1px; }
#bb-items div i { display: block; font-style: normal; color: #ffd27a; font-size: 13px; margin-top: 3px; }
#bb-items div.on { border-color: #ffd27a; background: rgba(255, 210, 122, 0.15); box-shadow: 0 0 12px rgba(255, 210, 122, 0.3); }
#bb-items div.poor { opacity: 0.4; }
#bb-info { font-size: 15px; font-weight: 600; margin-top: 7px; opacity: 0.9; }
#bb-keys { font-size: 13px; margin-top: 4px; opacity: 0.7; font-weight: 600; }
#bb-keys b { color: #ffd27a; }

/* ---------- Upgrade cards ---------- */
#upgrade { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4, 3, 10, 0.55); pointer-events: auto; }
.up-title { font-family: var(--display); font-size: clamp(22px, 3.4vw, 34px); letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 20px rgba(255, 200, 40, 0.5); }
#upgrade-weapons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 8px 0 18px; }
#upgrade-weapons span { font-family: var(--display); font-size: 12px; letter-spacing: 2px; color: var(--cyan); border: 1px solid rgba(95, 246, 255, 0.4); border-radius: 4px; padding: 3px 8px; }
#upgrade-weapons span::before { content: "\25B2  "; color: var(--green); }
#upgrade-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 0 16px; }
.card { position: relative; width: 210px; min-height: 230px; padding: 18px 16px; border-radius: 12px; background: linear-gradient(180deg, rgba(20, 30, 46, 0.95), rgba(10, 12, 22, 0.95));
  border: 1px solid rgba(95, 246, 255, 0.3); text-align: center; cursor: pointer; transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; }
.card.focus { transform: translateY(-6px) scale(1.04); border-color: var(--gold); box-shadow: 0 0 26px rgba(255, 204, 51, 0.35); }
.card .key { position: absolute; top: 8px; left: 10px; font-family: var(--display); font-size: 13px; opacity: 0.6; }
.card .icon { width: 64px; height: 64px; margin: 6px auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 30px; font-weight: 900; color: #0b0d14; background: radial-gradient(circle at 35% 35%, #fff3b0, var(--gold) 60%, #b37a00); box-shadow: 0 0 18px rgba(255, 204, 51, 0.5); }
.card .name { font-family: var(--display); font-size: 14px; letter-spacing: 2px; margin-bottom: 8px; }
.card .text { font-size: 17px; font-weight: 600; opacity: 0.9; line-height: 1.25; }
.card .have { margin-top: 10px; font-size: 13px; color: var(--green); font-weight: 700; }
.up-hint { margin-top: 18px; font-size: 15px; opacity: 0.75; }
