/* GameNova public site. Mobile first (360 px), then sm 640 · lg 1024 · xl 1280 · 2xl 1680 · 3xl 2400.
   Fluid on every screen: no max-width page box, the content always runs from gutter to gutter.
   Colours, type, spacing and layout steps come from tokens.css. No framework, no build step. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 var(--fs-16)/var(--lh) var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  /* The night sky: a violet glow, a little cyan, and a handful of stars at the top of every page. */
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, .7), transparent 60%),
    radial-gradient(1px 1px at 28% 62%, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(1.5px 1.5px at 47% 9%, rgba(255, 255, 255, .6), transparent 60%),
    radial-gradient(1px 1px at 66% 44%, rgba(255, 255, 255, .45), transparent 60%),
    radial-gradient(1.5px 1.5px at 83% 22%, rgba(255, 255, 255, .65), transparent 60%),
    radial-gradient(1px 1px at 93% 70%, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(ellipse 80% 60% at 15% -10%, rgba(109, 74, 255, .28), transparent 70%),
    radial-gradient(ellipse 60% 50% at 95% -5%, rgba(34, 211, 238, .10), transparent 70%);
  background-repeat: no-repeat;
  background-size: 100% 560px;
}
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: #67e8f9; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--fs-28); }
h2 { font-size: var(--fs-22); }
h3 { font-size: var(--fs-18); font-weight: 600; }
p { margin: 0 0 var(--sp-3); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(109, 74, 255, .55); color: #fff; }

@media (min-width: 1024px) {
  h1 { font-size: var(--fs-36); }
  h2 { font-size: var(--fs-22); }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-card);
  background: var(--primary); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus-visible { top: 8px; color: #fff; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-14); }
.fine-print { color: var(--text-muted); font-size: var(--fs-12); margin-top: var(--sp-5); }
.js .no-js-only { display: none; }

.container { width: 100%; padding: 0 var(--gutter); }
.site-main { flex: 1 0 auto; padding-bottom: calc(var(--sp-6) + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); outline: none; }

/* ---------- Icons, coin ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.coin-icon { width: 1.2em; height: 1.2em; stroke: none; }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex; align-items: center; min-height: var(--tap);
  font: 700 1.5rem/1 var(--font-head); color: var(--text); text-decoration: none; letter-spacing: -.02em; white-space: nowrap;
}
.logo:hover { color: var(--text); }
.logo-o { position: relative; display: inline-block; }
.logo-star { position: absolute; width: .46em; height: .46em; right: -.2em; top: -.06em; fill: var(--coin); }
.logo-sm { font-size: 1.25rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.header-inner { display: flex; align-items: center; gap: var(--sp-3); height: var(--header-h); position: relative; }
.header-nav { display: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none;
  border: 0; border-radius: var(--r-card); background: transparent; color: var(--text); padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 22px; height: 22px; }

.header-search { display: none; }
.header-search input {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: var(--r-chip);
  background: var(--surface-2); padding: 0 16px 0 40px; outline: none;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus { border-color: var(--accent); }
.header-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 18px; height: 18px; pointer-events: none; }
.header-search-close { display: none; }
.is-search-open .header-search {
  display: flex; align-items: center; position: absolute; inset: 0 var(--gutter); background: var(--surface); z-index: 2; gap: var(--sp-2);
}
.is-search-open .header-search > input { flex: 1; }
.is-search-open .header-search-icon { left: 14px; }
.is-search-open .header-search-close { display: inline-grid; }
.header-search { position: relative; }

.header-login { padding-inline: 16px; }
.page-auth .header-login { display: none; }

@media (min-width: 1024px) {
  .header-inner { gap: var(--sp-5); }
  .header-nav { display: flex; gap: var(--sp-1); }
  .header-nav a {
    display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 14px; border-radius: var(--r-card);
    color: var(--text-muted); font-weight: 600; text-decoration: none;
  }
  .header-nav a:hover { color: var(--text); background: var(--surface-2); }
  .header-nav a[aria-current] { color: var(--text); }
  .header-search { display: block; width: clamp(260px, 24vw, 420px); margin-left: auto; }
  .header-search-toggle { display: none; }
  .header-actions { margin-left: 0; }
}

/* Coin chip */
.coin-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 8px;
  border-radius: var(--r-chip); background: rgba(255, 200, 61, .12); border: 1px solid rgba(255, 200, 61, .35);
  color: var(--coin); font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none; position: relative;
}
.coin-chip:hover { color: var(--coin); background: rgba(255, 200, 61, .2); }
.coin-chip-sm { min-height: 32px; font-size: var(--fs-14); }
.coin-chip.is-bumped { animation: chip-bump .6s ease; }
@keyframes chip-bump { 30% { transform: scale(1.12); } 100% { transform: scale(1); } }
.coin-burst { position: absolute; left: 14px; top: 50%; width: 0; height: 0; pointer-events: none; }
.coin-burst i {
  position: absolute; width: 10px; height: 10px; margin: -5px; background: var(--coin);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: burst .7s ease-out forwards;
}
@keyframes burst { from { transform: translate(0, 0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(90deg); opacity: 0; } }

/* Avatar + frames */
.avatar { position: relative; display: inline-block; border-radius: 50%; flex: none; background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; }
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 56px; height: 56px; }
.avatar-lg { width: 72px; height: 72px; }
.frame-gold { box-shadow: 0 0 0 3px #f5c542, 0 0 0 5px rgba(245, 197, 66, .35); }
.frame-neon { box-shadow: 0 0 0 3px var(--accent), 0 0 12px 3px rgba(34, 211, 238, .6); }
.avatar-sm.frame-gold, .avatar-sm.frame-neon { box-shadow: 0 0 0 2px #f5c542; }
.avatar-sm.frame-neon { box-shadow: 0 0 0 2px var(--accent), 0 0 8px 1px rgba(34, 211, 238, .6); }

/* Avatar menu */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar-btn { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; cursor: pointer; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 240px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: var(--sp-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: grid; }
.menu-head span { color: var(--text-muted); font-size: var(--fs-12); overflow: hidden; text-overflow: ellipsis; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 0 10px;
  border: 0; border-radius: var(--r-input); background: none; color: var(--text); text-decoration: none; text-align: left; font-weight: 500;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); color: var(--text); }
.menu-panel .icon { color: var(--text-muted); width: 18px; height: 18px; }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

/* ---------- Bottom nav (phones) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); text-decoration: none; font-size: var(--fs-12); font-weight: 500;
}
.bottom-nav a .icon { width: 24px; height: 24px; }
.bottom-nav a.is-active { color: var(--primary); }
.bottom-nav a.is-active .icon { color: #8f74ff; }
.bottom-nav a.is-active span { color: var(--text); }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: var(--sp-6) 0 calc(var(--sp-6) + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); }
.footer-inner { display: grid; gap: var(--sp-4); }
.footer-brand p { color: var(--text-muted); font-size: var(--fs-14); margin: var(--sp-2) 0 0; max-width: 34ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-1); }
.footer-links a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px; margin-left: -10px; margin-right: 6px; color: var(--text); text-decoration: none; font-size: var(--fs-14); }
.footer-links a:hover { color: var(--accent); }
.footer-note { color: var(--text-muted); font-size: var(--fs-12); margin: 0; }
@media (min-width: 1024px) {
  .site-main { padding-bottom: var(--sp-7); }
  .footer-inner { grid-template-columns: 1fr auto; align-items: start; }
  .footer-note { grid-column: 1 / -1; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-card); border: 1.5px solid transparent;
  font-weight: 600; font-size: var(--fs-16); line-height: 1.2; text-decoration: none; text-align: center;
  white-space: nowrap; cursor: pointer; transition: background-color .15s, box-shadow .15s, border-color .15s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn .icon { width: 1.15em; height: 1.15em; }
.btn-sm { padding: 0 14px; font-size: var(--fs-14); }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: var(--fs-18); }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; box-shadow: var(--glow); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: #43398a; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-coin { background: var(--coin); color: var(--ink); }
.btn-coin:hover { background: #ffd566; color: var(--ink); }
.btn-coin .coin-icon { width: 1.1em; height: 1.1em; filter: brightness(.45) saturate(1.4); }
.btn-coin-soft .coin-icon { filter: none; }
.btn-coin-soft { background: rgba(255, 200, 61, .14); color: var(--coin); border-color: rgba(255, 200, 61, .45); }
.btn-coin-soft:hover { background: rgba(255, 200, 61, .24); color: var(--coin); }
.btn-ad { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ad:hover { background: rgba(34, 211, 238, .1); color: #67e8f9; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; left: 50%; top: 50%; margin: -10px 0 0 -10px;
  border: 2.5px solid currentColor; border-color: rgba(255, 255, 255, .9) rgba(255, 255, 255, .9) rgba(255, 255, 255, .25) rgba(255, 255, 255, .25);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn-coin.is-busy::after, .btn-ad.is-busy::after { border-color: var(--ink) var(--ink) rgba(0, 0, 0, .2) rgba(0, 0, 0, .2); }
.btn-ad.is-busy::after, .btn-secondary.is-busy::after, .btn-coin-soft.is-busy::after { border-color: var(--accent) var(--accent) rgba(34, 211, 238, .25) rgba(34, 211, 238, .25); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Chips, tags, segmented ---------- */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding: 4px var(--gutter); margin: var(--sp-4) calc(-1 * var(--gutter)); scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 16px; scroll-snap-align: start;
  border-radius: var(--r-chip); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: var(--fs-14); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.chip .icon { width: 18px; height: 18px; color: var(--text-muted); }
.chip:hover { color: var(--text); border-color: #43398a; background: var(--surface-2); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.is-active .icon { color: #fff; }
.chip-sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-12); }
.tag { display: inline-block; padding: 1px 8px; border-radius: var(--r-chip); font-size: var(--fs-12); font-weight: 600; vertical-align: middle; }
.tag-ok { background: rgba(34, 197, 94, .15); color: #4ade80; }
.tag-warn { background: rgba(245, 158, 11, .15); color: #fbbf24; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-chip); }
.segmented a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: var(--r-chip); color: var(--text-muted); font-size: var(--fs-14); font-weight: 600; text-decoration: none; }
.segmented a:hover { color: var(--text); }
.segmented a.is-active { background: var(--surface-2); color: var(--text); }

/* ---------- Page heads, sections ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-2); }
.section { margin-top: var(--sp-6); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.section-head h2 { font-size: var(--fs-22); }
.section-link { display: inline-flex; align-items: center; min-height: var(--tap); margin: -12px 0; font-size: var(--fs-14); font-weight: 600; text-decoration: none; }
.crumbs { margin-top: var(--sp-3); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--text-muted); text-decoration: none; font-size: var(--fs-14); font-weight: 500; }
.crumbs a:hover { color: var(--text); }
.crumbs .icon { width: 18px; height: 18px; }
.flashes { display: grid; gap: var(--sp-2); padding-top: var(--sp-4); }
.load-more { display: flex; justify-content: center; margin-top: var(--sp-5); }

/* ---------- Game cards ---------- */
.game-grid { display: grid; grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr)); gap: var(--grid-gap); }
.game-card { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--text); text-decoration: none; border-radius: var(--r-card); }
.game-card:hover { color: var(--text); }
.thumb { position: relative; display: block; aspect-ratio: 1; border-radius: var(--r-card); overflow: hidden; background: var(--surface-2); margin-bottom: 6px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 clamp(1.75rem, 9vw, 3rem)/1 var(--font-head); color: rgba(255, 255, 255, .92); letter-spacing: .02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}
.game-title { font-weight: 600; font-size: var(--fs-16); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-cat { color: var(--text-muted); font-size: var(--fs-12); }
.badge {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: var(--r-chip);
  font: 700 11px/18px var(--font-body); letter-spacing: .04em; color: var(--ink);
}
.badge-new { background: var(--accent); }
.badge-hot { background: var(--danger); color: #1c0309; }
.thumb-play {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s;
  background: rgba(14, 11, 36, .35);
}
.thumb-play .icon { width: 52px; height: 52px; padding: 14px; border-radius: 50%; background: var(--primary); color: #fff; box-shadow: var(--glow); }
@media (hover: hover) and (min-width: 1024px) {
  .game-card .thumb img, .game-card .thumb-fallback { transition: transform .2s ease; }
  .game-card:hover .thumb img, .game-card:hover .thumb-fallback { transform: scale(1.03); }
  .game-card:hover .thumb-play, .game-card:focus-visible .thumb-play { opacity: 1; }
}
/* Rows (Continue playing, Trending, category rows): swipe sideways on phones and tablets;
   on desktop one row of exactly --grid-cols cards (the rest is behind the section's See all). */
.game-row, .rank-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - var(--grid-gap)) / 2.4); gap: var(--grid-gap);
  overflow-x: auto; scrollbar-width: none; padding: 0 var(--gutter) 4px; margin: 0 calc(-1 * var(--gutter)); scroll-snap-type: x proximity;
  list-style: none;
}
.game-row::-webkit-scrollbar, .rank-row::-webkit-scrollbar { display: none; }
.game-row > *, .rank-row > * { scroll-snap-align: start; }
@media (min-width: 640px) { .game-row { grid-auto-columns: calc((100% - 3 * var(--grid-gap)) / 3.6); } }
@media (min-width: 1024px) {
  .game-row, .rank-row { grid-auto-flow: row; grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr)); overflow: visible; padding: 0; margin: 0; }
  .rank-row { grid-template-columns: repeat(var(--rank-cols), minmax(0, 1fr)); }
}

/* Only full rows on desktop. The server sends enough cards for the widest screen; each
   breakpoint shows as many as fit (.fit-1 = one row, .fit-2 = two rows; phones and tablets
   show 6 and 12, i.e. full rows of 2 and 3). The nth-child steps follow --grid-cols /
   --rank-cols in tokens.css: change them together. */
.fit-1 > :nth-child(n+7), .fit-2 > :nth-child(n+13) { display: none; }
@media (min-width: 1024px) {
  .game-row > :nth-child(n+5), .fit-1 > :nth-child(n+5), .fit-2 > :nth-child(n+9), .rank-row > :nth-child(n+5) { display: none; }
}
@media (min-width: 1280px) {
  .game-row > :nth-child(-n+6), .fit-1 > :nth-child(-n+6), .fit-2 > :nth-child(-n+12) { display: flex; }
  .rank-row > :nth-child(-n+5) { display: flex; }
}
@media (min-width: 1680px) {
  .game-row > :nth-child(-n+8), .fit-1 > :nth-child(-n+8), .fit-2 > :nth-child(-n+16) { display: flex; }
  .rank-row > :nth-child(-n+6) { display: flex; }
}
@media (min-width: 2400px) {
  .game-row > :nth-child(-n+12), .fit-1 > :nth-child(-n+12), .fit-2 > :nth-child(-n+24) { display: flex; }
  .rank-row > :nth-child(-n+8) { display: flex; }
}

/* Trending: a big outlined rank number with the card overlapping it (top 3 in coin gold).
   Sizes follow the cell width (container units), so it looks the same in every column count. */
.rank-row { margin-top: 0; margin-bottom: 0; grid-auto-columns: calc((100% - var(--grid-gap)) / 1.5); }
@media (min-width: 640px) { .rank-row { grid-auto-columns: calc((100% - 2 * var(--grid-gap)) / 2.6); } }
.rank-item { display: flex; align-items: flex-end; min-width: 0; container-type: inline-size; }
.rank-num {
  flex: none; width: 36%; margin-right: -4%; padding-bottom: 48px; text-align: right;
  font: 700 64cqi/.78 var(--font-head); letter-spacing: -.04em;
  color: var(--bg); -webkit-text-stroke: 4px #6355c4; paint-order: stroke fill; user-select: none;
}
.rank-item:nth-child(-n+3) .rank-num { -webkit-text-stroke-color: var(--coin); }
.rank-num.is-wide { font-size: 46cqi; letter-spacing: -.1em; }
.rank-item .game-card { position: relative; flex: 1; min-width: 0; }

/* Section heading with an icon (Trending, category rows) */
.section-head h2 { display: inline-flex; align-items: center; gap: 10px; }
.section-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); color: var(--accent); flex: none; }
.section-icon .icon { width: 18px; height: 18px; }
.section-icon.is-hot { background: rgba(244, 63, 94, .14); color: #fb7185; }

/* Gradient placeholders for games and items without artwork (hue-0 … hue-11). */
.hue-0 { background: linear-gradient(135deg, #7c3aed, #db2777); }
.hue-1 { background: linear-gradient(135deg, #2563eb, #06b6d4); }
.hue-2 { background: linear-gradient(135deg, #f97316, #e11d48); }
.hue-3 { background: linear-gradient(135deg, #059669, #22d3ee); }
.hue-4 { background: linear-gradient(135deg, #c026d3, #6d4aff); }
.hue-5 { background: linear-gradient(135deg, #eab308, #f97316); }
.hue-6 { background: linear-gradient(135deg, #0ea5e9, #6d4aff); }
.hue-7 { background: linear-gradient(135deg, #e11d48, #7c3aed); }
.hue-8 { background: linear-gradient(135deg, #16a34a, #84cc16); }
.hue-9 { background: linear-gradient(135deg, #4f46e5, #ec4899); }
.hue-10 { background: linear-gradient(135deg, #0891b2, #10b981); }
.hue-11 { background: linear-gradient(135deg, #f43f5e, #f59e0b); }

/* ---------- Home hero ---------- */
.page-home { padding-top: var(--sp-4); }
.hero { display: grid; gap: var(--grid-gap); }
.hero-main {
  position: relative; display: block; overflow: hidden; border-radius: var(--r-modal); color: #fff; text-decoration: none;
  background: var(--surface);
}
.hero-main:hover { color: #fff; }
.hero-media { position: relative; display: block; aspect-ratio: 16 / 10; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media .thumb-fallback { place-items: start end; padding: var(--sp-3) var(--sp-4); font-size: 3.25rem; opacity: .3; }
@media (min-width: 640px) { .hero-media .thumb-fallback { font-size: 5rem; padding: var(--sp-4) var(--sp-5); } }
.hero-body {
  position: absolute; inset: auto 0 0 0; display: grid; justify-items: start; gap: var(--sp-2);
  padding: 56px var(--sp-4) var(--sp-4);
  background: linear-gradient(180deg, transparent, rgba(14, 11, 36, .78) 45%, rgba(14, 11, 36, .95));
}
.hero-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--coin); font-weight: 600; font-size: var(--fs-14); }
.hero-tag .icon { fill: var(--coin); stroke: none; width: 16px; height: 16px; }
.hero-title { font: 700 var(--fs-28)/1.05 var(--font-head); letter-spacing: -.02em; }
.hero-desc { color: #d9d4ff; font-size: var(--fs-14); max-width: 46ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-play { margin-top: var(--sp-1); }
.hero-main:hover .hero-play { background: var(--primary-hover); box-shadow: var(--glow); }
.hero-side { display: none; }
@media (min-width: 640px) {
  .hero-media { aspect-ratio: 16 / 8; }
  .hero-title { font-size: var(--fs-36); }
  .hero-desc { font-size: var(--fs-16); }
}
@media (min-width: 1024px) {
  .page-home { padding-top: var(--sp-5); }
  .hero.has-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .hero-media { aspect-ratio: 16 / 7.6; }
  .hero-body { padding: 80px var(--sp-6) var(--sp-6); }
  .hero-title { font-size: 3rem; }
  .hero-side { display: grid; grid-template-rows: 1fr 1fr; gap: var(--grid-gap); }
  .hero-mini { position: relative; display: block; overflow: hidden; border-radius: var(--r-modal); color: #fff; text-decoration: none; background: var(--surface); }
  .hero-mini:hover { color: #fff; }
  .hero-mini-media { position: absolute; inset: 0; display: block; }
  .hero-mini-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
  .hero-mini:hover .hero-mini-media img { transform: scale(1.03); }
  .hero-mini-title {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 40px var(--sp-4) var(--sp-3);
    font: 700 var(--fs-22)/1.1 var(--font-head); background: linear-gradient(180deg, transparent, rgba(14, 11, 36, .9));
  }
}
@media (min-width: 1680px) {
  /* Wide screens: the hero grows in width, not in height (16:7.6 would be 600+ px tall). */
  .hero-media { aspect-ratio: auto; height: clamp(440px, 27vw, 640px); }
  .hero-title { font-size: 3.5rem; }
  .hero-desc { font-size: var(--fs-18); }
  .hero-mini-title { font-size: var(--fs-28); }
}

/* ---------- Banner, SEO text, empty ---------- */
.banner { margin: var(--sp-5) 0 0; padding: var(--sp-5) var(--sp-4); border-radius: var(--r-modal); background: linear-gradient(120deg, rgba(109, 74, 255, .35), rgba(34, 211, 238, .12)), var(--surface); border: 1px solid var(--border); }
.banner p { color: #d9d4ff; margin: var(--sp-2) 0 0; max-width: 60ch; }
.seo-text { margin-top: var(--sp-7); max-width: 72ch; color: var(--text-muted); font-size: var(--fs-14); }
.seo-text h2 { font-size: var(--fs-18); color: var(--text); margin-bottom: var(--sp-2); }

.empty-state { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-7) var(--sp-4); }
.empty-state p { color: var(--text-muted); max-width: 40ch; margin: 0; }
.empty-stars { width: 120px; height: 80px; }
.empty-stars .s1 { fill: var(--coin); }
.empty-stars .s2 { fill: var(--primary); }
.empty-stars .s3 { fill: var(--accent); }
.empty-inline { padding: var(--sp-5) 0; color: var(--text-muted); }

/* ---------- Ad slots (placeholders until Phase 10) ---------- */
.ad-slot {
  display: grid; place-items: center; margin: var(--sp-6) auto; border-radius: var(--r-input);
  background: repeating-linear-gradient(-45deg, #2a2550, #2a2550 10px, #262148 10px, #262148 20px);
  border: 1px dashed #4a4282; color: #a29dcb; font-size: var(--fs-12); font-weight: 600; letter-spacing: .06em;
}
.ad-banner { width: 100%; max-width: 320px; height: 100px; }
.ad-rect { width: 300px; max-width: 100%; height: 250px; }
@media (min-width: 1024px) { .ad-banner { max-width: 728px; height: 90px; } }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: var(--sp-4); }
.panel + .panel { margin-top: var(--sp-4); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.panel-title { font-size: var(--fs-18); font-weight: 700; margin-bottom: var(--sp-3); }
.panel-head .panel-title { margin-bottom: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }

/* ---------- Alerts and toasts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: var(--sp-2); padding: 12px 14px; border-radius: var(--r-card);
  border: 1px solid; font-size: var(--fs-14); line-height: 1.45;
}
.alert .icon { margin-top: 1px; }
.alert-success { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .5); }
.alert-error { background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .55); }
.alert-warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .55); }
.alert-info { background: rgba(34, 211, 238, .08); border-color: rgba(34, 211, 238, .45); }
.alert-warning .icon { color: var(--warning); }
.alert-action { align-items: center; flex-wrap: wrap; margin: var(--sp-4) 0; }
.alert-action > span { flex: 1 1 200px; }
.form > .alert, .auth-card > .alert { margin-bottom: var(--sp-4); }

.toasts {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--header-h) + 8px); transform: translateX(-50%);
  z-index: 120; display: grid; gap: var(--sp-2); width: min(420px, calc(100% - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-2); padding: 12px 16px; border-radius: var(--r-card);
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font-weight: 500; pointer-events: auto;
  animation: toast-in .2s ease-out;
}
.toast-success { border-left-color: var(--success); }
.toast-success .icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--accent); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Modal (bottom sheet on phones, centred dialog on desktop) ---------- */
.modal {
  width: 100%; max-width: 100%; margin: auto 0 0; padding: 0; border: 0;
  border-radius: var(--r-modal) var(--r-modal) 0 0; background: var(--surface); color: var(--text);
  max-height: 92vh; max-height: 92dvh; overflow: auto;
}
.modal::backdrop { background: var(--overlay); }
.modal[open] { animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .4; } }
.modal-inner { padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px)); position: relative; }
.modal-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: -12px auto 16px; }
.modal-close { position: absolute; right: 8px; top: 8px; }
.modal h2 { font-size: var(--fs-22); margin: 0 40px var(--sp-2) 0; }
.modal p { color: var(--text-muted); }
.modal-actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.modal-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; margin-bottom: var(--sp-3); background: var(--surface-2); }
.modal-icon .icon { width: 28px; height: 28px; }
.modal-icon.is-coin { background: rgba(255, 200, 61, .15); }
.modal-icon.is-coin .icon { width: 32px; height: 32px; }
.modal-sum { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-card); background: var(--surface-2); margin: var(--sp-3) 0 0; font-size: var(--fs-14); }
.modal-sum div { display: flex; justify-content: space-between; gap: var(--sp-3); }
.modal-sum strong { font-variant-numeric: tabular-nums; }
@media (min-width: 640px) {
  .modal { width: calc(100% - 32px); max-width: 420px; margin: auto; border-radius: var(--r-modal); }
  .modal[open] { animation: pop-in .18s ease-out; }
  .modal-grip { display: none; }
  .modal-inner { padding: var(--sp-5); }
  .modal-actions { grid-auto-flow: column; grid-auto-columns: 1fr; }
}
@keyframes pop-in { from { transform: scale(.96); opacity: 0; } }
body.has-modal { overflow: hidden; }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--sp-4); }
.field { display: grid; gap: 6px; }
.field label, .avatar-picker legend { font-size: var(--fs-14); font-weight: 600; }
.field input, .field textarea, .filter-row select {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--r-input);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); outline: none;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .filter-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: #958fc0; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: #fb7185; font-size: var(--fs-14); margin: 0; }
.field-help { color: var(--text-muted); font-size: var(--fs-12); margin: 0; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.password-toggle .icon { width: 20px; height: 20px; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-14); }
.form-row a { display: inline-flex; align-items: center; min-height: var(--tap); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.form-legal { color: var(--text-muted); font-size: var(--fs-12); margin: 0; }
.form-cols { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .form-cols { grid-template-columns: 1fr 1fr; } }
.turnstile { min-height: 65px; }
.divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-14); margin: var(--sp-4) 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-wrap { min-height: 44px; display: flex; justify-content: center; }

/* ---------- Auth ---------- */
.auth-shell { display: grid; place-items: start center; padding: var(--sp-5) var(--gutter) 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-modal); padding: var(--sp-5) var(--sp-4); }
.auth-card h1 { font-size: var(--fs-28); margin-bottom: var(--sp-2); }
.auth-sub { color: var(--text-muted); }
.auth-bonus { display: flex; align-items: center; gap: var(--sp-2); padding: 10px 12px; border-radius: var(--r-card); background: rgba(255, 200, 61, .1); color: #ffe199; font-size: var(--fs-14); }
.auth-bonus strong { color: var(--coin); }
.auth-switch { text-align: center; color: var(--text-muted); font-size: var(--fs-14); margin: var(--sp-5) 0 0; }
.auth-done { text-align: center; }
.auth-done p { color: var(--text-muted); }
.auth-done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(34, 211, 238, .12); color: var(--accent); margin-bottom: var(--sp-3); }
.auth-done-icon .icon { width: 30px; height: 30px; }
.auth-done-icon.is-ok { background: rgba(34, 197, 94, .14); color: var(--success); }
.auth-done-icon.is-bad { background: rgba(244, 63, 94, .14); color: var(--danger); }
@media (min-width: 640px) { .auth-shell { padding-top: var(--sp-7); } .auth-card { padding: var(--sp-6); } }

/* ---------- Search ---------- */
.search-field { position: relative; display: flex; gap: var(--sp-2); margin: var(--sp-5) 0 var(--sp-3); max-width: 720px; }
.search-field > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 14px 0 44px; border-radius: var(--r-card);
  border: 1px solid var(--border); background: var(--surface); outline: none; font-size: var(--fs-16);
}
.search-field input:focus { border-color: var(--accent); }
.search-field .btn { min-height: 48px; }
.result-count { color: var(--text-muted); font-size: var(--fs-14); }

/* ---------- Game page ---------- */
.page-play-inner { padding-top: var(--sp-4); }
.page-play-inner > .alert { margin-bottom: var(--sp-4); }
.play-layout { display: grid; gap: var(--sp-6); }
.stage { position: relative; border-radius: var(--r-modal); overflow: hidden; background: #05040f; margin: 0 calc(-1 * var(--gutter)); border-radius: 0; }
.stage-cover { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.stage-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage-cover > .thumb-fallback { display: none; }
.stage-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(14, 11, 36, .15), rgba(14, 11, 36, .55)); }
.stage-cover-body { position: relative; z-index: 1; display: grid; justify-items: center; gap: var(--sp-2); }
.play-btn {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: var(--primary); color: #fff; box-shadow: 0 0 0 8px rgba(109, 74, 255, .28), 0 12px 32px rgba(0, 0, 0, .4);
  transition: transform .15s, background-color .15s;
}
.play-btn:hover { background: var(--primary-hover); color: #fff; transform: scale(1.05); }
.play-btn .icon { width: 36px; height: 36px; margin-left: 4px; }
.stage-hint { font-weight: 600; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.hint-mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .hint-mouse { display: inline; } .hint-touch { display: none; } }
.stage-soon { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--r-chip); background: rgba(14, 11, 36, .8); font-weight: 600; }
.stage-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.stage.is-playing .stage-cover { display: none; }
.stage-bar { display: none; }
.stage-tools { display: none; }

/* Fullscreen game (phones, and the desktop Fullscreen button) */
.stage.is-full {
  position: fixed; inset: 0; z-index: 90; margin: 0; border-radius: 0; background: #000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.stage.is-full .stage-cover { display: none; }
.stage.is-full .stage-frame { width: 100%; height: 100%; }
.stage.is-full .stage-bar {
  display: flex; align-items: center; gap: var(--sp-2); position: absolute; z-index: 2;
  top: calc(env(safe-area-inset-top, 0px) + 8px); right: calc(env(safe-area-inset-right, 0px) + 8px);
}
.stage-close {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(14, 11, 36, .7); color: #fff; backdrop-filter: blur(4px);
}
.stage-close .icon { width: 20px; height: 20px; }
.stage.is-full .coin-chip { background: rgba(14, 11, 36, .75); }
body.game-open { overflow: hidden; }
body.game-open .bottom-nav { display: none; }

.game-info { display: grid; gap: var(--sp-4); margin-top: var(--sp-4); }
.game-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.game-head h1 { font-size: var(--fs-28); }
.game-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 0; }
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; flex: none;
  border-radius: var(--r-chip); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-14);
}
.fav-btn:hover { background: var(--surface-2); }
.fav-btn .fav-on { display: none; color: var(--danger); fill: var(--danger); stroke: var(--danger); }
.fav-btn.is-on .fav-on { display: block; }
.fav-btn.is-on .fav-off { display: none; }
.lede { font-size: var(--fs-18); color: #dcd8f5; margin: 0; }
.nudge { display: flex; gap: var(--sp-2); align-items: center; padding: 12px 14px; border-radius: var(--r-card); background: rgba(255, 200, 61, .08); border: 1px solid rgba(255, 200, 61, .25); font-size: var(--fs-14); margin: 0; }
.nudge a { color: var(--coin); font-weight: 600; }
.play-side .section-head h2 { font-size: var(--fs-22); }
.ad-below-game { margin-top: var(--sp-5); }
.ad-side { display: none; }

@media (min-width: 1024px) {
  .page-play-inner { padding-top: var(--sp-5); }
  .play-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .stage { margin: 0; border-radius: var(--r-modal); height: min(80vh, 760px); display: grid; grid-template: 100% / 100%; place-items: center; }
  .stage-cover { position: absolute; inset: 0; aspect-ratio: auto; }
  .stage .stage-frame { position: relative; height: 100%; width: 100%; }
  .stage-portrait .stage-frame { width: auto; aspect-ratio: 9 / 16; max-width: 100%; }
  .stage-tools { display: flex; justify-content: flex-end; margin-top: var(--sp-2); }
  .stage.is-full { height: auto; }
  .stage.is-full.stage-portrait .stage-frame { height: 100%; }
  .play-side { position: sticky; top: calc(var(--header-h) + 16px); }
  .play-side .game-grid { --grid-cols: 2; }
  .ad-side { display: grid; margin-top: var(--sp-5); }
  .ad-below-game { display: none; }
}
@media (min-width: 1280px) {
  /* How to play, Controls and About side by side under the frame instead of very long lines. */
  .game-info { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: var(--sp-6); align-items: start; }
  .game-info > :not(.prose) { grid-column: 1 / -1; }
  .lede { max-width: 80ch; }
}
@media (min-width: 1680px) {
  .play-layout { grid-template-columns: minmax(0, 1fr) 380px; gap: var(--sp-7); }
  .stage { height: min(80vh, 900px); }
}
@media (min-width: 2400px) {
  .play-layout { grid-template-columns: minmax(0, 1fr) 460px; }
  .stage { height: min(80vh, 1080px); }
}

/* ---------- Prose (pages, game texts) ---------- */
.reading { max-width: 760px; padding-top: var(--sp-5); }
.reading > h1 { margin-bottom: var(--sp-3); }

/* Static pages (About, Privacy, Terms, FAQ, Contact): the text keeps a readable width and
   starts at the left gutter like every other page; popular games fill the rest of the row on
   desktop and sit under the text on phones and tablets (full rows only at every step). */
.static-layout { display: grid; gap: var(--sp-6); }
.static-side .game-grid > :nth-child(n+7) { display: none; }
@media (min-width: 1024px) { .static-side .game-grid > :nth-child(n+5) { display: none; } }
@media (min-width: 1280px) {
  .static-layout { grid-template-columns: minmax(0, 760px) minmax(0, 1fr); column-gap: var(--sp-7); align-items: start; }
  .static-side { padding-top: var(--sp-5); }
  .static-side .game-grid { --grid-cols: 2; }
  .static-side .game-grid > :nth-child(-n+6) { display: flex; }
}
@media (min-width: 1680px) {
  .static-side .game-grid { --grid-cols: 4; }
  .static-side .game-grid > :nth-child(-n+8) { display: flex; }
}
@media (min-width: 2400px) {
  .static-side .game-grid { --grid-cols: 6; }
  .static-side .game-grid > :nth-child(-n+12) { display: flex; }
}
.prose { color: #dcd8f5; }
.prose h2 { font-size: var(--fs-22); margin: var(--sp-5) 0 var(--sp-2); color: var(--text); }
.prose section > h2:first-child, .prose > h2:first-child { margin-top: 0; }
.game-info .prose h2 { margin: 0 0 var(--sp-2); }
.prose h3 { margin: var(--sp-4) 0 var(--sp-2); }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 var(--sp-3); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 4px; }
.prose li::marker { color: var(--text-muted); }
.prose blockquote { border-left: 3px solid var(--primary); padding-left: var(--sp-3); color: var(--text-muted); }
.prose code, .prose pre { background: var(--surface-2); border-radius: 6px; font-size: .9em; }
.prose code { padding: 1px 5px; }
.prose pre { padding: var(--sp-3); overflow: auto; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
.prose strong { color: var(--text); }

/* FAQ */
.faq { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; padding: 12px 16px;
  font-weight: 600; cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: ""; width: 10px; height: 10px; flex: none; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
.faq-item[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq-item .prose { padding: 0 16px 14px; }
.faq-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-5); padding: var(--sp-4); border-radius: var(--r-card); border: 1px dashed var(--border); }
.faq-cta p { margin: 0; }

/* ---------- Store ---------- */
.store-balance { margin: 0; color: var(--text-muted); font-size: var(--fs-14); }
.coin-inline { display: inline-flex; align-items: center; gap: 4px; color: var(--coin); vertical-align: -3px; }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin: var(--sp-3) 0 var(--sp-4); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; flex: none;
  color: var(--text-muted); font-weight: 600; text-decoration: none; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tab-count { font-size: var(--fs-12); color: var(--text-muted); background: var(--surface-2); border-radius: var(--r-chip); padding: 0 7px; }
.filter-row { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); font-size: var(--fs-14); font-weight: 600; }
.filter-row select { width: auto; min-width: 180px; appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.offer-grid { display: grid; gap: var(--grid-gap); }
.offer-card {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-areas: "art body" "actions actions"; gap: var(--sp-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: var(--sp-4);
}
.offer-art { grid-area: art; display: grid; place-items: center; width: 72px; height: 72px; border-radius: var(--r-card); color: #fff; overflow: hidden; }
.offer-art img { width: 100%; height: 100%; object-fit: cover; }
.offer-art .icon { width: 34px; height: 34px; stroke-width: 1.8; }
.offer-body { grid-area: body; min-width: 0; }
.offer-body h3 { font-size: var(--fs-18); }
.offer-game { color: var(--text-muted); font-size: var(--fs-12); margin: 2px 0 6px; }
.offer-desc { font-size: var(--fs-14); color: #cfcaf0; margin: 0; }
.offer-owned { font-size: var(--fs-12); color: var(--success); margin: 6px 0 0; }
.offer-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.offer-actions .btn { flex: 1 1 auto; }
.owned-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 600; font-size: var(--fs-14); margin-right: auto; }
@media (min-width: 640px) {
  .offer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .offer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .offer-card { grid-template-columns: 1fr; grid-template-areas: "art" "body" "actions"; align-content: start; }
  .offer-card .offer-actions { align-self: end; flex-direction: column; align-items: stretch; }
  .offer-art { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .offer-art .icon { width: 48px; height: 48px; }
}
@media (min-width: 1280px) { .offer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1680px) { .offer-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 2400px) { .offer-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

/* ---------- Account ---------- */
.account-head { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-5) 0 var(--sp-4); }
.account-head h1 { font-size: var(--fs-28); }
.account-links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-3); }
.account-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text-muted); font-size: var(--fs-14); font-weight: 600; text-decoration: none; }
.account-links a:hover { color: var(--text); }
.account-grid { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.account-col { display: grid; gap: var(--sp-4); align-content: start; }
.account-col > .panel + .panel { margin-top: 0; }
@media (min-width: 1024px) { .account-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1680px) {
  /* Balance · Earn · Streak · Boosters in one row: the two column wrappers step aside. */
  .account-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .account-col { display: contents; }
}

.balance { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-1); }
.balance .coin-icon { width: 34px; height: 34px; }
.balance strong { font: 700 2.5rem/1 var(--font-head); color: var(--coin); font-variant-numeric: tabular-nums; }
.balance span { color: var(--text-muted); font-weight: 600; align-self: flex-end; padding-bottom: 6px; }
.balance-sm .coin-icon { width: 24px; height: 24px; }
.balance-sm strong { font-size: var(--fs-28); }
.balance-sm span { padding-bottom: 3px; }

.earn-card { border-color: rgba(34, 211, 238, .35); }
.earn-count { color: var(--accent); font-weight: 600; font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.meter { width: 100%; height: 6px; border: 0; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: var(--sp-3); appearance: none; -webkit-appearance: none; }
.meter::-webkit-progress-bar { background: var(--surface-2); border-radius: 6px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 6px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 6px; }
.earn-note { margin: var(--sp-3) 0 0; font-size: var(--fs-14); font-weight: 600; color: var(--warning); font-variant-numeric: tabular-nums; }
.earn-card[data-state="off"] .earn-note { color: var(--text-muted); }

.streak { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.streak li { display: grid; justify-items: center; gap: 4px; }
.streak-dot {
  display: grid; place-items: center; width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-12); font-weight: 700; border: 2px solid transparent;
}
.streak-dot .icon { width: 18px; height: 18px; stroke-width: 3; }
.streak-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.streak-done .streak-dot { background: rgba(255, 200, 61, .16); color: var(--coin); }
.streak-today .streak-dot { border-color: var(--coin); color: var(--coin); background: rgba(255, 200, 61, .08); box-shadow: 0 0 0 3px rgba(255, 200, 61, .15); }
.streak-today .streak-label { color: var(--text); font-weight: 600; }
.streak-future .streak-dot { opacity: .65; }
.streak li:last-child .streak-dot { position: relative; }
.streak-note { color: var(--warning); font-size: var(--fs-14); font-weight: 600; }

.booster-chips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.booster-chips li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-card); background: var(--surface-2); min-width: 0; }
.booster-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; flex: none; }
.booster-icon .icon { width: 20px; height: 20px; }
.booster-name { flex: 1; min-width: 0; font-size: var(--fs-14); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booster-qty { font-weight: 700; color: var(--coin); font-variant-numeric: tabular-nums; }

/* Ledger */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: 12px 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.ledger-icon .icon { width: 20px; height: 20px; }
.ledger-main { display: grid; min-width: 0; }
.ledger-label { font-weight: 600; }
.ledger-note { font-size: var(--fs-12); color: var(--text-muted); }
.ledger-date { font-size: var(--fs-12); color: var(--text-muted); }
.ledger-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger-amount.is-plus { color: var(--success); }
.ledger-amount.is-minus { color: #fb7185; }
.ledger-balance { display: none; }
.ledger-head { display: none; }
.ledger-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 0 var(--sp-4); margin-top: var(--sp-3); }
@media (min-width: 1024px) {
  .ledger-wrap .ledger-row, .ledger-head { grid-template-columns: 40px minmax(0, 1fr) 110px 110px; }
  .ledger-wrap .ledger-balance { display: block; text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .ledger-wrap .ledger-amount { text-align: right; }
  .ledger-head { display: grid; gap: var(--sp-3); padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-12); font-weight: 600; }
  .ledger-head span:nth-child(n+3) { text-align: right; }
}

/* Wallet: balance card on the left (sticky on desktop), coin history on the right */
.wallet-layout { display: grid; gap: var(--sp-4); align-items: start; }
.wallet-side .balance { margin-bottom: var(--sp-2); }
.wallet-side .fine-print { margin-top: var(--sp-3); }
.wallet-main .ledger-wrap { margin-top: 0; }
@media (min-width: 1024px) {
  .wallet-layout { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: var(--sp-5); }
  .wallet-side { position: sticky; top: calc(var(--header-h) + 16px); }
}
@media (min-width: 1680px) {
  .wallet-layout { grid-template-columns: 380px minmax(0, 1fr); }
  .ledger-wrap .ledger-row, .ledger-head { grid-template-columns: 40px minmax(0, 1fr) 140px 140px; }
}

/* Settings: Profile | Password + Account on desktop, three columns on wide screens */
.settings-grid { display: grid; gap: var(--sp-4); align-items: start; }
.settings-grid .panel + .panel { margin-top: 0; }
.settings-col { display: grid; gap: var(--sp-4); align-content: start; }
@media (min-width: 1024px) { .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 1680px) {
  .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-col { display: contents; }
}

/* Inventory */
.item-grid { display: grid; gap: var(--grid-gap); }
.item-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.item-card.is-equipped { border-color: rgba(109, 74, 255, .7); }
.item-card h2 { font-size: var(--fs-16); font-family: var(--font-body); font-weight: 600; }
.item-card .muted { margin: 2px 0 0; }
.item-art { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-card); color: #fff; overflow: hidden; }
.item-art .icon { width: 28px; height: 28px; }
.item-art img { width: 100%; height: 100%; object-fit: cover; }
.item-art .avatar { width: 40px; height: 40px; }
.item-qty { font: 700 var(--fs-22)/1 var(--font-head); color: var(--coin); padding-right: 4px; }
@media (min-width: 640px) { .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1680px) { .item-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 2400px) { .item-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* Settings */
.avatar-picker { border: 0; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.avatar-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); justify-items: center; }
.avatar-option { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.avatar-option .avatar { transition: transform .12s; }
.avatar-option input:checked + .avatar { outline: 3px solid var(--primary); outline-offset: 3px; }
.avatar-option input:focus-visible + .avatar { outline: 3px solid var(--accent); outline-offset: 3px; }
.avatar-option:hover .avatar { transform: scale(1.05); }
@media (min-width: 640px) { .avatar-options { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.details { margin: 0 0 var(--sp-4); display: grid; gap: var(--sp-2); }
.details div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--sp-2); font-size: var(--fs-14); }
.details dt { color: var(--text-muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Errors ---------- */
.error-box { text-align: center; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--sp-2); padding: var(--sp-6) 0 var(--sp-2); max-width: 520px; margin: 0 auto; }
.error-box p { color: var(--text-muted); }
.error-code { font: 700 var(--fs-14)/1 var(--font-body); color: var(--accent); letter-spacing: .08em; margin: 0; }
.error-box .search-field { width: 100%; }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-card); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.game-card.is-skeleton .thumb { background: var(--surface-2); }
.game-card.is-skeleton .game-title { height: 14px; width: 70%; border-radius: 4px; background: var(--surface-2); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .coin-burst { display: none; }
  .skeleton::after { display: none; }
  .game-card:hover .thumb img, .game-card:hover .thumb-fallback, .hero-mini:hover .hero-mini-media img, .play-btn:hover { transform: none; }
}
