* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #061014; }
body { font-family: "Segoe UI", "Leelawadee UI", Tahoma, sans-serif; color: #e8fbff; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.panel { position: absolute; background: rgba(6, 24, 30, 0.72); border: 1px solid rgba(95, 242, 255, 0.35); border-radius: 10px; padding: 10px 14px; backdrop-filter: blur(4px); }
.tag { font-size: 10px; letter-spacing: 2px; color: #7fd8e6; font-weight: 700; }
.bar { height: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 5px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; width: 0; transition: width 0.15s; }

#vitals { top: 16px; left: 16px; width: 290px; }
#vitals .patient { font-weight: 800; font-size: 16px; margin-top: 2px; }
#vitals .patient span { font-size: 10px; color: #8ab; font-weight: 600; margin-left: 6px; }
#vitals .row { display: flex; justify-content: space-between; font-size: 12px; margin-top: 3px; color: #bde; }
#hpFill { background: #3cf0a0; }
#ecg { width: 100%; height: 26px; margin-top: 4px; }
#ecg path { fill: none; stroke: #3cf0a0; stroke-width: 2; stroke-dasharray: 260; animation: ecg 1.4s linear infinite; }
#vitals.critical { border-color: #ff4d5e; animation: crit 0.6s infinite alternate; }
#vitals.critical #ecg path { stroke: #ff4d5e; animation-duration: 0.6s; }
@keyframes ecg { from { stroke-dashoffset: 520; } to { stroke-dashoffset: 0; } }
@keyframes crit { to { box-shadow: 0 0 18px rgba(255, 77, 94, 0.6); } }

#dtBox { margin-top: 10px; }
.tag.dt { color: #4fb8ff; }
#dtFill { background: linear-gradient(90deg, #1f6fd0, #4fb8ff); }
#dtBox .hint { font-size: 10px; color: #6a8; margin-top: 3px; letter-spacing: 1px; }
#dtBox.ready .hint { color: #8fe9ff; animation: blink 0.8s infinite alternate; }
#dtBox.ready #dtFill { box-shadow: 0 0 10px #4fb8ff; }
#dtBox.active #dtFill { background: linear-gradient(90deg, #5ff2ff, #ffffff); animation: blink 0.25s infinite alternate; }
#dtBox.active .hint { color: #fff; }
@keyframes blink { to { opacity: 0.55; } }

#orbs { top: 16px; right: 16px; font-weight: 700; font-size: 13px; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
#orbs b { font-size: 20px; color: #ff6b78; }
.orb { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #ff3344 50%, #800); box-shadow: 0 0 8px #ff3344; }

#style { position: absolute; right: 30px; top: 90px; text-align: right; transition: opacity 0.3s; }
#rankLetter { font-size: 96px; font-weight: 900; font-style: italic; line-height: 1; -webkit-text-stroke: 2px rgba(0, 0, 0, 0.6); text-shadow: 0 0 24px currentColor; }
#rankTitle { font-size: 18px; font-weight: 800; font-style: italic; letter-spacing: 1px; text-shadow: 0 2px 6px #000; }
.sbar { width: 200px; margin-left: auto; height: 6px; }
#styleFill { background: currentColor; transition: width 0.1s; }
#rankLetter.pop { animation: pop 0.35s ease-out; }
@keyframes pop { from { transform: scale(1.8) rotate(-8deg); opacity: 0.2; } to { transform: scale(1); opacity: 1; } }
#style.r0 { color: #8fa8c8; } #style.r1 { color: #5ff2ff; } #style.r2 { color: #7dff8a; }
#style.r3 { color: #ffe35a; } #style.r4 { color: #ff9a3c; } #style.r5 { color: #ff4f7b; }
#style.r6 { color: #ffd700; }
#style.r6 #rankLetter { animation: sss 0.5s infinite alternate; }
@keyframes sss { to { text-shadow: 0 0 40px #fff, 0 0 60px #ffd700; } }

#weapons { right: 16px; bottom: 16px; min-width: 270px; }
#weapons .w { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
#weapons .w + .w { border-top: 1px solid rgba(255, 255, 255, 0.08); }
#weapons .k { width: 26px; height: 26px; border: 1px solid #7fd8e6; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #7fd8e6; flex: none; }
#meleeName, #rangedName { font-weight: 800; font-size: 15px; }
.prod { font-size: 10px; color: #8ab; letter-spacing: 0.5px; }
#weapons .w.pop { animation: wpop 0.3s ease-out; }
@keyframes wpop { from { transform: translateX(-14px); opacity: 0.3; } }

#boss { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); width: min(620px, 60vw); text-align: center; }
#boss .bname { font-weight: 900; letter-spacing: 3px; font-size: 14px; color: #ff8ad8; text-shadow: 0 2px 6px #000; }
.bbar { height: 14px; border: 1px solid rgba(255, 120, 200, 0.5); }
#bossFill { background: linear-gradient(90deg, #a0207a, #ff4f9a); }

#banner { position: absolute; top: 24%; left: 0; right: 0; text-align: center; opacity: 0; }
#banner .t { font-size: 46px; font-weight: 900; font-style: italic; letter-spacing: 4px; text-shadow: 0 0 20px rgba(95, 242, 255, 0.7), 0 4px 10px #000; }
#banner .s { font-size: 18px; color: #bfefff; margin-top: 6px; text-shadow: 0 2px 6px #000; }
#banner.show { animation: banner 3.2s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

#toast { position: absolute; top: 36%; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 20px; color: #8fe9ff; text-shadow: 0 2px 8px #000; opacity: 0; }
#toast.show { animation: toast 1.8s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }

#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(6, 30, 38, 0.6), rgba(2, 8, 10, 0.92)); overflow: auto; padding: 20px; }
.box { max-width: 1040px; width: 100%; text-align: center; }
.box.small { max-width: 520px; }
.logo { font-size: clamp(40px, 7vw, 84px); font-weight: 900; font-style: italic; letter-spacing: 4px; color: #fff; text-shadow: 0 0 30px rgba(95, 242, 255, 0.7), 0 6px 0 #0c3b47; }
.logo span { color: #ff3355; text-shadow: 0 0 30px rgba(255, 51, 85, 0.8), 0 6px 0 #4a0d18; }
.subtitle { font-size: 18px; color: #9fe8f5; letter-spacing: 2px; margin-bottom: 22px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; text-align: left; }
.cols > div { background: rgba(6, 24, 30, 0.75); border: 1px solid rgba(95, 242, 255, 0.25); border-radius: 12px; padding: 16px 18px; }
h3 { font-size: 15px; letter-spacing: 2px; color: #7fd8e6; margin-bottom: 10px; }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 4px 0; vertical-align: top; }
.keys td:first-child { white-space: nowrap; padding-right: 12px; }
kbd { display: inline-block; padding: 1px 7px; border: 1px solid #6fb8c6; border-bottom-width: 3px; border-radius: 5px; font-family: inherit; font-size: 12px; background: rgba(255, 255, 255, 0.06); }
.arsenal { list-style: none; font-size: 13px; color: #bcd; }
.arsenal li { padding: 5px 0 5px 12px; border-left: 3px solid var(--c); margin-bottom: 6px; }
.arsenal b { color: var(--c); font-size: 14px; margin-right: 6px; }
.arsenal i { font-style: normal; font-size: 11px; color: #8ab; display: block; }
button { pointer-events: auto; margin-top: 22px; font: inherit; font-weight: 900; font-size: 20px; letter-spacing: 3px; padding: 14px 44px; border: none; border-radius: 10px; cursor: pointer; color: #041014; background: linear-gradient(135deg, #5ff2ff, #3cf0a0); box-shadow: 0 0 30px rgba(95, 242, 255, 0.5); transition: transform 0.1s; }
button:hover { transform: scale(1.05); }
.note { margin-top: 14px; font-size: 12px; color: #7a9aa4; }
#pause { cursor: pointer; }
#endStats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
#endStats div { background: rgba(6, 24, 30, 0.75); border: 1px solid rgba(95, 242, 255, 0.25); border-radius: 10px; padding: 10px; }
#endStats span { display: block; font-size: 12px; color: #8ab; }
#endStats b { font-size: 26px; }
#end:not(.win) .logo { text-shadow: 0 0 30px rgba(255, 51, 85, 0.8), 0 6px 0 #4a0d18; }

@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
