/* Binary Games - shared styles (no frameworks, no external requests) */
:root {
  --bg: #0c0e17; --bg2: #121528; --card: #161a2d; --card2: #1d2240; --line: rgba(255, 255, 255, .08);
  --text: #eef0fb; --muted: #9aa0c0; --brand: #7c5cff; --brand2: #22d3ee; --hot: #ff5ca8; --good: #34d399; --warn: #fbbf24; --bad: #fb7185;
  --radius: 20px; --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f4f5fb; --bg2: #e9ebf6; --card: #fff; --card2: #f0f1fa; --line: rgba(15, 20, 50, .09);
  --text: #12162b; --muted: #5a6082; --shadow: 0 14px 30px -16px rgba(30, 40, 90, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; line-height: 1.5; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.wrap { width: min(1320px, 100% - 32px); margin-inline: auto; }
.bg-glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; background:
  radial-gradient(60vmax 40vmax at 12% -10%, rgba(124, 92, 255, .22), transparent 60%),
  radial-gradient(50vmax 36vmax at 100% 10%, rgba(34, 211, 238, .12), transparent 60%),
  radial-gradient(50vmax 40vmax at 60% 110%, rgba(255, 92, 168, .1), transparent 60%); }
:root[data-theme="light"] .bg-glow { opacity: .55; }
.demobar { text-align: center; padding: 8px 14px; font-size: .8rem; background: linear-gradient(100deg, rgba(124, 92, 255, .9), rgba(34, 211, 238, .8)); color: #fff; }
.demobar b { letter-spacing: .08em; text-transform: uppercase; margin-right: 8px; }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar .wrap { height: 64px; display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.logo i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 8px 20px -8px var(--brand); }
.logo svg { width: 20px; height: 20px; fill: currentColor; }
.spacer { flex: 1; }
.search { position: relative; width: min(340px, 40vw); }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2.4; stroke-linecap: round; }
.search input { width: 100%; height: 42px; padding: 0 16px 0 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: .92rem; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 92, 255, .25); }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.tool:hover { border-color: var(--brand); }
.tool svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ad slots (collapsed until configured in the admin panel) ---------- */
.ad { display: none; margin: 18px auto; text-align: center; overflow: hidden; }
.ad.on { display: block; }
.ad iframe { border: 0; width: 100%; display: block; background: transparent; }
body.adpreview .ad { display: block; min-height: 90px; border: 2px dashed var(--brand); border-radius: 12px; color: var(--muted); padding: 24px 0; }
body.adpreview .ad::before { content: "Ad slot: " attr(data-slot); }
.ad-feed { grid-column: 1 / -1; margin: 2px 0; }

/* ---------- buttons ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; }
.pill.hot { background: linear-gradient(100deg, var(--hot), #ff8a5c); }
.play-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 28px; border-radius: 999px; border: 0; color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; background: linear-gradient(100deg, #22c55e, #16a34a); box-shadow: 0 14px 30px -10px rgba(34, 197, 94, .7); transition: transform .2s, box-shadow .2s, filter .2s; white-space: nowrap; }
.play-btn svg { width: 20px; height: 20px; fill: currentColor; }
.play-btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.08); }
.play-btn.sm { padding: 9px 20px; font-size: .9rem; }
.play-btn.xl { font-size: clamp(1.15rem, 2.4vw, 1.5rem); padding: 18px 54px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5), 0 14px 30px -10px rgba(34, 197, 94, .7); } 50% { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0), 0 14px 30px -10px rgba(34, 197, 94, .7); } }

/* ---------- home ---------- */
.intro { padding: 30px 0 4px; }
.intro h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.02em; line-height: 1.1; }
.intro h1 span { background: linear-gradient(100deg, var(--brand), var(--brand2) 55%, var(--hot)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro p { margin: 8px 0 0; color: var(--muted); }
.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.section-head .count { color: var(--muted); font-size: .85rem; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 16px; border-radius: 999px; font-size: .84rem; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--muted); transition: .2s; }
.chip:hover { border-color: var(--brand); color: var(--text); }
.chip.active { background: linear-gradient(100deg, var(--brand), #5b8cff); color: #fff; border-color: transparent; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.rail { display: none; }
@media (min-width: 1240px) { .layout.has-rail { grid-template-columns: minmax(0, 1fr) 320px; } .layout.has-rail .rail { display: block; } }
.rail .sticky { position: sticky; top: 84px; }

/* one column on small windows, two on larger ones, three on wide ones (two when the ad rail takes space) */
.list { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .layout:not(.has-rail) .list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .layout.has-rail .list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.gcard { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, border-color .3s; opacity: 0; animation: rise .5s cubic-bezier(.2, .8, .2, 1) forwards; }
.gcard:hover { transform: translateY(-5px); border-color: var(--brand); box-shadow: 0 22px 44px -18px rgba(124, 92, 255, .5); }
.cover { position: relative; display: block; width: 100%; aspect-ratio: 1024 / 500; overflow: hidden; background: var(--card2); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.gcard:hover .cover img { transform: scale(1.05); }
.cover .badge { position: absolute; top: 12px; left: 12px; font-size: .66rem; font-weight: 800; letter-spacing: .08em; padding: 4px 10px; border-radius: 999px; color: #fff; background: linear-gradient(100deg, var(--hot), #ff8a5c); }
.cover .badge.new { background: linear-gradient(100deg, var(--brand2), #5b8cff); }
.cover .badge.feat { background: linear-gradient(100deg, #f59e0b, #ef4444); }
.cover.nocover img.blur { position: absolute; inset: -10%; width: 120%; height: 120%; max-width: none; filter: blur(22px) saturate(1.3) brightness(.7); }
.cover.nocover img.center { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 38%; height: auto; aspect-ratio: 1; border-radius: 24%; box-shadow: 0 16px 36px -10px rgba(0, 0, 0, .7); }
.gcard .row { display: flex; align-items: center; gap: 14px; padding: 14px 16px 6px; }
.gicon { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; flex: none; background: var(--card2); box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .6); border: 1px solid var(--line); }
.gcard .txt { min-width: 0; flex: 1; }
.gcard h3 { margin: 0; font-size: 1.1rem; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .cat { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; font-size: .78rem; color: var(--muted); }
.gcard .cat b { font-weight: 700; color: var(--brand2); background: rgba(34, 211, 238, .1); padding: 2px 9px; border-radius: 999px; }
.gcard .desc { margin: 0; padding: 4px 16px 16px; color: var(--muted); font-size: .9rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.sk { background: linear-gradient(100deg, var(--card) 30%, var(--card2) 50%, var(--card) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius); aspect-ratio: 1024 / 640; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 70px 10px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 8px 0 4px; }
.empty .big { font-size: 3.4rem; }

/* ---------- footer ---------- */
.footer { margin-top: 60px; border-top: 1px solid var(--line); padding: 28px 0 38px; color: var(--muted); font-size: .88rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }

/* ---------- game detail page ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; margin: 16px 0 12px; font-size: .86rem; color: var(--muted); flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }
.detail { max-width: 1024px; }
.hero-cover { position: relative; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 1024 / 500; background: var(--card2); }
.hero-cover img.main { width: 100%; height: 100%; object-fit: cover; }
.hero-cover.nocover img.blur { position: absolute; inset: -10%; width: 120%; height: 120%; max-width: none; object-fit: cover; filter: blur(26px) saturate(1.3) brightness(.65); }
.hero-cover.nocover img.center { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 26%; height: auto; aspect-ratio: 1; border-radius: 24%; box-shadow: 0 20px 44px -10px rgba(0, 0, 0, .75); }
.playbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.playbar .play-btn { flex: 1 1 260px; }
.titlerow { display: flex; align-items: center; gap: 16px; margin-top: 26px; }
.titlerow .gicon { width: 84px; height: 84px; border-radius: 22px; }
.titlerow h1 { margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.02em; line-height: 1.1; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; margin-top: 6px; }
.stats b { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; margin-top: 18px; }
.panel h2 { margin: 0 0 8px; font-size: 1.05rem; }
.panel p { margin: 0; white-space: pre-line; color: var(--muted); line-height: 1.75; }
.shots { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.shots img { height: 190px; border-radius: 14px; border: 1px solid var(--line); flex: none; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, .9); display: none; place-items: center; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 14px; }
.toast { position: fixed; left: 50%; bottom: 26px; translate: -50% 0; z-index: 100; padding: 11px 20px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: .9rem; box-shadow: var(--shadow); }
@media (max-width: 560px) { .titlerow .gicon { width: 64px; height: 64px; border-radius: 18px; } }

/* ---------- full-page player ---------- */
body.player { height: 100dvh; overflow: hidden; background: #000; }
.pbar { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--bg); border-bottom: 1px solid var(--line); }
.pbar .logo { font-size: .98rem; }
.pbar .logo i { width: 28px; height: 28px; border-radius: 9px; }
.pbar .logo svg { width: 15px; height: 15px; }
.pbar .gname { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pbar .tool { padding: 5px 12px; font-size: .78rem; }
.frame { position: fixed; inset: 44px 0 0 0; background: #000; }
body.nobar .pbar { display: none; }
body.nobar .frame { inset: 0; }
.frame iframe { width: 100%; height: 100%; border: 0; background: #000; display: block; }
.frame .loading { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; background: #05060d; z-index: 2; }
.frame .msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #fff; }
.spin { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .12); border-top-color: var(--brand); border-right-color: var(--brand2); animation: spin .9s linear infinite; margin-inline: auto; }
@keyframes spin { to { rotate: 360deg; } }
.barToggle { position: fixed; right: 10px; top: calc(env(safe-area-inset-top) + 54px); z-index: 6; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(8, 10, 22, .55); color: #fff; font-size: 14px; display: grid; place-items: center; opacity: .8; }
body.nobar .barToggle { top: calc(env(safe-area-inset-top) + 10px); }
.rotate { position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 6; padding: 9px 16px; border-radius: 999px; background: rgba(8, 10, 22, .85); border: 1px solid rgba(255, 255, 255, .2); color: #fff; font-size: .82rem; display: flex; gap: 10px; align-items: center; }
.rotate button { border: 0; background: none; color: #fff; opacity: .7; font-size: 1rem; }

@media (max-width: 860px) { .search { display: none; } .search.show-mobile { display: block; width: 100%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- static pages (about / privacy) ---------- */
.doc { max-width: 780px; margin: 36px auto; }
.doc h1 { letter-spacing: -.02em; }
.doc h2 { margin-top: 28px; }
.doc p, .doc li { color: var(--muted); line-height: 1.8; }
