:root {
  --bg: #f6f4fd; --card: #ffffff; --ink: #1a1433; --muted: #6d6789; --line: #e6e1f4;
  --accent: #6842ff; --accent-soft: #ece7ff; --up: #0fa77a; --down: #e5484d; --hover: #f1eefb;
  --warn: #c76a00; --warn-soft: #fdf0dd; --info: #2f7fe0; --info-soft: #e5f0fc; --pink: #cf3b99; --pink-soft: #fbe6f3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0a1f; --card: #171230; --ink: #ece9fa; --muted: #9690b5; --line: #2a2348;
    --accent: #9b7bff; --accent-soft: #261c52; --up: #3ddc97; --down: #ff6b6b; --hover: #1f1840;
    --warn: #f5b74a; --warn-soft: #2d2412; --info: #6fb0ff; --info-soft: #14233d; --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: 1760px; 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 */
.st-sub { display: none; }
.c-sp, .c-sd { min-width: 0; }
.c-sp .devwrap, .c-sd .devwrap { display: flex; }
@media (max-width: 1000px) { .c-sp, .c-sd { display: none; } .st-sub { display: inline; } }
.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 */

/* charts */
.spark { width: 100%; max-width: 150px; height: 38px; display: block; margin: 0 auto; overflow: hidden; }
.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; }
}

/* Daily card controls: metric tabs left, view / bar size / range right */
.dctl { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dctl-r { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bookmark button: in list rows it sits in the row's left padding, so no table needs an extra column. */
.row { position: relative; }
.rows:has(.bmk) > .row, .rows:has(.bmk) > .dayhead { padding-left: 38px; }
.bmk { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 3px; cursor: pointer; line-height: 0; color: var(--muted); opacity: .45; border-radius: 6px; }
.bmk svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.bmk:hover { opacity: 1; color: var(--ink); background: var(--hover); }
.bmk.on { opacity: 1; color: #f5b301; }
.bmk.on svg { fill: currentColor; }
.bmk.big { position: static; transform: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1; opacity: 1; color: var(--ink); }
.bmk.big.on { color: #f5b301; border-color: #f5b30166; }
@media (max-width: 720px) { .rows:has(.bmk) > .row, .rows:has(.bmk) > .dayhead { padding-left: 32px; } .bmk { left: 6px; } }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.dsaves { display: flex; gap: 6px; }
.dsaves .btn { padding: 5px 10px; font-size: 12.5px; }

/* CrazyGames covers are wide: show them that way. */
.thumb { aspect-ratio: 16 / 9; height: auto; width: 64px; }
.thumb.sm { width: 48px; height: auto; }
.thumb.lg { width: 208px; height: auto; }
@media (max-width: 720px) { .thumb { width: 56px; height: auto; } }
.cell.c-sp b { font-weight: 700; }

/* Site search in the top bar */
.gsearch { position: relative; flex: 0 1 260px; min-width: 170px; }
.gsearch input[type=search] { width: 100%; max-width: none; }
.gs-menu { position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); padding: 6px; }
.gs-menu[hidden] { display: none; }
.gs-head { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 8px 8px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.gs-item.on, .gs-item:hover { background: var(--hover); }
.gs-item .thumb { flex: none; }
.gs-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 600; }
.gs-meta { flex: none; color: var(--muted); font-size: 12.5px; }
.gs-none { color: var(--muted); font-size: 13.5px; padding: 12px 8px; }
@media (max-width: 720px) { .gsearch { flex: 1 1 100%; } }
/* The menu keeps its full width: on narrower screens it gets its own row under the logo and search. */
@media (min-width: 1400px) { .top .nav { min-width: max-content; } }
@media (max-width: 1399px) { .top .nav { flex-basis: 100%; order: 3; } .gsearch { margin-left: auto; } }
