/* GameFormulas — shared styles.
   零外部请求：不引 Google Fonts / CDN，国内打开不卡。
   深色优先，游戏受众移动端为主。 */

:root {
  --bg: #0d0f14;
  --bg-soft: #14171f;
  --card: #191d27;
  --card-hi: #1f2431;
  --line: #272c3a;
  --fg: #e8ebf2;
  --fg-dim: #9aa3b8;
  --fg-faint: #6b7488;
  --accent: #38e0a8;
  --accent-dim: #1d9c74;
  --accent-ink: #05261c;
  --warn: #f0b34a;
  --radius: 12px;
  --radius-lg: 16px;
  --max: 940px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 18px; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(13, 15, 20, .86);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding-top: 12px; padding-bottom: 12px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px; color: var(--fg);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #4bd2ff);
  display: grid; place-items: center;
  color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
.site-header nav { display: flex; gap: 16px; font-size: 14px; }
.site-header nav a { color: var(--fg-dim); }
.site-header nav a:hover { color: var(--fg); text-decoration: none; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 8px; }
.hero h1 {
  font-size: clamp(26px, 5.2vw, 38px);
  line-height: 1.2; margin: 0 0 12px; letter-spacing: -.02em;
}
.hero p { color: var(--fg-dim); font-size: 17px; margin: 0; max-width: 60ch; }

/* ---------- tool grid ---------- */
.tool-grid {
  display: grid; gap: 12px; margin: 26px 0 8px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tool-card {
  display: block; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--fg);
  transition: border-color .15s ease, background .15s ease;
}
.tool-card:hover { text-decoration: none; border-color: var(--accent-dim); background: var(--card-hi); }
.tool-card h3 { margin: 0 0 5px; font-size: 16px; font-weight: 650; }
.tool-card p { margin: 0; color: var(--fg-dim); font-size: 14px; }
.tool-card .tag {
  display: inline-block; margin-top: 10px; font-size: 11px;
  color: var(--fg-faint); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 20px;
}

/* ---------- calculator UI ---------- */
.calc {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px; margin: 22px 0;
}
.calc .field { margin-bottom: 14px; }
.calc label { display: block; font-size: 14px; color: var(--fg-dim); margin-bottom: 6px; }
.calc input, .calc select {
  width: 100%; padding: 11px 13px; font-size: 16px; font-family: var(--font);
  color: var(--fg); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 10px;
}
.calc input:focus, .calc select:focus {
  outline: none; border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(56, 224, 168, .12);
}
.calc-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .calc-row { grid-template-columns: 1fr; } }

.out {
  margin-top: 18px; padding: 16px 18px;
  background: linear-gradient(180deg, rgba(56,224,168,.09), rgba(56,224,168,.03));
  border: 1px solid var(--accent-dim); border-radius: var(--radius);
}
.out-label { font-size: 13px; color: var(--fg-dim); }
.out-value {
  font-family: var(--mono); font-size: clamp(26px, 7vw, 34px);
  font-weight: 700; color: var(--accent); line-height: 1.15;
  word-break: break-all;
}
.out-note { font-size: 13px; color: var(--fg-dim); margin-top: 6px; }
.out-extra { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.out-extra div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.out-extra span:last-child { font-family: var(--mono); color: var(--fg); }

.btn {
  display: inline-block; padding: 10px 18px; font-size: 15px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px;
}
.btn:hover { background: #4febb8; }
.btn.ghost { background: transparent; color: var(--fg-dim); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--fg); border-color: var(--fg-faint); }

/* ---------- prose ---------- */
.prose { max-width: 72ch; }
.prose h2 {
  font-size: 22px; margin: 34px 0 12px; letter-spacing: -.01em;
  padding-top: 6px;
}
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p, .prose li { color: #d3d9e6; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose code {
  font-family: var(--mono); font-size: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px;
}
.prose strong { color: #fff; }

.formula {
  font-family: var(--mono); font-size: 15px;
  background: var(--bg-soft); border-left: 3px solid var(--accent-dim);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 14px 0;
  overflow-x: auto; white-space: pre-wrap;
}

table.data {
  width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px;
}
table.data th, table.data td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
table.data th { color: var(--fg-dim); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
table.data td:not(:first-child) { font-family: var(--mono); }

details.faq {
  border-bottom: 1px solid var(--line); padding: 12px 0;
}
details.faq summary {
  cursor: pointer; font-weight: 600; font-size: 16px; list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+ "; color: var(--accent); font-weight: 700; }
details.faq[open] summary::before { content: "− "; }
details.faq p { margin: 10px 0 2px; color: var(--fg-dim); }

.note {
  background: rgba(240,179,74,.07); border: 1px solid rgba(240,179,74,.3);
  border-radius: var(--radius); padding: 13px 16px; margin: 18px 0; font-size: 15px;
}
.note strong { color: var(--warn); }

.crumbs { font-size: 13px; color: var(--fg-faint); padding-top: 18px; }
.crumbs a { color: var(--fg-faint); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 56px; border-top: 1px solid var(--line);
  padding: 26px 0 40px; font-size: 14px; color: var(--fg-faint);
}
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 26px; justify-content: space-between; }
.site-footer a { color: var(--fg-dim); }
.site-footer .legal { margin-top: 18px; line-height: 1.5; font-size: 13px; }

.skip { position: absolute; left: -9999px; }
