:root {
  color-scheme: light;
  --ink: #1c2430;
  --accent: #0b5cad;
  --error: #b3261e;
  --line: #c9d2dd;
  --panel: #f4f7fa;
}

* { box-sizing: border-box; }

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

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

.brand { font-weight: 700; color: var(--accent); text-decoration: none; }
.language-links a { margin-left: 0.75rem; color: var(--ink); }

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

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

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

.group-block { background: #fff; }

.field { margin: 0.75rem 0; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field input, .field select {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.field input[aria-invalid="true"] { border-color: var(--error); }

button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button[disabled] { opacity: 0.5; cursor: default; }
button.remove-group { background: #fff; color: var(--error); border-color: var(--error); margin-top: 0.5rem; }

.mode-switch { display: flex; gap: 0.5rem; margin: 1rem 0; }
.mode-switch button { background: #fff; color: var(--accent); }
.mode-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.timer-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.elapsed-display { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.hint { color: #44536a; font-size: 0.92rem; }
.error { color: var(--error); font-weight: 600; margin: 0.35rem 0; }
.stale-note { color: var(--error); font-weight: 600; }
.honesty-note {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 0.75rem;
  background: var(--panel);
}
.unsupported-note { color: var(--error); font-weight: 600; }

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; }
.result-table td, .breakdown-table td { font-variant-numeric: tabular-nums; }
.result-table th { background: var(--panel); width: 45%; }
.breakdown-table thead th { background: var(--panel); }

.formula-note { border-top: 1px solid var(--line); margin-top: 2rem; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (max-width: 560px) {
  .field input, .field select { max-width: none; }
  th, td { padding: 0.35rem 0.4rem; font-size: 0.92rem; }
}
