:root {
  --bg: #0a0e1a; --card: #141a2e; --ink: #e8ecf4; --muted: #9aa6c0;
  --accent: #22d3ee; --accent-2: #a78bfa; --accent-3: #f472b6; --line: #26304a;
  --grad: linear-gradient(135deg, #22d3ee, #a78bfa 55%, #f472b6);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 12% -5%, rgba(34,211,238,.14), transparent 60%),
    radial-gradient(ellipse 60% 40% at 88% 5%, rgba(167,139,250,.14), transparent 60%),
    var(--bg);
  color: var(--ink); line-height: 1.6; }
h1, h2, h3, .logo a, .tab, .badge, .play, .featured-kicker { font-family: 'Baloo 2', 'Inter', system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-head { max-width: 64rem; margin: 0 auto; padding: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.logo { font-size: 1.4rem; margin: 0; }
.logo a { color: var(--ink); text-decoration: none; font-weight: 700; }
.logo-icon { width: 1.5rem; height: 1.5rem; vertical-align: -0.35rem; margin-right: .45rem; border-radius: 4px; }

.featured { position: relative; height: 16rem; margin-bottom: 2.5rem; }
.featured-card { position: absolute; inset: 0; display: block; border-radius: 1rem; overflow: hidden; border: 1px solid var(--line); opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.featured-card.active { opacity: 1; pointer-events: auto; }
.featured-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.featured-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 3rem 1.5rem 1.5rem; background: linear-gradient(transparent, rgba(15,23,42,.96)); }
.featured-kicker { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: .4rem; }
.featured-body h2 { margin: 0 0 .3rem; font-size: 1.6rem; }
.featured-body p { color: var(--muted); margin: 0 0 .6rem; font-size: .95rem; }
.featured-play { font-weight: 600; color: var(--accent); }

.search-bar { flex: 1; min-width: 12rem; max-width: 24rem; }
.search { width: 100%; max-width: 26rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1.2rem; color: var(--ink); font-size: .95rem; }
.search:focus { outline: none; border-color: var(--accent); }
.random-btn { background: var(--grad); color: #062033; border: none; border-radius: 999px; padding: .55rem 1.1rem; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.random-btn:hover { filter: brightness(1.1); }
.random-btn .dice { display: inline-block; margin-right: .32rem; animation: dice-shake 3s ease-in-out infinite; }
.random-btn:hover .dice { animation-duration: .5s; }
@keyframes dice-shake { 0%, 60%, 100% { transform: rotate(0); } 66% { transform: rotate(-15deg); } 74% { transform: rotate(12deg); } 82% { transform: rotate(-6deg); } 90% { transform: rotate(2deg); } }
.search::placeholder { color: var(--muted); }

main { max-width: 64rem; margin: 0 auto; padding: 0 1rem 3rem; }

.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.tab { background: var(--card); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .4rem 1rem; font-size: .85rem; cursor: pointer; }
.tab:hover { border-color: var(--accent); color: var(--ink); }
.tab.active { background: var(--grad); color: #062033; border-color: transparent; font-weight: 700; }
.cat-section { margin-bottom: 2.5rem; }
.cat-section h2 { display: inline-block; position: relative; font-size: 1.5rem; margin: 0 0 1rem; padding-bottom: .4rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cat-section h2::after { content: ''; position: absolute; left: 0; bottom: 0; width: 3.5rem; height: 3px; border-radius: 999px; background: var(--grad); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.card { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: .75rem; overflow: hidden; color: var(--ink); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; animation: cardIn .5s ease backwards; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,.45); }
.cover { position: relative; display: flex; align-items: center; justify-content: center; height: 9rem; flex: none; overflow: hidden; background: #1a2138; }
.cover::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); transform: translateX(-100%); animation: shimmer 1.6s infinite; }
.cover-img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; transition: transform .25s ease; }
@keyframes shimmer { to { transform: translateX(100%); } }
.card:hover .cover-img { transform: scale(1.07); }
.play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .2s ease; }
.card:hover .play-overlay { opacity: 1; }
.play-icon { width: 3rem; height: 3rem; border-radius: 50%; background: rgba(34,211,238,.9); color: #062a33; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; padding-left: .15rem; }
.emoji { font-size: 3.4rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.body { padding: .9rem 1.1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.cat-row { display: flex; gap: .4rem; align-items: center; }
.cat { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-2); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .55rem; }
.free-tag { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #4ade80; border: 1px solid rgba(74,222,128,.4); border-radius: 999px; padding: .1rem .55rem; }
.card h3 { margin: .5rem 0 .3rem; font-size: 1.15rem; }
.card p { color: var(--muted); font-size: .9rem; margin: 0 0 .6rem; }
.play { align-self: flex-start; margin-top: auto; display: inline-block; font-weight: 700; font-size: .85rem; color: #062033; background: var(--grad); padding: .42rem 1rem; border-radius: 999px; }
.badge { position: absolute; top: .6rem; left: .6rem; z-index: 5; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: .3rem .62rem; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.badge.new { background: linear-gradient(135deg, #22d3ee, #a78bfa); color: #062033; }
.badge.hot { background: linear-gradient(135deg, #fb923c, #f472b6); color: #fff; }

footer { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem 4rem; color: var(--muted); font-size: .9rem; }
footer nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* detail + static pages */
.bar { max-width: 64rem; margin: 0 auto; padding: 1rem; }
.crumbs { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs .crumb-cur { color: var(--ink); font-weight: 600; }
.detail main h1, .page main h1 { font-size: 2rem; margin-bottom: .25rem; }
.lead { color: var(--muted); max-width: 46rem; }
.howto, .tips, .about { background: var(--card); border: 1px solid var(--line); border-radius: .75rem;
  padding: 1rem 1.2rem; margin: 1.5rem 0; max-width: 46rem; }
.howto summary, .tips summary, .about summary { margin: 0 0 .5rem; font-size: 1.05rem; font-weight: 600; cursor: pointer; }
.tips p { color: var(--muted); }
.tips ul { margin: .5rem 0; padding-left: 1.2rem; color: var(--muted); }
.tips li { margin: .4rem 0; }
.game-frame { position: relative; margin: 1.5rem 0; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.frame-inner { position: relative; width: 100%; }
.game-frame iframe { width: 100%; height: 70vh; min-height: 28rem; border: 0; display: block; background: #000; }
.game-frame.portrait { display: flex; justify-content: center; }
.game-frame.portrait .frame-inner { width: 100%; max-width: 440px; }
.game-frame.portrait iframe { width: 100%; height: auto; aspect-ratio: var(--ratio); }
.fullscreen-btn { position: absolute; top: 10px; left: 10px; z-index: 10; width: 40px; height: 40px; display: grid; place-items: center; background: rgba(10,14,26,.62); color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); box-shadow: 0 2px 10px rgba(0,0,0,.4); transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.fullscreen-btn:hover { background: rgba(34,211,238,.22); border-color: var(--accent); transform: scale(1.06); }
.fullscreen-btn:active { transform: scale(.95); }
.fullscreen-btn:focus { outline: none; }
.game-frame:fullscreen { display: flex; align-items: center; justify-content: center; }
.game-frame:fullscreen .frame-inner { width: 100%; max-width: none; height: 100%; }
.game-frame:fullscreen iframe { width: 100%; height: 100%; aspect-ratio: auto; }
.game-frame:fullscreen .fullscreen-btn { display: none; }
.game-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; background: #0a0e1a; z-index: 5; color: var(--muted); font-size: .9rem; }
.spinner { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 3px solid var(--line); border-top-color: #22d3ee; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.game-nav { display: flex; gap: .6rem; justify-content: center; margin: 1.5rem 0; }
.nav-btn { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .55rem 1.2rem; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; }
.nav-btn:hover { border-color: var(--accent); text-decoration: none; }
.nav-btn.random-btn { background: var(--grad); color: #062033; border: none; }
.more-games { max-width: 64rem; margin: 0 auto; padding: 1rem 1rem 2rem; }
.more-games h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .75rem; }
.mini-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: .6rem; overflow: hidden; color: var(--ink); transition: transform .15s ease, border-color .15s ease; }
.mini-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.mini-card .cover { height: 6rem; }
.mini-card h3 { font-size: .8rem; padding: .45rem .55rem; margin: 0; }
.page main { max-width: 46rem; }
.page h2 { margin-top: 1.75rem; }

@media (max-width: 40rem) {
  .game-frame iframe { height: 60vh; min-height: 22rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .card .cover { height: 7.5rem; }
  .card h3 { font-size: 1rem; }
  .card p { display: none; }
  .card .free-tag { display: none; }
  .play { padding: .32rem .8rem; font-size: .78rem; }
}
