/* π 分布式无限运算 —— 深色科技仪表盘 */
:root {
  --bg: #07090f;
  --bg-2: #0d1119;
  --panel: #11162180;
  --panel-solid: #111621;
  --border: #1e2733;
  --border-hi: #2a3744;
  --text: #e6edf3;
  --text-dim: #8b97a6;
  --text-faint: #5b6675;
  --accent: #4dd0e1;       /* 青 */
  --accent-2: #7c4dff;     /* 紫 */
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, #11202a55, transparent),
    radial-gradient(900px 500px at 10% 110%, #1a1040aa, transparent),
    var(--bg);
  min-height: 100vh;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 22px 60px;
}

/* —— Hero —— */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.hero-left h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.hero-left h1 sub {
  font-size: 0.28em;
  font-weight: 600;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
  vertical-align: baseline;
  margin-left: 6px;
  letter-spacing: 0;
}
.tagline {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 15px;
}

/* —— Power button —— */
.power-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-solid);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 16px 26px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
  font-family: var(--sans);
}
.power-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px -10px var(--accent);
}
.power-btn .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 4px #ffffff10;
  transition: all .18s ease;
}
.power-btn.idle .dot { background: var(--text-faint); }
.power-btn.running { border-color: var(--good); color: #04130a; background: var(--good); }
.power-btn.running .dot { background: #04130a; box-shadow: 0 0 0 4px #4ade8040; }
.power-btn.running:hover { box-shadow: 0 8px 30px -10px var(--good); }

/* —— Stats grid —— */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px;
  backdrop-filter: blur(6px);
}
.stat.highlight {
  border-color: var(--accent-2);
  background: linear-gradient(160deg, #1a1240aa, #11162180);
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.stat.highlight .stat-value { color: var(--accent); }
.stat-unit {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* —— π viewer —— */
.pi-viewer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 26px;
}
.pi-head {
  font-family: var(--mono);
  font-size: 17px;
  word-break: break-all;
  line-height: 1.7;
  max-height: 240px;
  overflow: auto;
  padding-right: 6px;
}
.pi-label { color: var(--accent); font-weight: 700; }
.pi-mono { color: var(--text); }
.caret { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.pi-foot {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 13px;
}
#piLen { color: var(--text); font-family: var(--mono); font-weight: 700; }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--sans);
  transition: all .15s ease;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* —— 控制面板（算力自定义）—— */
.control-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 18px;
  align-items: center;
}
@media (max-width: 720px) {
  .control-panel { grid-template-columns: 1fr; }
}
.ctrl-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.ctrl-val { color: var(--accent); font-family: var(--mono); }
.ctrl-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--sans);
}
.ctrl-input:focus { outline: none; border-color: var(--accent); }
.slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px #0008;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
  cursor: pointer;
}
.ctrl-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* 我的贡献卡片高亮 */
.stat.highlight2 {
  border-color: var(--accent);
  background: linear-gradient(160deg, #0a2a33aa, #11162180);
}

/* —— 贡献榜 —— */
.leaderboard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
}
.lb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.lb-head h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0;
}
.lb-total { font-size: 12px; color: var(--text-faint); }
.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
}
@media (max-width: 720px) { .lb-list { grid-template-columns: 1fr; } }
.lb-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-2);
}
.lb-item.me {
  border: 1px solid var(--accent);
  background: linear-gradient(120deg, #0a2a3366, var(--bg-2));
}
.lb-item.me .lb-name { color: var(--accent); font-weight: 600; }
.lb-item.lb-mesep {
  border: none;
  background: transparent;
  opacity: 0.6;
  font-size: 11px;
  justify-content: center;
}
.lb-rank { color: var(--text-faint); font-family: var(--mono); font-size: 12px; }
.lb-name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-digits { color: var(--text); font-family: var(--mono); font-size: 12px; white-space: nowrap; }

/* —— 任务面板 —— */
.task-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
}
.task-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-2);
  border-radius: 8px;
}
.task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.task-name { font-size: 13px; color: var(--text-dim); }
.task-status { font-size: 12px; font-family: var(--mono); }
.task-status.ok { color: var(--good); }
.task-status.pending { color: var(--warn); }
.task-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.3s;
}
.task-meta { font-size: 11px; color: var(--text-faint); }

/* 任务弹窗 */
.task-dialog-overlay {
  position: fixed;
  inset: 0;
  background: #0008;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.task-dialog {
  background: var(--panel-solid);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
}
.task-dialog h3 { margin: 0 0 4px; color: var(--accent); }
.task-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.task-dialog-btns {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* —— Log —— */
.log-section h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin: 0 0 12px;
  font-weight: 600;
}
.log {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  height: 200px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
}
.log .line { color: var(--text-dim); }
.log .line .t { color: var(--text-faint); margin-right: 8px; }
.log .line.ok { color: var(--good); }
.log .line.warn { color: var(--warn); }
.log .line.bad { color: var(--bad); }
.log .line.info { color: var(--accent); }

/* —— Footer —— */
.footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.7;
}
.footer strong { color: var(--text-dim); }
.footer .hint { margin-top: 6px; color: var(--text-faint); }
