:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #5b6b7b;
  --line: #dce3ea;
  --brand: #1f6feb;
  --brand-d: #1453b8;
  --accent: #0f9d8f;
  --ok: #1f9d55;
  --ok-bg: #e7f6ec;
  --bad: #d64545;
  --bad-bg: #fbeaea;
  --warn: #b7791f;
  --shadow: 0 1px 3px rgba(16, 30, 50, .08), 0 4px 16px rgba(16, 30, 50, .06);
  --radius: 10px;
  --panel-2: #f0f4f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK SC", "Noto Sans CJK JP", "Noto Sans CJK KR", "Microsoft YaHei", "Hiragino Sans", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.brand { font-weight: 700; font-size: 16px; color: var(--brand-d); display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--brand); font-size: 20px; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a {
  text-decoration: none; color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.site-nav a:hover { background: #eef3fb; color: var(--brand-d); }
.site-nav a.active { background: var(--brand); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lang select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.btn {
  text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; border: 1px solid transparent; white-space: nowrap;
}
.btn-home { background: var(--brand); color: #fff; }
.btn-home:hover { background: var(--brand-d); }
.btn-email { background: #fff; color: var(--brand-d); border-color: var(--brand); }
.btn-email:hover { background: #eef3fb; }

/* Layout */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 18px 48px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 14px; font-size: 17px; color: var(--brand-d); }
.card h3 { margin: 18px 0 8px; font-size: 15px; color: var(--ink); }

/* Home */
.hero { padding: 30px 24px; }
.hero h1 { margin: 0 0 8px; font-size: 26px; }
.hero p.lead { color: var(--muted); max-width: 760px; }
.tagline { color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.cta { display: inline-block; padding: 11px 18px; border-radius: 9px; font-weight: 700; text-decoration: none; }
.cta-primary { background: var(--brand); color: #fff; }
.cta-primary:hover { background: var(--brand-d); }
.cta-secondary { background: #fff; color: var(--brand-d); border: 1px solid var(--brand); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { position: relative; padding: 10px 10px 10px 44px; border-bottom: 1px dashed var(--line); }
.steps li:before { counter-increment: s; content: counter(s); position: absolute; left: 8px; top: 10px; width: 24px; height: 24px; background: var(--brand); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.note { font-size: 13px; color: var(--muted); background: #fff8e9; border: 1px solid #f3e2b8; padding: 10px 12px; border-radius: 8px; margin-top: 14px; }

/* Forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.field .req { color: var(--bad); font-size: 11px; font-weight: 500; margin-left: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field input, .field select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.unit { color: var(--muted); font-size: 12px; margin-left: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; } }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-row label { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn-calc { background: var(--brand); color: #fff; border: none; padding: 11px 20px; border-radius: 9px; font-weight: 700; cursor: pointer; font-size: 15px; }
.btn-calc:hover { background: var(--brand-d); }
.btn-reset { background: #fff; color: var(--muted); border: 1px solid var(--line); padding: 11px 18px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.btn-reset:hover { background: #f1f4f8; }

/* Results */
.result-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.result-row .k { color: var(--muted); font-size: 14px; }
.result-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.result-row .v small { color: var(--muted); font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--line); }
.check .badge { font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 20px; min-width: 64px; text-align: center; }
.check .detail { font-size: 13px; color: var(--muted); }
.badge.pass { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }
.check.pass { border-color: #bfe6cd; }
.check.fail { border-color: #f1c9c9; }
.overall { text-align: center; padding: 14px; border-radius: 10px; font-weight: 800; font-size: 18px; margin-top: 6px; }
.overall.pass { background: var(--ok-bg); color: var(--ok); }
.overall.fail { background: var(--bad-bg); color: var(--bad); }
canvas { width: 100%; height: auto; display: block; background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; }

/* Tables (catalog) */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { background: #f3f6fa; color: var(--brand-d); font-size: 13px; }
tbody tr:hover { background: #f7faff; }
.series-filter { margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.use-btn { background: var(--accent); color: #fff; border: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.use-btn:hover { background: #0c8578; }
.est { color: var(--warn); font-size: 11px; }

/* Theory */
.formula { background: #f7f9fc; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 6px; padding: 10px 12px; margin: 6px 0 14px; font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif; overflow-x: auto; }
.sym-table td:first-child { font-weight: 700; white-space: nowrap; width: 160px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 30px; }
.empty { color: var(--muted); font-style: italic; padding: 14px; }

/* Module cards (home) */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 10px; }
.module-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.module-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.module-icon { font-size: 26px; line-height: 1; margin-bottom: 8px; color: var(--brand); }
.module-card h3 { margin: 0 0 6px; font-size: 16px; }
.module-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* SVG charts */
.chart-svg { width: 100%; height: auto; display: block; }
.ch-frame { fill: #fbfcfe; stroke: var(--line); }
.ch-grid { stroke: #eef2f7; }
.ch-zero { stroke: #c4ccd6; stroke-dasharray: 4 3; }
.ch-line { fill: none; stroke-width: 2; }
.ch-v { stroke: var(--brand); }
.ch-a { stroke: var(--bad); }
.ch-x { stroke: var(--accent); }
.ch-bar { fill: var(--brand); }
.ch-bar.load { fill: var(--warn); }
.ch-bar.peak { fill: var(--bad); }
.ch-bar.cont { fill: var(--ok); }
.ch-tick, .ch-ylab, .ch-xlab { fill: var(--muted); font-size: 10px; }
.ch-ylab { font-size: 9px; }
.ch-leg { fill: var(--ink); font-size: 10px; }
.ch-axis { fill: var(--muted); font-size: 11px; }
.ch-gauge { fill: var(--accent); opacity: .25; stroke: var(--accent); stroke-width: 1.5; }
.ch-gaugeval { fill: var(--ink); font-size: 22px; font-weight: 700; }
.ch-gaugeunit { fill: var(--muted); font-size: 11px; }

/* Cycle segment editor */
.seg-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.seg-table th, .seg-table td { border: 1px solid var(--line); padding: 5px 6px; text-align: center; font-size: 13px; }
.seg-table input { width: 78px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 4px; }
.seg-table select { padding: 3px 4px; border: 1px solid var(--line); border-radius: 4px; }
.seg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; }
.mini-btn { font-size: 12.5px; padding: 4px 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; }
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }

/* Two-column result layout for drive/guide */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }
.gauge-wrap { max-width: 320px; margin: 0 auto; }

/* Notice bars */
.banner { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 13.5px; }
.banner.warn { background: #fdf3e3; border: 1px solid #f0d8a8; color: #8a5a12; }
.banner.ok { background: var(--ok-bg); border: 1px solid #bfe6cc; color: #1c6b3c; }

/* ---- Print-only report header ---- */
.print-only { display: none; }
.print-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---- Compare page ---- */
.motor-list { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.motor-group { margin: 6px 0 10px; }
.motor-group-title { font-weight: 700; color: var(--brand); font-size: 13.5px; margin-bottom: 3px; }
.motor-opt { display: block; font-weight: 400; font-size: 13.5px; padding: 2px 0; cursor: pointer; }
.motor-opt .muted { color: var(--muted); }
.tag-est { color: #b9770e; font-weight: 700; }
.src-badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.src-ds { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6cc; }
.src-example { background: #eef2f7; color: var(--muted); border: 1px solid var(--line); }
.est { color: #b9770e; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cmp-table th, .cmp-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; font-size: 13px; }
.cmp-table th { background: var(--panel-2); color: var(--ink); font-weight: 600; }
.cmp-table td.cmp-model { text-align: left; }
.cmp-table tr.row-fail { background: #fdf3e3; }
.verdict { font-weight: 700; }
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.ubar { position: relative; background: #eef2f7; border-radius: 4px; height: 18px; min-width: 90px; overflow: hidden; }
.ubar-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.ubar-fill.ok { background: var(--ok); }
.ubar-fill.warn { background: var(--warn); }
.ubar-fill.over { background: var(--bad); }
.ubar-txt { position: relative; font-size: 11px; line-height: 18px; padding-left: 6px; }
.summary .best-pick { margin-top: 8px; font-size: 14px; }

/* ---- Print / PDF layout ---- */
@media print {
  body { background: #fff; color: #000; }
  .site-header { box-shadow: none; border-bottom: 1px solid #ccc; padding: 8px 0; }
  .brand-mark { display: none; }
  .site-header .header-actions, .site-nav, .actions, .seg-actions, .no-print { display: none !important; }
  .site-header .brand { font-size: 15px; }
  .wrap { max-width: 100%; padding: 0; }
  .grid { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; margin: 10px 0 !important; break-inside: avoid; }
  .chart-svg { max-height: 260px; }
  .cmp-table { font-size: 11px; }
  .cmp-table th, .cmp-table td { border-color: #999; }
  .print-only { display: block !important; margin-bottom: 6px; }
  .print-only h1 { font-size: 20px; margin: 0 0 2px; }
  a { color: #000; text-decoration: none; }
}
