:root { --me: #00e5ff; --opp: #ff2e88; --gold: #ffe600; --bg: #07061a; --panel: rgba(12, 10, 34, .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(7,6,26,.15) 0%, rgba(7,6,26,.75) 75%); z-index: 10; }
.panel { width: min(400px, 100%); background: var(--panel); border: 1px solid rgba(0,229,255,.3); border-radius: 22px;
  padding: 24px 20px 18px; text-align: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 60px rgba(0,229,255,.16), inset 0 0 30px rgba(255,46,136,.05); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.logo { font-size: 56px; letter-spacing: 1px; line-height: 1; background: linear-gradient(90deg, var(--me), #fff 50%, var(--opp));
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 16px rgba(0,229,255,.55));
  animation: wobble 2.4s ease-in-out infinite; }
.logo span { font-size: 26px; }
@keyframes wobble { 0%, 100% { transform: rotate(-1.5deg) scale(1); } 50% { transform: rotate(1.5deg) scale(1.04); } }
.tag { color: #9fb3ff; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; margin: 8px 0 16px; }
#nick { width: 100%; font: inherit; font-size: 20px; text-align: center; color: #fff; background: rgba(255,255,255,.06);
  border: 2px solid rgba(0,229,255,.35); border-radius: 14px; padding: 12px; outline: none; margin-bottom: 14px;
  user-select: text; -webkit-user-select: text; }
#nick:focus { border-color: var(--me); box-shadow: 0 0 18px rgba(0,229,255,.35); }
.big { width: 100%; font-size: 26px; letter-spacing: 2px; color: #fff; border: 0; border-radius: 16px; padding: 15px;
  background: linear-gradient(90deg, #00b8d4, #7b5cff); box-shadow: 0 6px 30px rgba(0,229,255,.45);
  animation: glow 1.4s ease-in-out infinite; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.big:active { transform: scale(.97); }
@keyframes glow { 50% { box-shadow: 0 6px 46px rgba(0,229,255,.85); } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ghost { width: 100%; margin-top: 10px; font-size: 15px; color: #fff; background: rgba(0,229,255,.12);
  border: 1px solid rgba(0,229,255,.5); border-radius: 14px; padding: 12px 6px; }
.ghost:active { transform: scale(.97); }
.link { background: none; border: 0; color: #8b96c2; margin-top: 10px; font-size: 13px; }
.how { margin-top: 16px; font-family: system-ui, sans-serif; font-size: 13px; color: #c4cdf5; 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: var(--me); }
.invite { background: rgba(255,230,0,.1); border: 1px solid rgba(255,230,0,.5); color: var(--gold); border-radius: 12px;
  padding: 8px 10px; margin-bottom: 12px; font-size: 14px; }

.dtitle { font-size: 34px; color: var(--gold); text-shadow: 0 0 20px rgba(255,230,0,.6); }
.dtitle.lose { color: #ff4b6e; text-shadow: 0 0 20px rgba(255,75,110,.6); }
.place { font-size: 56px; margin: 2px 0; white-space: nowrap; }
.place .a { color: var(--me); text-shadow: 0 0 22px rgba(0,229,255,.7); }
.place .b { color: var(--opp); text-shadow: 0 0 22px rgba(255,46,136,.7); }
.killer { color: #aab3d8; margin: 4px 0 12px; font-family: system-ui, sans-serif; min-height: 18px; }
.best { color: var(--gold); min-height: 20px; margin-bottom: 12px; font-size: 15px; }

.code { font-size: 54px; letter-spacing: 8px; color: var(--gold); text-shadow: 0 0 22px rgba(255,230,0,.6); margin: 6px 0 4px; user-select: text; }
.wtitle { font-size: 24px; }
.wsub { font-family: system-ui, sans-serif; font-size: 14px; color: #c4cdf5; margin: 6px 0 14px; }
.spin { width: 54px; height: 54px; margin: 6px auto 14px; border-radius: 50%; border: 5px solid rgba(0,229,255,.2);
  border-top-color: var(--me); animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.pl { position: absolute; left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); display: grid;
  grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; padding: 8px 14px 12px; border-radius: 16px;
  background: rgba(12,10,34,.72); border: 2px solid transparent; transition: .2s; }
.pl.opp { top: max(10px, env(safe-area-inset-top)); --c: var(--opp); }
.pl.me { bottom: max(10px, env(safe-area-inset-bottom)); --c: var(--me); }
.pl .dot { width: 18px; height: 18px; border-radius: 5px; background: var(--c); box-shadow: 0 0 12px var(--c); transform: rotate(45deg); }
.pl .nm { font-weight: normal; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.pl .sc { font-size: 30px; color: var(--c); text-shadow: 0 0 14px var(--c); min-width: 44px; text-align: right; }
.pl .sc.bump { animation: bump .3s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); } }
.pl .tm { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; opacity: 0; }
.pl .tm u { display: block; height: 100%; width: 100%; background: var(--c); transform-origin: left; text-decoration: none; }
.pl.turn { border-color: var(--c); box-shadow: 0 0 22px var(--c); }
.pl.turn .tm { opacity: 1; }
.pl.turn.low .tm u { background: #ff4b4b; }
#status { position: absolute; left: 0; right: 0; text-align: center; font-size: 15px; color: #c4cdf5; letter-spacing: 2px;
  text-transform: uppercase; text-shadow: 0 2px 6px #000; }
#status.mine { color: var(--me); text-shadow: 0 0 16px var(--me); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
#resign { pointer-events: auto; position: absolute; left: 10px; background: rgba(12,10,34,.55); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; color: #8b96c2; font-size: 12px; padding: 6px 9px; }

#announce { position: fixed; top: 24%; left: 0; right: 0; text-align: center; pointer-events: none; z-index: 6; }
#announce div { font-size: clamp(28px, 8vw, 58px); letter-spacing: 2px; animation: ann 1.7s ease-out forwards; padding: 0 8px;
  text-shadow: 0 0 24px currentColor, 0 3px 0 #000; }
#announce small { display: block; font-size: .38em; color: #fff; letter-spacing: 1px; }
@keyframes ann { 0% { transform: scale(2.4) rotate(-6deg); opacity: 0; } 12% { transform: scale(1) rotate(0); opacity: 1; }
  20% { transform: scale(1.08); } 28% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
#mute { position: fixed; right: 12px; top: 12px; z-index: 11; background: rgba(12,10,34,.5); border: 0; border-radius: 10px;
  font-size: 18px; padding: 6px 8px; color: #fff; }
body.playing #mute { top: 78px; right: 10px; opacity: .6; padding: 4px 7px; font-size: 16px; }
#conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(255,46,136,.85); padding: 8px 14px;
  border-radius: 10px; z-index: 20; font-size: 14px; }
#toast { position: fixed; bottom: 90px; left: 50%; transform: translate(-50%, 20px); background: #fff; color: #07061a;
  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); }

@media (max-width: 600px) {
  .logo { font-size: 46px; } .logo span { font-size: 22px; }
  .panel { padding: 20px 16px 14px; }
  .how { font-size: 12px; }
  .place { font-size: 46px; }
}
@media (max-height: 640px) { .how { display: none; } }

body.rec #hud, body.rec #mute, body.rec .screen, body.rec #toast, body.rec #conn { display: none !important; }

#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; }

.big:disabled { opacity: .6; animation: none; box-shadow: none; }
