:root { --c1: #76ff03; --c2: #ff1744; --gold: #ffd54f; --bg: #0b0f0a; --panel: rgba(34, 48, 32, .86); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: #fff;
  font-family: "Russo One", system-ui, sans-serif; touch-action: none; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- экраны ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(5,10,5,.05) 0%, rgba(5,10,5,.45) 75%); z-index: 10; }
.panel { width: min(420px, 100%); background: var(--panel); border: 2px solid rgba(118,255,3,.45); border-radius: 22px;
  padding: 26px 22px 20px; text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 60px rgba(118,255,3,.12), inset 0 0 30px rgba(255,23,68,.05); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.logo { font-size: 58px; letter-spacing: 2px; line-height: 1; background: linear-gradient(90deg, var(--c1), #ccff90 45%, var(--c2));
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(118,255,3,.5));
  animation: twitch 4s infinite; }
@keyframes twitch { 0%, 92%, 100% { transform: none; } 93% { transform: translate(-3px, 1px) skewX(-6deg); } 95% { transform: translate(3px, -1px); } }
.logo span { font-size: 28px; }
.tag { color: #e6f5dc; font-size: 14px; letter-spacing: 3px; text-transform: uppercase; margin: 6px 0 20px; }
#nick { width: 100%; font: inherit; font-size: 20px; text-align: center; color: #fff; background: rgba(255,255,255,.06);
  border: 2px solid rgba(118,255,3,.35); border-radius: 14px; padding: 12px; outline: none; user-select: text; -webkit-user-select: text; }
#nick:focus { border-color: var(--c1); box-shadow: 0 0 18px rgba(118,255,3,.35); }
#colors { display: flex; justify-content: center; gap: 10px; margin: 14px 0 16px; flex-wrap: wrap; }
#colors button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
#colors button.on { border-color: #fff; box-shadow: 0 0 14px currentColor; transform: scale(1.12); }
.big { width: 100%; font-size: 32px; letter-spacing: 3px; color: #0b1405; border: 0; border-radius: 18px; padding: 20px 15px; min-height: 76px;
  background: linear-gradient(90deg, var(--c1), #ccff90); box-shadow: 0 6px 30px rgba(118,255,3,.45);
  animation: glow 1.6s ease-in-out infinite; }
.big:active { transform: scale(.97); }
@keyframes glow { 50% { box-shadow: 0 6px 44px rgba(118,255,3,.8); } }
.ghost { width: 100%; margin-top: 10px; font-size: 16px; color: #fff; background: rgba(255,23,68,.15);
  border: 1px solid rgba(255,23,68,.5); border-radius: 14px; padding: 12px; }
.link { background: none; border: 0; color: #cfe3c7; margin-top: 10px; font-size: 13px; }
.how { margin-top: 18px; font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.35; color: #f1f8ec; text-align: left; display: grid; gap: 6px; }
.how b { font-family: "Russo One", sans-serif; font-weight: normal; color: #fff; }
#online { margin-top: 14px; font-size: 14px; color: #ccff90; }
#bestMenu { margin-top: 4px; font-size: 14px; color: var(--gold); }

.dtitle { font-size: 30px; color: var(--c2); text-shadow: 0 0 20px rgba(255,23,68,.6); }
.place { font-size: 56px; color: var(--c1); text-shadow: 0 0 24px rgba(118,255,3,.6); margin: 4px 0; }
.killer { color: #b5c7ae; margin: 2px 0 16px; font-family: system-ui, sans-serif; }
.dstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.dstats div { background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px 4px; }
.dstats span { display: block; font-size: 22px; }
.dstats small { color: #8fa889; font-size: 11px; font-family: system-ui, sans-serif; }
.best { color: var(--gold); min-height: 20px; margin-bottom: 12px; font-size: 15px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 16px; background: rgba(8,12,8,.7);
  border-radius: 12px; padding: 6px 16px; font-size: 20px; white-space: nowrap; }
#waveN { color: var(--c1); text-shadow: 0 0 10px rgba(118,255,3,.6); }
#bossbar { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); width: min(420px, 70vw); text-align: center; }
#bossbar b { font-weight: normal; font-size: 14px; color: #ff5252; letter-spacing: 3px; text-shadow: 0 0 10px #ff1744; }
#bossbar div { height: 12px; margin-top: 3px; border-radius: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,82,82,.6); overflow: hidden; }
#bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #b71c1c, #ff5252); transition: width .2s; }
#team { position: absolute; left: 12px; top: 12px; display: grid; gap: 4px; font-size: 13px; }
#team div { display: flex; align-items: center; gap: 6px; background: rgba(8,12,8,.6); border-radius: 8px; padding: 3px 8px; min-width: 130px; }
#team div.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
#team .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
#team .h { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
#team .h i { display: block; height: 100%; background: #69f0ae; }
#team .down { color: #ff5252; animation: blink .6s infinite; }
#team .dead { opacity: .45; }
@keyframes blink { 50% { opacity: .3; } }
#mini { position: absolute; left: 12px; bottom: 12px; width: 150px; height: 150px; border-radius: 12px;
  background: rgba(8,12,8,.6); border: 1px solid rgba(118,255,3,.2); }
#bars { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(320px, 50vw); }
#bars .bar { height: 16px; border-radius: 8px; background: rgba(255,255,255,.14); overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.2); }
#bars i { display: block; height: 100%; width: 100%; transition: width .15s; background: linear-gradient(90deg, #ff1744, #ffca28 50%, #76ff03); }
#bars span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; text-shadow: 0 0 3px #000; }
#weapon { position: absolute; right: 14px; bottom: 16px; text-align: right; background: rgba(8,12,8,.7); border-radius: 12px; padding: 6px 12px; }
#weapon b { display: block; font-weight: normal; font-size: 16px; color: var(--c1); } #weapon span { font-size: 22px; }
#weapon.low span { color: #ff5252; }
#pickBtn { pointer-events: auto; position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); border: 0; border-radius: 14px;
  padding: 12px 18px; font: inherit; font-size: 16px; color: #0b1405; background: linear-gradient(90deg, #76ff03, #ccff90);
  box-shadow: 0 0 22px rgba(118,255,3,.6); animation: glow 1s infinite; white-space: nowrap; }
#nadeBtn { pointer-events: auto; position: absolute; right: 22px; bottom: 90px; width: 78px; height: 78px; border-radius: 50%; border: 2px solid rgba(255,23,68,.8);
  background: rgba(255,23,68,.16); color: #fff; font-size: 30px; display: none; }
#nadeBtn b { position: absolute; right: 6px; bottom: 4px; font-size: 14px; font-weight: normal; }
#nadeBtn.empty { opacity: .35; }
#wait { position: absolute; top: 30%; left: 0; right: 0; text-align: center; font-size: 30px; text-shadow: 0 2px 8px #000; }
#wait small { display: block; font-size: 15px; color: #d6e6cf; margin-top: 6px; }
#downInfo { position: absolute; top: 58%; left: 0; right: 0; text-align: center; font-size: 26px; color: #ff5252; text-shadow: 0 2px 8px #000; }
#downInfo small { display: block; font-size: 15px; color: #fff; margin-top: 6px; }
#downInfo .rv { width: 200px; height: 10px; margin: 8px auto 0; border-radius: 5px; background: rgba(255,255,255,.15); overflow: hidden; }
#downInfo .rv i { display: block; height: 100%; background: #69f0ae; }
#downInfo button { pointer-events: auto; margin-top: 10px; }

#announce { position: fixed; top: 22%; left: 0; right: 0; text-align: center; pointer-events: none; z-index: 6; }
#announce div { font-size: clamp(26px, 6vw, 54px); letter-spacing: 2px; animation: ann 1.9s ease-out forwards;
  text-shadow: 0 0 24px currentColor, 0 2px 0 #000; }
#announce small { display: block; font-size: .4em; color: #fff; letter-spacing: 1px; }
@keyframes ann { 0% { transform: scale(2.2); opacity: 0; } 12% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
#mute { position: fixed; right: 12px; bottom: 12px; z-index: 11; background: rgba(8,12,8,.5); border: 0; border-radius: 10px;
  font-size: 18px; padding: 6px 8px; color: #fff; }
body.playing #mute { opacity: .5; }
body.playing:not(.touch) #mute { bottom: auto; top: 12px; }
body.touch #mute { bottom: auto; top: 12px; right: 12px; }
#conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(255,23,68,.85); padding: 8px 14px;
  border-radius: 10px; z-index: 20; font-size: 14px; }
#toast { position: fixed; bottom: 110px; left: 50%; transform: translate(-50%, 20px); background: #fff; color: #05060f;
  padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .25s; z-index: 30; pointer-events: none; font-size: 14px; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

body.touch #nadeBtn { display: block; }
body.touch #weapon { bottom: 180px; }
body.touch #mini { width: 100px; height: 100px; }
body.touch #pickBtn { bottom: 64px; }

@media (max-width: 600px) {
  .logo { font-size: 48px; }
  #topbar { font-size: 16px; gap: 10px; padding: 5px 12px; top: 8px; }
  #team { top: 52px; left: 8px; font-size: 11px; }
  #team div { min-width: 0; padding: 2px 6px; }
  #team .n { max-width: 64px; }
  #team .h { width: 26px; }
  #bossbar { top: 46px; }
  body.touch #team { top: 50px; }
  .dstats span { font-size: 18px; }
  .place { font-size: 46px; }
}

#play { font-size: 38px; min-height: 84px; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.how { background: rgba(0,0,0,.22); border-radius: 12px; padding: 10px 12px; }
#nick { background: rgba(255,255,255,.12); }

/* кнопка языка (в меню) */
#langBtn { position: fixed; left: 12px; top: 12px; z-index: 11; background: rgba(12,10,34,.55); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; font: 14px 'Russo One', system-ui, sans-serif; padding: 7px 10px; color: #fff; cursor: pointer; }
body.rec #langBtn { display: none !important; }
