:root { --c1: #9ccc65; --c2: #ff7043; --gold: #ffd54f; --bg: #0e1a10; --panel: rgba(16, 26, 18, .9); }
* { 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(15,18,10,.25) 0%, rgba(15,18,10,.75) 70%); z-index: 10; }
.panel { width: min(420px, 100%); background: var(--panel); border: 1px solid rgba(156,204,101,.25); 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(156,204,101,.12), inset 0 0 30px rgba(255,112,67,.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), #fff 45%, var(--c2));
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(156,204,101,.55)); }
.logo span { font-size: 28px; }
.tag { color: #9aa7d6; font-size: 13px; 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(156,204,101,.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(156,204,101,.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: 26px; letter-spacing: 2px; color: #0e1a10; border: 0; border-radius: 16px; padding: 15px;
  background: linear-gradient(90deg, var(--c1), #dcedc8); box-shadow: 0 6px 30px rgba(156,204,101,.45);
  animation: glow 1.6s ease-in-out infinite; }
.big:active { transform: scale(.97); }
@keyframes glow { 50% { box-shadow: 0 6px 44px rgba(156,204,101,.8); } }
.ghost { width: 100%; margin-top: 10px; font-size: 16px; color: #fff; background: rgba(255,112,67,.15);
  border: 1px solid rgba(255,112,67,.5); border-radius: 14px; padding: 12px; }
.link { background: none; border: 0; color: #8b96c2; margin-top: 10px; font-size: 13px; }
.how { margin-top: 18px; font-family: system-ui, sans-serif; font-size: 13px; color: #b9c3ea; 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: 13px; color: #dcedc8; }
#online .rec { color: var(--gold); display: block; margin-top: 4px; }

.dtitle { font-size: 30px; color: #ff5c7a; text-shadow: 0 0 20px rgba(255,92,122,.6); }
.killer { color: #aab3d8; margin: 6px 0 16px; font-family: system-ui, sans-serif; }
.killer b { color: #fff; font-family: "Russo One", sans-serif; font-weight: normal; }
.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: #8b96c2; 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; }
#topleft { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 10px; }
#lvl { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: radial-gradient(circle, rgba(156,204,101,.25), rgba(15,18,10,.6)); border: 2px solid var(--c1);
  box-shadow: 0 0 16px rgba(156,204,101,.5); }
#score { font-size: 22px; text-shadow: 0 0 10px rgba(0,0,0,.8); }
.xpbar { width: 150px; height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c1), #dcedc8); transition: width .2s; }
#lb { position: absolute; right: 12px; top: 12px; width: 190px; background: rgba(12,15,8,.5); border-radius: 12px;
  padding: 8px 10px; font-size: 13px; }
#lb .h { color: var(--gold); font-size: 12px; margin-bottom: 4px; letter-spacing: 1px; }
#lb .r { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; color: #d8def5; }
#lb .r span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lb .r.me { color: var(--c1); }
#lb .r.top { color: var(--gold); }
#feed { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: grid; gap: 4px; justify-items: center;
  font-family: system-ui, sans-serif; font-size: 13px; }
#feed div { background: rgba(12,15,8,.55); padding: 3px 10px; border-radius: 10px; white-space: nowrap; animation: fade 4s forwards; }
#feed b { font-family: "Russo One", sans-serif; font-weight: normal; }
@keyframes fade { 0% { opacity: 0; transform: translateY(-6px); } 8%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#mini { position: absolute; left: 12px; bottom: 12px; width: 150px; height: 150px; border-radius: 12px;
  background: rgba(12,15,8,.55); border: 1px solid rgba(156,204,101,.2); }
#hpwrap { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(340px, 50vw); }
#hpbar { height: 14px; border-radius: 7px; background: rgba(255,255,255,.12); overflow: hidden; border: 1px solid rgba(255,255,255,.2); }
#hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4f6d, #ffb84f 50%, #69f0ae); transition: width .15s; }
#hptext { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; text-shadow: 0 0 4px #000; }
#fireBtn { pointer-events: auto; position: absolute; right: 22px; bottom: 26px; width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid rgba(255,213,79,.7); color: #fff; font-size: 34px; background: rgba(255,213,79,.15);
  box-shadow: 0 0 20px rgba(255,213,79,.35); display: none; }
#fireBtn.cd { --p: 0%; background: conic-gradient(rgba(255,213,79,.35) var(--p), rgba(40,40,60,.55) 0); opacity: .7; }
body.touch #fireBtn { display: block; }
body.touch #mini { width: 110px; height: 110px; top: 70px; bottom: auto; }
#cards { position: absolute; left: 50%; bottom: 50px; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: auto; }
#cards .card { width: 132px; padding: 10px 8px 8px; border-radius: 14px; text-align: center; background: rgba(25,30,18,.9);
  border: 2px solid rgba(156,204,101,.55); box-shadow: 0 0 20px rgba(156,204,101,.3); color: #fff; animation: cardIn .3s ease-out backwards; }
#cards .card:nth-child(2) { animation-delay: .05s; } #cards .card:nth-child(3) { animation-delay: .1s; }
#cards .card:active { transform: scale(.95); }
@keyframes cardIn { from { transform: translateY(40px); opacity: 0; } }
#cards .ic { font-size: 28px; }
#cards .t { font-size: 13px; margin: 4px 0 2px; color: var(--c1); }
#cards .d { font-family: system-ui, sans-serif; font-size: 11px; color: #c3cbec; min-height: 28px; }
#cards .pips { margin-top: 4px; letter-spacing: 2px; font-size: 10px; color: var(--gold); }
#cards .k { position: absolute; margin: -16px 0 0 -6px; font-size: 11px; color: #8b96c2; }
#cards .more { align-self: center; color: var(--gold); font-size: 18px; }
body.touch #cards { bottom: 128px; gap: 6px; width: calc(100vw - 16px); justify-content: center; }
body.touch #cards .card { width: calc((100vw - 52px) / 3); max-width: 130px; padding: 8px 4px 6px; }
body.touch #cards .t { font-size: 11px; word-break: break-word; } body.touch #cards .d { font-size: 10px; }
body.touch #cards .k { display: none; }
body.touch #cards .more { position: absolute; right: 2px; top: -24px; font-size: 14px; }
body.touch #hpwrap { bottom: 28px; left: calc(50% - 30px); width: 52vw; }

#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.8s 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(12,15,8,.5); border: 0; border-radius: 10px;
  font-size: 18px; padding: 6px 8px; color: #fff; }
body.touch #mute { bottom: 56px; right: auto; left: 12px; opacity: .7; }
body.touch:not(.playing) #mute { bottom: 12px; }
body.playing #mute { opacity: .5; }
body.playing:not(.touch) #mute { bottom: auto; top: 220px; }
#conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(255,92,122,.85); padding: 8px 14px;
  border-radius: 10px; z-index: 20; font-size: 14px; }
#toast { position: fixed; bottom: 30px; 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; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  #lb { width: 140px; font-size: 11px; padding: 6px 8px; }
  #lb .r:nth-child(n+7) { display: none; }
  .xpbar { width: 100px; }
  #score { font-size: 18px; }
  #lvl { width: 40px; height: 40px; font-size: 17px; }
  #feed { top: 64px; font-size: 11px; }
  .logo { font-size: 48px; }
}

.modes { display: grid; gap: 10px; margin-top: 4px; }
.modes .big { font-size: 20px; padding: 13px; }
.modes .big small { display: block; font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: 0; opacity: .75; margin-top: 2px; }
.modes .big.alt { background: linear-gradient(90deg, #8bc34a, #cddc39); box-shadow: 0 6px 30px rgba(255,112,67,.45); animation: none; }
#fireBtn { width: 92px; height: 92px; font-size: 38px; border-color: rgba(255,82,82,.8); background: rgba(255,82,82,.18); box-shadow: 0 0 20px rgba(255,82,82,.4); }
#fireBtn.cd { --p: 0%; background: conic-gradient(rgba(255,82,82,.4) var(--p), rgba(40,40,40,.55) 0); }
#teambar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center;
  background: rgba(12,15,8,.6); border-radius: 12px; padding: 6px 16px; font-size: 24px; }
#tsA { color: #ff5252; } #tsB { color: #448aff; } #timer { font-size: 15px; color: #ddd; }
body.teammode #feed { top: 60px; }
#topleft { flex-direction: column; align-items: flex-start; gap: 2px; }
#kills { font-size: 24px; } #score { font-size: 14px; color: #c9c9b0; }
#powers { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); display: flex; gap: 8px; }
#powers div { background: rgba(12,15,8,.7); border: 1px solid rgba(156,204,101,.5); border-radius: 10px; padding: 3px 8px; font-size: 14px; }
#respawn { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 26px; text-shadow: 0 2px 8px #000; }
.rescore { font-size: 54px; margin: 6px 0; }
.rescore .a { color: #ff5252; } .rescore .b { color: #448aff; }
body.touch #powers { bottom: 64px; }

.modes { display: grid; gap: 10px; margin-top: 4px; }
.modes .big { font-size: 22px; padding: 12px; animation: none; }
.modes .big small { display: block; font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: 0; opacity: .8; margin-top: 2px; }
.modes .big.seek { background: linear-gradient(90deg, #ff7043, #ffab40); box-shadow: 0 6px 26px rgba(255,112,67,.45); color: #1b0d05; }
.modes .big.hide { background: linear-gradient(90deg, #9ccc65, #d4e157); box-shadow: 0 6px 26px rgba(156,204,101,.45); color: #0e1a10; }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: rgba(10,18,10,.7); border-radius: 14px; padding: 6px 14px; white-space: nowrap; }
#phase { font-size: 16px; color: var(--c1); } #timer { font-size: 24px; min-width: 64px; text-align: center; }
#heads { display: flex; gap: 4px; font-size: 18px; }
#heads span.j { filter: grayscale(1) brightness(.6); } #heads span.h { opacity: .55; }
#role { position: absolute; left: 12px; top: 12px; font-size: 15px; background: rgba(10,18,10,.6); padding: 6px 10px; border-radius: 10px; }
#hint { position: absolute; top: 64px; left: 0; right: 0; text-align: center; font-size: 15px; color: #ffe082; text-shadow: 0 2px 4px #000; font-family: system-ui, sans-serif; }
#mini { top: auto; bottom: 12px; }
#airbar, #rescuebar { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); width: 220px; height: 16px; border-radius: 8px;
  background: rgba(255,255,255,.15); overflow: hidden; border: 1px solid rgba(255,255,255,.3); }
#airbar i, #rescuebar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5252, #4fc3f7); }
#rescuebar i { background: linear-gradient(90deg, #ffd54f, #9ccc65); }
#airbar span, #rescuebar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; }
#actBtn, #ablBtn { pointer-events: auto; position: absolute; border-radius: 50%; color: #fff; font-family: inherit; display: none; }
#actBtn { right: 18px; bottom: 22px; width: 108px; height: 108px; font-size: 13px; border: 2px solid rgba(255,213,79,.85);
  background: rgba(255,213,79,.18); box-shadow: 0 0 22px rgba(255,213,79,.35); line-height: 1.1; padding: 6px; }
#actBtn.on { background: rgba(255,213,79,.5); box-shadow: 0 0 30px rgba(255,213,79,.8); animation: glow 1s infinite; }
#ablBtn { right: 134px; bottom: 96px; width: 72px; height: 72px; font-size: 30px; border: 2px solid rgba(79,195,247,.8); background: rgba(79,195,247,.16); }
#ablBtn.cd { opacity: .45; }
body.touch #actBtn, body.touch #ablBtn { display: block; }
body:not(.touch) #actBtn.on { display: block; width: auto; height: auto; border-radius: 14px; padding: 10px 16px; font-size: 15px; bottom: 60px; left: 50%; right: auto; transform: translateX(-50%); }
#rTable { text-align: left; font-size: 14px; margin: 8px 0 10px; }
#rTable .r { display: grid; grid-template-columns: 28px 1fr 74px 50px; gap: 6px; padding: 5px 8px; border-radius: 8px; }
#rTable .r:nth-child(odd) { background: rgba(255,255,255,.04); } #rTable .r.me { background: rgba(156,204,101,.25); }
#rTable .r span:nth-child(3), #rTable .r span:nth-child(4) { text-align: right; font-size: 12px; font-family: system-ui, sans-serif; }
body.touch #mini { width: 96px; height: 96px; top: 92px; bottom: auto; left: 10px; }
body.touch #hint { top: 52px; font-size: 12px; padding: 0 8px; }
body.touch #role { top: auto; bottom: 12px; font-size: 12px; }
@media (max-width: 600px) { #topbar { top: 6px; gap: 8px; padding: 4px 10px; } #heads { font-size: 14px; } #timer { font-size: 20px; } }

#roomChip { position: absolute; left: 12px; top: 46px; background: rgba(10,18,10,.7); border: 1px solid rgba(156,204,101,.5); border-radius: 10px;
  padding: 5px 10px; font-size: 13px; pointer-events: auto; cursor: pointer; }
#roomChip b { color: var(--c1); letter-spacing: 2px; }
body.touch #roomChip { top: auto; bottom: 40px; font-size: 11px; }
.invite { margin: 0 0 12px; padding: 10px; border-radius: 12px; background: rgba(156,204,101,.15); border: 1px solid rgba(156,204,101,.5); font-size: 15px; }
.invite b { color: var(--c1); letter-spacing: 2px; }
