:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #0f1a33; --muted: #6b7489; --line: #e7e9f0;
  --accent: #e5242b; --accent-soft: #fde8e8; --up: #12b886; --down: #e5484d; --hover: #f2f4f9;
  --warn: #d97706; --warn-soft: #fdf3e2; --info: #3b6fe0; --info-soft: #e8effc; --pink: #d6409f; --pink-soft: #fbe8f3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111d; --card: #131a2a; --ink: #e8ecf5; --muted: #8b94a8; --line: #222b3d;
    --accent: #ff4e45; --accent-soft: #2e1414; --up: #3ddc97; --down: #ff6b6b; --hover: #18213a;
    --warn: #f5b74a; --warn-soft: #2d2412; --info: #7aa2ff; --info-soft: #151f3a; --pink: #f07cc4; --pink-soft: #2e1427;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 16px 64px; }

/* nav */
.top { display: flex; align-items: center; gap: 18px; padding: 4px 0 18px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.brand img { display: block; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; padding: 7px 11px; border-radius: 9px; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a.on { color: var(--ink); background: var(--card); box-shadow: 0 0 0 1px var(--line); }

header.page { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; max-width: 760px; }
.meta { color: var(--muted); font-size: 13px; text-align: right; }
.meta b { color: var(--ink); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; animation: pulse 2s infinite; vertical-align: 1px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
input[type=search], select { padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
input[type=search] { flex: 1; min-width: 160px; max-width: 300px; }
input[type=search]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--hover); }
.btn.on { border-color: var(--accent); color: var(--accent); }
.spacer { flex: 1; }

/* share charts (bars / donut) */
.pie { display: grid; gap: 12px; justify-items: center; }
.pie svg { width: 140px; height: 140px; display: block; }
.legend-list { display: grid; gap: 4px; font-size: 12.5px; min-width: 0; width: 100%; }
.legend-list div { display: grid; grid-template-columns: 10px minmax(0, 1fr) 42px 44px; gap: 7px; align-items: center; }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; }
.legend-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-list b, .legend-list em { text-align: right; font-style: normal; font-variant-numeric: tabular-nums; }
.legend-list em { color: var(--muted); }
.ebars { display: grid; gap: 7px; }
.ebar { display: grid; grid-template-columns: 112px 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.ebar > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ebar > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.ebar .bar { position: relative; height: 20px; border-radius: 6px; background: var(--hover); overflow: hidden; }
.ebar .bar i { position: absolute; inset: 0 auto 0 0; opacity: .45; }
.ebar .bar span { position: relative; font-size: 12px; font-weight: 700; line-height: 20px; padding-left: 6px; }

/* segmented switch */
.tabs { display: inline-flex; gap: 2px; background: var(--hover); padding: 3px; border-radius: 10px; }
.tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.tabs button:disabled { opacity: .4; cursor: default; }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card.pad { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { margin-top: 26px; }
.section > .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 13px; }
.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { color: var(--muted); font-size: 12.5px; }

/* table rows */
.row > * { min-width: 0; }
.row { display: grid; gap: 12px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); }
.rows > .row:first-child { border-top: 0; }
.row.head { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding-top: 11px; padding-bottom: 11px; }
.row.head [data-sort] { cursor: pointer; user-select: none; }
.row.head [data-sort]:hover { color: var(--ink); }
.row.head .sorted { color: var(--accent); }
a.row, div.row.link { color: inherit; text-decoration: none; }
a.row:hover, div.row.link:hover { background: var(--hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.thumb { width: 48px; height: 48px; border-radius: 11px; object-fit: cover; background: var(--line); display: block; }
.thumb.sm { width: 32px; height: 32px; border-radius: 8px; }
.thumb.lg { width: 96px; height: 96px; border-radius: 20px; }
.name { min-width: 0; }
.title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { text-align: right; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.head .live { font-size: 11.5px; font-weight: 600; }
.live small, .cell small { display: block; font-size: 12px; font-weight: 600; }
.cell { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell small { color: var(--muted); font-weight: 400; }
.up { color: var(--up); } .down { color: var(--down); } .flat, .muted { color: var(--muted); }
.state { padding: 44px 16px; text-align: center; color: var(--muted); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.chip.green { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.pink { background: var(--pink-soft); color: var(--pink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }

/* game name + YouTube button */
.tline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tline .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tline .chip { flex: none; }
.pbtn { flex: none; font-size: 11px; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--muted); background: var(--card); cursor: pointer; white-space: nowrap; }
.pbtn:hover, .pbtn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
/* Phones: badges and the YouTube button wrap under the name instead of squeezing it to nothing. */
@media (max-width: 720px) { .tline { flex-wrap: wrap; row-gap: 3px; } .tline .tt { max-width: 100%; } }

.eng { color: var(--info); font-weight: 500; }

/* developer name + studio tier */
.devwrap { display: inline-flex; align-items: baseline; max-width: 100%; vertical-align: top; }
.devwrap > .devlink, .devwrap > .devname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devwrap > .stars { flex: none; }
.devlink { cursor: pointer; border-radius: 3px; }
.devlink:hover .devname, .devlink:focus-visible .devname { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.devlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.devname.gold { font-weight: 700; background: linear-gradient(90deg, #f5c542, #e09a1a 55%, #f7d774); -webkit-background-clip: text; background-clip: text; color: transparent; }
.devlink:hover .devname.gold { text-decoration-color: #e0a526; }
.stars { color: #f5b301; font-size: .85em; letter-spacing: -1px; margin-left: 4px; }
.stars.gold { text-shadow: 0 0 6px rgba(245, 179, 1, .55); }

/* star */
.star { background: none; border: 0; padding: 2px; cursor: pointer; color: var(--line); font-size: 17px; line-height: 1; }
.star.on { color: #f5b301; }
.star:hover { color: #f5b301; }

/* charts */
.spark { width: 150px; height: 38px; display: block; overflow: visible; }
.spark-empty { font-size: 12px; color: var(--muted); text-align: center; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 28px; }
.bars i { flex: 1; min-width: 0; border-radius: 2px 2px 0 0; background: var(--accent); }
.bars i.zero { height: 2px !important; background: var(--line); border-radius: 1px; }
.bars i.untracked { height: 2px !important; background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 4px); }
.bars-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: Inter, system-ui, sans-serif; }
.chart .grid line { stroke: var(--line); }
.meter { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.heat { display: inline-block; min-width: 30px; padding: 3px 4px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

#tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; opacity: 0; transition: opacity .1s; z-index: 10; }
footer { margin-top: 26px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
footer a { color: var(--muted); }

.hide-m { }
@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding-top: 12px; }
  .top { gap: 10px; }
  .nav { flex-basis: 100%; }
  h1 { font-size: 22px; }
  .meta { text-align: left; }
  .row { padding: 9px 12px; gap: 10px; }
  .hide-m { display: none !important; }
  .thumb { width: 42px; height: 42px; border-radius: 10px; }
  .live { font-size: 15px; }
  .dev { white-space: normal; }
}
