/* ===== AK工作室 · 基础样式 ===== */
:root {
  --bg: #070b14;
  --bg-soft: #0d1322;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e9eefb;
  --muted: #8a95ad;
  --muted-2: #626d84;
  --cyan: #38bdf8;
  --teal: #2dd4bf;
  --violet: #a855f7;
  --amber: #fbbf24;
  --rose: #fb7185;
  --green: #34d399;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --maxw: 1200px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

h1, h2, h3, h4, p { margin: 0; }

::selection { background: rgba(56, 189, 248, .3); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); background-clip: padding-box; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ===== 背景光斑 ===== */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-orbs::before,
.bg-orbs::after {
  content: "";
  position: absolute;
  width: 720px; height: 720px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .3;
}
.bg-orbs::before { background: radial-gradient(circle, #1e6fff, transparent 62%); top: -320px; left: -180px; }
.bg-orbs::after { background: radial-gradient(circle, #9b3cff, transparent 62%); top: -200px; right: -260px; }

.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 100%);
}

/* ===== 通用按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: .18s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #08101f;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(56, 189, 248, .28);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(56, 189, 248, .42); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--rose); border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .1); }
.btn-danger:hover { background: rgba(251, 113, 133, .2); border-color: rgba(251, 113, 133, .55); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ===== 表单 ===== */
.field { margin-bottom: 18px; }
.field > label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 600; color: #c3cddf;
  letter-spacing: .3px;
}
.field .hint { margin-top: 6px; font-size: 12px; color: var(--muted-2); }

.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .16s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(56, 189, 248, .6);
  background: rgba(56, 189, 248, .06);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.75; }
.select option { background: #0f1524; color: var(--text); }

.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }

.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #c3cddf; cursor: pointer; user-select: none; }
.checkline input { accent-color: var(--cyan); width: 16px; height: 16px; }

/* ===== 徽标 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .3px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #d5deee;
  white-space: nowrap;
}
.badge-ver { background: rgba(56, 189, 248, .16); border-color: rgba(56, 189, 248, .35); color: #7dd3fc; }
.badge-hot { background: linear-gradient(135deg, rgba(251, 113, 133, .25), rgba(251, 191, 36, .25)); border-color: rgba(251, 113, 133, .4); color: #fda4af; }
.badge-top { background: rgba(168, 85, 247, .2); border-color: rgba(168, 85, 247, .4); color: #d8b4fe; }
.badge-off { background: rgba(148, 163, 184, .18); border-color: rgba(148, 163, 184, .3); color: #94a3b8; }
.badge-ok { background: rgba(52, 211, 153, .16); border-color: rgba(52, 211, 153, .35); color: #6ee7b7; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 6, 14, .78);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
  animation: fade .2s ease;
  overflow-y: auto;
}
.modal-mask[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: 100%; max-width: 940px;
  background: linear-gradient(180deg, #111a2c, #0b1120);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
  margin: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(11, 17, 32, .92);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.modal-head h3 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.modal-body { padding: 22px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-close {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel); color: var(--muted);
  cursor: pointer; font-size: 19px; line-height: 1;
  transition: .16s;
}
.modal-close:hover { color: var(--text); background: rgba(251, 113, 133, .18); border-color: rgba(251, 113, 133, .4); }

/* ===== 提示条 ===== */
.toast-wrap {
  position: fixed; z-index: 200; top: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  width: max-content; max-width: 92vw;
}
.toast {
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(17, 26, 44, .96);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn .25s ease;
}
.toast-error { border-color: rgba(251, 113, 133, .5); color: #fecdd3; }
.toast-ok { border-color: rgba(52, 211, 153, .45); color: #a7f3d0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) } to { opacity: 1; transform: none } }

/* ===== 加载与空态 ===== */
.spinner {
  width: 30px; height: 30px; margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.empty {
  text-align: center; padding: 64px 20px; color: var(--muted);
}
.empty-icon { font-size: 42px; margin-bottom: 12px; opacity: .55; }
.empty-title { font-size: 16px; color: #c3cddf; margin-bottom: 6px; font-weight: 600; }

.grad-text {
  background: linear-gradient(120deg, #7dd3fc, #a5f3fc 30%, #d8b4fe 70%, #f0abfc);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== 全局兜底 =====
 * 必须放在所有样式之后：浏览器默认的 [hidden]{display:none} 属于 UA 样式，
 * 会被 .login-wrap{display:grid} 这类作者样式压掉，导致 JS 设置 hidden=true 却不生效。
 * 这里用 !important 强制：任何带 hidden 属性的元素一律隐藏。
 */
[hidden] { display: none !important; }

/* 显式兜底：登录后必须彻底移除登录容器（旧版此处的 display:grid 会覆盖 hidden） */
.login-wrap[hidden],
#appRoot[hidden] { display: none !important; }

@media (max-width: 640px) {
  .row { flex-direction: column; gap: 0; }
  .modal { max-width: 100%; border-radius: 16px; }
  .modal-body { padding: 16px; max-height: calc(100vh - 170px); }
}
