/* Vibcade — platform stylesheet
   Design language: "neon arcade at night" — deep violet-black, aurora glow,
   glass surfaces, per-game accent colors, playful micro-motion.
   No external assets; system fonts; prefers-reduced-motion respected. */

:root {
  --bg: #08070f;
  --bg-soft: #14121f;
  --card: #191627;
  --card-hover: #221e36;
  --line: rgba(255, 255, 255, .07);
  --text: #f5f3ff;
  --text-dim: #a5a0c8;
  --brand: #8b5cf6;
  --brand-2: #22d3ee;
  --brand-3: #ff3d9e;
  --gold: #ffd600;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  --grad: linear-gradient(100deg, var(--brand), var(--brand-3) 55%, var(--brand-2));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: #35304f var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(139, 92, 246, .45); }

/* ---------- ambient background (aurora + dot grid) ---------- */
body::before, body::after {
  content: ""; position: fixed; z-index: -2; pointer-events: none;
  width: 75vmax; height: 75vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22;
}
body::before {
  top: -38vmax; right: -22vmax;
  background: radial-gradient(closest-side, var(--brand), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
body::after {
  bottom: -42vmax; left: -25vmax;
  background: radial-gradient(closest-side, #0e7490, transparent 70%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-6vmax, 5vmax, 0) scale(1.15); }
}

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 13px clamp(16px, 4vw, 40px);
  background: rgba(8, 7, 15, .78);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 22px; letter-spacing: .04em; }
.logo .spark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); background-size: 200% 200%;
  font-size: 19px;
  box-shadow: 0 4px 18px rgba(139, 92, 246, .55);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.logo:hover .spark { transform: rotate(-8deg) scale(1.1); }
.logo b {
  background: linear-gradient(90deg, #fff 20%, #cdb7ff 60%, #8fe8ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.search {
  flex: 1; max-width: 480px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; color: var(--text-dim);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within {
  border-color: rgba(139, 92, 246, .65);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .16), 0 0 24px rgba(139, 92, 246, .18);
}
.search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px;
}
.search input::placeholder { color: #6f6a93; }
.nav-links { margin-left: auto; display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 15px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--text-dim);
  transition: .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: rgba(255, 255, 255, .08); }

/* ---------- hero ---------- */
.hero { padding: 42px clamp(16px, 4vw, 40px) 8px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 52px); margin: 0 0 8px; font-weight: 900;
  letter-spacing: -.02em; line-height: 1.05;
}
.hero h1 em {
  font-style: normal;
  background: var(--grad); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }
.hero p { margin: 0 0 16px; color: var(--text-dim); font-size: 17px; max-width: 560px; }
.hero-perks { display: flex; flex-wrap: wrap; gap: 10px; }
.perk {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 700; color: var(--text);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px;
}

/* ---------- category chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 22px clamp(16px, 4vw, 40px) 4px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-dim);
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .15s, color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .28); transform: translateY(-2px); }
.chip.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 4px 18px rgba(139, 92, 246, .4);
}

/* ---------- game grid ---------- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  padding: 22px clamp(16px, 4vw, 40px) 60px;
}
.tile {
  --c: var(--brand);
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  aspect-ratio: 1; background: var(--card); box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s ease, border-color .22s ease;
  animation: pop-in .45s cubic-bezier(.22, .9, .36, 1) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-6px) scale(1.025);
  border-color: color-mix(in srgb, var(--c) 65%, transparent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55), 0 8px 40px color-mix(in srgb, var(--c) 38%, transparent);
  z-index: 2;
}
.tile.featured { grid-column: span 2; grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile img.preview { position: absolute; inset: 0; opacity: 0; transition: opacity .18s ease; }
.tile:hover img.preview, .tile:focus-visible img.preview { opacity: 1; }

/* shine sweep on hover */
.tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .14) 48%, transparent 62%);
  transform: translateX(-110%);
}
.tile:hover::after { transition: transform .6s ease; transform: translateX(110%); }

/* centered play chip on hover */
.tile .go {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  opacity: 0; transition: opacity .18s ease;
}
.tile .go i {
  font-style: normal; font-weight: 900; font-size: 15px; letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(8, 7, 15, .72); border: 1px solid rgba(255, 255, 255, .25);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff; padding: 10px 18px; border-radius: 999px;
  transform: scale(.9); transition: transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
.tile:hover .go { opacity: 1; }
.tile:hover .go i { transform: scale(1); }

.tile .overlay {
  position: absolute; inset: auto 0 0 0; padding: 30px 12px 11px;
  background: linear-gradient(transparent, rgba(5, 4, 10, .92));
  opacity: 0; transform: translateY(6px); transition: .18s;
}
.tile:hover .overlay, .tile:focus-visible .overlay { opacity: 1; transform: none; }
.tile .overlay .t { font-weight: 800; font-size: 15px; }
.tile .overlay .m { font-size: 12px; color: var(--text-dim); display: flex; gap: 10px; margin-top: 2px; }
.tile .badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  font-size: 11px; font-weight: 800; letter-spacing: .06em;
  background: var(--grad); color: #fff;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.empty { grid-column: 1 / -1; text-align: center; color: var(--text-dim); padding: 60px 0; font-size: 15px; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line); padding: 28px clamp(16px, 4vw, 40px) 44px;
  color: var(--text-dim); font-size: 14px; display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between;
}
footer .links { display: flex; gap: 18px; }
footer a:hover { color: var(--text); }

/* ---------- play page ---------- */
.play-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px;
  padding: 22px clamp(16px, 3vw, 36px) 50px; align-items: start;
}
/* grid children must be allowed to shrink below their content's min-content
   width, or an intrinsically-wide child (the aspect-ratio stage) forces the
   whole column past the viewport on mobile. */
.play-wrap > * { min-width: 0; }
@media (max-width: 980px) { .play-wrap { grid-template-columns: minmax(0, 1fr); } }

.stage {
  position: relative; border-radius: var(--radius); overflow: hidden; background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 60px rgba(139, 92, 246, .13);
  aspect-ratio: 16 / 10; min-height: 420px; min-width: 0; width: 100%;
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* loading shimmer until the game iframe is ready */
.stage.loading::before {
  content: ""; position: absolute; inset: 0; z-index: 4;
  background: linear-gradient(115deg, var(--bg-soft) 40%, #1e1a30 50%, var(--bg-soft) 60%);
  background-size: 300% 100%;
  animation: stage-shimmer 1.2s linear infinite;
}
.stage.loading::after {
  content: "🕹️"; position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; font-size: 44px;
  animation: bounce .9s ease-in-out infinite alternate;
}
@keyframes stage-shimmer { to { background-position: -300% 0; } }
@keyframes bounce { from { transform: translateY(-6px); } to { transform: translateY(6px); } }

.stage .ad-note {
  position: absolute; top: 10px; right: 12px; z-index: 6;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  background: rgba(8, 7, 15, .66); border: 1px solid rgba(255, 214, 0, .35);
  color: var(--gold); padding: 5px 12px; border-radius: 999px; display: none;
  animation: pulse 1.6s ease-in-out infinite;
}
.stage.adplaying .ad-note { display: block; }
@keyframes pulse { 50% { opacity: .55; } }

.game-meta {
  margin-top: 14px; padding: 14px 16px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--line); border-radius: 16px;
}
.game-meta h1 { font-size: 24px; margin: 0; font-weight: 900; letter-spacing: -.01em; }
.game-meta .cat {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  background: var(--bg-soft); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px;
}
.game-meta .spacer { flex: 1; }
.btn {
  border: none; cursor: pointer; font-weight: 700; font-size: 14px;
  padding: 10px 18px; border-radius: 12px; transition: .15s;
  background: var(--bg-soft); color: var(--text); border: 1px solid rgba(255, 255, 255, .12);
}
.btn:hover { background: var(--card-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  background: var(--grad); border-color: transparent;
  box-shadow: 0 4px 18px rgba(139, 92, 246, .35);
}
.btn.primary:hover { filter: brightness(1.12); box-shadow: 0 6px 24px rgba(139, 92, 246, .5); }

/* Share — the standout secondary action: recognizable mobile share glyph on a
   bright cyan fill so it reads instantly against Restart/Fullscreen. */
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  color: #04181c; border-color: transparent;
  background: linear-gradient(100deg, var(--brand-2), #5cf2d6);
  box-shadow: 0 4px 18px rgba(34, 211, 238, .4);
}
.share-btn:hover { background: linear-gradient(100deg, var(--brand-2), #5cf2d6); filter: brightness(1.08); box-shadow: 0 7px 26px rgba(34, 211, 238, .58); }
.share-btn svg { display: block; }
.share-btn:hover svg { animation: share-nudge .5s ease; }
@keyframes share-nudge {
  40% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.stars { display: inline-flex; gap: 2px; font-size: 20px; cursor: pointer; user-select: none; }
.stars span { color: #3b3658; transition: transform .12s, color .12s; }
.stars span:hover { transform: scale(1.25); }
.stars span.lit { color: var(--gold); text-shadow: 0 0 14px rgba(255, 214, 0, .45); }
.stars.done { pointer-events: none; }

.desc { color: var(--text-dim); line-height: 1.6; font-size: 15px; padding: 4px 4px 8px; max-width: 780px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 0 6px; }
.stat-row span {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 600;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
}
.stat-row b { color: var(--text); font-variant-numeric: tabular-nums; }

.sidebar h3 {
  font-size: 13px; color: var(--text-dim); font-weight: 800; margin: 4px 0 12px;
  letter-spacing: .14em;
}
.side-tile {
  --c: var(--brand);
  display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 16px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .15s;
}
.side-tile:hover {
  background: var(--card); transform: translateX(4px);
  border-color: color-mix(in srgb, var(--c) 45%, transparent);
}
.side-tile img { width: 64px; height: 64px; border-radius: 13px; object-fit: cover; }
.side-tile .t { font-weight: 700; font-size: 14px; }
.side-tile .m { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

/* ---------- toast (share confirmation) ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px); z-index: 60;
  max-width: min(92vw, 420px); pointer-events: none;
  padding: 12px 18px; border-radius: 14px;
  background: rgba(25, 22, 39, .92); backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--text); font-size: 14px; font-weight: 700; text-align: center;
  overflow-wrap: anywhere;
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- docs & content pages ---------- */
.content { max-width: 880px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 40px) 70px; line-height: 1.65; }
.content h1 { font-size: 34px; font-weight: 900; letter-spacing: -.01em; }
.content h2 { margin-top: 38px; font-size: 23px; }
.content p, .content li { color: #c9cde8; font-size: 15.5px; }
.content code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 13.5px; }
.content pre {
  background: #0a0912; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.5;
}
.content pre code { background: none; border: none; padding: 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.pill { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 14px; }
.pill b {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-size: 16px;
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav-links { margin-left: 0; }
  .hero { padding-top: 26px; }
  .stage { min-height: 300px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .hero h1 em, .stage.loading::after, .stage .ad-note { animation: none; }
  .tile, .share-btn:hover svg { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
