:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --panel: #17191b;
  --panel-2: #1d2023;
  --panel-3: #24282c;
  --text: #edf0f2;
  --muted: #aeb5bc;
  --border: #30353a;
  --accent: #ff7a32;
  --accent-strong: #ff9257;
  --accent-soft: rgba(255, 122, 50, .13);
  --link: #8ab4ff;
  --mark: #ffcf3f;
  --mark-text: #241a00;
  --success: #74d99f;
  --shadow: 0 12px 30px rgba(0, 0, 0, .25);
  --max-width: 1440px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f6;
  --panel: #ffffff;
  --panel-2: #f7f8f9;
  --panel-3: #eef1f3;
  --text: #202428;
  --muted: #66717b;
  --border: #d8dde2;
  --accent: #ed6b24;
  --accent-strong: #d95813;
  --accent-soft: rgba(237, 107, 36, .10);
  --link: #2563c7;
  --mark: #ffe36b;
  --mark-text: #2b2100;
  --success: #138a4c;
  --shadow: 0 10px 26px rgba(27, 35, 43, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.65;
}
a { color: var(--link); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 94%, transparent); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.header-inner { width: min(var(--max-width), 100%); margin: 0 auto; min-height: 68px; padding: 10px 22px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { color: var(--accent); font-size: 1.8rem; line-height: 1; }
.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { font-size: .96rem; }
.brand small { margin-top: 3px; color: var(--muted); font-size: .68rem; letter-spacing: .04em; }
.main-nav { display: flex; align-self: stretch; align-items: stretch; margin-left: auto; }
.main-nav a { display: inline-flex; align-items: center; padding: 0 15px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 650; }
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.theme-toggle { min-height: 40px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--text); }

.page-shell { width: min(var(--max-width), 100%); margin: 0 auto; padding: 28px 22px 60px; }
.search-hero { padding: 26px; border: 1px solid var(--border); border-radius: 18px; background: radial-gradient(circle at 85% -10%, var(--accent-soft), transparent 35%), var(--panel); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 2px; color: var(--accent-strong); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.search-hero h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.15rem); line-height: 1.25; }
.search-hero > div > p:last-child { margin: 5px 0 18px; color: var(--muted); }
.search-form { display: grid; grid-template-columns: 1fr 112px; gap: 10px; }
.query-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.query-wrap span { font-size: 1.8rem; color: var(--muted); transform: rotate(-15deg); }
.query-wrap input { width: 100%; min-width: 0; padding: 13px 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1.08rem; }
.query-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-form button { border: 0; border-radius: 11px; background: var(--accent); color: #fff; font-weight: 750; }
.search-form button:hover { background: var(--accent-strong); }
.search-form button:disabled { opacity: .6; cursor: wait; }
.search-note { min-height: 1.5em; margin: 9px 2px 0; color: var(--muted); font-size: .86rem; }

.search-options { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 18px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--border); }
.search-options > h2 { grid-column: 1 / -1; margin: 0 0 -8px; font-size: .82rem; letter-spacing: .04em; }
.option-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; font-weight: 750; }
.search-options .radio-list { display: flex; flex-wrap: wrap; gap: 7px; }
.search-options .radio-list label { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); color: var(--text); }
.search-options .radio-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.search-options .custom-years { max-width: 360px; }
.search-options select { width: 100%; min-height: 40px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }
.summary-panel { margin-top: 16px; padding: 18px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 14px; background: linear-gradient(100deg, var(--accent-soft), transparent 60%), var(--panel); }
.summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.summary-heading p { margin: 0; }
.summary-heading p:last-child { color: var(--muted); }
#summaryCount { color: var(--accent-strong); font-size: 1.35rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat-card { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--panel-2) 85%, transparent); }
.stat-card span, .stat-card small, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: .76rem; }
.stat-card strong { margin-top: 3px; overflow-wrap: anywhere; }
.stat-card small { margin-top: 2px; color: var(--muted); }

.search-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.search-layout.no-hits { grid-template-columns: 1fr; }
.search-layout.no-hits .filters { display: none; }
.filters { display: grid; gap: 12px; position: sticky; top: 86px; }
.filter-card { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.filter-card h2, .select-label { display: block; margin: 0 0 10px; font-size: .9rem; font-weight: 750; }
.filter-title-row { display: flex; justify-content: space-between; gap: 8px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--link); font-size: .78rem; }
.year-graph { display: flex; align-items: end; gap: 2px; height: 112px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.graph-bar { flex: 1 1 0; min-width: 3px; border: 0; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .78; padding: 0; position: relative; }
.graph-bar:hover, .graph-bar.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent-soft); }
.graph-bar.zero { min-height: 1px !important; background: var(--border); }
.year-list { max-height: 330px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.year-row { width: 100%; display: flex; justify-content: space-between; padding: 5px 9px; border: 0; border-bottom: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: .82rem; }
.year-row:last-child { border-bottom: 0; }
.year-row:hover, .year-row.active { background: var(--accent-soft); color: var(--accent-strong); }
.year-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 700; }
.radio-list { display: grid; gap: 6px; color: var(--muted); font-size: .84rem; }
.radio-list label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.radio-list input { accent-color: var(--accent); }
.custom-years { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin-top: 10px; }
.filter-card select { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }

.results-column { min-width: 0; }
.results-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 12px; min-height: 48px; margin-bottom: 10px; }
.results-toolbar h2, .results-toolbar p { margin: 0; }
.results-toolbar h2 { font-size: 1.05rem; }
.results-toolbar p { color: var(--muted); font-size: .84rem; }
.active-filter { padding: 5px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .78rem; }
.result-list { display: grid; gap: 10px; }
.result-card { padding: 15px 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: .82rem; }
.date-badge { padding: 3px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.result-part { font-weight: 750; }
.result-meta { color: var(--muted); }
.result-link { margin-left: auto; text-decoration: none; font-weight: 650; }
.result-body { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
mark { padding: 0 .08em; border-radius: 2px; background: var(--mark); color: var(--mark-text); }
.load-more { width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: var(--text); font-weight: 700; }
.load-more:hover { border-color: var(--accent); }
.empty-state, .noscript { padding: 24px; border: 1px dashed var(--border); border-radius: 12px; background: var(--panel); color: var(--muted); text-align: center; }

@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; gap: 8px 14px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .main-nav a { min-height: 38px; padding: 0 11px; white-space: nowrap; }
  .theme-toggle { margin-left: auto; }
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graph-card { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .header-inner, .page-shell { padding-left: 12px; padding-right: 12px; }
  .brand small { display: none; }
  .search-hero { padding: 18px 14px; border-radius: 14px; }
  .search-form { grid-template-columns: 1fr; }
  .search-form button { min-height: 46px; }
  .search-options { grid-template-columns: 1fr; gap: 14px; }
  .search-options > h2 { grid-column: auto; }
  .search-options .radio-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-options .radio-list label { min-width: 0; padding: 7px 9px; border-radius: 9px; }
  .summary-heading { display: block; }
  .stat-grid, .filters { grid-template-columns: 1fr; }
  .graph-card { grid-column: auto; }
  .result-card { padding: 13px; }
  .result-link { width: 100%; margin-left: 0; }
}
