/* SteamMarketer — "market terminal" art direction: night-blue glass, electric blue accent, quiet motion */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('fonts/space-grotesk-latin.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --page: #f3f5fa;
  --page-glow-1: rgba(42, 120, 214, 0.14);
  --page-glow-2: rgba(124, 92, 255, 0.1);
  --grid-line: rgba(12, 18, 34, 0.035);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: #eef1f7;
  --ink: #0c1222;
  --ink-2: #4a5468;
  --muted: #7b8499;
  --grid: #e4e8f0;
  --axis: #c8cedb;
  --border: rgba(12, 18, 34, 0.08);
  --border-strong: rgba(12, 18, 34, 0.14);
  --accent: #2a78d6;
  --accent-2: #7c5cff;
  --accent-wash: rgba(42, 120, 214, 0.1);
  --series-1: #2a78d6;
  --series-muted: #c8cedb;
  --quadrant-fill: rgba(42, 120, 214, 0.05);
  --shadow: 0 1px 2px rgba(12, 18, 34, 0.04), 0 8px 24px rgba(12, 18, 34, 0.06);
  --shadow-lift: 0 2px 4px rgba(12, 18, 34, 0.06), 0 16px 40px rgba(12, 18, 34, 0.1);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #060a13;
    --page-glow-1: rgba(78, 163, 255, 0.16);
    --page-glow-2: rgba(139, 123, 255, 0.12);
    --grid-line: rgba(255, 255, 255, 0.028);
    --surface: rgba(16, 23, 38, 0.72);
    --surface-solid: #0f1626;
    --surface-2: rgba(255, 255, 255, 0.05);
    --ink: #eef2fb;
    --ink-2: #aab4c8;
    --muted: #6f7a90;
    --grid: rgba(255, 255, 255, 0.06);
    --axis: rgba(255, 255, 255, 0.16);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #4ea3ff;
    --accent-2: #8b7bff;
    --accent-wash: rgba(78, 163, 255, 0.14);
    --series-1: #4ea3ff;
    --series-muted: rgba(255, 255, 255, 0.18);
    --quadrant-fill: rgba(78, 163, 255, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 20px 48px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #060a13;
  --page-glow-1: rgba(78, 163, 255, 0.16);
  --page-glow-2: rgba(139, 123, 255, 0.12);
  --grid-line: rgba(255, 255, 255, 0.028);
  --surface: rgba(16, 23, 38, 0.72);
  --surface-solid: #0f1626;
  --surface-2: rgba(255, 255, 255, 0.05);
  --ink: #eef2fb;
  --ink-2: #aab4c8;
  --muted: #6f7a90;
  --grid: rgba(255, 255, 255, 0.06);
  --axis: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #4ea3ff;
  --accent-2: #8b7bff;
  --accent-wash: rgba(78, 163, 255, 0.14);
  --series-1: #4ea3ff;
  --series-muted: rgba(255, 255, 255, 0.18);
  --quadrant-fill: rgba(78, 163, 255, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 20px 48px rgba(0, 0, 0, 0.4);
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60rem 30rem at 12% -8%, var(--page-glow-1), transparent 70%),
    radial-gradient(50rem 26rem at 95% 0%, var(--page-glow-2), transparent 70%),
    var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
/* faint terminal grid, fading out towards the bottom */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
}
img {
  max-width: 100%;
}
::selection {
  background: var(--accent-wash);
}
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.01em;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px var(--page-glow-1);
  color: #fff;
}
.logo svg {
  width: 20px;
  height: 20px;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.wordmark span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.hero {
  margin: 34px 0 6px;
}
h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 22ch;
}
.subtitle {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 68ch;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  backdrop-filter: blur(8px);
}
.pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}
.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2.4s ease-out infinite;
}

/* ---------- controls ---------- */

.btn {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease-out), box-shadow 0.2s;
  backdrop-filter: blur(8px);
}
.btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-ghost {
  background: transparent;
}
.btn-icon {
  padding: 4px 10px;
  font-size: 16px;
  line-height: 1;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.2s;
}
.btn-icon:hover {
  background: var(--surface-2);
}
.header-actions .btn {
  min-width: 38px;
  height: 36px;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.link {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--axis);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: text-decoration-color 0.2s, color 0.2s;
}
.link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* tabs: pill control with a sliding indicator */
.tabs {
  position: relative;
  display: inline-flex;
  gap: 2px;
  margin: 26px 0 14px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  position: relative;
  z-index: 1;
  font: inherit;
  font-weight: 500;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s;
}
.tab:hover {
  color: var(--ink);
}
.tab[aria-selected='true'] {
  color: #fff;
}
.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 16px var(--page-glow-1);
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out);
}

/* filters panel */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0;
}
select,
.search {
  font: inherit;
  color: var(--ink);
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  max-width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
select option,
select optgroup {
  background: var(--surface-solid);
  color: var(--ink);
}
select:hover,
.search:hover {
  border-color: var(--border-strong);
}
select:focus,
.search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.search {
  min-width: 0;
  width: 260px;
}
.chips {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chips legend {
  width: 100%;
  margin-bottom: 5px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.chip:has(input:checked) {
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.chip input {
  margin: 0;
  accent-color: var(--accent);
}
.chip--active {
  cursor: default;
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.toggle {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 7px;
  cursor: pointer;
}
.toggle input {
  accent-color: var(--accent);
}

/* ---------- KPI tiles ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s, border-color 0.3s;
}
/* light seam along the top edge */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.7;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--border-strong);
}
.kpi-label {
  font-size: 12px;
  color: var(--ink-2);
}
.kpi-value {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
  line-height: 1.1;
}

/* ---------- cards ---------- */

.card {
  padding: 18px 20px;
  margin-bottom: 18px;
  min-width: 0;
}
.card h2,
.drawer h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.card-sub {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}
.card-head {
  margin-bottom: 14px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.toolbar .btn {
  margin-left: auto;
}
.empty {
  color: var(--muted);
  margin: 8px 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
  background: color-mix(in srgb, #f59e0b 9%, transparent);
  color: var(--ink-2);
  font-size: 13px;
}

/* ---------- charts ---------- */

.chart-box {
  width: 100%;
}
.chart {
  display: block;
  max-width: 100%;
  height: auto;
  font-family: var(--font);
  overflow: visible;
}
.grid line {
  stroke: var(--grid);
  stroke-width: 1;
}
.baseline {
  stroke: var(--axis);
  stroke-width: 1;
}
.tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.axis-label {
  fill: var(--ink-2);
  font-size: 12px;
}
.ref-line {
  stroke: var(--ink-2);
  stroke-width: 1;
  opacity: 0.6;
}
.ref-line--faint {
  stroke: var(--grid);
  opacity: 1;
}
.ref-label {
  fill: var(--ink-2);
  font-size: 11px;
}
.quadrant {
  fill: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.quadrant-fill {
  fill: var(--quadrant-fill);
}
.dot {
  fill: var(--series-1);
  stroke: var(--surface-solid);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 0.3s;
}
.dot--muted {
  fill: var(--series-muted);
}
.dot--selected {
  fill: var(--series-1);
  filter: drop-shadow(0 0 6px var(--series-1));
}
.dot-hover {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  pointer-events: none;
}
.point-label {
  fill: var(--ink-2);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--surface-solid);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
.point-label--selected {
  fill: var(--ink);
  font-weight: 600;
}
.hit-layer {
  fill: transparent;
}
.bar {
  fill: var(--series-1);
  transform-box: fill-box;
  transform-origin: bottom;
}
.muted-bars .bar {
  fill: var(--axis);
}

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  background: var(--surface-solid);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  padding: 9px 12px;
  font-size: 12px;
  min-width: 170px;
}
.tooltip:not([hidden]) {
  animation: tip-in 0.15s var(--ease-out);
}
.tooltip-title {
  font-family: var(--display);
  font-weight: 600;
  margin-bottom: 4px;
}
.tooltip-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.tooltip-row strong {
  font-variant-numeric: tabular-nums;
}
.tooltip-row span {
  color: var(--ink-2);
}

/* ---------- detail drawer ---------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(420px, 100vw);
  overflow-y: auto;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--border-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.25);
  padding: 18px 20px 28px;
}
.drawer--enter {
  animation: drawer-in 0.4s var(--ease-out);
}
@media (min-width: 1760px) {
  body.drawer-open .page {
    margin-right: 440px;
  }
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.drawer h2 {
  font-size: 22px;
}
.drawer h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 8px;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.mini-stat {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}
.mini-value {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
}
.game-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.game {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 5px 6px;
  margin: 0 -6px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.2s;
}
.game:hover {
  background: var(--surface-2);
}
.capsule {
  width: 92px;
  height: 35px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
  display: block;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-out);
}
.game:hover .capsule,
.game-row:hover .capsule {
  transform: scale(1.04);
}
.game-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-value {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.companions {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.companions .link {
  text-align: left;
}
.companions .muted {
  white-space: nowrap;
}
.companions li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  container-type: inline-size;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: var(--surface-solid);
}
th.sorted {
  color: var(--accent);
}
.th-btn {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.th-btn:hover {
  color: var(--ink);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tbody tr {
  transition: background 0.15s;
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover td {
  background: var(--surface-2);
}
tr.clickable:hover td:first-child,
tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
tr.selected td {
  background: var(--accent-wash);
}
.rate-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rate-track {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.rate-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 0 3px 3px 0;
  transform-origin: left;
}
.game-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.game-row .capsule {
  width: 120px;
  height: 45px;
}
.game-cell {
  display: flex;
  flex-direction: column;
  white-space: normal;
  min-width: 240px;
}
.game-cell a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}
.game-cell a:hover {
  color: var(--accent);
}
.more {
  margin-top: 14px;
}
.yearly {
  font-size: 12px;
}
.yearly th,
.yearly td {
  padding: 6px 6px;
}
.yearly th {
  background: transparent;
}
.yearly td:first-child {
  min-width: 0;
}

/* solo-dev ease: 5 dots, filled = easier */
.ease {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.ease-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--axis);
}
.ease-dot.on {
  background: var(--series-1);
  box-shadow: 0 0 6px color-mix(in srgb, var(--series-1) 50%, transparent);
}

/* ---------- methodology ---------- */

.prose {
  max-width: 820px;
  line-height: 1.7;
}
.prose h2 {
  font-size: 26px;
  margin-top: 4px;
}
.prose h3 {
  margin: 26px 0 6px;
  font-size: 17px;
}
.prose code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}
.prose li {
  margin: 4px 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--grid);
}

/* ---------- motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes tip-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}
@keyframes pulse {
  from {
    opacity: 0.7;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(2.8);
  }
}

/* entrance: only on first load and when switching tab or period (see app.js), never on every filter tweak */
.reveal > * {
  animation: rise 0.6s var(--ease-out) both;
}
.reveal > :nth-child(2) {
  animation-delay: 0.06s;
}
.reveal > :nth-child(3) {
  animation-delay: 0.12s;
}
.reveal > :nth-child(4) {
  animation-delay: 0.18s;
}
.hero,
.tabs,
.filters {
  animation: rise 0.6s var(--ease-out) both;
}
.tabs {
  animation-delay: 0.05s;
}
.filters {
  animation-delay: 0.1s;
}
.chart.enter .dot {
  animation: pop 0.5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 3ms + 0.15s);
}
.chart.enter .point-label {
  animation: rise 0.5s var(--ease-out) both;
  animation-delay: 0.5s;
}
.chart.enter .bar {
  animation: grow 0.6s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 15ms);
}
.reveal .rate-fill {
  animation: fill 0.9s var(--ease-out) both;
  animation-delay: 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .page {
    padding: 16px 16px 32px;
  }
  .hero {
    margin-top: 24px;
  }
  .search {
    width: 100%;
  }
  .toolbar .btn {
    margin-left: 0;
  }
  .mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi {
    padding: 12px 14px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .filters {
    padding: 12px;
  }
}

/* responsive tables: drop low-priority columns instead of scrolling sideways */
@container (max-width: 1180px) {
  .p4 {
    display: none;
  }
}
@container (max-width: 900px) {
  .p3 {
    display: none;
  }
}
@container (max-width: 680px) {
  .p2 {
    display: none;
  }
  th,
  td {
    padding: 8px 6px;
  }
  .rate-track {
    width: 36px;
  }
  .game-cell {
    min-width: 180px;
  }
}
/* the label column wraps so long tag names never push numbers off-screen */
td:first-child {
  white-space: normal;
  min-width: 110px;
}
@container (max-width: 420px) {
  table {
    font-size: 12px;
  }
  th,
  td {
    padding: 7px 4px;
  }
  .ease {
    gap: 2px;
  }
  .ease-dot {
    width: 6px;
    height: 6px;
  }
  .rate-track {
    display: none;
  }
  th {
    white-space: normal;
  }
  td:first-child {
    min-width: 96px;
  }
  .game-cell {
    min-width: 120px;
  }
  .game-row {
    align-items: flex-start;
    gap: 8px;
  }
  .game-row .capsule {
    width: 64px;
    height: 24px;
  }
}
/* p5: only dropped on the smallest phones */
@container (max-width: 310px) {
  .p5 {
    display: none;
  }
}
