:root {
  --ink: #1d2329;
  --muted: #56616b;
  --line: #d9dee3;
  --bg: #f5f6f7;
  --card: #ffffff;
  --accent: #1f5f8b;
  --up: #a33a1f;
  --down: #2f6b2a;
  --notice: #fff7e0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.site-header { background: #17324a; color: #fff; padding: 20px 0 14px; }
.site-header a { color: #fff; }
.site-name { margin: 0; font-weight: 700; letter-spacing: 0.02em; }
.site-name a { text-decoration: none; }
.site-header h1 { margin: 6px 0 4px; font-size: 1.6rem; line-height: 1.25; }
.tagline { margin: 0 0 10px; color: #d6e2ec; max-width: 760px; }
.top-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.95rem; }

main { padding: 18px 16px 32px; }

.notice { background: var(--notice); border: 1px solid #ecd9a0; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.load-error, .calc-error { background: #fdecea; border: 1px solid #f1b9b0; border-radius: 6px; padding: 10px 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.hint { color: var(--muted); font-size: 0.92rem; }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 0.85rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); }
tbody th { font-weight: 500; }
.num { text-align: right; white-space: nowrap; }
td.up { color: var(--up); }
td.down { color: var(--down); }
.tag { display: inline-block; font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; background: #e8eef3; color: #2b4a63; white-space: nowrap; }

.filters, .calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; }
input, select { font: inherit; padding: 7px 9px; border: 1px solid #b8c1ca; border-radius: 5px; background: #fff; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid #f2b705; outline-offset: 1px; }

.btn { font: inherit; padding: 8px 14px; border-radius: 5px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn-quiet { background: #fff; color: var(--accent); }

.chart-wrap { margin: 8px 0 18px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e6e9ec; stroke-width: 1; }
.chart .axis { font-size: 12px; fill: var(--muted); }
.chart .pt { stroke: #fff; stroke-width: 1.5; cursor: help; }
.chart .pt:hover { r: 6; }
.legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.9rem; }
.swatch { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.stats div { background: #f2f5f8; border-radius: 6px; padding: 10px 12px; }
.stats dt { font-size: 0.85rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 700; }
.stats .stat-key { background: #e3edf5; }

.sponsor { border: 1px dashed #9aa6b1; background: #fbfbfc; }
.sponsor-label { display: inline-block; margin: 0 0 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5a4600; background: #f3e7b8; padding: 2px 8px; border-radius: 4px; }
.sponsor-title { font-weight: 700; margin: 0 0 4px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1 1 240px; }

.form-stack { display: grid; gap: 12px; max-width: 560px; }
textarea { font: inherit; padding: 7px 9px; border: 1px solid #b8c1ca; border-radius: 5px; min-height: 110px; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 16px 0 28px; }

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

@media (max-width: 600px) {
  .site-header h1 { font-size: 1.3rem; }
  th, td { padding: 6px 5px; }
}
