:root {
  --bg: #120d0a; --panel: rgba(30, 21, 15, 0.94); --ink: #f3e6cf; --dim: #b49c7c;
  --gold: #f2c14e; --troll: #8fc46a; --line: #5a4330;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 15px/1.4 "Trebuchet MS", "Segoe UI", system-ui, sans-serif; overscroll-behavior: none;
  touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 420px); max-height: 92dvh; overflow: auto; touch-action: pan-y;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); }
h1 { margin: 0 0 4px; font-size: 40px; letter-spacing: 1px; color: var(--gold);
  text-shadow: 0 3px 0 #6b3d12; text-align: center; }
h1 span { color: var(--ink); }
h2 { margin: 0 0 12px; color: var(--gold); }
.tag { text-align: center; color: var(--dim); margin: 0 0 16px; }
.small { font-size: 13px; color: var(--dim); }
input { width: 100%; padding: 12px; font-size: 18px; border-radius: 10px; border: 2px solid var(--line);
  background: #1d1510; color: var(--ink); margin-bottom: 10px; user-select: text; -webkit-user-select: text; }
button { width: 100%; padding: 13px; font-size: 18px; font-weight: bold; border: 0; border-radius: 10px;
  background: linear-gradient(#f5c95c, #c98a24); color: #2a1706; cursor: pointer; margin-top: 4px; }
button.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
button:active { transform: translateY(1px); }
details { margin-top: 14px; color: var(--dim); }
summary { cursor: pointer; color: var(--ink); }
details ul { padding-left: 20px; margin: 8px 0; }
ul#lobbyList, ul#resList { list-style: none; padding: 0; margin: 0 0 12px; }
#lobbyList li, #resList li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #3a2a1e; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid rgba(0,0,0,.4); }
.score { margin-left: auto; color: var(--gold); white-space: nowrap; }
.score .t { color: var(--troll); margin-left: 8px; }
.tagme { color: var(--dim); font-size: 12px; }
#share { display: flex; gap: 12px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid #3a2a1e; }
#qr { width: 112px; height: 112px; background: #fff; border-radius: 8px; padding: 6px; flex: none; }
#link { color: var(--gold); word-break: break-all; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#topbar { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.55); padding: 6px 14px; border-radius: 20px; }
#phase { font-weight: bold; }
#timer { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: bold; min-width: 34px; text-align: right; }
#board { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 42px); left: max(8px, env(safe-area-inset-left));
  background: rgba(0,0,0,.45); padding: 6px 8px; border-radius: 10px; font-size: 12px; max-width: 42vw; }
#board div { display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
#board .dot { width: 10px; height: 10px; }
#board .out { opacity: .45; text-decoration: line-through; }
#status { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); padding: 6px 14px; border-radius: 20px; white-space: nowrap; font-weight: bold; }
#toasts { position: fixed; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 46px); left: 50%; transform: translateX(-50%); width: min(92vw, 440px);
  display: flex; flex-direction: column-reverse; gap: 6px; pointer-events: none; z-index: 5; }
.toast { background: rgba(20, 14, 10, .9); border: 1px solid var(--line); padding: 8px 12px; border-radius: 10px;
  text-align: center; animation: pop .25s ease-out; transition: opacity .5s; }
.toast.catch { border-color: #c0392b; } .toast.escape, .toast.gold { border-color: var(--gold); }
.toast.mush { border-color: #45c8e0; } .toast.hunt { border-color: var(--troll); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
#conn { position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%); background: #7a1f12; padding: 6px 14px; border-radius: 10px; z-index: 9; }
#result { top: auto; bottom: 16px; transform: translateX(-50%); }
