/* Happy Game — public theme. Fonts: Paytone One (display) + Nunito (body). Palette: cream / sunny / coral / teal / ink. */
/* Self-hosted fonts (SIL OFL), latin subset only — avoids render-blocking Google Fonts CSS. */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/static/fonts/nunito-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Paytone One'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/paytone-one-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #FFF8EC; --bg2: #FFEFD2; --card: #FFFFFF; --ink: #2B2340; --ink2: #6B6180; --line: #F0E1C4;
  --sun: #FFC93C; --sun2: #FFB000; --coral: #FF6B6B; --teal: #1FB5A8; --teal-ink: #0B7268; --coral-ink: #C73A40; --grape: #8E6CF0;
  --shadow: 0 3px 0 #EBD7B0, 0 8px 22px rgba(120, 80, 20, .10);
  --r: 18px; --disp: 'Paytone One', 'Nunito', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #1B1530; --bg2: #251D40; --card: #2C2350; --ink: #FFF3DC; --ink2: #BFB3DA; --line: #3B3066; --teal-ink: #4FE0D2;
  --shadow: 0 3px 0 #120D22, 0 8px 22px rgba(0, 0, 0, .35); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #1B1530; --bg2: #251D40; --card: #2C2350; --ink: #FFF3DC; --ink2: #BFB3DA; --line: #3B3066; --teal-ink: #4FE0D2;
  --shadow: 0 3px 0 #120D22, 0 8px 22px rgba(0, 0, 0, .35); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, .logo span, .btn-play { font-family: var(--disp); font-weight: 400; letter-spacing: .2px; }
button { font: inherit; color: inherit; cursor: pointer; }
main { max-width: 1320px; margin: 0 auto; padding: 14px 16px 40px; }

/* ---------- top bar ---------- */
.top { background: var(--sun); position: sticky; top: 0; z-index: 30; box-shadow: 0 3px 0 var(--sun2); }
.top-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo .smile { width: 40px; height: 40px; transition: transform .3s; }
.logo:hover .smile { transform: rotate(-14deg) scale(1.06); }
.logo span { font-size: 25px; color: #2B2340; line-height: 1; }
.logo b { color: #fff; -webkit-text-stroke: 1.5px #2B2340; paint-order: stroke fill; margin-left: 1px; }
.search { flex: 1; display: flex; max-width: 560px; margin: 0 auto; background: #fff; border: 3px solid #2B2340; border-radius: 999px; overflow: hidden; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 9px 16px; font: 700 15px 'Nunito', sans-serif; background: transparent; color: #2B2340; }
.search button { border: 0; background: var(--coral); color: #fff; width: 48px; display: grid; place-items: center; }
.search button svg { width: 20px; height: 20px; }
.toplinks { display: flex; gap: 4px; }
.toplinks a { font-weight: 800; color: #2B2340; padding: 6px 12px; border-radius: 999px; }
.toplinks a:hover { background: rgba(255,255,255,.55); }
.msearch { display: none; width: 36px; height: 36px; border-radius: 50%; background: var(--coral); color: #fff; place-items: center; flex-shrink: 0; margin-left: auto; }
.msearch svg { width: 19px; height: 19px; }
.theme { border: 0; background: #2B2340; color: var(--sun); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; flex-shrink: 0; }

/* ---------- category chips ---------- */
.chips { background: var(--bg2); border-bottom: 2px solid var(--line); }
.chips-in { max-width: 1320px; margin: 0 auto; display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; }
.chips-in::-webkit-scrollbar { display: none; }
.chips a { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 6px 14px 6px 8px; background: var(--card); border-radius: 999px; font-weight: 800; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap; transition: transform .15s; }
.chips a span { width: 26px; height: 26px; display: grid; place-items: center; background: var(--bg2); border-radius: 50%; font-size: 14px; }
.chips a:hover { transform: translateY(-2px); }
.chips a.on { background: #0B7268; color: #fff; }
.chips a.on span { background: rgba(255,255,255,.25); }

/* ---------- cards ---------- */
.card { position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; transition: transform .18s cubic-bezier(.3,1.6,.6,1), box-shadow .18s; }
.card:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 5px 0 var(--sun2), 0 14px 26px rgba(120,80,20,.16); }
.card .th { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg2); }
.card .th img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .th img { transform: scale(1.06); }
.card .nm { padding: 8px 10px 10px; font-weight: 800; font-size: 14.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .bs { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.b { font-style: normal; font: 900 11px 'Nunito', sans-serif; padding: 3px 8px; border-radius: 999px; background: #fff; color: #2B2340; box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.b.new { background: var(--coral-ink); color: #fff; } .b.top { background: var(--sun); } .b.mob { padding: 2px 6px; }
.card.sm .nm { font-size: 13px; padding: 6px 8px 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.shelf { margin-top: 28px; }
.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.sh h2 { margin: 0; font-size: 23px; display: flex; align-items: center; gap: 10px; }
.sh .ic { width: 38px; height: 38px; display: grid; place-items: center; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); font-size: 19px; }
.more { font-weight: 900; color: var(--teal-ink); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.more:hover { background: var(--card); }
.row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.row .card:nth-child(n+13) { display: none; }
@media (max-width: 1100px) { .row { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) {
  .row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; gap: 12px; scrollbar-width: none; }
  .row::-webkit-scrollbar { display: none; }
  .row .card { flex: 0 0 42%; scroll-snap-align: start; }
  .row .card:nth-child(n+13) { display: flex; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-top: 6px; }
.hero-big { position: relative; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 16 / 9; background: var(--bg2); }
.hero-big img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.hero-big:hover img { transform: scale(1.04); }
.hero-txt { position: absolute; inset: auto 0 0 0; padding: 60px 22px 20px; background: linear-gradient(transparent, rgba(30,20,50,.82)); color: #fff; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hero-txt i { font-style: normal; font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; background: var(--coral-ink); padding: 3px 10px; border-radius: 999px; }
.hero-txt b { font: 400 34px/1.1 var(--disp); text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.hero-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn-play { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--sun); color: #2B2340; font-size: 18px; padding: 9px 22px; border-radius: 999px; box-shadow: 0 4px 0 var(--sun2); transition: transform .12s; }
.btn-play:hover { transform: translateY(-2px); } .btn-play:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sun2); }
.home-h1 { font-size: 15px; font-family: 'Nunito', sans-serif; font-weight: 800; color: var(--ink2); margin: 18px 0 0; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } .hero-txt b { font-size: 26px; } }
@media (max-width: 760px) { .hero-side { display: flex; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; } .hero-side .card { flex: 0 0 42%; } }

/* ---------- listings ---------- */
.crumbs { font-size: 13.5px; font-weight: 700; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.crumbs a:hover { color: var(--teal-ink); } .crumbs b { color: var(--ink); font-weight: 800; }
.lhead h1 { margin: 0 0 4px; font-size: 32px; } .lhead h1 small { font: 700 16px 'Nunito', sans-serif; color: var(--ink2); }
.lhead p { margin: 0 0 18px; color: var(--ink2); font-weight: 600; max-width: 760px; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 28px 0 0; }
.pager a, .pager b { min-width: 42px; text-align: center; padding: 8px 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; }
.pager b { background: #0B7268; color: #fff; }
.empty { padding: 30px; text-align: center; background: var(--card); border-radius: var(--r); font-weight: 700; color: var(--ink2); }
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.catcard { position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow); background: var(--teal); }
.catcard img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.catcard span { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; color: #fff; font: 400 22px var(--disp); text-shadow: 0 2px 0 rgba(0,0,0,.35); background: linear-gradient(transparent 30%, rgba(30,20,50,.7)); }
.catcard i { font-style: normal; font-size: 26px; } .catcard small { font: 800 13px 'Nunito', sans-serif; }
.search.big { margin: 0 0 22px; max-width: 640px; border-color: var(--teal); }
.search.big button { width: auto; padding: 0 22px; font-weight: 900; background: #0B7268; }

/* ---------- game page ---------- */
.gamewrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.stage { min-width: 0; }
.player { position: relative; width: 100%; max-height: calc(100vh - 210px); margin: 0 auto; background: #120D22; border-radius: 22px; overflow: hidden; box-shadow: 0 6px 0 #0c0818, 0 14px 34px rgba(0,0,0,.25); }
.gamewrap.portrait .player { max-width: 480px; }
.player .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px) brightness(.6); transform: scale(1.12); }
.pcover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; text-align: center; padding: 16px; }
.pcover .picon { width: 150px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; border: 4px solid #fff; box-shadow: 0 6px 0 rgba(0,0,0,.3); }
.pcover b { font: 400 26px var(--disp); text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.btn-play.big { font-size: 24px; padding: 12px 40px; animation: bob 1.8s ease-in-out infinite; }
.pcover .hint { font-weight: 700; opacity: .8; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.pclose { display: none; position: absolute; top: 10px; right: 10px; z-index: 5; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--coral); color: #fff; font-weight: 900; }
.player.full { position: fixed; inset: 0; z-index: 100; max-height: none; border-radius: 0; aspect-ratio: auto !important; max-width: none !important; }
.player.full .pclose { display: block; }
.gbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; background: var(--card); border-radius: var(--r); padding: 10px 14px; box-shadow: var(--shadow); }
.gbar h1 { margin: 0; font-size: 24px; flex: 1; min-width: 200px; }
.gacts { display: flex; gap: 8px; flex-wrap: wrap; }
.gacts button { border: 0; background: var(--bg2); padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; transition: transform .12s; }
.gacts button:hover { transform: translateY(-2px); }
.gacts .vote.on.up { background: #0B7268; color: #fff; } .gacts .vote.on.down { background: var(--coral-ink); color: #fff; }
.rail { min-width: 0; }
.railh { font-size: 19px; margin: 0 0 10px; }
.minigrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ginfo { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; margin-top: 22px; }
.gdesc, .facts, .article { background: var(--card); border-radius: 22px; padding: 18px 22px; box-shadow: var(--shadow); }
.gdesc h2 { font-size: 22px; margin: 12px 0 6px; } .gdesc h2:first-child { margin-top: 0; } .gdesc h3 { font-size: 18px; margin: 14px 0 4px; }
.gdesc p { margin: 0 0 10px; }
.gdesc ol, .gdesc ul { padding-left: 22px; margin: 0 0 10px; } .gdesc li { margin: 3px 0; }
.feat { list-style: none; padding: 0 !important; } .feat li::before { content: '★ '; color: var(--sun2); }
.faq details { border-top: 2px dashed var(--line); padding: 10px 0; } .faq summary { font-weight: 800; cursor: pointer; }
.faq p { margin: 6px 0 0; color: var(--ink2); }
.facts dl { margin: 0; } .facts dl div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 2px dashed var(--line); }
.facts dt { color: var(--ink2); font-weight: 700; white-space: nowrap; } .facts dd { margin: 0; font-weight: 800; text-align: right; }
.facts dd a { color: var(--teal-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags a { background: var(--bg2); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.tags a:hover { background: var(--sun); color: #2B2340; }
@media (max-width: 1000px) { .gamewrap, .ginfo { grid-template-columns: 1fr; } .minigrid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) {
  .player { border-radius: 16px; max-height: none; }
  .pcover .picon { width: 110px; } .pcover b { font-size: 21px; }
  .minigrid { grid-template-columns: 1fr 1fr; }
  .gbar h1 { font-size: 21px; }
}

/* ---------- ads ---------- */
.ad { margin: 18px auto; text-align: center; overflow: hidden; }
.adlbl { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink2); opacity: .7; margin-bottom: 4px; }
.ad-game_side { margin: 0 0 16px; min-height: 250px; }
.only-mobile { display: none; } @media (max-width: 760px) { .only-mobile { display: block; } .ad-game_side { display: none; } }

/* ---------- blog / static ---------- */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.post { display: flex; flex-direction: column; gap: 6px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; padding-bottom: 12px; }
.post img, .post .pcov { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; } .post .pcov { display: grid; place-items: center; font-size: 46px; background: var(--bg2); }
.post b { font-family: var(--disp); font-weight: 400; font-size: 19px; padding: 0 14px; } .post span, .post small { padding: 0 14px; color: var(--ink2); font-weight: 600; }
.article { max-width: 860px; margin: 0 auto; } .article h1 { margin: 0 0 8px; font-size: 34px; } .pmeta { color: var(--ink2); font-weight: 700; margin: 0 0 12px; }
.prose h2 { font-size: 23px; margin: 20px 0 6px; } .prose h2 a { color: inherit; } .prose a.btn-play { color: #2B2340; font-size: 16px; padding: 7px 18px; } .prose .grid { margin: 10px 0; } .prose > a > img { width: 100%; max-width: 560px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 16px; box-shadow: var(--shadow); } .prose a { color: var(--teal-ink); font-weight: 800; } .prose img { border-radius: 14px; margin: 10px 0; }
.pcover-img { border-radius: 16px; margin-bottom: 14px; width: 100%; }
.cform { display: grid; gap: 12px; max-width: 520px; } .cform label { display: grid; gap: 4px; font-weight: 800; }
.cform input, .cform textarea { font: 600 15px 'Nunito', sans-serif; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.cform .hp { position: absolute; left: -9999px; } .cform button { justify-self: start; }
.okmsg { font-weight: 800; color: var(--teal-ink); font-size: 18px; }
.about-box { margin-top: 34px; background: var(--card); border-radius: 22px; padding: 18px 22px; box-shadow: var(--shadow); color: var(--ink2); font-weight: 600; }
.about-box h2 { color: var(--ink); margin: 0 0 6px; font-size: 22px; } .about-box a { color: var(--teal-ink); font-weight: 800; }
.nf { text-align: center; padding: 20px 0 10px; } .nfface .smile { width: 90px; height: 90px; margin: 0 auto; animation: bob 1.8s infinite; }

/* ---------- footer + mobile tab bar ---------- */
.foot { background: #2B2340; color: #E9DFFF; margin-top: 30px; padding: 30px 0 90px; }
.foot-in { max-width: 1320px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.fbrand { display: flex; gap: 12px; } .fbrand .smile { width: 46px; height: 46px; flex-shrink: 0; } .fbrand b { font: 400 22px var(--disp); color: var(--sun); } .fbrand p { margin: 4px 0 0; opacity: .8; max-width: 420px; }
.fcols { display: flex; gap: 40px; } .fcols div { display: flex; flex-direction: column; gap: 6px; } .fcols h3 { margin: 0 0 4px; color: var(--sun); font-family: var(--disp); font-weight: 400; font-size: 16px; }
.fcols a { opacity: .85; font-weight: 700; } .fcols a:hover { opacity: 1; color: var(--sun); }
.copy { grid-column: 1 / -1; opacity: .55; font-size: 13px; margin: 0; }
.tabbar { display: none; }
@media (max-width: 760px) {
  .top-in { gap: 8px; padding: 8px 12px; } .logo span { font-size: 20px; } .logo .smile { width: 34px; height: 34px; }
  .toplinks { display: none; } .top .search { display: none; } .msearch { display: grid; }
  .foot-in { grid-template-columns: 1fr; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--card); border-top: 2px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11.5px; font-weight: 800; color: var(--ink2); padding: 2px 0; border-radius: 12px; }
  .tabbar a span { font-size: 20px; line-height: 1.2; } .tabbar a.on { color: var(--ink); background: var(--bg2); }
  main { padding-bottom: 30px; }
  .lhead h1 { font-size: 26px; } .sh h2 { font-size: 20px; }
}
