:root {
  --bg: #0f1420;
  --glass: rgba(16, 22, 36, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef2fb;
  --muted: #9aa6bf;
  --red: #ff4d5e;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; touch-action: none; }
#scene canvas { display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.hud { position: fixed; z-index: 10; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; }
.hud-top { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.brand .title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand .subtitle { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }
.clock { text-align: right; }
#bj-time { font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 600; }
#bj-phase { font-size: 12px; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 10px; letter-spacing: 1px; margin-left: 6px; vertical-align: middle; }
.badge.demo { background: #f5a623; color: #1b1b1b; font-weight: 700; }

.hud-corner { top: 84px; right: 12px; width: 200px; padding: 12px 14px; font-size: 13px; }
.hud-corner .row { display: flex; justify-content: space-between; margin: 4px 0; }
.quota-bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; margin: 4px 0 8px; }
#quota-fill { height: 100%; width: 0; background: linear-gradient(90deg, #2ecc71, #f5a623, #ff4d5e); transition: width .6s; }

.hud-bottom { bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; }
.hud-bottom button { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.hud-bottom button:hover, .hud-bottom button.on { background: rgba(255,255,255,.1); }

.roster { bottom: 70px; left: 12px; width: 260px; max-height: 50vh; overflow: auto; padding: 8px; font-size: 13px; }
.roster .item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.roster .item:hover { background: rgba(255,255,255,.07); }
.roster .item .s { margin-left: auto; font-size: 11px; color: var(--muted); }

.panel { position: fixed; z-index: 20; top: 84px; left: 12px; width: 300px; max-width: calc(100vw - 24px); padding: 16px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.panel .close { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.panel-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 10px currentColor; }
.p-name { font-size: 18px; font-weight: 700; }
.p-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.1); }
.p-status.needs_logan { background: var(--red); color: #fff; }
.p-status.working { background: #2ecc71; color: #08210f; }
.p-status.thinking { background: #5b8def; color: #fff; }
.p-summary { line-height: 1.6; margin: 12px 0; }

/* floating labels */
.bot-label { pointer-events: auto; cursor: pointer; text-align: center; transform: translateY(-6px); white-space: nowrap; }
.bot-label .name { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.bot-label .sum { display: block; margin: 3px auto 0; max-width: 170px; white-space: normal; font-size: 10.5px; line-height: 1.3; color: #e8ecf6; background: rgba(10,14,24,.68); padding: 2px 6px; border-radius: 6px; }
.bot-label.needs_logan .name { box-shadow: 0 0 0 2px var(--red), 0 0 14px var(--red); animation: blink 1.2s infinite; }
.bot-label.needs_logan .name::after { content: " ❗"; }
.bot-label.off .name { opacity: .55; }
.bot-label.off .sum { opacity: .75; }
.room-label { font-size: 11px; letter-spacing: 2px; color: rgba(255,255,255,.75); background: rgba(0,0,0,.35); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
@keyframes blink { 50% { box-shadow: 0 0 0 2px var(--red), 0 0 2px var(--red); } }

.loading { position: fixed; inset: 0; display: grid; place-items: center; font-size: 15px; color: var(--muted); z-index: 30; background: var(--bg); transition: opacity .5s; }
.loading.done { opacity: 0; pointer-events: none; }

@media (max-width: 640px) {
  .hud-top { padding: 8px 12px; }
  .brand .title { font-size: 15px; }
  #bj-time { font-size: 16px; }
  .hud-corner { top: auto; bottom: 70px; right: 12px; width: 160px; font-size: 12px; padding: 8px 10px; }
  .panel { top: auto; bottom: 70px; left: 12px; right: 12px; width: auto; }
  .bot-label .sum { display: none; }
  .roster { width: calc(100vw - 24px); }
}
