/*
 * lobby.css — the /lobby app shell, and only that page.
 *
 * This is the BC.Game-shaped surface: a sidebar rail, a top bar, a live hero
 * and a wall of game art, laid out from the two committed boards in
 * design/kismat-redesign/ (Desktop.dc.html ≥960px, Main.dc.html <720px).
 * It deliberately does NOT import site.css — this page is an app shell, not a
 * marketing document, and the two layouts share nothing but the tokens.
 *
 * Every colour, size, radius and duration is a token from tokens.css
 * (CLAUDE.md rule 6, which holds on the web side too). The literal breakpoints
 * 720px and 960px are --break-lap and --break-rail, documented in tokens.css —
 * a media query cannot read a custom property.
 *
 * Mobile-first: the base rules are the phone layout with the bottom nav;
 * ≥720px drops the bottom nav; ≥960px brings in the 220px rail.
 */

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Screen-reader-only: the page's h1 — the hero is visual-first and carries
 * no headline a sighted visitor needs. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { display: block; max-width: 100%; }

/* The hidden attribute always wins — several components set display:flex on
 * elements the page also toggles with [hidden] (kind sections, nav entries
 * for kinds the live catalogue doesn't publish, the multiplier readout). */
[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  z-index: 30;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-overlay);
  border-radius: var(--radius-md);
  transform: translateY(-300%);
}
.skip:focus { transform: none; }

/* ------------------------------------------------------------------ shell */
.app { display: flex; min-height: 100vh; }

.rail { display: none; }

.shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: var(--space-4);
  /* room for the fixed bottom nav on phones */
  padding-bottom: calc(var(--bnav-h) + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ------------------------------------------------------------------ brand */
.rail__brand,
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
}
.rail__brand:hover,
.topbar__brand:hover { color: var(--text-primary); }

.rail__wordmark {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-title);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
}

/* The diya mark — the lantern flame from the identity boards. Drawn inline in
 * the markup; coloured here so the SVG carries no raw value. */
.brand__diya {
  width: var(--diya-w);
  height: var(--diya-h);
  flex: none;
}
.brand__diya path {
  stroke: var(--gold);
  stroke-width: var(--icon-stroke);
  fill: var(--accent-subtle);
}
.brand__diya circle { fill: var(--gold); }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'brand auth'
    'search search';
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-scrim);
  backdrop-filter: blur(var(--blur-header));
  -webkit-backdrop-filter: blur(var(--blur-header));
  border-bottom: var(--border-hairline) solid var(--border-subtle);
}

/* The dotted bazaar divider: dashes of lantern light with alternating gold
 * and rani beads, riding just under the top bar. */
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--divider-h);
  background-image: var(--bazaar-divider);
  background-size: var(--divider-sizes);
  background-position: var(--divider-pos);
  background-repeat: repeat-x;
  pointer-events: none;
}

.topbar__brand { grid-area: brand; }
.topbar__auth {
  grid-area: auth;
  display: flex;
  gap: var(--space-2);
}

.search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-raised);
  border: var(--border-hairline) solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  color: var(--text-muted);
  height: var(--tap-min);
}
.search:focus-within {
  border-color: var(--focus-ring);
  color: var(--text-secondary);
}
.search svg { width: var(--icon-md); height: var(--icon-md); flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  font-size: var(--text-label);
}
.search input::placeholder { color: var(--text-muted); }

/* ------------------------------------------------------------------ topnav
 * The desktop category strip. Hidden until the rail breakpoint — on smaller
 * screens its jobs belong to the rail filters and the bottom nav. */
.topnav { display: none; }

.topnav__item {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-label);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.topnav__item:hover { background: var(--surface-wash); color: var(--text-primary); }
.topnav__item.is-active { color: var(--accent); }
.topnav__item--gold { color: var(--gold); }
.topnav__item--gold:hover { color: var(--gold); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-label);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.btn--accent {
  background: var(--cta-grad);
  color: var(--text-on-accent);
  box-shadow: var(--glow-accent);
}
.btn--accent:hover { background: var(--cta-grad-hover); color: var(--text-on-accent); }
.btn--accent:active { background: var(--accent-pressed); }

/* The celebration button — rani red, per the boards' shagun card. */
.btn--gold {
  background: var(--rani-grad);
  color: var(--text-on-rani);
}
.btn--gold:hover { color: var(--text-on-rani); opacity: var(--opacity-pressed); }

.btn--ghost {
  background: var(--surface-raised);
  border: var(--border-hairline) solid var(--border-default);
  color: var(--text-primary);
}
.btn--ghost:hover { background: var(--surface-overlay); color: var(--text-primary); }

.btn--lg {
  min-height: var(--tap-cta);
  padding: 0 var(--space-5);
  font-size: var(--text-body);
}

/* Once the cut CTA (a skewed parallelogram); the Ratri identity retired the
 * diagonal, so this is now a plain rounded CTA — the class survives so the
 * markup did not have to change. --skew-brand is 0deg. */
.btn--slash {
  transform: skewX(var(--skew-brand));
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 700;
}
.btn--slash .btn__t {
  display: inline-block;
  transform: skewX(calc(var(--skew-brand) * -1));
}

/* ------------------------------------------------------------------ hero row
 * The compact banner row: crash card + promo carousel. Stacked on phones,
 * side by side from --break-rail so the tiles stay above the fold. */
.hero-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: var(--hero-min-h);
  background-color: var(--felt);
  background-image: var(--wash-promo-accent), var(--wash-felt);
  border: var(--border-hairline) solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card), var(--glow-accent), var(--inset-top);
  overflow: hidden;
}

/* The marquee-bulb strip along the top edge of the banner card. */
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--bulb-h);
  background-image: var(--bulb-strip);
  background-size: var(--bulb-tile) var(--bulb-h);
  background-repeat: repeat-x;
  pointer-events: none;
  z-index: 1;
}

/* Full-bleed key art behind the live readouts: the Aviator moment, painted
 * wide (web/art/hero/crash-hero.svg), darkened by --scrim-hero exactly where
 * the copy and the multiplier live. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--scrim-hero), url('/art/png/crash-hero.png');
  background-repeat: no-repeat;
  background-position: center, center;
  background-size: cover, cover;
  pointer-events: none;
}
.hero > * { position: relative; }

.hero__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.hero__live {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  color: var(--live);
}

.hero__dot {
  position: relative;
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--live);
  box-shadow: var(--glow-dot-live);
  animation: pulse var(--dur-live) infinite;
}
/* The expanding sonar ring behind the LIVE dot — alive without inventing
 * anything: it only pulses while the socket really is connected. */
.hero__dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--live);
  animation: ring var(--dur-live) var(--ease-out) infinite;
}
.hero__dot.is-dead { background: var(--text-muted); box-shadow: none; animation: none; }
.hero__dot.is-dead::after { animation: none; opacity: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(3.2); opacity: 0; }
}

/* The readout is one thing at a time: the multiplier while a round flies or
 * has just crashed, otherwise the phase line ("Betting open · locks in Xs")
 * promoted to display scale — never a grey 1.00 waiting for something. */
.hero__readout {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.hero__state {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label);
  font-weight: 600;
  font-variant-numeric: var(--numeric);
}
/* the phase line carries the card while the multiplier is hidden */
.hero__state.is-lead {
  font-family: var(--font-display);
  font-weight: var(--weight-display-sub);
  font-size: var(--text-wait);
  letter-spacing: var(--tracking-display);
  color: var(--text-primary);
}

.hero__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.hero__mult {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-mult-compact);
  letter-spacing: var(--tracking-mega);
  line-height: var(--leading-tight);
  font-variant-numeric: var(--numeric);
  color: var(--mult-mid);
  text-shadow: var(--glow-ink-accent);
  transition: color var(--dur-fast) var(--ease-out);
}
.hero__mult[hidden] { display: none; }
.hero__mult .hero__x { font-size: var(--text-subhead); color: var(--text-secondary); }

/* phase colouring, set by lobby.js */
.hero__mult.is-idle { color: var(--mult-low); text-shadow: none; }
.hero__mult.is-crashed { color: var(--loss); text-shadow: none; }
.hero__mult.is-hot { color: var(--mult-high); text-shadow: var(--glow-ink-gold); }

/* the climb: the glow breathes while the curve is actually running */
.hero__mult.is-flying { animation: climbglow var(--dur-shimmer) var(--ease-in-out) infinite; }
.hero__mult.is-flying.is-hot { animation: winglow var(--dur-shimmer) var(--ease-in-out) infinite; }

@keyframes climbglow {
  0%, 100% { text-shadow: var(--glow-ink-accent); }
  50% { text-shadow: var(--glow-ink-accent), var(--glow-ink-accent); }
}

/* gold breathing wherever a money figure glows */
@keyframes winglow {
  0%, 100% { text-shadow: var(--glow-ink-gold); }
  50% { text-shadow: var(--glow-ink-gold), var(--glow-ink-gold); }
}

.hero__round {
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  font-variant-numeric: var(--numeric);
}

/* -------------------------------------------------------- crash history
 * The last few crash points this session actually watched land on the
 * socket. Until one lands the strip renders nothing at all — lobby.js never
 * fills a chip with a number that did not happen, and there is no em-dash
 * placeholder pretending to be one. */
.hero__history {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.hero__history:empty { display: none; }

.hchip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(var(--chip-h) * 1.7);
  height: var(--chip-h);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 700;
  font-variant-numeric: var(--numeric);
  background: var(--surface-sunken);
  border: var(--border-hairline) dashed var(--border-default);
  color: var(--text-muted);
}
.hchip--low { color: var(--loss); background: var(--loss-subtle); border-color: var(--loss-subtle); }
.hchip--mid { color: var(--accent); background: var(--accent-subtle); border-color: var(--accent-border); }
.hchip--high {
  color: var(--gold);
  background: var(--pending-subtle);
  border-color: var(--pending-subtle);
  animation: winglow var(--dur-shimmer) var(--ease-in-out) infinite;
}
.hchip--new { animation: chipin var(--dur-normal) var(--ease-spring); }
.hchip--new.hchip--high { animation: chipin var(--dur-normal) var(--ease-spring), winglow var(--dur-shimmer) var(--ease-in-out) infinite; }

@keyframes chipin {
  from { transform: scale(var(--press-scale)); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------- carousel
 * Three promo slides stacked in one grid cell and crossfaded; lobby.js
 * drives the auto-advance and the dots. Rich grounds are radial light pools
 * from the token register plus art layers — never a flat two-hue gradient. */
.carousel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.carousel__track { display: grid; flex: 1; }

.promo-slide {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 100%;
  min-height: var(--promo-h);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--panel);
  border: var(--border-hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-card), var(--inset-top);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-xfade) var(--ease-out),
    visibility var(--dur-none) var(--ease-out) var(--dur-xfade);
}
.promo-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-xfade) var(--ease-out);
}

/* Every promo card wears the marquee bulbs along its top edge. */
.promo-slide::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--bulb-h);
  background-image: var(--bulb-strip);
  background-size: var(--bulb-tile) var(--bulb-h);
  background-repeat: repeat-x;
  pointer-events: none;
}

.promo-slide--pack {
  background-image: var(--scrim-promo), url('/art/png/hero-pack.png');
  background-repeat: no-repeat;
  background-position: center, center;
  background-size: cover, cover;
  border-color: var(--pending-subtle);
}
.promo-slide--games {
  background-image: var(--wash-promo-accent), var(--slash-band-accent), var(--wash-promo-floor);
  border-color: var(--accent-border);
}
.promo-slide--india {
  background-image: var(--wash-promo-gold), var(--slash-band-accent), var(--wash-promo-accent);
  border-color: var(--pending-subtle);
}

.promo-slide__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.promo-slide__kicker {
  margin: 0;
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
}
.promo-slide--pack .promo-slide__kicker,
.promo-slide--india .promo-slide__kicker { background: var(--gold); color: var(--text-inverse); box-shadow: var(--glow-gold); }
.promo-slide--games .promo-slide__kicker { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--glow-accent); }

.promo-slide__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-promo);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
}

.promo-slide__line {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label);
  font-weight: 600;
  max-width: var(--measure-tight);
}

.promo-slide__copy .btn { margin-top: var(--space-2); }

/* The fanned art collage. On a phone it recedes behind the copy; from
 * --break-lap it stands beside it at full strength. */
.promo-slide__fan {
  position: absolute;
  right: calc(var(--space-6) * -1);
  top: 50%;
  transform: translateY(-50%);
  width: 62%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
}

.promo-slide__fan img {
  position: absolute;
  width: 58%;
  aspect-ratio: var(--art-ratio);
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: var(--border-hairline) solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.promo-slide__fan img:nth-child(1) { left: 0; top: 14%; transform: rotate(-9deg); z-index: 1; }
.promo-slide__fan img:nth-child(2) { left: 18%; top: 4%; transform: rotate(-2deg); z-index: 2; }
.promo-slide__fan img:nth-child(3) { left: 36%; top: 12%; transform: rotate(5deg); z-index: 3; }
.promo-slide__fan img:nth-child(4) { left: 52%; top: 22%; transform: rotate(11deg); z-index: 4; }

/* Dots ride on the card instead of spending a row of the fold. */
.carousel__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-3);
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.carousel__dot {
  width: var(--promo-dot);
  height: var(--promo-dot);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), width var(--dur-fast) var(--ease-out);
}
.carousel__dot:hover { background: var(--text-muted); }
.carousel__dot.is-active {
  width: calc(var(--promo-dot) * 3);
  background: var(--accent);
  box-shadow: var(--glow-dot);
}

/* ------------------------------------------------------------------ blocks */
.block { display: flex; flex-direction: column; gap: var(--space-3); }

.block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* The bulb run: a strip of marquee dots fills the space between the section
 * title and whatever sits at the row's end — the bazaar's string of lights. */
.block__head::after {
  content: '';
  order: 1;
  flex: 1;
  height: var(--bulb-h);
  background-image: var(--bulb-strip);
  background-size: var(--bulb-tile) var(--bulb-h);
  background-repeat: repeat-x;
  background-position: 0 50%;
}
.block__head .block__count,
.block__head .pills { order: 2; }

.block__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-heading);
  letter-spacing: var(--tracking-display);
}
/* A single lit marquee bulb leads every section title. */
.block__title:not(.block__title--muted):not(.block__title--kicked)::before {
  content: '';
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--gold-pale);
  box-shadow: var(--glow-dot);
}
.block__title--muted { color: var(--text-secondary); font-size: var(--text-body); }

.block__title--kicked {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.block__title--kicked svg { width: var(--icon-md); height: var(--icon-md); color: var(--gold); }

.block__count {
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  font-variant-numeric: var(--numeric);
}

/* ------------------------------------------------------------------ rows
 * A horizontally scrollable shelf per kind — every game of that kind, in
 * the same tiles as the grids. Scrolls by touch/trackpad on every size;
 * the scrollbar itself stays hidden, like the pills row. */
.row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--row-tile-w);
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.row::-webkit-scrollbar { display: none; }
.row .g-tile { scroll-snap-align: start; }

/* ------------------------------------------------------------------ pills */
.pills {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pills::-webkit-scrollbar { display: none; }

/* A filter pill is a casino chip: round face, dashed inner ring. The active
 * chip flips to a gold face and the ring stamps in its own ink. */
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: var(--chip-ring);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-label);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.pill:hover { background: var(--surface-overlay); color: var(--text-primary); }
.pill.is-active { background: var(--gold); border: var(--chip-ring-active); color: var(--text-inverse); }
.pill__count { font-weight: 600; opacity: 0.75; font-variant-numeric: var(--numeric); }

/* ------------------------------------------------------------------ grids */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.grid__empty,
.grid__error {
  margin: 0;
  padding: var(--space-5);
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
}
.grid__error .btn { margin-left: var(--space-2); }

/* ------------------------------------------------------------------ tiles */
.g-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-primary);
  transition: transform var(--dur-fast) var(--ease-out);
}
.g-tile:hover,
.g-tile:focus-visible { color: var(--text-primary); transform: translateY(var(--lift-tile)); }

.g-tile__art {
  position: relative;
  aspect-ratio: var(--art-ratio);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--felt);
  background-image: var(--wash-tile), var(--wash-felt);
  border: var(--border-hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.g-tile:hover .g-tile__art,
.g-tile:focus-visible .g-tile__art {
  transform: scale(var(--scale-tile-hover));
  border-color: var(--accent-border);
  box-shadow: var(--shadow-card-hover), var(--glow-tile-hover);
}

.g-tile__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The emerald play disc, revealed on hover/focus over a scrim. */
.g-tile__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-scrim);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.g-tile__play::before {
  content: '';
  width: var(--play-badge);
  height: var(--play-badge);
  border-radius: var(--radius-pill);
  background: var(--accent);
  box-shadow: var(--glow-accent);
}
.g-tile__play::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  border-top: calc(var(--play-tri) * 0.62) solid var(--transparent);
  border-bottom: calc(var(--play-tri) * 0.62) solid var(--transparent);
  border-left: var(--play-tri) solid var(--text-on-accent);
}
.g-tile:hover .g-tile__play,
.g-tile:focus-visible .g-tile__play { opacity: 1; }

/* A game whose illustration has not shipped yet: a hue-rotated gradient
 * ground (the hue is data — lobby.js hashes the slug into `--tile-hue`) and
 * a big stroked initial. Designed, never a broken image, never a blank. */
.g-tile__art--fallback {
  background-image:
    var(--wash-tile),
    radial-gradient(
      130% 130% at 26% 0%,
      hsl(var(--tile-hue, 152) var(--fallback-sat) var(--fallback-l-hi)) 0%,
      hsl(var(--tile-hue, 152) var(--fallback-sat) var(--fallback-l-mid)) 56%,
      hsl(var(--tile-hue, 152) var(--fallback-sat) var(--fallback-l-lo)) 100%
    );
}

.g-tile__letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--text-numeral);
  color: var(--transparent);
  -webkit-text-stroke: var(--letter-stroke) hsl(var(--tile-hue, 152) var(--fallback-ink-sat) var(--fallback-ink-l) / var(--letter-alpha));
  paint-order: stroke fill;
}
.g-tile__letter::after {
  content: '';
  position: absolute;
  inset: 0;
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.g-tile__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.g-tile__name {
  font-size: var(--text-label);
  font-weight: 700;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-tile:hover .g-tile__name { color: var(--text-primary); }

.g-tile__kind {
  flex: none;
  padding: calc(var(--space-1) / 2) var(--space-2);
  border-radius: var(--radius-pill);
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
}
.g-tile:hover .g-tile__kind { color: var(--accent); border-color: var(--accent-border); }

/* In the 3-across phone grids a chip crushes the name to two letters; the
 * fixed-width row tiles keep it at every size. Re-enabled ≥720px below. */
.grid .g-tile__kind { display: none; }

/* skeletons while the catalogue loads */
.g-skel {
  aspect-ratio: var(--art-ratio);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  animation: skel var(--dur-live) infinite;
}
@keyframes skel {
  0%, 100% { opacity: var(--opacity-skeleton-hi); }
  50% { opacity: var(--opacity-skeleton-lo); }
}

/* ------------------------------------------------------------------ bets
 * The designed absence. There is no public bet feed yet, and the card says
 * so in the page's own voice — a mark, a lead, a reason — instead of a
 * header row over nothing. */
.bets {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  background-color: var(--felt);
  background-image: var(--wash-tile), var(--wash-felt);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--inset-top);
}

.bets__pulse {
  width: var(--empty-mark);
  height: var(--empty-mark);
  color: var(--gold);
  opacity: var(--opacity-skeleton-lo);
}

.bets__lead {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-display-sub);
  font-size: var(--text-heading);
  letter-spacing: var(--tracking-display);
  color: var(--text-primary);
}

.bets__sub {
  margin: 0;
  max-width: var(--measure-tight);
  color: var(--text-on-felt);
  font-size: var(--text-label);
}

/* ------------------------------------------------------------------ foot */
.foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: var(--border-hairline) solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--text-caption);
}
.foot p { margin: 0; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

.foot__strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--rail-bg);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.foot__fair {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-weight: 600;
}
.foot__fair svg { width: var(--icon-md); height: var(--icon-md); color: var(--accent); flex: none; }

.paymarks {
  display: inline-flex;
  gap: var(--space-2);
  margin-left: auto;
}

.paymark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: calc(var(--paymark-h) + var(--space-2));
  padding: 0 var(--space-2);
  border: var(--border-hairline) solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: var(--text-caption);
  letter-spacing: var(--tracking-label);
}
.paymark svg { width: var(--icon-sm); height: var(--icon-sm); flex: none; }
.paymark--upi svg { color: var(--info); }
.paymark--usdt svg { color: var(--accent); }

.foot__rp { font-weight: 700; }

.rail__age-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  border: var(--border-hairline) solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ bnav */
.bnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  min-height: var(--bnav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--rail-bg);
  border-top: var(--border-hairline) solid var(--border-default);
}

.bnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 700;
  min-height: var(--tap-min);
}
.bnav__item svg { width: var(--icon-lg); height: var(--icon-lg); }
.bnav__item.is-active,
.bnav__item:hover { color: var(--accent); }

/* ================================================================= ≥720px
 * --break-lap. The bottom nav goes; the top bar becomes one row. */
@media (min-width: 720px) {
  .bnav { display: none; }

  /* --space-5, not 6: the fold budget at 1280x900 is spent on tiles */
  .content { padding: var(--space-5); gap: var(--space-5); }

  .topbar {
    grid-template-columns: auto minmax(0, var(--search-w)) 1fr;
    grid-template-areas: 'brand search auth';
    padding: var(--space-3) var(--space-5);
  }
  .topbar__auth { justify-self: end; }

  /* the promo fan stays recessed behind the copy at every width — the slide
   * is a compact banner card now, not a two-column stage */
  .promo-slide__fan { opacity: 0.5; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(var(--lobby-tile-min), 1fr)); }
  .grid .g-tile__kind { display: inline-flex; }
}

/* ================================================================= ≥960px
 * --break-rail. The 220px sidebar rail appears and takes the brand. */
@media (min-width: 960px) {
  .rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    width: var(--rail-w);
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: var(--space-4) var(--space-3);
    background: var(--rail-bg);
    border-right: var(--border-hairline) solid var(--border-subtle);
  }

  .rail__brand { padding: 0 var(--space-3) var(--space-4); }

  .rail__nav { display: flex; flex-direction: column; gap: var(--space-1); }

  .rail__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    min-height: var(--tap-min);
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-weight: 700;
    font-size: var(--text-label);
    text-align: left;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  }
  .rail__item svg { width: var(--icon-lg); height: var(--icon-lg); flex: none; }
  .rail__item:hover { background: var(--surface-wash); color: var(--text-primary); }
  .rail__item.is-active { background: var(--accent-subtle); color: var(--accent); }
  .rail__item--gold { color: var(--gold); }
  .rail__item--gold:hover { color: var(--gold); }

  /* Hue-tinted icons: each section owns a hue, the label stays ink. The
   * colourful rail is what makes this read as a game floor. */
  .rail__item--t-emerald svg { color: var(--tint-emerald); }
  .rail__item--t-ember svg { color: var(--tint-ember); }
  .rail__item--t-rose svg { color: var(--tint-rose); }
  .rail__item--t-sky svg { color: var(--tint-sky); }
  .rail__item--t-violet svg { color: var(--tint-violet); }
  .rail__item--t-gold svg { color: var(--tint-gold); }

  /* VIP: a real plan, not a real feature yet — muted and honest. */
  .rail__item--vip { color: var(--text-muted); cursor: default; }
  .rail__item--vip:hover { background: none; color: var(--text-muted); }
  .rail__item--vip svg { color: var(--text-muted); }
  .rail__soon {
    margin-left: auto;
    font-style: normal;
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--text-muted);
  }

  .rail__rule {
    height: var(--border-hairline);
    background: var(--border-subtle);
    margin: var(--space-3) var(--space-2);
  }

  .rail__age {
    margin-top: auto;
    padding: var(--space-3);
    color: var(--text-muted);
    font-size: var(--text-caption);
    line-height: var(--leading-normal);
  }

  .topbar__brand { display: none; }
  .topbar {
    grid-template-columns: auto minmax(0, var(--search-w)) 1fr;
    grid-template-areas: 'nav search auth';
  }
  .topnav {
    grid-area: nav;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }

  /* The banner row goes side by side: the live crash card leads, the promo
   * card seconds it, and both stay under --hero-max-h so at least one full
   * tile row is on screen at 1280x900 without scrolling. */
  .hero-row {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: stretch;
  }
  .hero { max-height: var(--hero-max-h); }
  .carousel { max-height: var(--hero-max-h); }
}
