:root {
  --ink: #f7f1e6;
  --muted: #b7aa98;
  --dim: #8a7d6e;
  --line: rgba(255, 236, 210, 0.14);
  --glass: rgba(16, 13, 18, 0.62);
  --glass-2: rgba(22, 18, 24, 0.78);
  --work: #3dcc6a;
  --wait: #f0c44c;
  --err: #e05656;
  --rest: #9a9086;
  --accent: #e8c27a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.42);
  --radius: 16px;
  --font: "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #8eb8e0; color: var(--ink); font-family: var(--font); }
button, time { font-family: inherit; }

#viewport, canvas.three { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#labels .tag, #labels .bubble, #labels .zzz, #labels .bang { pointer-events: auto; }

.hud {
  position: fixed;
  z-index: 20;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.top-hud {
  top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.brand-mark, .boot-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #f0d7a0, #c49248);
  color: #2a1c0e; font-weight: 800; font-size: 18px;
  box-shadow: 0 0 0 1px rgba(255, 220, 160, 0.35), 0 6px 16px rgba(180, 110, 30, 0.35);
}
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.04em; }
.clock-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#clock { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink); }
.asof { font-size: 11px; color: var(--dim); }

.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count {
  min-width: 72px; padding: 6px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.count b { font-size: 20px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.count span { font-size: 11px; color: var(--muted); }
.count[data-k="work"] b { color: var(--work); }
.count[data-k="wait"] b { color: var(--wait); }
.count[data-k="err"] b { color: var(--err); }
.count[data-k="rest"] b { color: var(--rest); }

.filters {
  top: 100px; left: 16px;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; border-radius: 999px; max-width: calc(100% - 32px);
}
.filters button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 12px;
}
.filters button.on, .filters button:hover { background: rgba(255, 220, 160, 0.14); color: var(--ink); }
.filters .ghost { color: var(--dim); }

.panel {
  width: 300px; max-height: calc(100vh - 180px);
  border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden;
}
.wait-panel { top: 150px; left: 16px; }
.feed-panel { top: 150px; right: 16px; }
.detail-panel { top: 150px; right: 328px; width: 320px; }

.panel-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; border-bottom: 1px solid var(--line);
}
.panel-h h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.icon-btn {
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,0.06); color: var(--ink); cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed { max-height: none; }
.panel-body { overflow: auto; padding: 8px 10px 12px; }
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; }

.wait-item, .feed-item, .empty {
  width: 100%; text-align: left; border: 0; cursor: pointer;
  background: transparent; color: inherit; padding: 9px 8px; border-radius: 10px;
  display: block;
}
.wait-item { background: rgba(240, 196, 76, 0.08); border: 1px solid rgba(240, 196, 76, 0.18); margin-bottom: 8px; }
.wait-item:hover, .feed-item:hover { background: rgba(255,255,255,0.06); }
.wait-item .who, .feed-item .who { font-weight: 700; font-size: 13px; }
.wait-item .why, .feed-item .act { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.feed-item { display: grid; grid-template-columns: 102px 1fr; gap: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); border-radius: 0; }
.feed-item .when { font-size: 11px; color: var(--dim); white-space: nowrap; }
.empty { color: var(--dim); font-size: 12px; cursor: default; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kv div, .block { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 10px; }
.kv .lab, .block .lab { font-size: 11px; color: var(--dim); margin-bottom: 2px; }
.kv .val, .block .val { font-size: 13px; line-height: 1.45; }
.status-工作中 { color: var(--work); font-weight: 700; }
.status-等你拍板 { color: var(--wait); font-weight: 700; }
.status-出错 { color: var(--err); font-weight: 700; }
.status-休息, .status-睡觉 { color: var(--rest); font-weight: 700; }
.block { margin-bottom: 8px; }
.recent { margin: 0 0 8px 18px; color: var(--ink); font-size: 13px; }
.recent li { margin: 0 0 4px; }
.quip { color: var(--muted); font-style: italic; font-size: 13px; padding: 0 4px 6px; }
.hidden { display: none !important; }

.mobile-docks {
  display: none; position: fixed; z-index: 25; left: 12px; right: 12px; bottom: 16px; gap: 8px;
}
.mobile-docks button {
  flex: 1; border: 0; border-radius: 12px; padding: 10px 12px;
  background: var(--glass-2); color: var(--ink); border: 1px solid var(--line);
  backdrop-filter: blur(16px); font-size: 13px; cursor: pointer;
}
.mobile-docks i {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--wait); color: #2a1c0e; font-style: normal; font-size: 11px; font-weight: 700;
}

.hint {
  position: fixed; z-index: 15; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: 12px; color: #4a453c; pointer-events: none;
  text-shadow: 0 1px 6px rgba(255,255,255,0.8);
}

#boot {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 30%, #d5e7f6, #8eb8e0 70%);
  transition: opacity .6s ease;
}
#boot.out { opacity: 0; pointer-events: none; }
.boot-card { text-align: center; }
.boot-mark { margin: 0 auto 14px; width: 56px; height: 56px; font-size: 24px; border-radius: 16px; }
.boot-title { font-size: 22px; font-weight: 700; color: #2a2218; }
.boot-sub { color: #5a5048; font-size: 13px; margin: 6px 0 16px; }
.boot-bar { width: 180px; height: 4px; margin: 0 auto; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #c49248, #f0d7a0); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }

/* 3D labels */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 6px; border-radius: 999px;
  background: rgba(255, 250, 244, 0.82); border: 1px solid rgba(255,255,255,0.7);
  color: #2a2218; font-size: 11px; font-weight: 650; white-space: nowrap;
  transform: translate(-50%, -120%);
  box-shadow: 0 3px 10px rgba(40,30,20,0.14);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.tag.sel { border-color: #c49248; box-shadow: 0 0 0 1px #e8c27a, 0 4px 12px rgba(40,30,20,0.16); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rest); box-shadow: 0 0 6px currentColor; }
.dot.s-工作中 { background: var(--work); color: var(--work); }
.dot.s-等你拍板 { background: var(--wait); color: var(--wait); }
.dot.s-出错 { background: var(--err); color: var(--err); }

.bubble {
  max-width: 200px; padding: 5px 8px; border-radius: 8px;
  background: #f4efe4; color: #2a1c10; font-size: 11px; line-height: 1.35;
  transform: translate(-50%, -210%);
  box-shadow: 0 6px 16px rgba(0,0,0,0.28);
  pointer-events: none;
}
.bubble.wait { background: #5a4a18; color: #f6e7a8; border: 1px solid #e6c04a; }
.bubble.err { background: #4a2020; color: #ffd0d0; border: 1px solid #e05050; }

.zzz {
  color: #e8e0c8; font-weight: 800; font-size: 14px; letter-spacing: 1px;
  transform: translate(10px, -160%);
  animation: zzz 2.2s ease-in-out infinite;
  text-shadow: 0 2px 8px #000; pointer-events: none;
}
@keyframes zzz { 0%,100% { opacity: .5; transform: translate(10px, -150%); } 50% { opacity: 1; transform: translate(16px, -200%); } }

.bang {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--wait); color: #2a1c0e; font-weight: 800; font-size: 14px;
  transform: translate(16px, -200%);
  box-shadow: 0 0 0 3px rgba(240,196,76,0.25);
  animation: pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
.bang.err { background: var(--err); color: #fff; box-shadow: 0 0 0 3px rgba(224,80,80,0.28); }
@keyframes pulse { 0%,100% { transform: translate(16px, -200%) scale(1); } 50% { transform: translate(16px, -200%) scale(1.12); } }

@media (max-width: 820px) {
  .top-hud { top: 8px; left: 8px; right: 8px; padding: 10px 12px; }
  .filters { top: auto; bottom: 64px; left: 8px; right: 8px; max-width: none; justify-content: center; }
  .wait-panel, .feed-panel, .detail-panel {
    top: auto; bottom: 112px; left: 8px; right: 8px; width: auto; max-height: 42vh;
  }
  .detail-panel { bottom: 112px; }
  .feed-panel, .wait-panel { display: none; }
  .feed-panel.open, .wait-panel.open, .detail-panel:not(.hidden) { display: flex; }
  .mobile-docks { display: flex; }
  .hint { display: none; }
  .brand-mark { width: 34px; height: 34px; font-size: 15px; }
  .count { min-width: 58px; padding: 4px 8px; }
  .count b { font-size: 16px; }
}
