/* =========================================================================
   魔方开放平台 · 0_ 风格样式
   深色 / 等宽 / 发丝线 / 无外部依赖
   ========================================================================= */

:root {
  --bg: #08090a;
  --bg-soft: #0b0d0f;
  --panel: #101316;
  --panel-2: #14181c;
  --panel-3: #191e23;
  --line: #22282f;
  --line-soft: #1a1f24;
  --line-strong: #333b45;
  --text: #e6e8e6;
  --text-soft: #c3c8c6;
  --muted: #98a0a8;
  --dim: #6a7078;
  --accent: #c6ff3d;
  --accent-ink: #101400;
  --accent-soft: rgba(198, 255, 61, 0.12);
  --ok: #57d98a;
  --warn: #ffc857;
  --danger: #ff6b6b;
  --info: #79c9ff;
  --radius: 5px;
  --mono: "SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(1100px 600px at 50% -20%, rgba(198, 255, 61, 0.05), transparent 65%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li { margin: 2px 0; }
small { font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
code, kbd, pre { font-family: var(--mono); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- 头部 */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 9, 10, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-mark {
  display: inline-block;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(198, 255, 61, 0.35);
  border-radius: 3px;
  padding: 0 5px;
  font-weight: 700;
  line-height: 1.4;
}
.brand-mark.is-plain { background: none; border: 0; padding: 0; }
.brand:hover .brand-mark { background: var(--accent); color: var(--accent-ink); }
.brand-text { font-size: 14px; }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  padding: 6px 9px;
  border-radius: 3px;
  border: 1px solid transparent;
  font-size: 13px;
}
.site-nav a:hover { color: var(--text); background: var(--panel-2); }
.site-nav a.is-active { color: var(--accent); border-color: rgba(198, 255, 61, 0.25); background: var(--accent-soft); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ 布局容器 */

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 56px;
  animation: rise 0.18s ease-out;
}
.container.is-narrow { max-width: 760px; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 6px; }
.kicker {
  display: block;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.lead { color: var(--muted); max-width: 68ch; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.mt0 { margin-top: 0; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; }
.mb8 { margin-bottom: 8px; }
.mb16 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card.is-flat { background: var(--bg-soft); }
.card.is-pad-sm { padding: 14px 16px; }
.card h3 { margin-bottom: 4px; }
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.auto-sm { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label {
  display: block;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stat-value { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-value small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #d6ff66; border-color: #d6ff66; color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-danger { background: transparent; border-color: rgba(255, 107, 107, 0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.1); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.45; pointer-events: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- 表格 */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  color: var(--dim);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.table td.right, .table th.right { text-align: right; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 7px 10px; }

/* ---------------------------------------------------------------- 徽标 */

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); border-color: rgba(87, 217, 138, 0.4); background: rgba(87, 217, 138, 0.08); }
.badge-warn { color: var(--warn); border-color: rgba(255, 200, 87, 0.4); background: rgba(255, 200, 87, 0.08); }
.badge-danger { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); }
.badge-info { color: var(--info); border-color: rgba(121, 201, 255, 0.4); background: rgba(121, 201, 255, 0.08); }
.badge-accent { color: var(--accent); border-color: rgba(198, 255, 61, 0.4); background: var(--accent-soft); }
.badge-muted { color: var(--dim); }

/* ---------------------------------------------------------------- 表单 */

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field > label, .label {
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.field .hint { color: var(--dim); font-size: 11px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="search"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  transition: border-color 0.12s;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:hover, select:hover, textarea:hover { border-color: #414b56; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 13px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-card { max-width: 460px; }
.form-card.is-wide { max-width: 760px; }

/* ------------------------------------------------------------ 提示条 */

.flash {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  margin-bottom: 18px;
  font-size: 13px;
}
.flash-ok { border-color: rgba(87, 217, 138, 0.4); background: rgba(87, 217, 138, 0.07); color: #c9f5d8; }
.flash-err { border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.07); color: #ffd7d7; }
.flash-mark { color: var(--accent); font-weight: 700; }
.flash-ok .flash-mark { color: var(--ok); }
.flash-err .flash-mark { color: var(--danger); }

/* ------------------------------------------------------ 键值 / 列表 */

.kv { display: grid; grid-template-columns: minmax(110px, 180px) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--dim); font-size: 12px; letter-spacing: 0.05em; }
.kv dd { margin: 0; color: var(--text-soft); word-break: break-word; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.list > li:last-child { border-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.list-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--dim);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 13px;
}
.empty code { color: var(--muted); }

/* ------------------------------------------------------------ 子导航 */

.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.tabs a {
  padding: 9px 13px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- 首页 */

.hero { padding: 30px 0 8px; }
.hero-title {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  font-weight: 600;
}
.hero-title .accent { color: var(--accent); }
.hero-lead { color: var(--muted); font-size: 15px; max-width: 62ch; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-note { color: var(--dim); font-size: 12px; }

.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-head .more { color: var(--muted); font-size: 13px; }
.section-head .more:hover { color: var(--accent); }

.steps { counter-reset: step; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.step {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  display: block;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}
.step h3 { font-size: 14px; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 12.5px; margin: 0; }

.feature { border-left: 2px solid var(--line-strong); padding-left: 14px; }
.feature h3 { font-size: 14px; margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: 13px; margin: 0; }

.announce-item { display: block; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.announce-item:last-child { border-bottom: 0; }
.announce-item .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.announce-item .meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.announce-item .excerpt { color: var(--muted); font-size: 13px; margin-top: 6px; }

.download-card { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.download-card .plat { display: flex; align-items: center; justify-content: space-between; }
.download-card .ver { color: var(--accent); font-size: 13px; }
.download-card .meta { color: var(--dim); font-size: 12px; word-break: break-all; }

.prose { color: var(--text-soft); max-width: 76ch; }
.prose h2 { color: var(--text); margin-top: 32px; font-size: 18px; }
.prose h3 { color: var(--text); margin-top: 24px; font-size: 15px; }
.prose p, .prose li { color: var(--muted); font-size: 13.5px; }
.prose code { color: var(--accent); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 2px; font-size: 12.5px; }
.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-soft);
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 14px 0; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border: 1px solid var(--line); }
.prose th { background: var(--bg-soft); color: var(--muted); font-weight: 500; }

.notice {
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--accent);
  background: var(--panel);
  padding: 12px 16px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 13px;
}
.notice strong { color: var(--text); }

.copy-field {
  display: flex;
  gap: 0;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-soft);
}
.copy-field input {
  border: 0;
  border-radius: 0;
  background: transparent;
  flex: 1;
  min-width: 0;
}
.copy-field .btn { border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; }

/* 分页 */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .is-current { background: var(--accent-soft); border-color: rgba(198, 255, 61, 0.4); color: var(--accent); }
.pagination .gap { border: 0; color: var(--dim); }

/* 登录页 */
.auth-wrap { min-height: calc(100vh - 220px); display: flex; align-items: center; justify-content: center; padding: 20px 0; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 22px; }
.auth-card .brand { margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .lead { font-size: 13px; margin-bottom: 20px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 12px; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 12px;
}
.footer-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }

/* 工具类 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 响应式 */
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split { grid-template-columns: 1fr; }
  .container { padding: 24px 16px 48px; }
  .header-inner { padding: 0 16px; gap: 12px; flex-wrap: wrap; min-height: 54px; }
  .site-nav { order: 3; width: 100%; padding-bottom: 8px; }
  .header-actions { margin-left: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .hero { padding-top: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .table td, .table th { padding: 8px 10px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
