* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 20%, #1a2550 0%, #0b1024 55%, #05070f 100%);
  color: #eef2ff; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }

#hub {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 16px;
}
header { text-align: center; }
h1 {
  font-size: clamp(30px, 9vw, 46px); line-height: 0.95; letter-spacing: 0.04em; font-weight: 900;
  background: linear-gradient(#fff6c8, #ffc73d 55%, #ff8a2a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #6b2c06) drop-shadow(0 0 18px rgba(255, 190, 60, 0.35));
}
h1 span {
  display: block; font-size: 0.55em; letter-spacing: 0.32em;
  background: linear-gradient(#e6f6ff, #7fd2ff); -webkit-background-clip: text; background-clip: text;
}
header p { margin-top: 10px; font-size: 15px; font-weight: 600; color: #aab8e6; }

#tiles {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  width: min(100%, 460px, calc((100vh - 250px) * 1));
}
.tile {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; overflow: hidden;
  border-radius: 22px; background: #10173a;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14), 0 8px 0 #050816, 0 12px 28px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s;
  animation: tileIn 0.45s ease-out backwards;
}
.tile:nth-child(2) { animation-delay: 0.06s; }
.tile:nth-child(3) { animation-delay: 0.12s; }
.tile:nth-child(4) { animation-delay: 0.18s; }
@keyframes tileIn { from { transform: translateY(24px) scale(0.9); opacity: 0; } }
button.tile:hover { transform: translateY(-3px); }
button.tile:active { transform: scale(0.95); }
.tile img, .tile svg { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.tile.has-badge { overflow: visible; } /* badges sit on the tile edge, clear of the painted titles */
.tile.soon {
  cursor: default; display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(135deg, #0e1430 0 14px, #121a3c 14px 28px);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07), 0 8px 0 #050816;
}
.soon b { display: block; font-size: 56px; color: #3b4a80; line-height: 1; }
.soon span { font-size: 13px; font-weight: 800; letter-spacing: 0.14em; color: #6a79ad; }

/* ---- A game on screen ---- */
#frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #05070f; }
#veil {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: #05070f; transition: opacity 0.3s;
}
#veil.fade { opacity: 0; pointer-events: none; }
#veil i {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid #26325e; border-top-color: #7fd2ff; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- The pack goal, one line under the tiles ---- */
#goal {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800; letter-spacing: 0.1em; color: #cdd8ff;
  background: rgba(20, 30, 70, 0.7); box-shadow: inset 0 0 0 2px rgba(127, 210, 255, 0.25);
}
#goalDots { display: flex; gap: 5px; }
#goalDots i { width: 11px; height: 11px; border-radius: 50%; background: #26325e; box-shadow: inset 0 0 0 2px #3a4a85; }
#goalDots i.on { background: #ffc73d; box-shadow: 0 0 8px rgba(255, 199, 61, 0.7); }
#goalCount { color: #ffc73d; }
#goal.champ { color: #ffe27a; background: linear-gradient(90deg, rgba(120, 70, 10, 0.75), rgba(160, 100, 20, 0.75)); box-shadow: inset 0 0 0 2px #ffc73d, 0 0 18px rgba(255, 190, 60, 0.4); }
#goal.champ #goalDots, #goal.champ #goalCount { display: none; }
#goal.tick { animation: goalTick 0.6s ease-out; }
@keyframes goalTick { 40% { transform: scale(1.12); } }

/* ---- Tile badges: NEW! on a game not yet opened, a tick once a level of it is cleared,
   CONTINUE on the one played last; the suggested game pulses gently. ---- */
.tile em {
  position: absolute; top: -9px; left: -6px; padding: 4px 9px; border-radius: 999px; pointer-events: none;
  font-style: normal; font-size: 12px; font-weight: 900; letter-spacing: 0.08em;
}
.tile em.new { color: #10131f; background: linear-gradient(#fff6c8, #ffc73d); box-shadow: 0 2px 0 #9a5a10, 0 0 12px rgba(255, 199, 61, 0.6); }
.tile em.cont { color: #fff; background: #2a7bff; box-shadow: 0 2px 0 #12408f; }
.tile em.done { left: auto; right: -6px; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; color: #10131f; background: #7dffa8; box-shadow: 0 2px 0 #1f7a45; }
.tile.suggest { animation: tileIn 0.45s ease-out backwards, suggest 1.8s ease-in-out 0.6s infinite; }
@keyframes suggest { 50% { box-shadow: 0 0 0 3px #ffc73d, 0 8px 0 #050816, 0 0 26px rgba(255, 199, 61, 0.65); } }

/* ---- "Try this game next" ---- */
#offer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(3, 5, 14, 0.72); }
#offer.inGame { inset: 0 0 auto 0; place-items: start center; padding: 64px 12px 0; background: none; pointer-events: none; }
.offerCard {
  position: relative; width: min(100%, 420px); display: grid; grid-template-columns: 76px 1fr; gap: 6px 12px; align-items: center;
  padding: 12px; border-radius: 20px; pointer-events: auto;
  background: linear-gradient(#1c2856, #121a3c); box-shadow: inset 0 0 0 2px rgba(255, 199, 61, 0.55), 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: offerIn 0.35s ease-out;
}
@keyframes offerIn { from { transform: translateY(-16px); opacity: 0; } }
#offerImg { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; grid-row: span 2; }
.offerText b { display: block; font-size: 16px; font-weight: 900; color: #ffe27a; padding-right: 26px; }
.offerText p { margin-top: 3px; font-size: 13px; font-weight: 600; color: #aab8e6; line-height: 1.3; }
.offerPlay {
  height: 44px; border: 0; border-radius: 14px; cursor: pointer; font: inherit; font-size: 17px; font-weight: 900; letter-spacing: 0.08em;
  color: #10131f; background: linear-gradient(#fff6c8, #ffc73d); box-shadow: 0 4px 0 #9a5a10;
}
.offerPlay:active { transform: scale(0.96); }
.offerClose {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
  font-size: 15px; color: #aab8e6; background: rgba(255, 255, 255, 0.06);
}
