:root { --c1: #6bff9e; --c2: #5ef2ff; --gold: #ffd54f; --bg: #05060f; --panel: rgba(10, 14, 32, .78); }
* { 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,6,15,.25) 0%, rgba(5,6,15,.75) 70%); z-index: 10; }
.panel { width: min(420px, 100%); background: var(--panel); border: 1px solid rgba(105,255,170,.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(105,255,170,.12), inset 0 0 30px rgba(255,79,216,.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(105,255,170,.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(105,255,170,.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(105,255,170,.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: #061018; border: 0; border-radius: 16px; padding: 15px;
  background: linear-gradient(90deg, #6bff9e, #c6ff5e); box-shadow: 0 6px 30px rgba(105,255,170,.45);
  animation: glow 1.6s ease-in-out infinite; }
.big:active { transform: scale(.97); }
@keyframes glow { 50% { box-shadow: 0 6px 44px rgba(105,255,170,.8); } }
.ghost { width: 100%; margin-top: 10px; font-size: 16px; color: #fff; background: rgba(255,79,216,.15);
  border: 1px solid rgba(255,79,216,.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: #8fffcf; }
#online .rec { color: var(--gold); display: block; margin-top: 4px; }

.dtitle { font-size: 32px; 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; }
#len { min-width: 62px; height: 52px; padding: 0 12px; border-radius: 26px; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle, rgba(107,255,158,.25), rgba(5,6,15,.6)); border: 2px solid var(--c1);
  box-shadow: 0 0 16px rgba(107,255,158,.5); transition: transform .12s; }
#len.pop { transform: scale(1.18); }
#lenlbl { font-size: 11px; letter-spacing: 2px; color: #9aa7d6; }
#sub { font-size: 14px; text-shadow: 0 0 10px rgba(0,0,0,.8); }
#lb { position: absolute; right: 12px; top: 12px; width: 190px; background: rgba(5,8,20,.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(5,8,20,.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: 130px; height: 130px; border-radius: 50%;
  background: rgba(5,8,20,.55); border: 1px solid rgba(107,255,158,.25); }
body.touch #mini { width: 100px; height: 100px; top: 74px; bottom: auto; }
#pows { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 8px; }
#pows div { background: rgba(10,16,40,.8); border: 2px solid var(--c1); border-radius: 14px; padding: 5px 10px; font-size: 14px; white-space: nowrap; }
body.touch #pows { bottom: auto; top: 70px; left: auto; right: 12px; transform: none; flex-direction: column; align-items: flex-end; margin-top: 190px; }
#boostBtn { pointer-events: auto; position: absolute; right: 18px; bottom: 26px; width: 104px; height: 104px; border-radius: 50%;
  border: 3px solid rgba(255,213,79,.8); color: #fff; font-size: 36px; background: rgba(255,213,79,.18);
  box-shadow: 0 0 24px rgba(255,213,79,.4); display: none; line-height: 1; padding: 0; }
#boostBtn small { display: block; font-size: 9px; letter-spacing: 1px; margin-top: 3px; }
#boostBtn.on { background: rgba(255,213,79,.5); transform: scale(.94); box-shadow: 0 0 40px rgba(255,213,79,.9); }
body.touch #boostBtn { display: block; }

#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(5,8,20,.5); border: 0; border-radius: 10px; font-size: 18px; padding: 6px 8px; color: #fff; }
body.touch #mute { bottom: auto; top: 12px; right: auto; left: 50%; margin-left: 40px; opacity: .7; }
body.touch:not(.playing) #mute { top: auto; bottom: 12px; left: auto; right: 12px; margin: 0; }
body.playing #mute { opacity: .5; }
body.playing:not(.touch) #mute { bottom: auto; top: 230px; }
#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: 138px; font-size: 11px; padding: 6px 8px; }
  #lb .r:nth-child(n+7) { display: none; }
  #len { height: 44px; min-width: 52px; font-size: 20px; }
  #feed { top: 64px; font-size: 11px; }
  .logo { font-size: 44px; }
}
.how .mob { display: none; } body.touch .how .mob { display: block; } body.touch .how .pc { display: none; }
.nickrow { display: flex; gap: 8px; align-items: stretch; }
.nickrow input { flex: 1; min-width: 0; }
#dice { width: 52px; border-radius: 12px; border: 2px solid rgba(107,255,158,.4); background: rgba(10,16,40,.8); font-size: 22px; cursor: pointer; }
#dice:active { transform: scale(.92); }
#fw { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.best.rec { color: var(--gold); font-size: 20px; animation: ann 1.8s ease-out; }
/* режим съёмки ?rec=1: чистый кадр */
body.rec #hud, body.rec #mute, body.rec #conn, body.rec #toast { display: none !important; }
