:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1c1c22;
  --border: #292931;
  --text: #e2e2e6;
  --text-dim: #aaaab2;
  --accent: #7c6af7;
}

* { box-sizing: border-box; }
html {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(900px 500px at 50% 0, #7c6af720, transparent), var(--bg);
}
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

.lobby-wrap {
  width: min(100% - 32px, 1100px);
  margin: auto;
}
.lobby-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 12px;
}
.lobby-brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.04em;
  text-decoration: none;
  white-space: nowrap;
}
.lobby-brand b { color: var(--accent); }
.lang-btn {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
}
.lang-btn button {
  border: 0;
  border-radius: 30px;
  padding: 7px 10px;
  color: var(--text-dim);
  background: none;
  min-height: 44px;
}
.lang-btn button.active { color: white; background: var(--accent); }
.lobby-intro { padding: 28px 0 16px; }
.lobby-intro h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 3rem); }
.lobby-intro p { margin: 5px 0; color: var(--text-dim); }
.lobby-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 10px 0;
  background: #0d0d0ff2;
  backdrop-filter: blur(16px);
}
.lobby-search {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #504778;
  border-radius: 14px;
  outline-color: var(--accent);
  background: var(--surface);
  color: var(--text);
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip, .hub-nav a {
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}
.chip.active { border-color: var(--accent); background: #493d91; color: white; }
.hub-nav a:hover, .hub-nav a:focus-visible {
  border-color: var(--accent);
  color: white;
}
.lobby-main { padding-bottom: 32px; }
.shelf { margin: 26px 0 38px; }
.shelf-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.shelf h2 { flex: 1; margin: 0; font-size: 1.4rem; }
.shelf-head a, .lobby-link {
  color: #bcb2ff;
  text-decoration: none;
}
.shelf-controls { display: flex; gap: 6px; }
.shelf-controls[hidden] { display: none; }
.shelf-arrow {
  width: 34px;
  height: 34px;
  border: 1px solid #544c75;
  border-radius: 50%;
  background: var(--surface-2);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
}
.shelf-arrow:disabled { opacity: .35; cursor: default; }
.shelf-scroll { position: relative; }
.shelf-scroll.can-scroll:not(.at-end)::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 12px;
  width: 52px;
  background: linear-gradient(90deg, transparent, var(--bg));
  content: '';
  pointer-events: none;
}
.shelf-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow-x: auto;
  padding: 3px 2px 16px;
  scroll-snap-type: x mandatory;
}
.game-card {
  --c: var(--accent);
  display: flex;
  flex: 0 0 215px;
  flex-direction: column;
  gap: 5px;
  width: 215px;
  min-height: 165px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: radial-gradient(circle at 0 0, color-mix(in srgb, var(--c) 24%, transparent), transparent 65%),
    var(--surface);
  text-decoration: none;
  scroll-snap-align: start;
}
.game-card:hover, .game-card:focus-visible {
  border-color: var(--c);
  transform: translateY(-2px);
}
.game-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--c);
  font-size: 2rem;
}
.game-name { font-size: 1.05rem; font-weight: 750; line-height: 1.25; }
.game-name small {
  display: block;
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 400;
}
.game-desc { color: var(--text-dim); font-size: .82rem; line-height: 1.4; }
.game-meta { color: #c5bbff; font-size: .75rem; }
.game-plays { color: #c7edcf; font-size: .73rem; }
.new-badge {
  display: inline-block;
  width: fit-content;
  border-radius: 20px;
  padding: 2px 9px;
  background: #7c6af7;
  color: white;
  font-size: .7rem;
  font-weight: 700;
}
.feature-hero {
  --c: var(--accent);
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 48px);
  min-height: 240px;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid color-mix(in srgb, var(--c) 65%, #ffffff);
  border-radius: 24px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--c) 55%, #17121f), #17121f 75%);
  box-shadow: 0 14px 55px #0005;
}
.feature-icon {
  display: grid;
  flex: 0 0 clamp(90px, 13vw, 145px);
  place-items: center;
  width: clamp(90px, 13vw, 145px);
  height: clamp(90px, 13vw, 145px);
  border-radius: 26px;
  background: color-mix(in srgb, var(--c) 75%, white);
  font-size: clamp(3.5rem, 7vw, 5rem);
  box-shadow: 0 14px 35px #0005;
}
.feature-copy h3 { margin: 7px 0 5px; font-size: clamp(1.5rem, 3vw, 2.25rem); }
.feature-copy p { max-width: 670px; margin: 0 0 18px; color: #f0e9f8; }
.feature-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.feature-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 750;
  text-decoration: none;
}
.feature-play { background: white; color: #211628; }
.feature-daily { border: 1px solid #ffffff91; background: #ffffff20; color: white; }
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.results .game-card { width: 100%; }
.kids-door {
  display: block;
  margin: 8px 0 38px;
  border-radius: 20px;
  padding: 25px;
  background: linear-gradient(120deg, #edb8fe, #9acbff);
  color: #231b37;
  font-size: 1.25rem;
  font-weight: 750;
  text-decoration: none;
}
.kids-door span { display: block; font-size: .9rem; font-weight: 400; }
.lobby-footer {
  border-top: 1px solid var(--border);
  padding: 30px 16px;
  color: var(--text-dim);
  font-size: .85rem;
  text-align: center;
}
.hub-intro { max-width: 850px; color: var(--text-dim); line-height: 1.75; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
  margin: 26px 0;
}
.hub-grid .game-card { width: 100%; }
.hub-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0; }

.kids-page {
  --bg: #fff9ed;
  --surface: #fffdf6;
  --border: #e4cfae;
  --text: #302548;
  --text-dim: #655879;
  background: radial-gradient(700px 380px at 30% 0, #ffe1bd, transparent), var(--bg);
}
.kids-page .lobby-brand { color: #302548; }
.kids-page h1 { margin: 25px 0 4px; color: #302548; font-size: clamp(2rem, 5vw, 3.5rem); }
.kids-page .hub-intro { font-size: 1.12rem; }
.kids-page .hub-grid { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 18px; }
.kids-page .game-card {
  min-height: 245px;
  border: 2px solid #e9c998;
  border-radius: 26px;
  padding: 22px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 18%, white), #fffdf6 70%);
  box-shadow: 0 9px 24px #6a45791a;
}
.kids-page .game-icon { width: 82px; height: 82px; border-radius: 22px; font-size: 3.3rem; }
.kids-page .game-name { font-size: 1.35rem; color: #302548; }
.kids-page .game-desc { font-size: 1rem; }
.kids-page .game-meta { color: #6542aa; font-size: .9rem; }
.kids-page .lobby-link { color: #5136a0; }

@media (hover: none), (max-width: 700px) {
  .shelf-controls { display: none; }
  .shelf-scroll.can-scroll::after { display: none; }
}
@media (max-width: 500px) {
  body:not(.home-page) .lobby-top { flex-wrap: wrap; }
  .lobby-wrap { width: min(100% - 24px, 1100px); }
  .lobby-top { padding-top: 12px; }
  .home-page .lobby-top { padding-left: 50px; }
  .lobby-brand { font-size: 1.1rem; }
  .lang-btn button { padding: 6px 7px; font-size: .75rem; }
  .game-card { flex-basis: 178px; width: 178px; min-height: 145px; padding: 12px; }
  .game-icon { width: 47px; height: 47px; font-size: 1.7rem; }
  .feature-hero { gap: 16px; min-height: 0; padding: 22px; }
  .feature-icon { flex-basis: 72px; width: 72px; height: 72px; border-radius: 18px; font-size: 2.7rem; }
  .feature-copy h3 { font-size: 1.5rem; }
  .results, .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .results .game-card, .hub-grid .game-card { min-width: 0; width: 100%; }
  .kids-page .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kids-page .game-card { min-height: 0; padding: 13px; }
  .kids-page .game-icon { width: 65px; height: 65px; font-size: 2.6rem; }
  .kids-page .game-name { font-size: 1.13rem; }
  .kids-page .game-desc { font-size: .9rem; }
}
@media (max-width: 390px) {
  .home-page .lobby-top { gap: 6px; padding-left: 45px; }
  .home-page .lobby-brand { font-size: 1rem; }
  .home-page .lang-btn button { padding: 6px 5px; font-size: .7rem; }
  .feature-hero { flex-direction: column; align-items: flex-start; }
}
