:root {
  --bg-base: #070d1a;
  --bg-surface: #0f172a;
  --bg-card: #131f35;
  --bg-card-alt: #182640;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --under: #22d3ee;
  --under-soft: rgba(34, 211, 238, 0.14);
  --under-border: rgba(34, 211, 238, 0.35);

  --over: #fb7185;
  --over-soft: rgba(251, 113, 133, 0.14);
  --over-border: rgba(251, 113, 133, 0.35);

  --neutral: #94a3b8;
  --accent: #60a5fa;
  --emerald: #34d399;
  --amber: #fbbf24;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 10px 30px -12px rgba(2, 6, 23, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top right, #112240 0%, var(--bg-base) 55%);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans JP', 'Yu Gothic UI', 'Hiragino Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

/* 読み込み中・エラー */
.loading-screen {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(96, 165, 250, 0.2);
  border-top-color: var(--under);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ヘッダー */
.app-header {
  background: linear-gradient(145deg, rgba(19, 31, 53, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.title-block h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--under-soft);
  color: var(--under);
  border: 1px solid var(--under-border);
}

.title-sub {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.file-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 12px;
  border-right: 1px solid var(--border-subtle);
}

.meta-item:last-child {
  padding-right: 0;
  border-right: none;
}

.meta-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 600;
}

.header-controls {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tab-group,
.period-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-right: 4px;
}

.btn-tab {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tab:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-tab.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--under);
  color: var(--under);
}

.btn-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  font-size: 0.78rem;
}

.btn-pill {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-pill.active {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--accent);
  color: #e0f2fe;
  font-weight: 600;
}

/* KPIカード */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-main {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ball-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

.digit-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(37, 99, 235, 0.35);
}

.digit-ball.sm {
  width: 26px;
  height: 26px;
  font-size: 0.85rem;
}

.digit-ball.under-ball {
  background: linear-gradient(145deg, #06b6d4, #0284c7);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(6, 182, 212, 0.35);
}

.digit-ball.over-ball {
  background: linear-gradient(145deg, #f43f5e, #e11d48);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(244, 63, 94, 0.35);
}

/* セクションパネル */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.panel-desc {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend-dot.under {
  background: var(--under);
}

.legend-dot.over {
  background: var(--over);
}

.legend-dot.theory {
  background: var(--emerald);
}

/* 状態色 */
.is-under {
  color: var(--under);
}

.is-over {
  color: var(--over);
}

.is-neutral {
  color: var(--neutral);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.badge.is-under {
  background: var(--under-soft);
  border: 1px solid var(--under-border);
}

.badge.is-over {
  background: var(--over-soft);
  border: 1px solid var(--over-border);
}

.badge.is-neutral {
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* SVGチャート */
.chart-box {
  width: 100%;
  overflow-x: auto;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.interactive-bar {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.interactive-bar:hover {
  opacity: 0.82;
}

.chart-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(2, 6, 23, 0.94);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.5;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  max-width: 260px;
}

/* テーブル */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  white-space: nowrap;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.76rem;
  background: rgba(15, 23, 42, 0.55);
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.06);
}

/* ヒートマップ */
.heatmap-wrap {
  width: 100%;
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  min-width: 780px;
}

.heatmap-table th {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px;
  text-align: center;
}

.heatmap-table th.pos-head {
  text-align: left;
  width: 82px;
}

.heat-cell {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 5px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.heat-cell:hover {
  transform: translateY(-1px);
}

.heat-gap {
  font-weight: 700;
  font-size: 0.85rem;
}

.heat-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.pick-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--under-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notice-note {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.08);
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-size: 0.78rem;
}

/* 2カラムグリッド */
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

@media (max-width: 960px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

.two-col-grid > .panel {
  margin-bottom: 0;
}

/* 横方向比較バー（理論 vs 実績） */
.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pattern-row {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.pattern-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.84rem;
}

.pattern-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-track-row {
  display: grid;
  grid-template-columns: 52px 1fr 62px;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.bar-track {
  height: 8px;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.bar-fill.theory {
  background: var(--emerald);
}

.bar-fill.actual-under {
  background: var(--under);
}

.bar-fill.actual-over {
  background: var(--over);
}

.bar-fill.actual-neutral {
  background: var(--accent);
}

/* 数字セレクタ（収束チャート） */
.digit-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.digit-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.digit-btn:hover {
  border-color: var(--accent);
}

.digit-btn.active {
  background: var(--under-soft);
  border-color: var(--under);
  color: var(--under);
}

/* 過去当選チェッカー */
.checker-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.checker-input {
  flex: 1;
  min-width: 0;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.checker-input:focus {
  outline: none;
  border-color: var(--under);
}

.btn-primary {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.checker-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 540px) {
  .checker-result-grid {
    grid-template-columns: 1fr;
  }
}

.checker-stat-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.checker-stat-box h3 {
  margin: 0 0 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.hit-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.hit-list li {
  padding: 4px 0;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

.history-scroll {
  max-height: 410px;
  overflow-y: auto;
}

/* 予想理論検証セクション */
.theory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 820px) {
  .theory-grid {
    grid-template-columns: 1fr;
  }
}

.theory-card,
.theory-subpanel {
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.theory-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.theory-card-top h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.theory-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.84rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

.mini-tag.hit-9 {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.4);
  color: #67e8f9;
}

.mini-tag.hit-consec {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.42);
  color: #fcd34d;
}

.mini-tag.hit-pull {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.42);
  color: #c4b5fd;
}

.mini-tag.hit-all {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

.mini-tag.hit-king {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.mini-tag.hit-ura {
  background: rgba(244, 114, 182, 0.16);
  border-color: rgba(244, 114, 182, 0.42);
  color: #f9a8d4;
}

.mini-tag.hit-slide {
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.42);
  color: #fdba74;
}

.mini-tag.hit-revival {
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(45, 212, 191, 0.42);
  color: #5eead4;
}

.mini-tag.hit-cross {
  background: rgba(250, 204, 21, 0.15);
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde047;
}

.mini-tag.hit-cooccur {
  background: rgba(129, 140, 248, 0.16);
  border-color: rgba(129, 140, 248, 0.45);
  color: #a5b4fc;
}

.mini-tag.hit-rebound {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.42);
  color: #fca5a5;
}

.mini-tag.hit-bands {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.42);
  color: #86efac;
}

.mini-tag.hit-drought {
  background: rgba(192, 132, 252, 0.16);
  border-color: rgba(192, 132, 252, 0.42);
  color: #d8b4fe;
}

/* マルチ期間・理論収束予測セクション */
.forecast-panel {
  border-color: rgba(34, 211, 238, 0.34);
  background: linear-gradient(160deg, rgba(19, 34, 58, 0.96), rgba(15, 23, 42, 0.98));
}

.sub-heading {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #cbd5e1;
}

.forecast-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 12px;
}

.forecast-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forecast-card.is-rank1 {
  border-color: var(--under-border);
  background: linear-gradient(145deg, rgba(8, 51, 68, 0.42), rgba(15, 23, 42, 0.85));
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.14);
}

.forecast-card-head,
.forecast-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.forecast-card-foot {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.period-forecast-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1024px) {
  .period-forecast-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .period-forecast-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.period-mini-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.period-mini-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.period-mini-num {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f8fafc;
}

.pos-rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.pos-rank-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pos-rank-chip {
  display: grid;
  grid-template-columns: 28px 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.35);
}

/* メインナビゲーション & コントロール整理 */
.main-nav {
  display: grid;
  grid-template-columns: repeat(var(--nav-cols, 6), minmax(0, 1fr));
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

@media (max-width: 900px) {
  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.main-nav-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.main-nav-btn:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.08);
}

.main-nav-btn.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.18));
  border-color: var(--under-border);
  color: #e0f2fe;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18);
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 22px;
}

/* 当選回数ヒストグラム */
.hist-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.hist-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.hist-stat-chip {
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hist-stat-chip strong {
  font-size: 1.08rem;
  color: var(--text-primary);
}

.hist-ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.hist-ranking-box {
  padding: 14px;
}

.hist-ranking-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.hist-ranking-head h3 {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-primary);
}

.hist-mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hist-mini-item {
  display: grid;
  grid-template-columns: 30px auto minmax(88px, auto) auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.36);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.hist-num-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hist-num-btn:hover {
  border-color: var(--under);
  background: rgba(34, 211, 238, 0.16);
  color: var(--under);
}

.hist-pattern-tag {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-count-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--emerald);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.hist-last-meta {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .hist-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .hist-ranking-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hist-summary-strip {
    grid-template-columns: 1fr;
  }

  .hist-mini-item {
    grid-template-columns: 28px auto auto 1fr;
  }

  .hist-pattern-tag {
    display: none;
  }
}

/* ロト系・配当UI追加スタイル */
.is-amber {
  color: var(--amber);
}

.digit-ball.loto-ball {
  font-size: 0.92rem;
}

.digit-ball.loto-ball.sm {
  width: 28px;
  height: 28px;
  font-size: 0.78rem;
}

.digit-ball.bonus-ball {
  background: linear-gradient(145deg, #f59e0b, #d97706);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(245, 158, 11, 0.35);
}

.checker-input.checker-input-wide {
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}

.loto-number-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 900px) {
  .loto-number-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.loto-heat-cell {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: default;
}

.loto-heat-num {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
}

.loto-heat-gap {
  font-size: 0.75rem;
  font-weight: 700;
}

.loto-heat-ago {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.theory-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.theory-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.loto-target-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.mini-tag.hit-ac {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

.mini-tag.hit-prime {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.42);
  color: #93c5fd;
}

.mini-tag.hit-skip {
  background: rgba(244, 114, 182, 0.15);
  border-color: rgba(244, 114, 182, 0.4);
  color: #f9a8d4;
}
