:root {
  --ink: #1c2430;
  --muted: #5a6572;
  --line: #c9d2dc;
  --accent: #0b5fa5;
  --error: #b00020;
  --stale-bg: #fff4d6;
  --note-bg: #eef4fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
  line-height: 1.55;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--accent); font-weight: 600; text-decoration: none; }

.language-links { display: flex; gap: 0.75rem; }
.language-links a { color: var(--accent); }

.task-canvas {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem;
}

h1 { font-size: 1.6rem; margin: 0.5rem 0; }
h2 { font-size: 1.25rem; margin-top: 1.75rem; }
h3 { font-size: 1.05rem; }

.intro { color: var(--ink); }

fieldset {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
}

legend { font-weight: 600; padding: 0 0.25rem; }

.field { margin-bottom: 0.9rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.field input,
.field select {
  width: 100%;
  max-width: 22rem;
  padding: 0.5rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
}

.field input[aria-invalid="true"] { border-color: var(--error); }

.hint { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0 0; }
.error { color: var(--error); font-size: 0.9rem; margin: 0.25rem 0 0; }

.radio-group { display: flex; gap: 1rem; margin: 0.75rem 0; }
.radio-option { display: inline-flex; gap: 0.35rem; align-items: center; }

.band {
  border: 1px dashed var(--line);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.band-title { font-weight: 600; margin: 0 0 0.5rem; }

button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}

button:hover { background: var(--note-bg); }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.stale-note {
  background: var(--stale-bg);
  border: 1px solid #d9a400;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}

.limitation-note {
  background: var(--note-bg);
  border-left: 4px solid var(--accent);
  padding: 0.5rem 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
}

th, td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.result-table td, .breakdown-table td { text-align: right; }
.result-table th, .breakdown-table th[scope="row"] { text-align: left; }

.unsupported-note { color: var(--error); }

.formula-note p { color: var(--ink); }

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  th, td { padding: 0.35rem 0.4rem; }
}
