* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #04060c;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #dbe7f3;
  font-size: 13px;
}

canvas { display: block; }

/* ---------- 通用面板 ---------- */
.panel {
  position: fixed;
  background: rgba(9, 14, 26, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.hidden { display: none !important; }

/* ---------- 左侧面板 ---------- */
#left {
  left: 16px; top: 16px;
  width: 252px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
#left::-webkit-scrollbar { width: 4px; }
#left::-webkit-scrollbar-thumb { background: rgba(125,211,252,.25); border-radius: 2px; }

#left h1 { font-size: 16px; font-weight: 700; letter-spacing: .5px; color: #f1f7ff; padding-right: 30px; }
#left .sub { font-size: 11px; color: #7d93ad; margin: 6px 0 10px; line-height: 1.55; }

#stats {
  font-size: 11px; color: #9fb8cf;
  background: rgba(125, 211, 252, 0.06);
  border: 1px solid rgba(125, 211, 252, 0.1);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 10px;
  line-height: 1.7;
}
#stats b { color: #7dd3fc; font-weight: 600; }

.sec {
  font-size: 11px; font-weight: 600; color: #5f7e9c;
  letter-spacing: 1.5px;
  margin: 12px 0 6px;
  text-transform: uppercase;
}

/* 分组列表 */
.grow {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 4px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.grow:hover { background: rgba(125, 211, 252, 0.07); }
.grow input { accent-color: #38bdf8; cursor: pointer; }
.grow .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.grow .gname { flex: 1; color: #c9dcee; }
.grow .gcount { font-size: 10px; color: #66809c; font-variant-numeric: tabular-nums; }

.row-btns { display: flex; gap: 6px; margin-top: 8px; }
button.mini {
  flex: 1;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
  border-radius: 7px;
  padding: 4px 0;
  font-size: 11px;
  cursor: pointer;
}
button.mini:hover { background: rgba(56, 189, 248, 0.22); }

label.opt {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 4px;
  color: #b8cfe4;
  cursor: pointer; user-select: none;
}
label.opt input { accent-color: #38bdf8; }

/* 搜索 */
#search {
  width: 100%;
  background: rgba(4, 8, 16, 0.8);
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  color: #e6f2ff;
  padding: 7px 10px;
  font-size: 12px;
  outline: none;
}
#search:focus { border-color: rgba(125, 211, 252, 0.55); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
#results { margin-top: 4px; }
.ritem {
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #b9d2e8;
  display: flex; justify-content: space-between; gap: 8px;
}
.ritem:hover { background: rgba(125, 211, 252, 0.12); color: #fff; }
.ritem .rid { color: #5f7e9c; font-size: 10px; flex: none; }

/* ---------- 时钟 ---------- */
#clockbox { right: 16px; top: 16px; text-align: right; min-width: 300px; transition: transform .35s cubic-bezier(.4, 0, .2, 1); }
#clock {
  font-size: 17px;
  font-weight: 600;
  color: #eaf5ff;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.speed-row { display: flex; gap: 5px; justify-content: flex-end; }
.speed-row button {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #9cc8e8;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.speed-row button:hover { background: rgba(56, 189, 248, 0.2); }
.speed-row button.on {
  background: rgba(56, 189, 248, 0.32);
  color: #fff;
  border-color: rgba(125, 211, 252, 0.6);
}
#btnPause { min-width: 34px; }

/* ---------- 信息面板 ---------- */
#info { right: 16px; top: 118px; width: 264px; }
.info-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
#infoName { font-weight: 700; font-size: 14px; color: #7dd3fc; flex: 1; padding-right: 8px; }
#infoClose {
  background: none; border: none; color: #66809c;
  cursor: pointer; font-size: 14px;
}
#infoClose:hover { color: #fff; }
#infoTable { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
#infoTable td {
  padding: 3.5px 2px;
  font-size: 12px;
  border-bottom: 1px dashed rgba(125, 211, 252, 0.08);
}
#infoTable td:first-child { color: #5f7e9c; width: 78px; }
#infoTable td:last-child { color: #dcebfb; font-variant-numeric: tabular-nums; }
.hint { font-size: 10px; color: #5f7e9c; margin-top: 6px; }

/* ---------- 跟随标签 ---------- */
#label {
  position: fixed;
  z-index: 9;
  pointer-events: none;
  background: rgba(9, 14, 26, 0.85);
  border: 1px solid rgba(125, 211, 252, 0.4);
  color: #aee3ff;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
  transform: translate(12px, -50%);
}

/* ---------- 页脚 ---------- */
#footer {
  position: fixed;
  left: 16px; bottom: 14px;
  z-index: 10;
  font-size: 11px;
  color: #5f7e9c;
  display: flex; gap: 14px;
}
#footFps { color: #34d399; font-variant-numeric: tabular-nums; }

#btnRefresh {
  position: fixed;
  right: 16px; bottom: 14px;
  z-index: 10;
  background: rgba(9, 14, 26, 0.72);
  border: 1px solid rgba(125, 211, 252, 0.18);
  color: #7d93ad;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
}
#btnRefresh:hover { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.45); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; bottom: 60px;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(12, 20, 36, 0.95);
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 12px;
  color: #d5e9ff;
  max-width: 480px;
  text-align: center;
  line-height: 1.6;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}

/* ---------- 加载层 ---------- */
#loading {
  position: fixed; inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, #0a1122 0%, #04060c 70%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s;
}
#loading.fade { opacity: 0; pointer-events: none; }
.load-box { text-align: center; width: 320px; }
.load-sat { font-size: 42px; animation: float 2.2s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.load-title { font-size: 16px; font-weight: 600; color: #cfe6ff; margin: 14px 0 18px; }
.load-bar {
  height: 4px; border-radius: 2px;
  background: rgba(125, 211, 252, 0.12);
  overflow: hidden;
}
#loadFill {
  height: 100%; width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  transition: width .25s;
}
#loadText { margin-top: 10px; font-size: 11px; color: #66809c; }

/* ---------- 面板折叠 / 弹出 ---------- */
/* 面板内右上角的收起按钮 */
.fold-btn {
  position: absolute;
  top: 12px; right: 12px;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #7dd3fc;
  font-size: 16px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.fold-btn:hover { background: rgba(56, 189, 248, 0.24); color: #aee3ff; }

/* 折叠后悬浮在屏幕边缘的弹出按钮 */
.fab {
  position: fixed;
  z-index: 30;
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(9, 14, 26, 0.82);
  border: 1px solid rgba(125, 211, 252, 0.28);
  color: #7dd3fc;
  font-size: 19px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.fab:hover { background: rgba(9, 14, 26, 0.96); color: #aee3ff; }
.fab.show { display: flex; }

/* 折叠态：把面板平移出视口 */
#left.collapsed { transform: translateX(calc(-100% - 28px)); }
#clockbox.collapsed { transform: translateY(calc(-100% - 28px)); }

#leftFab { left: 14px; top: 16px; }
#clockFab { right: 14px; top: 16px; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 760px) {
  #left { width: 210px; }
  #clockbox { min-width: 0; }
  /* 小屏下弹出按钮略小，更易点 */
  .fab { width: 40px; height: 40px; font-size: 17px; }
}
