:root {
  color-scheme: light dark;
  --bg: #f6f4ef;
  --panel: #fffdfa;
  --panel-strong: #f0ebe2;
  --text: #17211c;
  --muted: #59665f;
  --line: #d9d0c2;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --warning: #8a4f12;
  --shadow: 0 18px 40px rgb(22 32 28 / 12%);
  --radius: 8px;
  font-family: ui-serif, "Songti TC", "Noto Serif TC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgb(15 118 110 / 10%) 1px, transparent 1px),
    linear-gradient(0deg, rgb(138 79 18 / 8%) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
}

a {
  color: var(--accent-strong);
}

.wrap {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
}

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 28px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.proof-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.proof-panel div {
  min-width: 0;
}

.proof-panel dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.proof-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.controls,
.results-shell {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.5fr) minmax(0, 1fr);
  gap: 18px;
  align-items: end;
}

.controls p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}

input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.results-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.results-bar p {
  margin-bottom: 0;
  color: var(--muted);
}

.records {
  display: grid;
  gap: 12px;
}

.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.record h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.55;
  letter-spacing: 0;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.record-meta li {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 0.82rem;
}

.law {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.amount {
  align-self: start;
  min-width: 116px;
  padding: 10px;
  border-left: 3px solid var(--accent);
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem;
  text-align: right;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.site-footer {
  padding: 28px 0 40px;
  color: var(--muted);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.footer-grid p {
  margin-bottom: 0;
  line-height: 1.7;
}

@media (max-width: 820px) {
  .site-header {
    padding-top: 32px;
  }

  .header-grid,
  .controls,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .record {
    grid-template-columns: 1fr;
  }

  .amount {
    width: 100%;
    text-align: left;
  }

  .footer-grid,
  .results-bar {
    display: grid;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --panel: #18201c;
    --panel-strong: #202922;
    --text: #f2eee6;
    --muted: #bdc8c0;
    --line: #364039;
    --accent: #5eead4;
    --accent-strong: #99f6e4;
    --warning: #f0b15f;
    --shadow: 0 18px 42px rgb(0 0 0 / 28%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
