/* Layout: solid Hyperlab-red top bar carrying the white wordmark; below, one scanning column of rounded game rows
   on a quiet neutral ground, with the brand's oversized "h" watermark at 5% in the corner (HL BG rule). */
:root {
  /* Brand palette (Hyperlab Brand Guidelines 2022): red #d52234, black, white, grey #646464 */
  --red: #d52234;
  --red-press: #b81c2c;
  --black: #000000;
  --white: #ffffff;
  --grey: #646464;

  --bg: #f4f4f4;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #646464;
  --line: #e4e4e4;
  --red-tint: rgb(213 34 52 / .08);
  --red-ink: #d52234;
  --logo-on-surface: #d52234;
  /* "Legendary item" orange for followed studios, so it never reads as a red drop */
  --legend: #e07b24;
  --legend-ink: #b85d12;
  --legend-tint: rgb(224 123 36 / .10);
  --ios-pill: #000000;
  --android-pill: #646464;
  --watermark: rgb(213 34 52 / .05);
  --period-ink: #1f7a3d;
  --period-tint: rgb(47 158 68 / .12);
  --warn-bg: #fff3d6;
  --warn-ink: #6b4a00;
  --shadow: 0 1px 2px rgb(0 0 0 / .05);

  --font: "Quicksand", "Nunito", "Varela Round", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #121212; --ink: #ffffff; --muted: #a3a3a3; --line: #262626;
    --red-tint: rgb(213 34 52 / .22); --red-ink: #ff7380; --logo-on-surface: #ffffff; --legend: #f0913a; --legend-ink: #ffb067; --legend-tint: rgb(240 145 58 / .14); --period-ink: #6fd28b; --period-tint: rgb(47 158 68 / .2); --ios-pill: #ffffff; --android-pill: #8a8a8a;
    --watermark: rgb(255 255 255 / .04); --warn-bg: #3a2e10; --warn-ink: #f3d27a; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #121212; --ink: #ffffff; --muted: #a3a3a3; --line: #262626;
  --red-tint: rgb(213 34 52 / .22); --red-ink: #ff7380; --logo-on-surface: #ffffff; --legend: #f0913a; --legend-ink: #ffb067; --legend-tint: rgb(240 145 58 / .14); --period-ink: #6fd28b; --period-tint: rgb(47 158 68 / .2); --ios-pill: #ffffff; --android-pill: #8a8a8a;
  --watermark: rgb(255 255 255 / .04); --warn-bg: #3a2e10; --warn-ink: #f3d27a; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
h1, h2 { font-family: var(--font); font-weight: 700; text-wrap: balance; margin: 0; }
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
.sub { margin: 6px 0 0; color: var(--muted); max-width: none; }

/* Brand "h" watermark, red at 5% opacity on light (guideline), white at 4% on black */
.watermark {
  position: fixed; z-index: 0; pointer-events: none;
  left: -6vw; bottom: -14vh; width: min(70vw, 760px); aspect-ratio: 1;
  background: var(--watermark);
  -webkit-mask: url("/brand/h-mask.svg") center / contain no-repeat;
  mask: url("/brand/h-mask.svg") center / contain no-repeat;
}
.page, .topbar, .toasts { position: relative; z-index: 1; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--red); color: var(--white); }
.topbar-inner {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding-block: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.logo {
  display: block; width: 104px; aspect-ratio: 3237 / 1201; background: currentColor;
  -webkit-mask: url("/brand/logo-mask.svg") center / contain no-repeat;
  mask: url("/brand/logo-mask.svg") center / contain no-repeat;
}
.brand-name { font-weight: 700; font-size: 1.05rem; padding-left: 12px; border-left: 2px solid rgb(255 255 255 / .55); line-height: 1.1; }

/* Second tier: page tabs on a light strip, last scan time at the far end */
.subbar { background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }
.subbar-inner {
  display: flex; align-items: center; gap: 8px 24px;
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.nav { display: flex; gap: 24px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 13px 2px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--red-ink); box-shadow: inset 0 -3px 0 var(--red); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / .35); }
.live-dot.on { background: currentColor; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.scan { font: 500 12px/1.3 var(--font-mono); color: rgb(255 255 255 / .85); }
.theme-btn { border: 0; background: rgb(255 255 255 / .14); color: var(--white); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 17px; line-height: 1; }
.theme-btn:hover { background: rgb(255 255 255 / .24); }
.bell-wrap { position: relative; }
.bell { position: relative; border: 0; background: rgb(255 255 255 / .14); color: var(--white); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.bell:hover { background: rgb(255 255 255 / .24); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--white); color: var(--red); font: 700 11px/19px var(--font); text-align: center; }
.bell-panel { position: absolute; right: 0; top: 48px; width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 40px rgb(0 0 0 / .18); }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-list li { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.bell-list li.unread { background: var(--red-tint); }
.bell-list a { text-decoration: none; }
.link-btn { background: none; border: 0; color: var(--red); cursor: pointer; font: 600 13px var(--font); padding: 0; }

.warn { background: var(--warn-bg); color: var(--warn-ink); text-align: center; padding: 7px 16px; font-size: 13px; font-weight: 600; }

/* ---------- page ---------- */
.scan-line { margin: 0 0 0 auto; flex: none; font: 500 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
@media (max-width: 900px) { .scan-line { display: none; } }
.page { max-width: 1180px; margin: 0 auto; padding-block: 14px 72px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head > div:first-child { flex: 1 1 100%; min-width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); font: 600 13px var(--font); padding: 6px 13px; border-radius: 999px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--red); color: var(--white); }

/* ---------- rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--red-tint); }
.row.flash { animation: flash 3s ease-out; }
@keyframes flash { from { background: var(--red-tint); } to { background: transparent; } }
.icon { width: 56px; height: 56px; border-radius: 14px; background: var(--line); object-fit: cover; }
.row-main { min-width: 0; display: grid; gap: 4px; }
.title { font-weight: 700; font-size: 1.02rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title:hover { color: var(--red); }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-weight: 600; }
.notes { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font: 700 11px/1 var(--font); letter-spacing: .03em; padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ios { background: var(--ios-pill); color: var(--surface); }
.pill.android { background: var(--android-pill); color: var(--white); }
.pill.tag { border: 1px solid var(--line); color: var(--muted); }
.row-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.ver { font: 500 13px var(--font-mono); white-space: nowrap; }
.ver .arrow { color: var(--red); padding: 0 5px; font-family: var(--font); font-weight: 700; }
.when { font: 12px var(--font-mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); font-weight: 600; }
.more { display: flex; justify-content: center; margin-top: 18px; }

.country-pick { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px 4px 3px 14px; font: 600 13px var(--font); color: var(--muted); }
.country-pick select { font: 700 13px var(--font); color: var(--ink); background: var(--bg); border: 0; border-radius: 999px; padding: 6px 10px; }
.avail { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: var(--muted); }
.avail { font-weight: 500; }
.avail.pending { font-style: italic; }
.pill.soft { background: var(--red); color: var(--white); }
.pill.missing { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- game cards (new releases, watchlist) ---------- */
.list-note { margin: -6px 0 14px; font-size: 13px; color: var(--muted); font-weight: 600; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.cards > .empty { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-game { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 0 14px 14px; display: grid; grid-template-rows: auto auto auto auto auto auto 1fr auto; row-gap: 0; min-width: 0; overflow: hidden; transition: border-color .15s, transform .15s; }
/* Cards side by side share row heights, so titles, tags, screenshots and footers line up */
@supports (grid-template-rows: subgrid) {
  .cards { grid-auto-rows: auto; }
  .card-game { grid-row: span 8; grid-template-rows: subgrid; }
}
.cg-band { margin: 0 -14px; }
/* Followed studio: an orange band across the top names the studio */
.card-game { position: relative; }
.card-game.followed { border-color: var(--legend); }
.follow-band { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: linear-gradient(90deg, var(--legend), #f0a35a); color: #fff; font: 700 12px/1.2 var(--font); letter-spacing: .02em; min-width: 0; }
.follow-band > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.band-star { display: inline-grid; flex: none; }
.band-star svg { width: 12px; height: 12px; fill: #fff; }
.card-game.followed .publisher { color: var(--legend-ink); }
.star-inline { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(145deg, #ffc46b, var(--legend) 55%, #a8501a); vertical-align: -3px; margin-left: 6px; }
.star-inline svg { width: 11px; height: 11px; fill: #fff; }
.qr { display: grid; justify-items: center; gap: 3px; }
.qr-cap { font: 700 9px/1.1 var(--font); color: #646464; text-align: center; max-width: 64px; }
.h-count { font-size: 1rem; font-weight: 600; color: var(--muted); }
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.pg { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 700 14px var(--font); cursor: pointer; }
.pg:hover:not(:disabled) { border-color: var(--red); }
.pg.on { background: var(--red); border-color: var(--red); color: var(--white); }
.pg:disabled { opacity: .45; cursor: default; }
.pg-gap { align-self: center; color: var(--muted); padding: 0 2px; }
.card-game:hover { border-color: var(--red); transform: translateY(-2px); }
.cg-top { padding-top: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rank { font: 700 1.5rem/1 var(--font); color: var(--red-ink); min-width: 2.2em; align-self: center; font-variant-numeric: tabular-nums; }
/* Icon is as tall as the QR box so the top row reads as one block */
.cg-top .icon { width: 88px; height: 88px; border-radius: 20px; flex: none; }
.cg-top .qr { height: 88px; flex: none; }
.cg-title, .cg-pub, .cg-tags, .cg-avail { min-width: 0; }
.cg-title { margin-top: 12px; }
.cg-pub, .cg-tags, .cg-avail { margin-top: 6px; }
.cg-tags:empty, .cg-avail:empty { margin-top: 0; }
.cg-title .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.cg-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; align-self: start; }
.shots.empty { margin-top: 0; }
.shots .shot { display: block; border-radius: 10px; overflow: hidden; background: var(--bg); aspect-ratio: 9 / 16; }
.shots img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; min-width: 0; }
.cg-foot .when:last-child { overflow: hidden; text-overflow: ellipsis; }
/* publisher: quiet small caps line; category: tinted brand chip */
.publisher { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.genre { font: 700 11px/1 var(--font); padding: 5px 9px; border-radius: 999px; background: var(--red-tint); color: var(--red-ink); white-space: nowrap; }
.store-label { display: inline-flex; align-items: center; gap: 6px; font: 700 12px/1 var(--font); color: var(--ink); white-space: nowrap; }
.store-mark { display: inline-grid; width: 16px; height: 16px; flex: none; }
.store-mark svg { width: 100%; height: 100%; }

/* ---------- studios ---------- */
.cat-seg { margin-bottom: 18px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 16px; margin-bottom: 14px; color: var(--muted); }
.search-box:focus-within { border-color: var(--red); }
.search-box input { flex: 1; min-width: 0; border: 0; background: none; font: 600 15px var(--font); color: var(--ink); padding: 8px 0; outline: none; }
.title-line { display: flex; align-items: center; min-width: 0; }
.studio-group { display: grid; gap: 10px; margin-bottom: 26px; }
.studio-group h2 .count { color: var(--muted); font-weight: 600; font-size: .9rem; }
.studio-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
.studio-row .title .ext { color: var(--muted); font-weight: 600; }
.studio-row .title:hover .ext { color: var(--red); }
.studio-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; align-items: end; margin-top: 8px; }
.studio-edit .row-actions { align-self: end; }
.studio-edit .link-field, .studio-edit .cat-field { grid-column: 1 / -1; }
.studio-row.editing { grid-template-columns: 44px minmax(0, 1fr); background: var(--legend-tint); }
.studio-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--red-tint); color: var(--red-ink); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }

/* ---------- Top Chart toolbar ---------- */
.chart-toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 14px; margin-bottom: 18px; box-shadow: var(--shadow); }
.tb-row { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.tb-group { display: grid; gap: 7px; min-width: 0; }
.tb-label { font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tabs { display: inline-flex; background: var(--bg); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button { border: 0; background: none; color: var(--muted); font: 700 14px var(--font); padding: 9px 18px; border-radius: 11px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--surface); color: var(--red-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-select { font: 700 14px var(--font); color: var(--ink); background: var(--bg); border: 0; border-radius: 14px; padding: 12px 14px; min-width: 200px; max-width: 100%; cursor: pointer; }
.tb-select:focus { outline: 2px solid var(--red); }
.chips button { flex: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px var(--font); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.chips button:hover { border-color: var(--red); }
.chips button.on { background: var(--red); border-color: var(--red); color: var(--white); }

/* ---------- Top Chart: Free and Grossing side by side ---------- */
.chart-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }
.chart-col { display: grid; gap: 10px; min-width: 0; }
.chart-col h2 { display: flex; align-items: baseline; gap: 8px; }
.chart-col h2 .count { font-size: .85rem; color: var(--muted); font-weight: 600; }
.chart-col .row.chart-row { grid-template-columns: 40px 44px minmax(0, 1fr) auto; padding: 9px 12px; gap: 12px; }
.chart-col .chart-row .icon { width: 44px; height: 44px; border-radius: 11px; }
.chart-col .chart-row .row-side { display: none; }
.chart-col .pager { margin-top: 10px; }

/* ---------- Top Chart rows ---------- */
.row.chart-row { grid-template-columns: 48px 52px minmax(0, 1fr) auto auto; padding: 10px 16px; }
.chart-row .icon { width: 52px; height: 52px; border-radius: 13px; }
.est { display: flex; gap: 14px; flex-wrap: wrap; font: 600 12px var(--font-mono); color: var(--ink); }
.est { align-items: center; }
.est-period { font: 700 10px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--period-ink); background: var(--period-tint); padding: 4px 7px; border-radius: 999px; }
.est b { font: 700 11px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rank-col { display: grid; justify-items: center; gap: 2px; }
.rank-col .rank { font: 700 1.35rem/1 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; min-width: 0; }
.mv { font: 700 12px/1 var(--font); min-height: 12px; white-space: nowrap; }
.mv.up { color: #2f9e44; }
.mv.down { color: var(--red-ink); }
.mv.new { color: var(--red-ink); font-size: 10px; letter-spacing: .06em; }
.chart-row.followed { box-shadow: inset 4px 0 0 var(--legend); background: linear-gradient(90deg, var(--legend-tint), transparent 45%); }
.qr-mini { padding: 3px; border-radius: 9px; }
.qr-mini img { width: 40px; height: 40px; }

/* QR: always on a white tile so phones can scan it in dark mode too */
.qr { border: 1px solid var(--line); background: #fff; padding: 4px; border-radius: 12px; cursor: zoom-in; line-height: 0; }
.qr img { width: 56px; height: 56px; display: block; }
.qr:hover { border-color: var(--red); }
.qr-dialog { border: 0; padding: 0; border-radius: 24px; background: var(--surface); color: var(--ink); max-width: min(340px, calc(100vw - 32px)); }
.qr-dialog::backdrop { background: rgb(0 0 0 / .6); }
.qr-card { display: grid; gap: 14px; padding: 22px; justify-items: center; text-align: center; }
.qr-card img { width: 260px; height: 260px; max-width: 100%; background: #fff; padding: 10px; border-radius: 16px; }
.qr-text { display: grid; gap: 6px; justify-items: center; min-width: 0; }
.qr-text strong { font-size: 1.1rem; }
.qr-text .url { font: 12px var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }

/* ---------- controls ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 700 14px var(--font); padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--red); color: var(--white); border-color: var(--red); }
.btn.primary:hover { background: var(--red-press); border-color: var(--red-press); }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; align-content: start; box-shadow: var(--shadow); }
.add-studio { grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; margin-bottom: 16px; position: relative; }
.studio-extra { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.field input, .field select { font: 600 15px var(--font); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; width: 100%; }
.field input:focus, .field select:focus { border-color: var(--red); outline: none; }
.suggest { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.suggest li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.suggest li:last-child { border-bottom: 0; }
.form-msg { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 1em; }
.form-msg.err { color: var(--red); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.hook-form { display: grid; gap: 10px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hooks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hooks li { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.hooks .url { font: 12px var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.hooks .err { color: var(--red); font-size: 13px; font-weight: 600; }

/* ---------- feedback ---------- */
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: var(--white); font: 700 11px/18px var(--font); text-align: center; }
.tb-input { font: 600 15px var(--font); color: var(--ink); background: var(--bg); border: 1.5px solid transparent; border-radius: 12px; padding: 10px 12px; width: 100%; resize: vertical; }
.tb-input:focus { border-color: var(--red); outline: none; }
.fb-images { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-thumb { position: relative; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; background: var(--bg); }
.fb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fb-thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .6); color: #fff; cursor: pointer; font: 700 14px/1 var(--font); }
.fb-add { justify-self: start; cursor: pointer; }
.fb-filter { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 12px 24px; }
.fb-list-title { margin: 6px 0 12px; }
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fb-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.fb-head h3 { margin: 0; font-size: 1.05rem; }
.fb-meta { color: var(--muted); font-size: 13px; font-weight: 600; }
.fb-body { white-space: pre-wrap; margin: 0; }
.pill.bug { background: var(--red); color: var(--white); }
.pill.request { background: var(--legend); color: var(--white); }
.pill.st-new { background: var(--bg); color: var(--ink); }
.pill.st-reviewing { background: var(--warn-bg); color: var(--warn-ink); }
.pill.st-resolved { background: #2f9e44; color: #fff; }
.fb-shots { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-shots a { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; background: var(--bg); }
.fb-shots img { width: 100%; height: 100%; object-fit: cover; }
.fb-msgs { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.fb-msg { background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.fb-msg.admin { background: var(--red-tint); }
.fb-msg strong { font-size: 13px; }
.fb-reply { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.fb-reply.admin { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 640px) { .fb-reply { grid-template-columns: 1fr; } }

/* ---------- login / user menu ---------- */
.auth-screen { position: fixed; inset: 0; z-index: 100; background: var(--red); display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); overflow: auto; }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 24px; padding: 28px; display: grid; gap: 18px; box-shadow: 0 24px 60px rgb(0 0 0 / .25); }
.auth-card form { display: grid; gap: 14px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--logo-on-surface); } /* brand rule: never red logo on black */
.auth-brand .brand-name { border-left-color: var(--line); color: var(--ink); }
.user-wrap { position: relative; }
.user-btn { border: 0; background: rgb(255 255 255 / .14); color: var(--white); height: 38px; padding: 0 14px; border-radius: 999px; font: 700 14px var(--font); cursor: pointer; white-space: nowrap; }
.user-btn:hover { background: rgb(255 255 255 / .24); }
.user-panel { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgb(0 0 0 / .18); padding: 8px; display: grid; z-index: 30; }
.user-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-head span { font-size: 12px; color: var(--muted); }
.menu-item { border: 0; background: none; text-align: left; font: 600 14px var(--font); color: var(--ink); padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--red-ink); }
.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; align-items: end; }
.users-card { grid-column: 1 / -1; }
.badge-role { font: 700 11px var(--font); padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 50; width: min(340px, calc(100vw - 32px)); }
/* iOS-style banner notification: frosted glass, app row, title, studio, then category and store */
.toast { --tb: rgb(246 246 248 / .86); --tt: #111; --tm: #5b5b60; display: grid; gap: 4px; padding: 10px 12px 12px 14px; border-radius: 22px; background: var(--tb); color: var(--tt); text-decoration: none;
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 12px 34px rgb(0 0 0 / .2); border: 1px solid rgb(0 0 0 / .04); animation: toast-in .25s ease-out; cursor: pointer; }
a.toast:hover { transform: translateY(-1px); box-shadow: 0 16px 40px rgb(0 0 0 / .24); }
.toast-head { display: flex; align-items: center; gap: 7px; font: 700 11.5px var(--font); letter-spacing: .03em; color: var(--tm); }
.toast-app { width: 20px; height: 20px; border-radius: 6px; background: var(--red); display: grid; place-items: center; flex: none; }
.toast-app i { width: 12px; height: 12px; background: #fff; -webkit-mask: url("/brand/h-mask.svg") center / contain no-repeat; mask: url("/brand/h-mask.svg") center / contain no-repeat; }
.toast-when { margin-left: auto; font-weight: 600; letter-spacing: 0; }
.toast-x { border: 0; background: rgb(0 0 0 / .07); color: var(--tt); width: 24px; height: 24px; border-radius: 50%; font: 700 15px/1 var(--font); cursor: pointer; display: grid; place-items: center; padding: 0; }
.toast-x:hover { background: var(--red); color: #fff; }
.toast-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.toast-text { display: grid; gap: 1px; min-width: 0; }
.toast-title { font: 700 15px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-studio { font: 700 12.5px var(--font); color: var(--legend-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-dev, .toast-facts { font: 600 13.5px/1.3 var(--font); color: var(--tm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-dev { color: color-mix(in srgb, var(--tt) 78%, transparent); }
.toast-icon { width: 46px; height: 46px; border-radius: 11px; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { --tb: rgb(44 44 46 / .86); --tt: #fff; --tm: #a1a1a6; border-color: rgb(255 255 255 / .06); } :root:not([data-theme="light"]) .toast-x { background: rgb(255 255 255 / .12); } }
:root[data-theme="dark"] .toast { --tb: rgb(44 44 46 / .86); --tt: #fff; --tm: #a1a1a6; border-color: rgb(255 255 255 / .06); }
:root[data-theme="dark"] .toast-x { background: rgb(255 255 255 / .12); }
.toasts { width: min(400px, calc(100vw - 32px)); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1240px) {
  .scan { display: none; }
}
@media (max-width: 640px) {
  .cg-top .icon { width: 66px; height: 66px; border-radius: 16px; }
  .cg-top .qr { height: 66px; }
  .cg-top .qr-cap { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding-inline: 4px; }
  .tabs button { padding: 8px 12px; }
  .row.chart-row { grid-template-columns: 36px 44px minmax(0, 1fr) auto; }
  .row.chart-row .row-side { display: none; }
  .chart-row .icon { width: 44px; height: 44px; }
  .scan { display: none; }
  .logo { width: 88px; }
  .row { grid-template-columns: 44px minmax(0, 1fr); padding: 12px 14px; }
  .icon { width: 44px; height: 44px; border-radius: 11px; }
  .row-side { grid-column: 2; text-align: left; justify-items: start; grid-auto-flow: column; justify-content: start; gap: 10px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 10px; }
  .card-game { padding: 12px; }
  .qr img { width: 44px; height: 44px; }
  .add-studio { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot.on, .row.flash, .toast { animation: none; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding-block: 28px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 24px; }
.footer-brand { grid-row: span 2; color: var(--logo-on-surface); } /* brand rule: never red logo on black */
.footer-brand .logo { width: 96px; }
.footer-made { margin: 0; font-weight: 600; }
.footer-made strong { color: var(--logo-on-surface); }
.footer-meta { margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; text-align: center; justify-items: center; } .footer-brand { grid-row: auto; } }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > .page { flex: 1 0 auto; width: 100%; }

/* Card colour wash from the game's icon (sits behind the card content, not in the subgrid rows) */
.card-game { isolation: isolate; }
.cg-cover { position: absolute; inset: 0 0 auto 0; height: 160px; z-index: -1; background-size: cover; background-position: center; filter: blur(28px) saturate(1.4); transform: scale(1.5); opacity: .5; pointer-events: none; }
.cg-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--surface)); }
.card-game .cg-top .icon { box-shadow: 0 6px 16px rgb(0 0 0 / .22); }
.card-game .qr { box-shadow: 0 6px 16px rgb(0 0 0 / .12); }

/* Long studio names stay on one line and end in "…"; the full name shows on hover */
.cg-pub { min-width: 0; overflow: hidden; }
.cg-pub .publisher { display: block; }
.tip { position: fixed; z-index: 50; max-width: min(360px, calc(100vw - 16px)); padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--surface); font: 600 12px/1.35 var(--font); box-shadow: 0 6px 18px rgb(0 0 0 / .2); pointer-events: none; }

/* Top Chart rows: every row is exactly three single lines, so Free and Grossing stay level */
.chart-row .row-main { grid-template-rows: repeat(3, 22px); align-content: center; }
.chart-row .title-line .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chart-row .meta, .chart-row .est { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; min-width: 0; }
.chart-row .meta .publisher { flex: 0 1 auto; min-width: 0; }
.chart-row .meta > :not(.publisher) { flex: none; }
.chart-row .est > span { flex: none; }
.est.pending { color: var(--muted); font-family: var(--font); }
.rank-col .mv { min-height: 14px; }

/* Dropdowns: own chevron, set in from the edge (the native arrow sits flush against the border) */
select, .tb-select, .field select, .country-pick select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238a8a8a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 12px 8px;
  padding-right: 42px;
}
.country-pick select { background-position: right 12px center; padding-right: 34px; }

/* ---------- Soft Launches ---------- */
.sl-rows .row.chart-row { grid-template-columns: 48px 52px minmax(0, 1fr) auto auto; }
.sl-row .row-main { grid-template-rows: repeat(3, 22px); }
.sl-stats { display: grid; justify-items: end; gap: 2px; min-width: 150px; font-variant-numeric: tabular-nums; }
.sl-total { font: 700 1.05rem/1.2 var(--font-mono); }
.sl-total small { font: 600 12px var(--font); color: var(--muted); }
.sl-gain { font: 600 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
.sl-gain.up { color: #2f9e44; }
.sl-row .meta .avail { margin: 0; }
@media (max-width: 640px) {
  .sl-rows .row.chart-row { grid-template-columns: 36px 44px minmax(0, 1fr); }
  .sl-stats { grid-column: 2 / -1; justify-items: start; grid-auto-flow: column; gap: 10px; min-width: 0; }
  .sl-row .qr-mini { display: none; }
  .sl-row .row-main { grid-template-rows: none; }
  .sl-row .meta { flex-wrap: wrap; white-space: normal; }
}

/* ---------- members ---------- */
.check { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--font); color: var(--muted); }
.user-actions { flex-wrap: wrap; align-items: center; }
.user-role { padding: 7px 34px 7px 12px; min-width: 0; font-size: 13px; }
.badge-role.role-standard { background: var(--bg); color: var(--muted); }
.role-standard #studio-form, .role-standard .studio-actions { display: none !important; }
.badge-role.role-hyperlab { background: var(--red-tint); color: var(--red-ink); }
.user-pass { padding: 7px 12px; font-size: 13px; width: 180px; max-width: 100%; }
.sl-upd { font: 700 11px/1 var(--font); padding: 4px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.sl-upd.on { background: rgb(59 130 246 / .14); color: #2f6fd6; }
.sl-how { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; max-width: 95ch; }
.sl-how strong { color: var(--ink); }
.sl-note { padding: 12px 18px; font-size: 13px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border-bottom: 1px solid var(--line); }

/* Kategori starts folded; the picked one shows next to the title */
.genre-box > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.genre-box > summary::-webkit-details-marker { display: none; }
.genre-toggle { display: inline-flex; align-items: center; gap: 0; text-transform: none; letter-spacing: 0; color: var(--red-ink); }
.genre-toggle i { display: inline-block; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s; margin: 0 4px 0 6px; }
.genre-box[open] .genre-toggle i { transform: rotate(-135deg) translateY(-1px); }
.genre-box .gt-hide, .genre-box[open] .gt-show { display: none; }
.genre-box[open] .gt-hide { display: inline; }
.genre-box[open] > summary { margin-bottom: 8px; }
.genre-picked { color: var(--red-ink); text-transform: none; letter-spacing: 0; }

/* Invite text for a new member, ready to copy */
.pass-row { display: flex; gap: 8px; align-items: center; }
.pass-row input { flex: 1; min-width: 0; }
.invite { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); display: grid; gap: 8px; }
.invite-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite textarea { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }

/* Studio category picker: tick-box chips plus a field for a new one */
.cat-picker { display: grid; gap: 8px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; user-select: none; color: var(--ink); background: var(--surface); }
.cat-chip input { margin: 0; accent-color: var(--red); }
.cat-chip.on { border-color: var(--red); color: var(--red-ink); font-weight: 600; background: var(--red-tint); }
.cat-add { display: flex; gap: 8px; }
.cat-add input { flex: 1; min-width: 0; }
.studio-cat-field { grid-column: 1 / -1; }
