/* QQ音乐签到台 — 手写样式，没有框架 */

:root {
  --bg: #0a0d11;
  --bg-grad: radial-gradient(1100px 520px at 12% -12%, #13312a 0%, transparent 62%),
             radial-gradient(900px 460px at 96% 4%, #1a2233 0%, transparent 58%);
  --panel: #11151c;
  --panel-2: #161b24;
  --panel-3: #1b212c;
  --line: #232b37;
  --line-soft: #1b222c;
  --text: #e8eef6;
  --dim: #8b98ab;
  --dimmer: #5f6b7c;
  --accent: #4ade9b;
  --accent-dim: #2f9e6f;
  --amber: #f5b942;
  --red: #f0616d;
  --blue: #6aa6ff;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性要压得住 label / div 上的 display，否则「确认密码」这种会漏出来 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.centered {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 13, 17, 0.82);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(74, 222, 155, 0.14), 0 0 18px rgba(74, 222, 155, 0.5);
  flex: none;
}

.brand-name { font-weight: 650; letter-spacing: 0.2px; }
.brand-sub { color: var(--dimmer); font-size: 12px; padding-left: 10px; border-left: 1px solid var(--line); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.clock { font-family: var(--mono); font-size: 12px; color: var(--dim); letter-spacing: 0.5px; }

/* ---------- 布局 ---------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 22px 64px; }

.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}

.hero h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.4px; font-weight: 680; }
.hero p { margin: 0; font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

/* ---------- 卡片 ---------- */

.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.card:hover { border-color: #2e3948; }
.card.running { border-color: rgba(74, 222, 155, 0.4); }
.card.running::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 155, 0.18);
}

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.card-title { font-size: 15px; font-weight: 620; margin: 0; letter-spacing: -0.1px; }
.card-uin { font-family: var(--mono); font-size: 11.5px; color: var(--dimmer); margin-top: 2px; }

.balance { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 4px; }
.balance .num {
  font-family: var(--mono); font-size: 32px; font-weight: 600; letter-spacing: -1px;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.balance .unit { font-size: 12px; color: var(--dim); }
.balance .delta { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; }
.delta.up { color: var(--accent); background: rgba(74, 222, 155, 0.1); }
.delta.flat { color: var(--dim); background: rgba(255, 255, 255, 0.04); }

.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }

.chip {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--mono);
  white-space: nowrap;
}

.chip.on { color: var(--accent); border-color: rgba(74, 222, 155, 0.28); background: rgba(74, 222, 155, 0.07); }
.chip.off { color: var(--dimmer); text-decoration: line-through; }

.badge {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { color: var(--accent); background: rgba(74, 222, 155, 0.11); border-color: rgba(74, 222, 155, 0.25); }
.badge.fail { color: var(--red); background: rgba(240, 97, 109, 0.11); border-color: rgba(240, 97, 109, 0.25); }
.badge.warn { color: var(--amber); background: rgba(245, 185, 66, 0.11); border-color: rgba(245, 185, 66, 0.25); }
.badge.idle { color: var(--dim); background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.badge.live { color: var(--accent); background: rgba(74, 222, 155, 0.11); border-color: rgba(74, 222, 155, 0.3); }
.badge.live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: 1px;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.card-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- 日志流 ---------- */

.live-log {
  margin-top: 12px;
  background: #080b0f;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  color: #b6c3d4;
  max-height: 190px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.live-log .ln { display: block; }
.live-log .ln.ok { color: #9fe8c6; }
.live-log .ln.warn { color: var(--amber); }
.live-log .ln.err { color: var(--red); }

/* ---------- 按钮 ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
  white-space: nowrap;
}
.btn:hover { background: #212936; border-color: #303b4a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, #58e6a8, var(--accent));
  border-color: #3ecf8e;
  color: #06231a;
  font-weight: 650;
}
.btn.primary:hover { background: linear-gradient(180deg, #6df0b6, #45d695); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); }

.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); border-color: rgba(240, 97, 109, 0.3); }
.btn.danger:hover { background: rgba(240, 97, 109, 0.12); }

/* ---------- 面板 ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 620; color: var(--text); }

.history { display: flex; flex-direction: column; gap: 2px; }

.hrow {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
}
.hrow:hover { background: var(--panel-2); border-color: var(--line-soft); }
.hrow .when { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.hrow .who { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .coins { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 56px; text-align: right; }

.empty { color: var(--dimmer); font-size: 13px; padding: 18px 4px; text-align: center; }

/* ---------- 表单 ---------- */

label { display: block; margin-bottom: 14px; font-size: 12.5px; color: var(--dim); }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  margin-top: 6px;
  background: #0c1015;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(74, 222, 155, 0.1);
}
textarea { resize: vertical; min-height: 92px; font-family: var(--mono); font-size: 12.5px; }

.switch {
  appearance: none;
  width: 42px; height: 24px;
  border-radius: 999px;
  background: #232b37;
  position: relative;
  cursor: pointer;
  flex: none;
  margin: 0;
  transition: background 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #7c8798;
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch:checked { background: rgba(74, 222, 155, 0.32); }
.switch:checked::after { transform: translateX(18px); background: var(--accent); }

.prefs .row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.prefs .row:last-child { border-bottom: none; }
.prefs .row span { display: block; }
.prefs .row b { font-weight: 580; font-size: 13px; color: var(--text); display: block; }
.prefs .row i { font-style: normal; font-size: 11.5px; color: var(--dimmer); display: block; margin-top: 2px; }
.prefs .row input[type="text"] { width: 190px; margin: 0; }

/* ---------- 登录 ---------- */

.auth-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 26px;
  margin: 8vh auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
body.centered .auth-card { margin: 0; }
.auth-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -0.3px; }
.auth-card p { margin: 0 0 20px; font-size: 12.5px; }
.err { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 10px 0 0; }

.dim { color: var(--dim); }

/* ---------- 弹层 ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: rise 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.modal.wide { max-width: 720px; }
@keyframes rise { from { transform: translateY(10px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }

.modal h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.2px; }
.modal .sub { color: var(--dim); font-size: 12.5px; margin: 0 0 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.hint {
  background: rgba(106, 166, 255, 0.06);
  border: 1px solid rgba(106, 166, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12px;
  color: #a9c6ee;
  line-height: 1.7;
  margin-bottom: 16px;
}
.hint b { color: #cfe1fb; }
.hint code {
  font-family: var(--mono); font-size: 11.5px;
  background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px;
}

.logbox {
  background: #070a0e;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  color: #b6c3d4;
  max-height: 52vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  background: #1b2230;
  border: 1px solid #2c3644;
  color: var(--text);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.2s ease;
}
.toast.bad { border-color: rgba(240, 97, 109, 0.4); color: #ffb3b9; }


/* ---------- 走势图 ---------- */

.seg {
  display: flex; gap: 2px; padding: 2px;
  background: #0c1015;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.seg button {
  appearance: none; border: 0; background: transparent;
  color: var(--dim); font: inherit; font-size: 12px;
  padding: 4px 10px; border-radius: 7px; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: #202836; color: var(--text); }

.chart-accounts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chart-accounts:empty { display: none; }

.acct-chip {
  appearance: none; font: inherit; font-size: 12px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent; color: var(--dim);
  cursor: pointer;
  transition: all 0.14s ease;
}
.acct-chip:hover { color: var(--text); border-color: #303b4a; }
.acct-chip.on {
  color: var(--accent);
  border-color: rgba(74, 222, 155, 0.35);
  background: rgba(74, 222, 155, 0.08);
}

.chart-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head .big {
  font-family: var(--mono); font-size: 27px; font-weight: 600;
  letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums;
}
.chart-head .unit { font-size: 12px; color: var(--dimmer); }
.chart-head .stat { font-family: var(--mono); font-size: 12.5px; }
.chart-head .stat.up { color: var(--accent); }
.chart-head .stat.down { color: var(--red); }
.chart-head .stat.flat { color: var(--dim); }
.chart-head .note { font-size: 11.5px; color: var(--dimmer); }

.chart-wrap { position: relative; min-height: 214px; margin-top: 4px; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #1b2230;
  border: 1px solid #2c3644;
  border-radius: 9px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: nowrap;
  transform: translate(-50%, -128%);
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  z-index: 5;
}
.chart-tip.on { opacity: 1; }
.chart-tip .d { color: var(--dim); font-size: 10.5px; }
.chart-tip .v { color: var(--accent); font-size: 13px; }

/* ---------- 标签页 ---------- */

.auth-tabs {
  display: flex; gap: 2px; padding: 3px;
  background: #0c1015;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
  appearance: none; border: 0; background: transparent;
  color: var(--dim); font: inherit; font-size: 13px;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.auth-tabs button:hover { color: var(--text); }
.auth-tabs button.on { background: #1e2632; color: var(--text); }
.auth-tabs.sm { margin: 0 0 16px; }
.auth-tabs.sm button { font-size: 12.5px; padding: 6px 10px; }

/* ---------- 提示条 ---------- */

.tip { margin: 12px 0 0; font-size: 11.5px; color: var(--dimmer); line-height: 1.65; }
.tip b { color: var(--dim); font-weight: 600; }

.codebox {
  margin: 0;
  background: #070a0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: #9fe8c6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
  user-select: all;
}

/* ---------- 用户管理 ---------- */

.admin-new {
  display: grid;
  grid-template-columns: 1fr 1fr 120px auto;
  gap: 8px;
  margin-bottom: 16px;
}
.admin-new input, .admin-new select { margin: 0; }

.user-list { display: flex; flex-direction: column; gap: 2px; }

.user-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.user-row:hover { background: var(--panel-2); border-color: var(--line-soft); }
.u-name { font-size: 13px; font-weight: 580; display: flex; align-items: center; gap: 7px; }
.u-meta { font-size: 11.5px; color: var(--dimmer); margin-top: 3px; }
.u-acts { display: flex; gap: 6px; flex-wrap: wrap; }

.chip.owner {
  color: #a9c6ee;
  border-color: rgba(106, 166, 255, 0.28);
  background: rgba(106, 166, 255, 0.08);
}

/* ---------- 滚动条 ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232b37; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2f3a49; }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 48px; }
  .topbar { padding: 12px 14px; }
  .brand-sub { display: none; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
  .hrow { grid-template-columns: 1fr auto; row-gap: 4px; }
  .hrow .when { grid-column: 1 / -1; }
  .prefs .row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .prefs .row input[type="text"] { width: 100%; }
  .admin-new { grid-template-columns: 1fr; }
}
