:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #ffffff;
  --line: rgba(23, 32, 37, 0.12);
  --muted: #5d6970;
  --text: #172025;
  --accent: #0f7c7f;
  --accent-dark: #07585c;
  --gold: #b78b49;
  --danger: #b54708;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }

.topbar {
  height: 68px; padding: 0 max(24px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  background: rgba(247, 245, 239, .92); backdrop-filter: blur(14px);
}
.site-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 16px; font-weight: 900; }
.site-brand img { width: 40px; height: 40px; border-radius: 8px; }
.site-brand small { color: var(--muted); font-size: 13px; font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 6px; }
.topbar nav a { padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.topbar nav a:hover { color: var(--text); background: var(--line); }

main { width: min(1320px, calc(100% - 48px)); margin: auto; padding: 54px 0 80px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 36px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--accent-dark); text-decoration: none; }
.intro { display: grid; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 48px; margin-bottom: 48px; }
.eyebrow { margin: 0 0 16px; color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(50px, 7vw, 96px); line-height: .88; letter-spacing: -.07em; }
h1 em { color: var(--accent); font-style: normal; }
.lede { max-width: 430px; margin: 0 0 5px auto; color: var(--muted); font-size: 18px; line-height: 1.65; }
.trust-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: -12px 0 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.trust-strip p { margin: 0; padding: 14px 16px; color: var(--muted); background: var(--panel); font-size: 11px; line-height: 1.55; }
.trust-strip strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 18px; align-items: start; }
.controls, .results { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 18px 40px rgba(16, 23, 27, .08); }
.controls { padding: 30px; }
.form-section + .form-section { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 30px; }
h2 { font-size: 15px; margin: 0 0 22px; letter-spacing: .01em; }
h2 span { color: var(--accent); margin-right: 10px; font-family: ui-monospace, monospace; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.fuel-helper { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.fuel-helper summary { padding: 13px 16px; color: var(--accent-dark); font-size: 13px; font-weight: 800; cursor: pointer; }
.fuel-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 4px 16px 16px; }
.fuel-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); }
.fuel-action p { margin: 0; color: var(--muted); font-size: 12px; }
.fuel-action button { flex: none; margin: 0; color: white; border-color: var(--accent); background: var(--accent); }
.fuel-action button:disabled { opacity: .45; cursor: not-allowed; }
.section-note { margin: 18px 0 0; padding: 14px 16px; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.7; }
.section-note strong { color: var(--text); }
label { position: relative; display: grid; gap: 8px; color: var(--text); font-size: 13px; font-weight: 700; }
input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text);
  padding: 14px 72px 14px 14px; outline: none; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 124, 127, .14); }
input:invalid { border-color: var(--danger); }
label small { position: absolute; right: 13px; bottom: 15px; color: var(--muted); font-weight: 500; pointer-events: none; }
button {
  margin-top: 30px; border: 1px solid var(--line); border-radius: 8px; padding: 11px 15px;
  color: var(--text); background: transparent; cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button:active { transform: translateY(1px); }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 30px; }
.form-actions button { width: 100%; margin: 0; }
.form-actions .calculate-button { color: white; border-color: var(--accent); background: var(--accent); }
.form-actions .calculate-button:hover { color: white; background: var(--accent-dark); }

.results { position: sticky; top: 18px; padding: 30px; overflow: hidden; }
.result-head, .mix-head { display: flex; align-items: center; justify-content: space-between; }
.result-head p { margin: 0; color: var(--muted); font-size: 13px; }
.result-head span { border: 1px solid var(--accent); border-radius: 8px; color: var(--accent-dark); padding: 5px 9px; font-size: 11px; font-weight: 800; background: rgba(15, 124, 127, .07); }
.result-head span.loss { color: var(--danger); border-color: var(--danger); }
.hero-metric { padding: 32px 0 28px; border-bottom: 1px solid var(--line); }
.hero-metric small { color: var(--muted); }
.hero-metric strong { display: block; margin: 6px 0; color: var(--accent); font-size: clamp(46px, 5vw, 68px); letter-spacing: -.06em; }
.hero-metric strong.loss { color: var(--danger); }
.hero-metric p { margin: 0; color: var(--muted); font-size: 13px; }
.metrics { margin: 0; }
.metrics div { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: 13px; }
.metrics dd { margin: 0; font-weight: 800; }
.metrics .recommended dd { color: var(--accent-dark); }
.cost-mix { margin-top: 28px; }
.mix-head { font-size: 13px; }
.mix-head span:last-child { color: var(--muted); }
.bar { display: flex; height: 8px; margin: 14px 0 18px; border-radius: 8px; overflow: hidden; background: var(--line); }
.bar span { transition: width .25s ease; }
#fixedBar { background: var(--accent); }
#fuelBar { background: var(--gold); }
#wearBar { background: #7aa9aa; }
.cost-mix ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.cost-mix li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.cost-mix b { color: var(--text); }
.cost-mix i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cost-mix .fuel-dot { background: var(--gold); }
.cost-mix .wear-dot { background: #7aa9aa; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.result-actions a, .result-actions button { margin: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent-dark); background: transparent; text-align: center; text-decoration: none; font-size: 11px; font-weight: 800; cursor: pointer; }
.result-actions a:hover, .result-actions button:hover { border-color: var(--accent); color: var(--accent-dark); background: rgba(15, 124, 127, .06); }
.result-actions #downloadCard { color: white; border-color: var(--accent); background: var(--accent); }
.note { margin: 20px -30px -30px; padding: 18px 30px; border-top: 1px solid var(--line); color: var(--muted); background: var(--bg); font-size: 11px; line-height: 1.6; }
.tool-explainer { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); }
.tool-explainer h2 { font-size: clamp(26px, 3vw, 38px); }
.tool-explainer > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 22px; }
.tool-explainer p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.tool-explainer strong { display: block; margin-bottom: 5px; color: var(--accent-dark); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 26px max(24px, calc((100vw - 1320px) / 2)); border-top: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 12px; }

@media (max-width: 820px) {
  main { width: min(100% - 28px, 680px); padding-top: 36px; }
  .intro, .workspace { grid-template-columns: 1fr; }
  .intro { gap: 22px; margin-bottom: 30px; }
  .lede { margin-left: 0; }
  .results { position: static; }
  .trust-strip { grid-template-columns: 1fr 1fr; }
  .tool-explainer > div { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar { padding-inline: 16px; }
  .site-brand small, .topbar nav a:not(:last-child) { display: none; }
  main { width: calc(100% - 24px); }
  h1 { font-size: 50px; }
  .controls, .results { padding: 22px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .fuel-fields { grid-template-columns: 1fr; }
  .fuel-action { align-items: stretch; flex-direction: column; }
  .trust-strip, .result-actions { grid-template-columns: 1fr; }
  .note { margin: 24px -22px -22px; padding-inline: 22px; }
  footer { flex-direction: column; }
}

@media (max-width: 359px) {
  .fields { grid-template-columns: 1fr; }
}

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