:root {
  --ink: #1c2430;
  --muted: #4a5568;
  --line: #c9d2dd;
  --accent: #0b5fa5;
  --notice-bg: #fff7e6;
  --notice-line: #b97e10;
  --error: #9d1c1c;
  --stale-bg: #fdecec;
  --panel-bg: #f6f8fa;
}

* { 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.6;
  background: #ffffff;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.site-header {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.site-header a { color: var(--accent); }

h1 { font-size: 1.75rem; margin: 0.5rem 0; }
h2 { font-size: 1.2rem; }

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

.notice {
  border: 2px solid var(--notice-line);
  background: var(--notice-bg);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.notice h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.notice p { margin: 0; }

.mode-toggle {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0.75rem 1rem;
}

.mode-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  min-height: 2rem;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
}

.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

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

.field input {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  max-width: 100%;
  min-height: 2.75rem;
}

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

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

.error { color: var(--error); font-weight: 600; margin: 0.25rem 0 0; }

.results { margin-top: 1.5rem; }

.stale {
  background: var(--stale-bg);
  border: 1px solid var(--error);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}

.results dl { margin: 0; }

.results dl > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.results dt { font-weight: 600; min-width: 12rem; }
.results dd { margin: 0; font-size: 1.1rem; }

.beyond { color: var(--error); font-weight: 600; }

.trimester-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
}

.trimester-table caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 0.5rem;
}

.trimester-table th,
.trimester-table td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  text-align: left;
}

.trimester-table thead th { background: var(--panel-bg); }

.site-footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer a { color: var(--accent); }

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