:root {
  --bg: rgba(18, 21, 26, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --fg: #eef1f4;
  --muted: #9aa5b1;
  --accent: #ffbe1e;
  --ok: #4cd07d;
  --bad: #ff6b5a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a8cbe8; color: var(--fg); font: 14px/1.4 system-ui, 'Segoe UI', sans-serif; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); }
.title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.row span { color: var(--muted); }
.small { font-size: 12px; }
.bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 4px 0 6px; }
.bar b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f0a500, var(--accent)); transition: width 0.2s; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18); font: 600 11px/1.5 ui-monospace, Consolas, monospace; text-align: center; color: #fff; }

#top { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none; }
#top > * { pointer-events: auto; }
.brand { background: var(--accent); color: #1a1a1a; font-weight: 800; padding: 7px 14px; border-radius: 10px; letter-spacing: 0.2px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }
.pill { background: var(--bg); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.pill.ok::before, .pill.bad::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--ok); }
.pill.bad::before { background: var(--bad); }
#players { display: flex; gap: 6px; flex-wrap: wrap; }
.pl { background: var(--bg); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pl i, .st i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pl em { color: var(--muted); font-style: normal; font-size: 12px; }

#stats { position: fixed; top: 60px; right: 12px; width: 230px; padding: 12px 14px; }
#resetBtn { margin-top: 8px; width: 100%; }
#hud { position: fixed; top: 60px; left: 12px; width: 300px; padding: 12px 14px; }
.keys { margin-top: 10px; display: grid; gap: 5px; font-size: 13px; }
.keys div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: start; }
.keys kbd { width: 100%; }
.keys .tip { grid-template-columns: 1fr; color: var(--accent); font-size: 12px; }
.keys .tip kbd { display: none; }
#help { position: fixed; right: 12px; top: 290px; width: 230px; padding: 12px 14px; font-size: 13px; }
#help p { margin: 6px 0; color: #d3d9df; }

button { font: inherit; cursor: pointer; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.ghost:hover { color: var(--fg); border-color: rgba(255, 255, 255, 0.3); }

#vehbar { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; max-width: calc(100vw - 24px); overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); }
.card { position: relative; flex: 0 0 auto; width: 128px; display: grid; justify-items: center; gap: 3px; padding: 10px 8px 9px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--fg); transition: transform 0.12s, background 0.12s, border-color 0.12s; }
.card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.09); }
.card .key { position: absolute; top: 5px; left: 7px; font-size: 11px; color: var(--muted); }
.card .ic { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 55%, transparent), transparent 70%); }
.card .nm { font-weight: 700; font-size: 13px; white-space: nowrap; }
.card .st { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
.card .ld { width: 80%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.card .ld b { display: block; height: 100%; width: 0; background: #d8b26c; }
.card.mine { border-color: var(--accent); background: rgba(255, 190, 30, 0.16); }
.card.mine .st { color: var(--accent); }
.card.taken { opacity: 0.55; cursor: not-allowed; }
.card.taken:hover { transform: none; }

#toast { position: fixed; left: 50%; bottom: 150px; transform: translate(-50%, 10px); background: rgba(18, 21, 26, 0.9); padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; border: 1px solid var(--line); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10, 14, 20, 0.45); backdrop-filter: blur(3px); padding: 16px; }
.modal form { width: min(420px, 100%); padding: 28px; text-align: center; }
.modal .big { font-size: 52px; }
.modal h1 { margin: 6px 0 8px; font-size: 24px; }
.modal p { color: #c6cdd4; margin: 0 0 18px; }
.modal input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); color: var(--fg); font: inherit; font-size: 15px; outline: none; }
.modal input:focus { border-color: var(--accent); }
.modal button[type=submit] { margin-top: 12px; width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: #1a1a1a; font-weight: 800; font-size: 15px; }

@media (max-width: 760px) {
  #stats, #help { display: none; }
  #hud { width: calc(100vw - 24px); }
  .card { width: 104px; }
}
