/* Steam 账号池 — 深色单页样式，零依赖 */
:root {
  --bg: #0d1117;
  --bg-2: #131a24;
  --card: #161e2a;
  --card-2: #1b2532;
  --line: #24303f;
  --line-soft: #1d2735;
  --text: #e4ecf5;
  --muted: #8595a8;
  --accent: #66c0f4;
  --accent-2: #2a475e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 520px at 12% -10%, #1b3a5c 0%, transparent 62%),
    radial-gradient(900px 480px at 100% 0%, #1a4a6b 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

h1, h2 { margin: 0 0 4px; font-weight: 650; letter-spacing: .2px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 14px; }
[hidden] { display: none !important; }

/* ---------- 锁屏 ---------- */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(28, 41, 57, .96), rgba(16, 23, 32, .96));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.gate-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: linear-gradient(160deg, #66c0f4, #1b6fb3);
  color: #06101a;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(102, 192, 244, .28);
}

/* ---------- 布局 ---------- */
.app {
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(19, 26, 36, .82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 10px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(160deg, #66c0f4, #1b6fb3);
  color: #06101a;
  font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  white-space: nowrap;
}
.chip.ok { border-color: #2c5b3a; color: #8fe0aa; background: #12251a; }
.chip.bad { border-color: #5f2b2b; color: #f1a5a5; background: #241414; }
/* 有外网地址时，这个小标签就是「点一下复制地址」的按钮 */
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: #2c5b3a; }
.chip.clickable:active { transform: translateY(1px); }

/* ---------- 统计 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat b { display: block; font-size: 22px; font-weight: 650; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.hot b { color: var(--danger); }

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { display: none; }
.panel.active { display: block; }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .input { flex: 1 1 220px; min-width: 0; }
.toolbar .select { flex: 0 0 auto; min-width: 132px; }

/* ---------- 表单元素 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { color: var(--muted); font-size: 12px; }
.field.span2 { grid-column: span 2; }
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
  margin-top: 10px;
}

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #3a6a8f;
  box-shadow: 0 0 0 3px rgba(102, 192, 244, .14);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #5c6b7d; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input { width: auto; }

.btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 8px 14px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #212d3d; border-color: #33455a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #3f9ddb, #2278b6);
  border-color: #2278b6;
  color: #04121c;
  font-weight: 600;
}
.btn.primary:hover { background: linear-gradient(180deg, #4fb0ef, #2a86c7); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { background: #4a1f1f; border-color: #6b2c2c; color: #ffb4b4; }
.btn.danger:hover { background: #5c2626; }
.btn.block { width: 100%; margin-top: 6px; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

/* ---------- 卡片 ---------- */
.cards { display: grid; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  transition: border-color .15s, background .15s;
}
.card:hover { background: var(--card-2); }
.card.is-in_use { border-left-color: var(--accent); }
.card.is-banned { border-left-color: var(--danger); }
.card.is-retired { border-left-color: #4b5563; opacity: .72; }
.card-main { min-width: 0; flex: 1 1 auto; }
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.card-title b { font-size: 15px; font-weight: 650; word-break: break-all; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}
.card-meta code { font-family: Consolas, monospace; font-size: 11.5px; }
.card-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 320px;
}

.tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid #2b4a63;
  background: #14283a;
  color: #9ccbe8;
  white-space: nowrap;
}
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.idle { color: #9fe0b4; border-color: #2c5b3a; background: #12251a; }
.badge.in_use { color: #9fd8f7; border-color: #2b5470; background: #102636; }
.badge.banned { color: #f2a4a4; border-color: #653131; background: #241414; }
.badge.retired { color: #a4adba; }
.badge.warn { color: #f4cd8a; border-color: #5c4a24; background: #241f10; }
.badge.danger { color: #f2a4a4; border-color: #653131; background: #241414; }
.badge.ok { color: #9fe0b4; border-color: #2c5b3a; background: #12251a; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* 提醒条：没装 Steam、或别的需要注意但不需要弹窗的事 */
.notice {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid #5c4a24;
  background: #241f10;
  color: #f4cd8a;
  font-size: 13px;
  line-height: 1.7;
}

/* ---------- 日志 ---------- */
.audit {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.audit-row {
  display: grid;
  grid-template-columns: 150px 150px 1fr;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.audit-row:last-child { border-bottom: 0; }
.audit-row time { color: var(--muted); font-family: Consolas, monospace; font-size: 11.5px; }
.audit-row .act { color: var(--accent); }
.audit-row .det { color: var(--muted); }
.audit-row .tgt { color: var(--text); }

/* ---------- 弹窗 ---------- */
.dlg {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #18212e, #121922);
  color: var(--text);
  padding: 22px 24px;
  width: min(680px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dlg.small { width: min(470px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(4, 8, 13, .68); backdrop-filter: blur(3px); }
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.secret-field {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 4px;
}
.reveal-body { display: grid; gap: 8px; margin-top: 12px; }
.reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
}
.reveal-row .k { color: var(--muted); font-size: 12px; flex: 0 0 88px; }
.reveal-row .v {
  flex: 1 1 auto;
  font-family: Consolas, monospace;
  word-break: break-all;
  user-select: all;
}
.reveal-row .v.empty-val { color: var(--muted); font-style: italic; font-family: inherit; }

/* ---------- 备份恢复 ---------- */
.restore-preview {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  line-height: 1.75;
}
.restore-preview p { margin: 4px 0; }
.restore-list {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 200px;
  overflow: auto;
  color: var(--muted);
}
.restore-list li { margin: 3px 0; }

/* ---------- 记事 ---------- */
.card.is-pinned { border-left-color: var(--warn, #d9a441); }
.note-body {
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--fg, #dbe4ee);
  font-size: 13px;
  max-height: 220px;
  overflow: auto;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #1d2b3a;
  border: 1px solid #2f4359;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 99;
  font-size: 13px;
  animation: rise .18s ease-out;
}
.toast.err { background: #2d1618; border-color: #6b2c2c; color: #ffb4b4; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 共享池 ---------- */
.pool-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.pool-me {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pool-me .field { margin-bottom: 0; min-width: 200px; flex: 1 1 200px; }
.field.inline { flex-direction: column; }
/* 「正在用」卡片右侧挂心跳断了的提醒 */
.card-meta .badge.danger { margin-left: 4px; }
.sub-head {
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  margin: 18px 0 10px;
  letter-spacing: .02em;
}
.sub-head:first-of-type { margin-top: 4px; }
/* 可用号列表用两列，比「正在用」更紧凑 */
.cards.compact {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.compact-card { padding: 12px 14px; }
.compact-card .card-title b { font-size: 14px; }
.empty-val { color: var(--muted); font-style: italic; }

@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .field.span2 { grid-column: span 1; }
  .card { flex-direction: column; }
  .card-actions { max-width: none; justify-content: flex-start; }
  .audit-row { grid-template-columns: 1fr; gap: 2px; }
  .topbar { flex-wrap: wrap; }
}