/* 站点共享基础样式：tokens、重置、导航、按钮、表单、页脚。
   页面各自的内容样式写在各自 HTML 的 <style> 中。 */
:root {
  --bg: #0c0d0e;
  --bg-soft: #131416;
  --panel: #17181b;
  --panel-2: #1d1f23;
  --border: #26282d;
  --text: #e8eaed;
  --text-dim: #9aa0a8;
  --text-faint: #6b7280;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-border: rgba(34, 197, 94, 0.35);
  --blue: #3b82f6;
  --orange: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 13, 14, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: #052e12;
}
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 14px; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-login {
  margin-left: 14px; font-size: 13.5px; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent-border);
  background: var(--accent-soft); border-radius: 8px; padding: 5px 14px;
}
.nav-login:hover { text-decoration: none; filter: brightness(1.15); }

/* ---------- 汉堡按钮与移动端下拉面板 ---------- */
.nav-burger {
  display: none; margin-left: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); cursor: pointer; padding: 7px 9px; line-height: 0;
}
.nav-burger .icon-close { display: none; }
nav.open .nav-burger .icon-menu { display: none; }
nav.open .nav-burger .icon-close { display: block; }
nav.open .nav-burger { border-color: var(--accent-border); }

@media (max-width: 860px) {
  .nav-burger { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(12, 13, 14, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 6px 24px 16px;
  }
  nav.open .nav-links { display: flex; }
  .nav-links a { padding: 13px 4px; font-size: 15px; border-bottom: 1px solid var(--border); }
  .nav-links a:hover { color: var(--text); }
  .nav-links .nav-login { margin: 14px 0 0; text-align: center; padding: 10px 0; font-size: 14.5px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 10px; padding: 12px 24px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; transition: 0.15s; cursor: pointer;
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #052e12; }
.btn-primary:hover { background: #34d76b; }
.btn-ghost { border-color: var(--border); background: var(--panel); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-border); }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, 0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }
.btn-small { padding: 7px 16px; font-size: 13.5px; border-radius: 8px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; color: var(--text-dim); margin-bottom: 6px; }
.input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-size: 14.5px; padding: 10px 14px;
  font-family: inherit; outline: none;
}
.input:focus { border-color: var(--accent-border); }
.msg { border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.msg.error { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.msg.ok { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

/* ---------- page card (login / authorize / account) ---------- */
.page-main { display: flex; justify-content: center; padding: 80px 24px 120px; min-height: calc(100vh - 60px); }
.page-card {
  width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 30px;
}
.page-card h1 { font-size: 22px; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-card .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.tabs { display: flex; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tabs button {
  flex: 1; border: none; background: transparent; color: var(--text-dim);
  font-size: 14px; font-weight: 600; padding: 8px 0; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.tabs button.active { background: var(--accent); color: #052e12; }
.device-code {
  font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: 0.18em;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: 10px; text-align: center; padding: 14px 0; margin: 18px 0 22px;
}
.row-line { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.row-line:last-of-type { border-bottom: none; }
.row-line .k { color: var(--text-faint); }
.row-line .v { color: var(--text); }

/* ---------- 站点对话框（替代原生 confirm / prompt） ---------- */
dialog.site-dialog {
  /* 显式居中：站点的 `* { margin: 0 }` 重置会覆盖 UA 的 dialog 居中规则 */
  position: fixed; inset: 0; margin: auto;
  padding: 0; border: none; background: transparent; color: var(--text);
  width: min(440px, calc(100vw - 32px)); height: fit-content;
  max-width: none; max-height: calc(100vh - 32px); overflow: auto;
}
dialog.site-dialog::backdrop {
  background: rgba(6, 7, 8, 0.62);
  backdrop-filter: blur(3px);
  animation: dialog-fade 0.16s ease-out;
}
dialog.site-dialog[open] { animation: dialog-pop 0.18s cubic-bezier(0.22, 1, 0.36, 1); }
.dialog-card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 24px 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.dialog-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-message { color: var(--text-dim); font-size: 13.5px; line-height: 1.65; margin-top: 8px; }
.dialog-input-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.dialog-input-row .input { flex: 1; min-width: 0; }
.dialog-suffix { flex: none; color: var(--text-dim); font-size: 14px; }
.dialog-error { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-actions .btn:hover { transform: none; }
@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--border); padding: 40px 0 56px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 560px) {
  .page-main { padding: 48px 16px 80px; }
}
