:root {
  --bg: #0a0f2e;
  --bg-2: #0f1538;
  --panel: #151c48;
  --line: #262f6b;
  --text: #f4f6ff;
  --dim: #97a0d4;
  --purple: #7c3aed;
  --purple-2: #6d28d9;
  --yellow: #ffc933;
  --radius: 14px;
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 58, 237, .18), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(37, 99, 235, .14), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; }

.ic { width: 18px; height: 18px; flex-shrink: 0; }
.emo { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 14px 12px 18px;
  background: linear-gradient(180deg, #111846 0%, #0d1236 100%);
  border-right: 1px solid rgba(255, 255, 255, .04);
  scrollbar-width: thin; scrollbar-color: #2a3372 transparent;
}
.brand { display: block; padding: 2px 10px 10px; }
.brand img { display: block; width: 100%; height: auto; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px 12px;
  border: 0; border-radius: 12px; background: none;
  color: #cdd3fb; font-weight: 800; font-size: 14.5px; text-align: left; white-space: nowrap;
  transition: background .15s;
}
.side-link:hover { background: rgba(255, 255, 255, .06); }
.side-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--purple), var(--purple-2));
  box-shadow: 0 6px 18px rgba(124, 58, 237, .45), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.side-link.is-soon { opacity: .6; }
.side-link.is-soon:hover { opacity: .85; }

.daily-card {
  position: relative; display: block; width: 100%; max-width: 172px; margin: 14px auto 0;
  border-radius: 18px; container-type: inline-size;
}
.daily-card img { display: block; width: 100%; height: auto; }
.daily-card:hover img { filter: brightness(1.08); }
.daily-title, .daily-sub, .daily-btn { position: absolute; left: 8%; right: 8%; text-align: center; }
.daily-title {
  top: 5.5%; font-family: var(--display); font-weight: 800; font-size: 11cqw; line-height: 1.05;
  color: #ffd23f; -webkit-text-stroke: 2.6cqw #2b1a8f; paint-order: stroke fill;
  text-shadow: 0 1.5cqw 0 #1b0f6b;
}
.daily-sub { top: 13.5%; font-weight: 800; font-size: 7.2cqw; color: #fff; }
.daily-btn {
  left: 7%; right: 6.5%; top: 82.6%; height: 9.8%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 10cqw; color: #4a2800;
}

.scrim { display: none; }
.main { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(10, 15, 46, .82);
  backdrop-filter: blur(12px);
}
.topbar .menu-btn, .topbar-logo { display: none; }
.search {
  flex: 1; max-width: 460px; height: 44px;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-radius: 999px; background: #161d4c; border: 1px solid var(--line);
  color: var(--dim);
}
.search:focus-within { border-color: #6d5cff; box-shadow: 0 0 0 3px rgba(109, 92, 255, .25); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  color: var(--text); font: 700 14.5px 'Nunito', sans-serif;
}
.search input::placeholder { color: #7f88bd; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: #161d4c;
}
.icon-btn:hover { background: #1d2560; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: #161d4c; color: var(--dim);
}
.user-chip img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #ffc933; background: #243; }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-meta b { color: #fff; font-size: 14px; }
.user-meta small { font-size: 11px; font-weight: 700; }

.content { padding: 6px 26px 30px; max-width: 1320px; }

/* ---------- Buttons ---------- */
.btn-yellow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ffe169, #ffbe14);
  color: #3a2300; font-weight: 900; font-size: 16px;
  box-shadow: 0 4px 0 #c98800, 0 10px 22px rgba(255, 190, 20, .3);
  transition: transform .12s;
}
.btn-yellow:hover { transform: translateY(-2px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 12px;
  border: 1px solid var(--line); background: #161d4c;
  font-weight: 800; font-size: 14px;
}
.btn-ghost:hover { background: #1d2560; }
.btn-ghost[disabled] { opacity: .45; cursor: default; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; aspect-ratio: 3 / 1; min-height: 230px;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 75% 40%; }
.hero-text {
  position: absolute; left: 4.5%; top: 50%; transform: translateY(-50%);
  width: 52%; display: flex; flex-direction: column; align-items: flex-start;
}
.hero-line1, .hero-line2 { font-family: var(--display); font-weight: 800; line-height: .92; paint-order: stroke fill; }
.hero-line1 {
  font-size: clamp(44px, 7.4vw, 104px);
  color: #ffd23f; -webkit-text-stroke: 9px #102072;
  text-shadow: 0 7px 0 #0a1450, 0 14px 30px rgba(0, 0, 0, .35);
}
.hero-line2 {
  font-size: clamp(28px, 4.5vw, 62px); color: #fff;
  -webkit-text-stroke: 7px #1a3cb0; text-shadow: 0 5px 0 #0f2580;
  margin-top: 2px;
}
.hero-ribbon {
  margin-top: 12px; padding: 6px 18px 6px 16px;
  background: linear-gradient(90deg, #1e40af, #2563eb);
  clip-path: polygon(0 0, 100% 0, 96% 100%, 0 100%);
  font-weight: 900; font-size: clamp(11px, 1.15vw, 15px); letter-spacing: .3px;
}
.hero-btn { margin-top: 16px; }

/* ---------- Game rows / cards ---------- */
.row-section { margin-top: 26px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.row-head h2 {
  display: flex; align-items: center; gap: 9px; margin: 0;
  font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: .3px;
}
.row-emo { width: 26px; height: 26px; }
.see-all { display: flex; align-items: center; gap: 4px; color: #aeb6ff; font-weight: 800; font-size: 13.5px; }
.see-all:hover { color: #fff; }
.see-all .ic { width: 15px; height: 15px; }

.game-row {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 4 * 14px) / 5);
  gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: #2a3372 transparent;
}
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 14px; }

.game-card { display: flex; flex-direction: column; min-width: 0; scroll-snap-align: start; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 12px; background: #1b2358;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.game-card:hover .thumb img { transform: scale(1.06); }
.game-card:hover .thumb { border-color: rgba(167, 139, 250, .6); }
.badge-plays {
  position: absolute; right: 6px; bottom: 6px;
  display: flex; align-items: center; gap: 3px;
  padding: 3px 8px 3px 6px; border-radius: 999px;
  background: rgba(8, 12, 40, .78); font-size: 11px; font-weight: 900;
}
.badge-plays .ic { width: 11px; height: 11px; fill: currentColor; }
.badge-soon {
  position: absolute; left: 6px; top: 6px; padding: 3px 8px; border-radius: 7px;
  background: #ffb020; color: #2a1800; font-size: 10.5px; font-weight: 900;
}
.card-title {
  margin-top: 8px; font-weight: 800; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-cat { color: var(--dim); font-weight: 700; font-size: 12.5px; }

/* ---------- Challenge strip ---------- */
.challenge { position: relative; container-type: inline-size; }
.challenge > img { display: block; width: 100%; height: auto; }
.ch-text { position: absolute; left: 19.5%; top: 18%; width: 43%; display: flex; flex-direction: column; gap: .4cqw; }
.ch-text b {
  font-family: var(--display); font-weight: 800; font-size: 2.7cqw; line-height: 1.1;
  text-shadow: 0 2px 0 rgba(10, 20, 80, .6);
}
.ch-text span { font-weight: 800; font-size: 1.7cqw; color: #ffe27a; }
.ch-track {
  position: absolute; left: 18.2%; top: 75.8%; width: 27.2%; height: 10.8%;
  border-radius: 999px; overflow: hidden;
  background: #0c1d6e; box-shadow: inset 0 0 0 2px #3d63ff, 0 0 10px rgba(61, 99, 255, .5);
}
.ch-fill {
  position: absolute; inset: 3px auto 3px 3px; width: 0; max-width: calc(100% - 6px);
  border-radius: 999px; background: linear-gradient(180deg, #ffe169, #ffb400);
  transition: width .4s;
}
.ch-count {
  position: absolute; right: 5%; top: 50%; transform: translateY(-50%);
  font-weight: 900; font-size: 1.35cqw; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.ch-btn {
  position: absolute; left: 47.5%; top: 69.2%; width: 20%; height: 22.5%;
  display: flex; align-items: center; justify-content: center; border-radius: 999px;
  font-family: var(--display); font-weight: 800; font-size: 2.5cqw; color: #4a2800;
}
.ch-btn:hover { background: rgba(255, 255, 255, .12); }
.challenge.done .ch-count::before { content: '🎉 '; }

/* ---------- Pages ---------- */
.page-head h1 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 14px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: #161d4c; border: 1px solid var(--line);
  font-weight: 800; font-size: 13.5px; color: #cdd3fb;
}
.chip .emo { width: 18px; height: 18px; }
.chip.active { color: #fff; border-color: transparent; background: linear-gradient(90deg, var(--purple), var(--purple-2)); }

.empty-state { text-align: center; color: var(--dim); padding: 50px 10px; font-weight: 700; }
.empty-state a:not(.btn-yellow) { color: #aeb6ff; text-decoration: underline; }
.empty-emo { width: 64px; height: 64px; }
.text-page { max-width: 680px; margin-top: 18px; line-height: 1.65; }
.text-page h1 { font-family: var(--display); font-size: 30px; margin-bottom: 8px; }
.text-page p { color: #c3c9ef; font-weight: 600; }
.credits { font-size: 13px; }
.credits a { text-decoration: underline; }

.play-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 10px 0 14px; }
.play-head h1 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 0; line-height: 1.1; }
.play-cat { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-weight: 800; font-size: 13px; }
.play-cat .emo { width: 18px; height: 18px; }
.play-actions { display: flex; gap: 10px; }
.play-frame {
  position: relative; aspect-ratio: 16 / 9; max-height: 78vh; width: 100%;
  border-radius: 18px; overflow: hidden; background: #000;
  border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}
.play-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.coming-soon { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; text-align: center; }
.coming-soon > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(8px) brightness(.4); transform: scale(1.1); }
.coming-soon p { position: relative; display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 900; font-size: 18px; }
.coming-soon .btn-yellow { position: relative; }
.play-desc { color: #c3c9ef; font-weight: 700; margin: 14px 0 0; }

.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 40px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .06);
  color: #6f78ad; font-size: 12.5px; font-weight: 700;
}
.site-footer a:hover { color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 12px;
  background: #1d2560; border: 1px solid #3a45a0;
  font-weight: 800; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablet / phone ---------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: 264px;
    transform: translateX(-102%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, .5); }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(3, 6, 20, .6); }
  .sidebar.open + .scrim { display: block; }
  .topbar .menu-btn { display: grid; }
  .topbar-logo { display: block; width: 104px; flex-shrink: 0; }
  .topbar-logo img { display: block; width: 100%; height: auto; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .content { padding: 4px 16px 24px; }
  .game-row { grid-auto-columns: calc((100% - 2 * 12px) / 3.2); gap: 12px; }
}

@media (max-width: 700px) {
  .user-meta, .user-chip .ic, .top-actions .icon-btn { display: none; }
  .user-chip { padding: 3px; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; height: 42px; }
  .hero { aspect-ratio: auto; height: 230px; min-height: 0; border-radius: 18px; }
  .hero-bg { object-position: 72% center; }
  .hero-text { width: 64%; left: 5%; }
  .hero-line1 { -webkit-text-stroke-width: 6px; }
  .hero-line2 { -webkit-text-stroke-width: 5px; }
  .hero-btn { padding: 10px 18px; font-size: 14px; }
  .row-head { gap: 8px; }
  .row-head h2 { font-size: 16px; }
  .row-emo { width: 22px; height: 22px; }
  .see-all { white-space: nowrap; font-size: 12.5px; }
  .game-row { grid-auto-columns: 46%; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .play-head h1 { font-size: 22px; }
  .play-actions { width: 100%; }
  .play-actions .btn-ghost { flex: 1; justify-content: center; }

  .challenge {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
    padding: 16px; border-radius: 18px;
    background: linear-gradient(120deg, #3b1fb8, #1d3fd6);
  }
  .challenge > img { display: none; }
  .ch-text, .ch-track, .ch-btn { position: static; inset: auto; width: auto; height: auto; }
  .ch-text { grid-column: 1 / -1; gap: 3px; }
  .ch-text b { font-size: 17px; }
  .ch-text span { font-size: 13px; }
  .ch-track { height: 20px; position: relative; }
  .ch-count { font-size: 11px; }
  .ch-btn {
    padding: 9px 18px; font-size: 16px;
    background: linear-gradient(180deg, #ffe169, #ffbe14); box-shadow: 0 3px 0 #c98800;
  }
}
