:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #334155;
  --muted-bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --primary: #1e3a5f;
  --primary-on: #ffffff;
  --link: #1e3a8a;
  --hit: #14532d;
  --hit-bg: #dcfce7;
  --bonus-bg: #fff7ed;
  --bonus: #9a3412;
  --warn-bg: #f0fdf4;
  --warn-border: #86efac;
  --focus: #1d4ed8;
  --danger: #991b1b;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}
img, svg { max-width: 100%; }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--primary);
  color: var(--primary-on);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}
.skip:focus { top: 0.5rem; }

.wrap { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }
header.site {
  background: var(--primary);
  color: var(--primary-on);
}
header.site a { color: var(--primary-on); text-decoration: none; }
header.site a:hover { text-decoration: underline; }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
}
.brand { font-weight: 700; font-size: 1.125rem; letter-spacing: 0.02em; }
.tools { display: flex; gap: 1rem; align-items: center; }
.tools a { min-height: 44px; display: inline-flex; align-items: center; }
.topgames { display: none; gap: 0.75rem; }
nav.crumbs { font-size: 0.875rem; color: var(--muted); margin: 1rem 0 0.5rem; }
nav.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0; }
nav.crumbs li:not(:last-child)::after { content: ">"; margin-left: 0.35rem; color: #64748b; }

main { padding-bottom: 2.5rem; }
h1 { font-size: 1.5rem; line-height: 1.35; margin: 0.25rem 0 0.5rem; word-break: keep-all; line-break: strict; }
h2 { font-size: 1.2rem; line-height: 1.4; margin: 2rem 0 0.6rem; }
p { margin: 0.6rem 0; }
.lede { color: var(--muted); margin-top: 0; }

.grid {
  display: grid;
  gap: 0.75rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.card h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.meta { color: var(--muted); font-size: 0.9375rem; margin: 0; }
.carry {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}
.carry strong { font-variant-numeric: tabular-nums; }

.balls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; align-items: center; }
.ball, .bonus {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}
.ball { background: var(--primary); color: var(--primary-on); }
.bonus {
  background: var(--card);
  color: var(--primary);
  border: 2px solid var(--primary);
}
.digit {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
  margin: 0.25rem 0 0.5rem;
}
.tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-variant-numeric: tabular-nums;
}
th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem 0.5rem;
  vertical-align: top;
}
th { background: var(--muted-bg); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
caption { text-align: left; font-weight: 600; padding: 0.5rem; }

.years { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.years a, .btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-on);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.years a { background: var(--card); color: var(--primary); }
.btn.secondary, button.secondary { background: var(--card); color: var(--primary); }
.btn:hover, button:hover, .years a:hover { filter: brightness(1.05); }

form.check { margin-top: 0.5rem; }
.nums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.nums label {
  position: relative;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.nums input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
}
.nums input:checked + span {
  background: var(--primary);
  color: var(--primary-on);
}
.nums span {
  width: 100%;
  height: 100%;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.nums input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.nums input:disabled + span { color: #94a3b8; background: var(--muted-bg); }
label.field { display: block; font-weight: 600; margin-top: 0.75rem; }
input[type="number"], input[type="text"], select {
  font: inherit;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  width: min(100%, 16rem);
  background: white;
  color: var(--fg);
}
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.hit { background: var(--hit-bg); }
.note { font-size: 0.9375rem; color: var(--muted); }
footer.site {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 5.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 5;
}
.tabbar a {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
}
.tabbar a[aria-current="page"] { background: #e8eef5; }

@media (min-width: 768px) {
  h1 { font-size: 1.85rem; }
  .topgames { display: flex; }
  .tabbar { display: none; }
  footer.site { padding-bottom: 1.5rem; }
  .grid.cards { grid-template-columns: 1fr 1fr; }
  .ball, .bonus { width: 56px; height: 56px; font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
