/* ============================================================
   ymch.top — 统一设计令牌与组件样式
   仅视觉层：不改变任何 DOM id / hidden 语义，JS 行为不受影响
   ============================================================ */

:root {
  --bg: #f5f7fb;
  --card: rgba(255, 255, 255, .82);
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .10);
  --line-strong: rgba(15, 23, 42, .17);
  --brand: #2563eb;
  --brand-2: #3b82f6;
  --brand-ink: #1d4ed8;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --r-lg: 18px;
  --r-md: 12px;
  --shadow-card: 0 18px 40px -24px rgba(15, 23, 42, .35), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-btn: 0 1px 2px rgba(15, 23, 42, .08);
  --focus: 0 0 0 3px rgba(59, 130, 246, .28);
  --dur: .18s;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── 动态极光背景：纯 CSS，GPU 合成，尊重 reduced-motion ── */
body::before {
  content: "";
  position: fixed;
  inset: -25vmax;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 16% 18%, rgba(59, 130, 246, .38), transparent 62%),
    radial-gradient(34vmax 34vmax at 84% 14%, rgba(139, 92, 246, .30), transparent 62%),
    radial-gradient(42vmax 42vmax at 72% 88%, rgba(14, 165, 233, .30), transparent 64%),
    radial-gradient(30vmax 30vmax at 22% 92%, rgba(45, 212, 191, .26), transparent 62%);
  filter: blur(6px) saturate(1.05);
  animation: drift 28s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120vmax 80vmax at 50% 0%, rgba(255, 255, 255, .55), transparent 70%);
}
@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(1.5%, 1.5%, 0) scale(1.05); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ── 版心 ── */
.page { max-width: 600px; margin: 0 auto; padding: 48px 20px 64px; }

.brand { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; padding-left: 4px; }
.brand .mark {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, .65);
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .5px;
}
.brand h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
.brand .sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
}
.foot { margin: 20px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* ── 标题层级 ── */
h2 { font-size: 16px; margin: 20px 0 10px; letter-spacing: -.1px; }
h1 + h2, .bar + h2 { margin-top: 18px; }
h3 { font-size: 14px; margin: 18px 0 8px; }

/* ── 状态条 ── */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: #f1f5f9; border: 1px solid var(--line);
  color: var(--ink-2); font-size: 14px;
}
.bar::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8; flex: none;
}
.bar.on { background: var(--ok-bg); color: #047857; border-color: rgba(5, 150, 105, .18); }
.bar.on::before { background: var(--ok); box-shadow: 0 0 0 4px rgba(5, 150, 105, .15); }
.bar.off { background: var(--err-bg); color: #b91c1c; border-color: rgba(220, 38, 38, .16); }
.bar.off::before { background: var(--err); box-shadow: 0 0 0 4px rgba(220, 38, 38, .14); }

/* ── 表单 ── */
form { display: grid; gap: 13px; margin: 12px 0 0; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label + input, label + select, label + textarea { margin-top: -2px; }

input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
input, select { height: 44px; padding: 0 14px; }
select { cursor: pointer; }
textarea { min-height: 120px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: var(--focus); background: #fff;
}

/* ── 按钮：统一高度/圆角/状态 ── */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: filter var(--dur), box-shadow var(--dur), transform .06s, background var(--dur);
}
button:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .6), inset 0 1px 0 rgba(255, 255, 255, .22);
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: var(--focus); }

button.ghost {
  background: #fff; color: var(--ink-2);
  border-color: var(--line-strong); box-shadow: var(--shadow-btn);
}
button.ghost:hover { background: #f8fafc; color: var(--brand-ink); border-color: #bfdbfe; }

/* 危险操作（退出登录等）：实心红，尺寸与主按钮一致但足够醒目 */
button.danger {
  background: linear-gradient(180deg, #f87171, #dc2626);
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, .35), inset 0 1px 0 rgba(255, 255, 255, .22);
}
button.danger:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 20px -8px rgba(220, 38, 38, .65), inset 0 1px 0 rgba(255, 255, 255, .22);
}
button.danger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(248, 113, 113, .40); }
button:disabled, button[disabled] {
  opacity: .5; cursor: not-allowed; filter: none; transform: none;
}

/* ── 反馈信息 ── */
.msg { min-height: 18px; margin: 0; font-size: 13px; color: var(--muted); }
.msg.ok, .ok { color: var(--ok); }
.msg.err, .err { color: var(--err); }
.hint { margin: 6px 0; font-size: 12.5px; color: var(--muted); }

/* 部分状态位没有 class（由 JS 动态填充），用 id 后缀兜底统一 */
[id$="Msg"] { min-height: 18px; margin: 6px 0; font-size: 13px; color: var(--muted); }

/* app-page.js 在运行时注入的「我的 QQ 人设」区块 */
#authed > section > h2 { margin-top: 26px; }
#personaOwner { margin: 0 0 8px; font-size: 13px; color: var(--muted); }

hr {
  height: 1px; border: 0; margin: 14px 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* ── 表格 ── */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13.5px;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child th, tr:last-child td { border-bottom: 0; }
tbody th { width: 36%; font-weight: 600; color: var(--ink-2); background: #f8fafc; }

/* ── 链接 ── */
a { color: var(--brand-ink); text-decoration: none; border-bottom: 1px solid rgba(37, 99, 235, .25); }
a:hover { border-bottom-color: var(--brand); }

/* ── 机器人 QQ 展示卡（登录后首屏） ── */
.bot-card {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 18px; padding: 16px 18px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(37, 99, 235, .10), rgba(139, 92, 246, .10));
  border: 1px solid rgba(37, 99, 235, .20);
}
.bot-avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #818cf8, #2563eb);
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .7);
}
.bot-meta { min-width: 0; }
.bot-label { font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.bot-num {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 25px; font-weight: 700; line-height: 1.2;
  letter-spacing: .5px; font-variant-numeric: tabular-nums;
  color: #1d4ed8; cursor: copy;
  -webkit-user-select: all; user-select: all;
}
.bot-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .page { padding: 28px 14px 44px; }
  .card { padding: 20px; border-radius: 16px; }
  .brand h1 { font-size: 21px; }
  button { width: 100%; }
  .row button, .top button { width: auto; }
}

/* 账号中心与 QQ 控制中心之间的导航入口 */
.button-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px; border: 1px solid transparent;
  border-radius: var(--r-md); color: #fff; font-weight: 600;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  box-shadow: var(--shadow-btn); text-align: center;
}
.button-link:hover { color: #fff; filter: brightness(1.06); border-color: transparent; }
.button-link:focus-visible { outline: none; box-shadow: var(--focus); }
#botContent > .bot-card { margin-top: 20px; }
#personalPanel > button { margin: 0 8px 8px 0; }
@media (max-width: 640px) {
  .button-link { width: 100%; }
  #personalPanel > button { margin-right: 0; }
}
