:root {
  --bg: #f5f6f8;
  --card: #fff;
  --line: #e2e5ea;
  --ink: #1f2430;
  --muted: #6b7280;
  --brand: #1f6feb;
  --ok: #16794b;
  --err: #b42318;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 顶部导航 */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.nav .brand { display: inline-flex; align-items: center; padding: 5px 10px; background: #0f1319; border-radius: 8px; text-decoration: none; }
.nav .brand .logo { display: block; height: 16px; width: auto; }
.nav nav { display: flex; align-items: center; gap: 16px; }
.nav a { color: var(--brand); text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.inline { display: inline; margin: 0; }
.linklike {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--brand); font: inherit;
}
.linklike:hover { text-decoration: underline; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
main.narrow { max-width: 380px; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

/* 计算页两栏 */
.layout { display: grid; grid-template-columns: 1fr; gap: 20px; }

.figure { display: block; max-width: 100%; height: auto; margin: 0 0 14px; }

/* 专家模式画面（复刻旧 App fragment_expert.xml）：左栏 3 张人体示意图 + 右栏 11 行 */
.expert-screen { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.figures { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; }
.figures .figure { display: block; width: 100%; height: auto; margin: 0; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-label { flex: none; width: 120px; height: auto; }
.step {
  flex: none; padding: 0; border: 0; background: none; line-height: 0; cursor: pointer;
}
.step img { display: block; width: 26px; height: auto; }
.step:hover img { opacity: .8; }
.row input { width: 84px; text-align: center; }
.radio-group { display: flex; gap: 18px; }
.radio-group label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.radio-group input { width: auto; }

.calc {
  margin-top: 8px; padding: 11px 20px;
  border: 0; border-radius: 8px;
  background: #f37070; color: #fff;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.calc:hover { background: #e05a5a; }
.calc:disabled { background: #f0b0b0; cursor: not-allowed; }

/* 结果画面（复刻旧 App activity_result.xml）：车架几何图 + 青底标题 + 结果表 */
.result-card .frame { display: block; width: 100%; height: auto; }
.result-head { margin: 12px 0 0; padding: 7px 10px; background: #7fcdd1; color: #fff; font-weight: 600; }
.expert-screen, .result-card { max-width: 720px; margin-left: auto; margin-right: auto; }

@media (max-width: 720px) {
  .expert-screen { grid-template-columns: 1fr; }
  .figures { max-width: 240px; margin: 0 auto; }
}

/* 表单行 */
.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.field label { color: var(--muted); }
.unit { white-space: nowrap; color: var(--muted); }
input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 110px;
}
input:focus { outline: 2px solid rgba(31, 111, 235, .25); border-color: var(--brand); }
select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
select:focus { outline: 2px solid rgba(31, 111, 235, .25); border-color: var(--brand); }

/* 专家模式输入 */
.expert { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px 12px; margin: 12px 0 0; }
.expert legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.expert-result { margin-top: 12px; border-top: 1px dashed var(--line); }

.primary {
  margin-top: 12px;
  padding: 9px 20px;
  border: 0; border-radius: 8px;
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer;
}
.primary:hover { background: #1857c4; }
.primary:disabled { background: #9db8e4; cursor: not-allowed; }

/* 结果表 */
.result { width: 100%; border-collapse: collapse; }
.result th, .result td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.result th { font-weight: 500; color: var(--muted); }
.result td { font-variant-numeric: tabular-nums; }

.similar { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.similar-title { color: var(--brand); margin-bottom: 6px; }

.notice { margin-top: 14px; padding: 10px 12px; background: #fff8e6; border: 1px solid #f2d98a; border-radius: 8px; color: #7a5b12; font-size: 13px; }

/* 保存区 */
.save { margin-top: 20px; }
.hint { color: var(--muted); font-size: 13px; }
.datatype { display: flex; gap: 10px; margin: 10px 0; }
.toggle {
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; cursor: pointer;
}
.toggle.active { border-color: var(--brand); color: var(--brand); background: #eef4ff; }
.mods { margin: 10px 0; }
.save-msg { margin-left: 12px; font-size: 13px; }
.save-msg.ok { color: var(--ok); }
.save-msg.err, .err { color: var(--err); }

/* 后台表格 */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.grid th { background: #fafbfc; color: var(--muted); font-weight: 500; text-align: right; }
.grid tbody tr:hover { background: #f7f9fc; }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.pager a { color: var(--brand); text-decoration: none; }

/* 历史线 */
.timeline { position: relative; margin: 8px 0 0 8px; padding-left: 26px; border-left: 2px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 26px 0; }
.timeline-item::before {
  content: ''; position: absolute; left: -35px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--bg);
}
.timeline-year { color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.timeline-item h2 { margin: 2px 0 6px; }
.timeline-item p { margin: 0 0 10px; color: var(--muted); }
.timeline-item .tech { font-size: 12px; color: var(--muted); }
.timeline-item a.preview { display: inline-block; margin-top: 4px; padding: 7px 16px; border-radius: 8px;
  background: var(--brand); color: #fff; text-decoration: none; font-weight: 600; }
.timeline-item a.preview:hover { background: #1857c4; }
