:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --page-plane:      #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);

  --series-1: #2a78d6; /* 勝率 / 回収率プラス側 */
  --series-2: #eb6834; /* 複勝率 */
  --status-critical: #d03b3b; /* 回収率マイナス側 */
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page-plane:      #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);

    --series-1: #3987e5;
    --series-2: #d95926;
    --status-critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --page-plane:      #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255,255,255,0.10);

  --series-1: #3987e5;
  --series-2: #d95926;
  --status-critical: #e66767;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.page-header {
  padding: 32px 20px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 6px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.stat-label {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: proportional-nums;
}

.stat-value-small {
  font-size: 19px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-card h2 {
  font-size: 20px;
  margin: 0 0 4px;
}

.chart-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

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

.chart-wrap {
  width: 100%;
  overflow-x: auto;
  position: relative;
}

.chart-wrap svg {
  display: block;
}

.chart-wrap text {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  fill: var(--text-secondary);
}

.chart-wrap .axis-line {
  stroke: var(--baseline);
}

.chart-wrap .gridline {
  stroke: var(--gridline);
}

.chart-wrap .value-label {
  fill: var(--text-primary);
  font-size: 14px;
}

.bar-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  white-space: nowrap;
  z-index: 10;
  display: none;
}

.table-toggle {
  margin-top: 14px;
}

.table-toggle summary {
  cursor: pointer;
  font-size: 15px;
  color: var(--text-secondary);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 12px;
}

table.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

table.data-table th,
table.data-table td {
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

table.data-table th {
  color: var(--text-secondary);
  font-weight: 700;
}

.chart-bar {
  cursor: pointer;
}

.chart-bar:hover {
  filter: brightness(1.08);
}
