:root {
  --bg: #0e1320;
  --panel: rgba(16, 22, 36, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef2fa;
  --muted: #9aa6bd;
  --accent: #ff4d5e;
  --accent2: #3b82f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
canvas { display: block; width: 100vw; height: 100vh; touch-action: none; cursor: none; }
[hidden] { display: none !important; }

.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px));
  padding: 26px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); display: grid; gap: 10px; text-align: center; }
h1, h2 { margin: 0 0 2px; letter-spacing: 0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
.sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
button, input { font: inherit; color: var(--text); border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); padding: 11px 14px; }
button { cursor: pointer; font-weight: 600; transition: background 0.15s, transform 0.05s; }
button:hover { background: rgba(255, 255, 255, 0.12); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: transparent; }
button.primary:hover { background: #ff6573; }
button.ghost { background: transparent; color: var(--muted); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; min-width: 0; }
.code { font-size: 40px; font-weight: 800; letter-spacing: 0.3em; padding: 6px 0 4px 0.3em; }

#hud { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.score { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.score b { font-size: 26px; min-width: 1.4ch; font-variant-numeric: tabular-nums; }
.score i { color: var(--muted); font-style: normal; }
.who { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.serve { margin-top: 6px; font-size: 13px; color: var(--muted); text-shadow: 0 1px 3px #000; }
.link { position: fixed; top: 12px; right: 12px; font-size: 12px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 5px 9px; pointer-events: none; }
.link.p2p { color: #6ee7a8; }
.hint { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  font-size: 13px; color: var(--muted); text-align: center; text-shadow: 0 1px 3px #000; pointer-events: none; }
.toast { position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(0.9); font-size: 30px; font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
@media (max-width: 600px) { .link { top: auto; bottom: 44px; right: 50%; transform: translateX(50%); } .hint { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { .toast, button { transition: none; } }
