:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --card: #1b2029;
  --card2: #212734;
  --line: #2a3140;
  --text: #e6eaf2;
  --muted: #8b95a8;
  --brand: #00a4ff;
  --brand2: #0086d1;
  --green: #2ecc71;
  --red: #ff5c5c;
  --amber: #ffb020;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2740 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.app { max-width: 1180px; margin: 0 auto; padding: 0 20px 130px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 0 18px; flex-wrap: wrap; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #6f5cff);
  display: grid; place-items: center;
  font-weight: 800; font-size: 21px; color: #fff;
  box-shadow: 0 6px 20px rgba(0, 164, 255, .35);
}
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.brand .sub { font-size: 12px; color: var(--muted); }

.top-status { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: #9be8bd; border-color: rgba(46,204,113,.35); background: rgba(46,204,113,.1); }
.pill.warn { color: #ffd591; border-color: rgba(255,176,32,.35); background: rgba(255,176,32,.1); }
.pill.bad { color: #ffb3b3; border-color: rgba(255,92,92,.35); background: rgba(255,92,92,.1); }

/* ---------- 面板 ---------- */
.panel { animation: fade .22s ease; }
.panel.hidden { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h3 { font-size: 15px; font-weight: 650; margin-bottom: 14px; letter-spacing: .2px; }
.card h4 { font-size: 13px; font-weight: 600; margin: 14px 0 10px; color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.center { text-align: center; }

/* ---------- 统计卡 ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: left; }
.stat .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat strong { font-size: 24px; font-weight: 700; display: block; line-height: 1.2; }
.stat .hint { font-size: 11px; color: var(--muted); }
.red { color: var(--red); }
.green { color: var(--green); }
.amber { color: var(--amber); }

/* ---------- 键值表 ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); word-break: break-all; }
.kv dd.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 13px;
  transition: .15s; font-family: inherit;
}
.btn:hover { border-color: #3a465c; background: #252c3a; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); border: none; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #ff8f8f; border-color: rgba(255,92,92,.3); }
.btn.danger:hover { background: rgba(255,92,92,.12); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 9px; margin-top: 15px; flex-wrap: wrap; }
.actions.center { justify-content: center; }

/* ---------- 二维码 ---------- */
.qr-box {
  width: 300px; height: 300px; margin: 6px auto 14px;
  background: #fff; border-radius: 14px; display: grid; place-items: center;
  overflow: hidden; position: relative;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { color: #94a3b8; font-size: 13px; padding: 20px; text-align: center; }
.hidden { display: none !important; }
.tip { text-align: center; font-size: 13px; color: var(--muted); }
.tip small { font-size: 11px; opacity: .8; }
.status-line { text-align: center; font-size: 13px; margin-top: 12px; min-height: 20px; color: var(--muted); }
.status-line.ok { color: var(--green); }
.status-line.err { color: var(--red); }

/* ---------- 上传区 ---------- */
.drop {
  border: 2px dashed var(--line); border-radius: 12px; padding: 34px 20px;
  text-align: center; cursor: pointer; transition: .18s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: rgba(0,164,255,.06); }
.drop-icon { font-size: 34px; margin-bottom: 8px; opacity: .85; }
.drop p { font-size: 13px; }
.drop small { font-size: 11px; color: var(--muted); }

.har-result {
  margin-top: 15px; background: rgba(0,164,255,.06);
  border: 1px solid rgba(0,164,255,.2); border-radius: 10px; padding: 14px;
  font-size: 12px;
}
.har-result.ok { background: rgba(46,204,113,.07); border-color: rgba(46,204,113,.25); }
.har-result.err { background: rgba(255,92,92,.07); border-color: rgba(255,92,92,.25); }
.har-result pre { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; line-height: 1.55; }

/* ---------- 列表 ---------- */
.steps, .bullets { padding-left: 20px; font-size: 13px; color: #c3ccdd; }
.steps li, .bullets li { margin: 7px 0; }
.steps b, .bullets b { color: var(--text); }

.timeline { list-style: none; }
.timeline li {
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px;
  display: flex; justify-content: space-between; gap: 10px;
}
.timeline li:last-child { border-bottom: none; }
.timeline .t { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.timeline .empty { color: var(--muted); justify-content: center; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 500;
  padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 11.5px;
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid rgba(42,49,64,.55); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table td.empty { text-align: center; color: var(--muted); padding: 26px; }
.table .mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.badge.ok { background: rgba(46,204,113,.15); color: #7ee2a8; }
.badge.bad { background: rgba(255,92,92,.15); color: #ff9d9d; }
.badge.warn { background: rgba(255,176,32,.15); color: #ffce7a; }

/* ---------- 表单 ---------- */
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row label { font-size: 13px; color: #c3ccdd; }
.input {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 9px; font-size: 13px; font-family: inherit;
}
.input.sm { width: 90px; }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.hint { font-size: 11.5px; color: var(--muted); }

.code {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 9px;
  padding: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.6; overflow-x: auto; color: #a8b6cc;
}

hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- 底部导航 ---------- */
.tabs {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 4px; background: rgba(22,26,33,.92);
  backdrop-filter: blur(14px); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px; z-index: 50;
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 7px 15px; border-radius: 10px; font-size: 11px; transition: .15s;
  font-family: inherit;
}
.tab span { font-size: 16px; line-height: 1; }
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2)); }
@media (max-width: 900px) { .tab { padding: 6px 8px; font-size: 9.5px; } .tab span { font-size: 13px; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translate(-50%, -90px);
  background: var(--card2); border: 1px solid var(--line);
  padding: 11px 22px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 34px rgba(0,0,0,.5); z-index: 999;
  transition: transform .28s cubic-bezier(.2,.9,.3,1.2), opacity .2s;
  opacity: 0; pointer-events: none; max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { border-color: rgba(46,204,113,.5); }
.toast.err { border-color: rgba(255,92,92,.5); }

.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- 短剧成长值 ---------- */
.progress-bar {
  height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), #6f5cff);
  transition: width .35s ease;
}
.progress-text { font-size: 12px; color: var(--muted); margin-top: 8px; }

.drama-status {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; min-height: 100px; font-size: 12.5px;
  font-family: ui-monospace, Menlo, monospace; line-height: 1.7;
  max-height: 240px; overflow-y: auto;
}
.drama-status .line { padding: 2px 0; }
.drama-status .line.ok { color: #7ee2a8; }
.drama-status .line.err { color: #ff9d9d; }
.drama-status .line.info { color: #8bc7ff; }

select.input { appearance: none; background-image: none; }

/* ---------- 手动填写 / 分段控件 ---------- */
.seg {
  display: flex; gap: 4px; background: var(--bg2); padding: 4px;
  border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--line);
}
.seg-btn {
  flex: 1; padding: 8px 12px; border: none; background: none; color: var(--muted);
  border-radius: 7px; cursor: pointer; font-size: 12.5px; font-family: inherit;
  transition: .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--card2); color: #fff; font-weight: 600; }

.textarea {
  width: 100%; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.6; min-height: 90px;
}
.field { margin-bottom: 11px; }
.field label {
  display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px;
}
.field label .red { color: var(--red); }
.field .input { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 令牌验证遮罩 ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 999;
  display: none; place-items: center;
  background: rgba(8, 10, 14, .88);
  backdrop-filter: blur(8px);
  padding: 20px;
}
.auth-gate.show { display: grid; }
.auth-box {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 34px 30px 28px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.auth-logo {
  width: 54px; height: 54px; margin: 0 auto 16px;
  border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #6f5cff);
  color: #fff; font-weight: 800; font-size: 25px;
  box-shadow: 0 8px 24px rgba(0, 164, 255, .35);
}
.auth-box h2 { font-size: 18px; margin-bottom: 8px; }
.auth-tip { color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }
.auth-input { width: 100%; text-align: center; letter-spacing: 1px; }
.auth-btn { width: 100%; margin-top: 12px; }
.auth-note { color: var(--muted); font-size: 11px; margin-top: 16px; line-height: 1.5; }
