:root {
  --bg: #0f141b;
  --bg-soft: #161d27;
  --card: #1a2230;
  --card-2: #202a3a;
  --border: #2a3548;
  --text: #e6edf3;
  --muted: #9fb0c3;
  --accent: #4fd1c5;
  --accent-2: #63b3ed;
  --ad: #2a2333;
  --ad-border: #4a3a5c;
  --warn: #f6c177;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16202e 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 27, 0.7);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.site-header h1 { margin: 0; font-size: 20px; letter-spacing: .5px; }
.tagline { margin: 0; color: var(--muted); font-size: 12.5px; }
.topnav { display: flex; gap: 18px; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-size: 14px; }
.topnav a:hover, .topnav a.active { color: var(--accent); text-decoration: none; }
.nav-en { font-size: 12px; color: inherit; margin-left: 3px; }
.topnav a:hover .nav-en, .topnav a.active .nav-en { color: var(--accent); }
.soft-logo { height: 30px; width: auto; max-width: 100%; vertical-align: middle; margin-right: 6px; }
.soft-tile .soft-logo { display: block; margin: 0 0 12px; }
.soft-logo-lg { height: 36px; }
/* 视觉隐藏（保留给搜索引擎与读屏软件）：图标外不再重复显示软件名 */
.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; }
.soft-tile h3.sr-only, .soft-tile .soft-logo + h3 { margin: -1px; }


/* Ad slots */
.ad-slot {
  margin: 18px auto;
  max-width: 920px;
  width: calc(100% - 40px);
  min-height: 90px;
  border: 1px dashed var(--ad-border);
  background: var(--ad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b9a7c9;
  font-size: 13px;
}

/* 广告位被真实内容填充后：去掉虚线占位框的外框与灰底，避免包一圈难看的边 */
.ad-slot.ad-filled {
  border: none;
  background: transparent;
  min-height: 0;
  display: block;
  padding: 0;
}
.ad-slot.ad-filled .ad-label { display: none; }

/* 赞助 / 打赏卡片（ads.js 的 donate 模式） */
.ad-slot.ad-donate .ad-donate-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
}
.ad-slot.ad-donate .ad-donate-txt { min-width: 0; flex: 1 1 320px; }
.ad-slot.ad-donate .ad-donate-txt b { display: block; font-size: 14px; margin-bottom: 2px; }
.ad-slot.ad-donate .ad-donate-txt .en { display: block; font-size: 12px; color: var(--muted); }
.ad-slot.ad-donate .ad-donate-txt p {
  margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55;
}
.ad-slot.ad-donate .ad-donate-actions {
  display: flex; gap: 12px; flex-wrap: wrap; flex: 0 0 auto; align-items: center;
}

/* 收款码：给白底，防止二维码截图自带透明背景在深色主题下看不清 */
.ad-slot.ad-donate .ad-donate-qr {
  display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 0 0 auto;
}
.ad-slot.ad-donate .ad-donate-qr img {
  display: block;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}
.ad-slot.ad-donate .ad-donate-qr span { font-size: 12px; color: var(--muted); }
/* 深色主题下 --accent (#4fd1c5) 是亮青色，按钮文字必须用深色才够对比度 */
.btn-donate {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-donate:hover { filter: brightness(1.08); color: var(--bg); }

/* Layout */
main { max-width: 920px; margin: 0 auto; padding: 10px 20px 40px; }
.hero { padding: 26px 4px 8px; }
.hero h2 { margin: 0 0 6px; font-size: 26px; }
.hero p { margin: 0; color: var(--muted); max-width: 680px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.breadcrumb a { color: var(--muted); }

/* Tool cards */
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin: 22px 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.tool-card h3 { margin: 0 0 4px; font-size: 18px; }
.tool-card h3 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }

.row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.row label {
  display: flex; flex-direction: column; font-size: 13px; color: var(--muted);
  gap: 6px; flex: 1 1 140px;
}
/* 复选框 / 行内标签：横排、按内容宽度，不被 .row label 竖排规则影响 */
.row label.chk, .row label.inline {
  display: inline-flex; flex-direction: row; align-items: center;
  gap: 8px; flex: 0 0 auto; width: auto;
  white-space: nowrap; color: var(--text); font-size: 13.5px;
}
label.chk { cursor: pointer; user-select: none; }

/* 晶胞尺寸手动输入：A/B/C/αβγ 四组横排，与左侧下拉框底部对齐 */
.cell-units {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  flex: 1 1 auto; align-self: flex-end; min-width: 0;
}
.row label.cell-unit {
  display: inline-flex; flex-direction: row; align-items: center;
  gap: 7px; flex: 0 0 auto; width: auto; white-space: nowrap;
  font-size: 13px; color: var(--muted);
}
.cell-unit input { width: 74px; text-align: center; padding: 9px 8px; }
.cell-unit-abg input { width: 96px; }
/* 复选框本体：清掉通用 input 的内边距/背景，恢复正常尺寸 */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; min-width: 17px; padding: 0; margin: 0;
  flex: 0 0 auto; border: 1.5px solid var(--border); border-radius: 4px;
  background: var(--bg-soft); cursor: pointer; position: relative;
  transition: border-color .15s, background .15s;
}
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
  content: "✓"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #0b1220; font-size: 12px; font-weight: 700; line-height: 1;
}
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.result-box {
  margin-top: 8px; padding: 12px 14px; background: var(--card-2);
  border-left: 3px solid var(--accent); border-radius: 8px;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.result-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.result-table th, .result-table td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border);
}
.result-table th { color: var(--muted); font-weight: 500; }
.result-table td:nth-child(2) { font-variant-numeric: tabular-nums; color: var(--accent); }
.hidden { display: none !important; }

/* Portal tool grid */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 24px 0; }
.tool-tile {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; transition: border-color .15s, transform .15s;
}
.tool-tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tool-tile .ic { font-size: 26px; }
.tool-tile h3 { margin: 10px 0 6px; font-size: 16px; color: var(--text); }
.tool-tile p { margin: 0; color: var(--muted); font-size: 13px; }
.en { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.bilingual-title { font-size: 13px; color: var(--muted); font-weight: 400; }
.section-h { margin: 28px 0 6px; font-size: 18px; }
.section-h .en { margin-top: 0; }

/* Params section */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.filter-bar input, .filter-bar select { flex: 1 1 160px; }
.params-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.params-table th, .params-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.params-table th { color: var(--muted); font-weight: 500; background: var(--bg-soft); position: sticky; top: 0; }
.params-table tr:hover td { background: var(--card-2); }
.tag { display: inline-block; background: var(--card-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--accent); margin: 1px 2px; }
.ref { color: var(--muted); font-size: 12.5px; }
.ref a { color: var(--accent-2); }
.seed-note { font-size: 12.5px; color: var(--warn); background: rgba(246,193,119,.08); border: 1px solid rgba(246,193,119,.3); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.ext-db { margin-top: 14px; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ext-db li { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ext-db li b { display: block; margin-bottom: 3px; }
.soft-badge { display: inline-block; background: var(--card-2); border: 1px solid var(--border); color: var(--accent); border-radius: 999px; padding: 2px 12px; font-size: 12.5px; margin-left: 8px; vertical-align: middle; }
.soft-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.soft-tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; transition: border-color .15s, transform .15s; }
.soft-tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.soft-tile .ic { font-size: 28px; }
.soft-tile h3 { margin: 10px 0 4px; font-size: 17px; color: var(--text); }
.soft-tile p { margin: 0; color: var(--muted); font-size: 13px; }
.coming-soon { display: inline-block; background: rgba(246,193,119,.12); border: 1px solid rgba(246,193,119,.4); color: var(--warn); border-radius: 999px; padding: 2px 12px; font-size: 12px; margin-left: 6px; vertical-align: middle; }
.placeholder-list { list-style: none; padding: 0; margin: 10px 0 0; }
.placeholder-list li { padding: 8px 11px; border: 1px dashed var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--bg-soft); font-size: 13.5px; }
.placeholder-list li .en { margin-top: 2px; }

/* Footer */
.site-footer { max-width: 920px; margin: 30px auto; padding: 0 20px 60px; color: var(--muted); font-size: 13px; }
.site-footer details { margin-top: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.site-footer summary { cursor: pointer; color: var(--accent); }
.site-footer ul { margin: 10px 0 0; padding-left: 18px; }
.site-footer li { margin-bottom: 8px; }
code { background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* 生成器通用样式 Generator tools */
.out-area { width: 100%; min-height: 240px; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 1.55; resize: vertical; white-space: pre; tab-size: 2; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn { background: var(--accent); color: #06222a; border: none; padding: 9px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.gen-section { margin-top: 4px; }
.gen-section h4 { margin: 16px 0 6px; font-size: 14px; color: var(--text); }
.help { color: var(--muted); font-size: 12.5px; margin: 2px 0 8px; }
textarea.in { width: 100%; min-height: 96px; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace; font-size: 13px; resize: vertical; }

@media (max-width: 560px) {
  .site-header { padding: 14px 16px; }
  .tool-card { padding: 16px; }
  .row label { flex: 1 1 100%; }
}
