:root {
  --bg: #140a24;
  --bg-2: #1d0f33;
  --card: rgba(255, 255, 255, .055);
  --card-line: rgba(255, 255, 255, .1);
  --text: #f6eeff;
  --muted: #b39ccd;
  --pink: #ff5fa2;
  --violet: #7c6cff;
  --mint: #3ddc97;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 700px at 80% -10%, #35185c 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

.glow { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .35; pointer-events: none; z-index: 0; }
.glow-a { width: 460px; height: 460px; background: var(--pink); top: -160px; left: -120px; }
.glow-b { width: 520px; height: 520px; background: var(--violet); bottom: -240px; right: -140px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: rgba(20, 10, 36, .72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { font-size: 24px; }
.brand-name { font-size: 17px; letter-spacing: .2px; }

.fun-pill {
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 700;
  background: rgba(61, 220, 151, .13); color: var(--mint);
  border: 1px solid rgba(61, 220, 151, .34);
}

/* ---------- hero ---------- */
.lobby { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 26px 24px 40px; }

.hero {
  display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; align-items: center;
  padding: 34px; border-radius: 26px; overflow: hidden;
  background: linear-gradient(120deg, rgba(255, 95, 162, .22), rgba(124, 108, 255, .18)), var(--bg-2);
  border: 1px solid var(--card-line);
}
.hero-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--pink); }
.hero-title { margin: 8px 0 10px; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; }
.hero-text { margin: 0 0 18px; max-width: 46ch; color: var(--muted); }
.hero-stats { display: flex; gap: 26px; margin-bottom: 22px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 19px; }
.hero-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }

.play-btn {
  padding: 14px 34px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--pink), #ff8f4d);
  box-shadow: 0 10px 30px rgba(255, 95, 162, .4);
  transition: transform .15s, box-shadow .2s;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(255, 95, 162, .55); }

.hero-art { display: grid; place-items: center; }
.hero-art img {
  width: 100%; max-width: 325px; height: auto; display: block;
  border-radius: 16px; border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .45);
  transform: rotate(-3deg);
  animation: float 5s ease-in-out infinite;
}
.hero-art .art-fallback { font-size: 72px; }
@keyframes float { 50% { transform: rotate(-3deg) translateY(-10px); } }

/* ---------- no-real-money notice ---------- */
.notice {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 20px; padding: 18px 20px; border-radius: var(--radius);
  background: rgba(61, 220, 151, .09);
  border: 1px solid rgba(61, 220, 151, .3);
  font-size: 14px; line-height: 1.6; color: #dcf6ea;
}
.notice-icon { font-size: 22px; line-height: 1.2; }
.notice b { color: #fff; }

/* ---------- games ---------- */
.lobby-body { display: grid; grid-template-columns: 1fr 250px; gap: 26px; margin-top: 32px; align-items: start; }
.section-title { font-size: 15px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.game-card {
  position: relative; padding: 0; cursor: pointer; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--card-line); background: var(--card);
  color: var(--text); font: inherit; text-align: left;
  transition: transform .18s, border-color .2s;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.game-thumb {
  position: relative; aspect-ratio: 325 / 234; display: grid; place-items: center;
  font-size: 44px; overflow: hidden;
  background: linear-gradient(140deg, var(--accent), transparent 130%);
}
.game-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.game-card:hover .game-thumb img { transform: scale(1.06); }
.game-meta { padding: 11px 13px 13px; }
.game-name { font-weight: 700; font-size: 14px; }
.game-tag { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.featured-flag {
  position: absolute; top: 10px; right: 10px; padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; background: rgba(0,0,0,.45); color: #ffd76e;
}

/* ---------- recently played ---------- */
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.recent-item {
  display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer;
  padding: 9px 12px; border-radius: 12px; font: inherit; text-align: left;
  background: var(--card); border: 1px solid var(--card-line); color: var(--text);
  transition: border-color .2s, transform .15s;
}
.recent-item:hover { border-color: var(--accent); transform: translateX(2px); }
.recent-art { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; }
.recent-item .art-fallback { font-size: 19px; width: 30px; text-align: center; flex: none; }
.recent-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-empty { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* ---------- game overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(9, 4, 17, .96); backdrop-filter: blur(6px); }
.overlay-bar { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-bottom: 1px solid var(--card-line); }
.overlay-title { font-weight: 700; }
.overlay-actions { display: flex; gap: 8px; }
.overlay-actions button {
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px;
  background: var(--card); border: 1px solid var(--card-line); color: var(--text);
}
.overlay-actions button:hover { background: rgba(255,255,255,.13); }
.overlay-frame { position: relative; flex: 1; }
.overlay-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.frame-loader { position: absolute; inset: 0; display: grid; place-items: center; gap: 14px; align-content: center; color: var(--muted); font-size: 13px; }
.frame-loader span {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.14); border-top-color: var(--pink);
  animation: rotate .8s linear infinite;
}
@keyframes rotate { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.footer {
  position: relative; z-index: 1;
  padding: 26px 24px 40px; text-align: center;
  font-size: 12.5px; color: var(--muted);
  border-top: 1px solid var(--card-line);
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 26px; }
  .hero-art { display: none; }
  .lobby-body { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .lobby { padding: 18px 16px 30px; }
}

.art-fallback { line-height: 1; }

/* ---------- in-game navigation ----------
   A floating bar over the frame, the way a webview wraps an embedded page.
   Sits below the safe-area inset so it clears the phone's home indicator. */
.game-nav {
  position: absolute; z-index: 10;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px;
}
.game-nav button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; font: inherit; font-weight: 700; color: var(--text);
  background: rgba(20, 10, 36, .82);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
  transition: transform .15s, background .2s, border-color .2s;
}
.game-nav button:hover { background: rgba(40, 22, 68, .92); border-color: rgba(255,255,255,.3); }
.game-nav button:active { transform: scale(.94); }
.game-nav svg {
  width: 20px; height: 20px; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.nav-back { width: 48px; height: 48px; border-radius: 50%; }
.nav-home { height: 48px; padding: 0 22px; border-radius: 999px; font-size: 14px; }

@media (max-width: 900px) {
  .game-nav { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); gap: 10px; }
  .nav-back { width: 44px; height: 44px; }
  .nav-home { height: 44px; padding: 0 18px; }
}

/* ---------- language switcher ---------- */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.lang {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 13px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-line);
  transition: border-color .2s, background .2s;
}
.lang:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.09); }
.lang-icon { font-size: 14px; line-height: 1; }
.lang select {
  appearance: none; cursor: pointer; padding-right: 4px;
  background: transparent; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
}
.lang select option { background: var(--bg-2); color: var(--text); }

@media (max-width: 560px) {
  .fun-pill { display: none; }
}

.frame-loader i { font-style: normal; }

/* Keeps the "just for fun" framing on screen while a game is open, since
   nothing inside the game frame can be relabelled from here. */
.overlay-bar { gap: 10px; }
.overlay-bar .overlay-title { flex: none; }
.overlay-pill { font-size: 11px; padding: 4px 10px; }
.overlay-bar > .overlay-actions { margin-left: auto; }

@media (max-width: 560px) {
  .overlay-pill { display: inline-block; }
}

/* ---------- legal pages ---------- */
.topbar .brand { text-decoration: none; color: inherit; }
.legal-back {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--card-line); background: var(--card);
  transition: color .2s, border-color .2s;
}
.legal-back:hover { color: var(--text); border-color: rgba(255,255,255,.3); }

.legal {
  position: relative; z-index: 1;
  max-width: 760px; margin: 0 auto; padding: 34px 24px 60px;
}
.legal h1 { font-size: clamp(26px, 4vw, 36px); margin: 0 0 6px; }
.legal-date { margin: 0 0 26px; font-size: 13px; color: var(--muted); }
.legal h2 {
  font-size: 17px; margin: 34px 0 10px;
  padding-top: 22px; border-top: 1px solid var(--card-line);
}
.legal p, .legal li { color: #d9cbec; line-height: 1.75; }
.legal p { margin: 0 0 14px; }
.legal ul { margin: 0 0 14px; padding-left: 20px; }
.legal li { margin-bottom: 8px; }
.legal b { color: #fff; }
.legal a { color: var(--pink); }

.legal-todo {
  margin: 0 0 30px; padding: 16px 18px; border-radius: var(--radius);
  background: rgba(255, 201, 60, .1); border: 1px solid rgba(255, 201, 60, .34);
  color: #f7ecd0; font-size: 14px; line-height: 1.65;
}
.legal-todo b { color: #ffd76e; }

.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }
.footer-links { display: block; margin-top: 8px; }
.footer-links a { margin: 0 9px; }
