/* Night felt lobby. Colour comes from the game art and promo art; gold only marks money actions. */
:root {
  color-scheme: dark;
  --bg: #0c1512;
  --side: #101c17;
  --raised: #18271f;
  --raised-hover: #213429;
  --line: #1e2e27;
  --text: #eaf2ee;
  --muted: #8fa39a;
  --gold: #e9b949;
  --gold-hover: #f2c964;
  --on-gold: #1a1405;

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Schibsted Grotesk", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --header-h: 64px;
  --side-w: 236px;
  --gutter: 16px;
}

@media (min-width: 768px) { :root { --gutter: 28px; } }

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html.nav-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 0.95rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1320px; margin-inline: auto; padding-inline: var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 0; border-radius: 8px;
  font-weight: 600; font-size: 0.92rem; white-space: nowrap; text-decoration: none;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-secondary { background: var(--raised); color: var(--text); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 0.85rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 8px;
  background: var(--raised); font-size: 1.1rem; cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.topbar .icon-btn { width: 40px; height: 40px; }

.link-btn {
  margin-left: auto; padding: 6px 4px; border: 0; background: none;
  color: var(--muted); font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: color 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--gold-hover); }
  .btn-secondary:hover, .icon-btn:not(:disabled):hover { background: var(--raised-hover); }
  .link-btn:hover { color: var(--text); }
}

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font: 800 1.4rem/1 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; }

/* ---------- Sidebar: fixed on desktop, drawer below 1024px ----------
   The closed drawer and scrim are display:none, not just transparent: iOS Safari
   paints the area under its bottom bar with the colour of fixed elements that
   touch the bottom edge, even invisible ones. */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: min(290px, 86vw);
  display: none; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  transform: translateX(-100%);
  transition: transform 320ms var(--ease-drawer), display 320ms allow-discrete;
}
.nav-open .sidebar { display: flex; transform: none; }
@starting-style { .nav-open .sidebar { transform: translateX(-100%); } }

.side-top { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding: 0 12px 0 16px; flex: none; }
.side-nav { display: grid; gap: 1px; padding: 6px 10px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px; border-radius: 8px;
  color: var(--muted); font-weight: 600; font-size: 0.9rem; text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}
.side-nav a img { width: 26px; height: 26px; }
.side-nav a[aria-current] { background: var(--raised); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .side-nav a:hover { background: var(--raised); color: var(--text); } }
.side-group { margin: 16px 20px 2px; font-size: 0.78rem; font-weight: 600; color: #627469; }
.side-legal a { min-height: 34px; font-weight: 500; font-size: 0.85rem; }
.side-legal a i { width: 26px; text-align: center; font-size: 1.05rem; }
.side-foot { margin-top: auto; padding: 18px 20px 22px; display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--muted); }

.scrim {
  position: fixed; inset: 0; z-index: 35;
  display: none; background: rgb(0 0 0 / 0.6);
  opacity: 0; transition: opacity 240ms ease, display 240ms allow-discrete;
}
.nav-open .scrim { display: block; opacity: 1; }
@starting-style { .nav-open .scrim { opacity: 0; } }

@media (min-width: 1024px) {
  .sidebar { display: flex; width: var(--side-w); transform: none; transition: none; }
  .main-col { margin-left: var(--side-w); }
  .menu-btn, .side-close, .scrim, .topbar .brand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transform: none; opacity: 0; transition: opacity 200ms ease, display 200ms allow-discrete; }
  .nav-open .sidebar { opacity: 1; }
  @starting-style { .nav-open .sidebar { transform: none; opacity: 0; } }
  @media (min-width: 1024px) { .sidebar { opacity: 1; } }
}

/* ---------- Top bar: translucent layer the lobby scrolls under ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgb(12 21 18 / 0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 10px; height: var(--header-h); }
.search-field {
  display: none; align-items: center; gap: 10px;
  width: min(380px, 40vw); height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--side); color: var(--muted); font-size: 0.9rem; cursor: pointer; text-align: left;
  transition: border-color 160ms ease;
}
.search-field i { font-size: 1.1rem; }
@media (hover: hover) and (pointer: fine) { .search-field:hover { border-color: #2f463c; } }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-login { display: none; }
@media (min-width: 640px) { .btn-login { display: inline-flex; } }
@media (min-width: 768px) {
  .search-field { display: inline-flex; }
  .search-icon { display: none; }
}
@media (max-width: 380px) { .topbar .brand-name { font-size: 1.2rem; } }

@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- Promo banners: real art, named offers ---------- */
.promo-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 88%; gap: 12px;
  margin-top: 16px; padding-bottom: 4px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.promo-strip::-webkit-scrollbar { display: none; }
.banner {
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 5 / 4; border-radius: 14px; scroll-snap-align: start;
  background: var(--side);
}
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 75% 20%; z-index: -2; }
/* Scrim: text sits on near-solid dark, art stays visible above it */
.banner::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, rgb(7 12 10 / 0.97) 0%, rgb(7 12 10 / 0.88) 38%, rgb(7 12 10 / 0.25) 68%, transparent 100%);
}
.banner-copy { position: absolute; left: 20px; right: 20px; bottom: 20px; display: grid; gap: 8px; justify-items: start; }
.banner h2 { font: 800 clamp(1.7rem, 2.6vw, 2.6rem)/0.95 var(--font-display); text-transform: uppercase; letter-spacing: 0.01em; max-width: 12ch; }
.banner p { max-width: 34ch; font-size: 0.88rem; color: #d3ddd8; }
.banner .btn { margin-top: 4px; }

@media (min-width: 768px) {
  .promo-strip { grid-auto-columns: 60%; }
  .banner { aspect-ratio: 16 / 10; }
}
@media (min-width: 1180px) {
  .promo-strip {
    grid-auto-flow: row; overflow: visible;
    grid-template-columns: 1.7fr 1fr; grid-template-rows: 1fr 1fr; height: 400px;
  }
  .banner { aspect-ratio: auto; }
  .banner img { object-position: 70% 50%; }
  .banner::before { background: linear-gradient(90deg, rgb(7 12 10 / 0.94) 0%, rgb(7 12 10 / 0.7) 38%, transparent 70%); }
  .banner-welcome { grid-row: span 2; }
  .banner-welcome .banner-copy { left: 36px; bottom: 36px; }
  .banner-welcome h2 { font-size: 3.4rem; }
  .banner:not(.banner-welcome) p { display: none; }
  .banner:not(.banner-welcome) h2 { font-size: 1.9rem; }
}

/* Arrival: the three banners land in order, once */
.motion .banner { animation: rise 560ms var(--ease-out) both; }
.motion .banner:nth-child(2) { animation-delay: 70ms; }
.motion .banner:nth-child(3) { animation-delay: 140ms; }
.motion-settled .banner { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  .motion .banner { animation: fade 240ms ease both; }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- Category tiles: phones and tablets, the sidebar covers desktop ---------- */
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.cat {
  display: grid; justify-items: center; gap: 6px;
  padding: 10px 4px 9px; border-radius: 10px;
  background: var(--raised); text-decoration: none;
  font-size: 0.74rem; font-weight: 600; text-align: center; line-height: 1.2;
  transition: transform 140ms var(--ease-out);
}
.cat img { width: 40px; height: 40px; }
.cat:active { transform: scale(0.96); }
@media (min-width: 640px) { .cats { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cats { display: none; } }

/* ---------- Sections: flat, no panels ---------- */
.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 700; }
.section-head h2 img { width: 28px; height: 28px; }
.section-head .row-nav { display: none; gap: 6px; }
@media (min-width: 768px) { .section-head .row-nav { display: flex; } }
#providers .section-head h2 { padding-left: 2px; }

/* ---------- Game tiles ---------- */
.tile {
  display: block; width: 100%; padding: 0; text-align: left;
  background: none; border: 0; cursor: pointer;
  transition: transform 140ms var(--ease-out);
}
.tile:active { transform: scale(0.97); }
.tile-art {
  display: block; position: relative; overflow: hidden;
  aspect-ratio: 1; border-radius: 10px;
  background: var(--raised);
}
.tile-art img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.tile-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgb(7 12 10 / 0.55);
  opacity: 0; transition: opacity 180ms ease;
}
.tile-play i {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--gold); color: var(--on-gold); font-size: 1.3rem;
}
.tile-name { display: block; margin-top: 7px; font-weight: 600; font-size: 0.84rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-studio { display: block; font-size: 0.76rem; color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-art img { transform: scale(1.04); }
  .tile:hover .tile-play { opacity: 1; }
}

.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 124px; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row-2 { grid-template-rows: auto auto; row-gap: 14px; }
@media (min-width: 768px) { .row { grid-auto-columns: 152px; gap: 14px; } }

/* ---------- Tournaments: data, not cards ---------- */
.races { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
@media (max-width: 559px) { .races > * > tr > :nth-child(3) { display: none; } .races th, .races td { padding-inline: 8px; } }
.races th, .races td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.races thead th { font-size: 0.76rem; font-weight: 600; color: var(--muted); padding-block: 8px; }
.races tbody th { font-weight: 700; }
.races td { color: var(--muted); }
.races td:last-child { text-align: right; }
.races tbody tr { transition: background-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .races tbody tr:hover { background: var(--side); } }
.note { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

/* ---------- Studios ---------- */
.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.provider {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 0; border-radius: 10px;
  background: var(--side); cursor: pointer; text-align: left;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}
.provider img { width: 28px; height: 28px; flex: none; }
.provider span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .provider:hover { background: var(--raised); color: var(--text); } }
@media (min-width: 768px) { .providers { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* ---------- Footer: dense, the way real lobbies end ---------- */
.site-footer { margin-top: 56px; background: var(--side); border-top: 1px solid var(--line); padding-block: 40px 28px; }
.footer-top { display: grid; gap: 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-about { grid-column: 1 / -1; }
.footer-about p { margin-top: 12px; color: var(--muted); max-width: 46ch; font-size: 0.88rem; }
.footer-links { display: grid; gap: 2px; align-content: start; }
.footer-links h2 { font-size: 0.8rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.footer-links a { min-height: 30px; display: flex; align-items: center; text-decoration: none; font-size: 0.86rem; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .footer-links a:hover { color: var(--text); } }
.footer-legal { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); display: grid; gap: 12px; font-size: 0.8rem; color: var(--muted); }
.seals { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.seal {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--text);
}
.seal i { font-size: 1.05rem; }
.seal-pending { color: var(--muted); border-style: dashed; }
.age-badge {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid currentColor; font-weight: 800; font-size: 0.78rem; color: var(--text);
}
@media (min-width: 900px) {
  .footer-top { grid-template-columns: 1.6fr 1fr 1fr; }
  .footer-about { grid-column: auto; }
}

/* ---------- Legal pages ---------- */
.doc { max-width: 760px; margin-top: 32px; }
.doc .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.doc h1 { margin-top: 14px; font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.1; }
.doc .updated { margin-top: 8px; color: var(--muted); font-size: 0.86rem; }
.doc-body { margin-top: 28px; }
.doc-body h2 { font-size: 1.2rem; font-weight: 700; margin: 26px 0 8px; }
.doc-body h2:first-child { margin-top: 0; }
.doc-body p, .doc-body li { color: #c9d6cf; max-width: 68ch; }
.doc-body p + p { margin-top: 10px; }
.notice { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; }
.notice i { font-size: 1.4rem; color: var(--gold); }

/* ---------- Toast: transition-based so repeat taps retarget ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100% - 32px); padding: 11px 16px 11px 13px;
  background: var(--text); color: var(--bg); border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
  font-size: 0.9rem; font-weight: 600;
  opacity: 0; transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 240ms var(--ease-out);
}
.toast i { font-size: 1.2rem; }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1024px) { .toast { left: calc(50% + var(--side-w) / 2); } }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-shown { transform: translate(-50%, 0); }
}
