:root {
  --stats-bg: #140a1e;
  --stats-panel: #1e1030;
  --stats-panel-2: #271640;
  --stats-gold: #c9a227;
  --stats-gold-soft: #e6c85a;
  --stats-violet: #8e44ad;
  --stats-text: #ece3d4;
  --stats-muted: #a99bbd;
  --stats-line: rgba(201, 162, 39, 0.35);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -10%, #2a1440 0%, var(--stats-bg) 60%);
  color: var(--stats-text);
  font-family: 'Noto Serif KR', Georgia, 'Times New Roman', serif;
  line-height: 1.5;
}
.stats-wrap { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.stats-head { text-align: center; border-bottom: 2px solid var(--stats-line); padding-bottom: 1.25rem; margin-bottom: 1.75rem; }
.stats-brand { color: var(--stats-gold-soft); letter-spacing: 0.14em; font-size: 0.9rem; }
.stats-head h1 { font-family: 'Pirata One', serif; font-weight: 400; font-size: clamp(2rem, 5vw, 3.4rem); margin: 0.35rem 0; color: var(--stats-gold); text-shadow: 0 0 18px rgba(201, 162, 39, 0.35); }
.stats-nav { font-size: 0.95rem; }
.stats-nav a { color: var(--stats-gold-soft); text-decoration: none; }
.stats-nav a:hover { text-decoration: underline; }
.stats-nav-sep { color: var(--stats-muted); margin: 0 0.5rem; }
.stats-nav-active { color: var(--stats-muted); }
.stats-sub { color: var(--stats-muted); font-style: italic; margin: 0.6rem 0 0; }
.stats-loading, .stats-empty, .stats-error { text-align: center; padding: 3rem 1rem; color: var(--stats-muted); font-size: 1.1rem; }
.stats-error { color: #e08a8a; }

.stats-section { margin: 2.25rem 0; }
.stats-section-title { font-family: 'Pirata One', serif; font-weight: 400; color: var(--stats-gold-soft); font-size: 1.6rem; border-left: 3px solid var(--stats-gold); padding-left: 0.6rem; margin: 0 0 1rem; }

.stats-hero { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; }
.stats-counter { background: linear-gradient(180deg, var(--stats-panel-2), var(--stats-panel)); border: 1px solid var(--stats-line); border-radius: 12px; padding: 0.9rem 0.6rem; text-align: center; }
.stats-counter-num { font-family: 'Pirata One', serif; font-size: 1.6rem; color: var(--stats-gold); }
.stats-counter-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stats-muted); }

.stats-series-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.stats-toggle-btn { background: var(--stats-panel); color: var(--stats-muted); border: 1px solid var(--stats-line); border-radius: 999px; padding: 0.3rem 0.9rem; cursor: pointer; text-transform: capitalize; font-family: inherit; }
.stats-toggle-btn.active { background: var(--stats-gold); color: #1a0f28; border-color: var(--stats-gold); }
.stats-series-chart, .stats-trend-chart { background: var(--stats-panel); border: 1px solid var(--stats-line); border-radius: 12px; padding: 0.5rem; }
.stats-svg { display: block; width: 100%; height: auto; }
.stats-axis { stroke: var(--stats-line); stroke-width: 1; }
.stats-bar { fill: var(--stats-gold); opacity: 0.85; }
.stats-bar-label { fill: var(--stats-muted); font-size: 11px; }

.stats-streak-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.75rem; }
.stats-streak-card { background: var(--stats-panel); border: 1px solid var(--stats-line); border-radius: 12px; padding: 0.85rem; }
.stats-streak-metric { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stats-muted); margin-bottom: 0.4rem; }
.stats-streak-current, .stats-streak-best { display: flex; justify-content: space-between; gap: 0.5rem; }
.stats-streak-value { color: var(--stats-gold-soft); }
.stats-streak-len { color: var(--stats-muted); font-size: 0.85rem; }

.stats-dim-card { background: var(--stats-panel); border: 1px solid var(--stats-line); border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.75rem; }
.stats-dim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.stats-dim-title { margin: 0; font-size: 1.05rem; color: var(--stats-gold-soft); font-weight: 600; }
.stats-dim-module { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stats-muted); white-space: nowrap; }
.stats-dim-rows { margin-top: 0.5rem; }
.stats-dim-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) 3fr auto; align-items: center; gap: 0.5rem; padding: 0.15rem 0; }
.stats-dim-value { overflow-wrap: anywhere; }
.stats-dim-bar { height: 9px; border-radius: 999px; background: linear-gradient(90deg, var(--stats-violet), var(--stats-gold)); min-width: 2px; }
.stats-dim-count { color: var(--stats-muted); font-variant-numeric: tabular-nums; }
.stats-dim-showall { margin-top: 0.5rem; background: none; border: 1px solid var(--stats-line); color: var(--stats-gold-soft); border-radius: 999px; padding: 0.2rem 0.8rem; cursor: pointer; font-family: inherit; }

.stats-cross-card { background: var(--stats-panel); border: 1px solid var(--stats-line); border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.75rem; overflow-x: auto; }
.stats-cross-title { margin: 0 0 0.6rem; font-size: 1.05rem; color: var(--stats-gold-soft); font-weight: 600; }
.stats-cross-matrix { border-collapse: collapse; }
.stats-cross-matrix th, .stats-cross-matrix td { border: 1px solid var(--stats-line); padding: 0.3rem 0.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.stats-cross-rowhead { text-align: left; color: var(--stats-muted); }
.stats-cross-cell { min-width: 40px; }
.stats-cross-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; border-bottom: 1px dotted var(--stats-line); }
.stats-cross-count { color: var(--stats-muted); font-variant-numeric: tabular-nums; }

.stats-trend-picker { background: var(--stats-panel); color: var(--stats-text); border: 1px solid var(--stats-line); border-radius: 8px; padding: 0.35rem 0.6rem; font-family: inherit; margin-bottom: 0.6rem; }
.stats-trend-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin: 0.6rem 0 0; }
.stats-trend-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.stats-trend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.stats-trend-legend-label { color: var(--stats-text); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .stats-hero { grid-template-columns: repeat(2, 1fr); }
  .stats-dim-row { grid-template-columns: minmax(80px, 1fr) 2fr auto; }
}
