/* MofuPlay portal — sticker-style cards with thick ink outlines, matching the games' art.
   Layout: header, short hero, category banners (home) or game cards (category pages), ad slots between sections. */
:root {
  --cream: #FFF8EF;
  --paper: #FDF1E6;
  --ink: #3A2A33;
  --muted: #76626C;
  --berry: #D9485F;
  --peach: #F7DCC8;
  --mint: #CDEBDD;
  --night: #2E2A4F;
  --sun: #F6C343;
  --f-display: "Mali", "Itim", system-ui, sans-serif;
  --f-body: "Anuphan", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; border-radius: 12px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: rgba(253, 241, 230, .92); backdrop-filter: blur(8px); border-bottom: 2.5px solid var(--ink); }
.top .wrap { display: flex; align-items: center; gap: 16px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; margin-right: auto; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-family: var(--f-display); font-size: 1.5rem; line-height: 1; color: var(--berry); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 600; font-size: .92rem; padding: 6px 12px; border-radius: 999px; border: 2px solid transparent; }
.nav a:hover { border-color: var(--ink); background: var(--cream); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--cream); }

/* hero */
.hero { padding-block: 40px 8px; }
/* Thai stacks vowels and tone marks above and below the letters, so lines need extra room */
.hero h1 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.5; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--berry); display: inline-block; } /* wraps as one phrase, never mid-phrase */
.hero p { margin: 12px 0 0; max-width: 36em; color: var(--muted); font-size: 1.08rem; line-height: 1.75; }

/* sticker surface */
.sticker { background: var(--cream); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 6px 0 var(--ink); }

/* home: category banners */
.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; padding-block: 24px 30px; }
.cat { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.cat:hover { transform: translateY(-4px); box-shadow: 0 10px 0 var(--ink); }
.cat .art { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 3px solid var(--ink); background: var(--peach); }
.cat .art img { width: 100%; height: 100%; object-fit: cover; }
.cat.td .art { background: var(--night); }
.cat.kids .art { background: var(--mint); }
.cat .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cat h2 { margin: 0; font-family: var(--f-display); font-size: 1.45rem; line-height: 1.25; }
.cat p { margin: 0; color: var(--muted); }
.cat .foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chip { display: inline-block; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--peach); border: 2px solid var(--ink); }
.chip.soon { background: var(--sun); }
.chip.beta { background: var(--mint); }
.go { font-weight: 700; color: var(--berry); white-space: nowrap; }

/* category page */
.crumb { display: inline-flex; align-items: center; gap: 6px; margin-top: 26px; font-weight: 600; text-decoration: none; color: var(--muted); }
.crumb:hover { color: var(--ink); }
.page-title { padding-block: 10px 6px; }
.page-title h1 { margin: 0; font-family: var(--f-display); font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.45; }
.page-title p { margin: 6px 0 0; color: var(--muted); max-width: 40em; }
.games { display: grid; gap: 22px; padding-block: 22px 30px; }
.game { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); overflow: hidden; }
.game .art { background: var(--peach); border-right: 3px solid var(--ink); min-height: 220px; }
.game.td .art { background: var(--night); }
.game .art img { width: 100%; height: 100%; object-fit: cover; }
.game .info { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.game h2 { margin: 0; font-family: var(--f-display); font-size: 1.7rem; line-height: 1.2; }
.game p { margin: 0; }
.game ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: 999px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-weight: 700; font-size: 1rem; text-decoration: none; background: var(--cream); }
.btn.primary { background: var(--berry); color: #fff; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn[aria-disabled="true"] { background: #EDE3DA; color: var(--muted); box-shadow: none; cursor: default; }

.more { padding-block: 6px 24px; }
.more h2 { font-family: var(--f-display); font-size: 1.25rem; margin: 0 0 10px; }
.more .row { display: flex; gap: 10px; flex-wrap: wrap; }
.more a { text-decoration: none; }

/* about */
.about { padding: 22px 24px; margin-block: 8px 30px; }
.about h2 { margin: 0 0 6px; font-family: var(--f-display); font-size: 1.35rem; }
.about p { margin: 0 0 8px; max-width: 46em; }

/* ad slots: hidden on the live site until an AdSense ID is filled in */
.ad-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-block: 14px; }
.ad { min-height: 250px; min-width: 0; display: flex; align-items: center; justify-content: center; }
.ad-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.ad-stack .ad { min-height: 90px; width: 100%; max-width: 970px; margin-inline: auto; }
/* phones: one ad per row so the page doesn't turn into a wall of ads */
@media (max-width: 860px) { .ad-row { grid-template-columns: minmax(0, 1fr); } .ad-row .ad:nth-child(n+2), .ad-stack .ad:nth-child(n+2) { display: none; } .ad-stack .ad { min-height: 100px; } }
.ad.preview { border: 2px dashed #B9A79B; border-radius: 14px; background: rgba(255, 255, 255, .5); color: var(--muted); font-size: .85rem; font-weight: 600; }
.ad .adsbygoogle { width: 100%; }

/* footer */
.foot-site { border-top: 2.5px solid var(--ink); margin-top: 20px; }
.foot-site .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 18px 26px; color: var(--muted); font-size: .9rem; }
.foot-site nav { display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .cats { grid-template-columns: minmax(0, 1fr); }
  .game { grid-template-columns: minmax(0, 1fr); }
  .game .art { border-right: 0; border-bottom: 3px solid var(--ink); aspect-ratio: 16 / 9; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { .cat, .cat:hover { transition: none; transform: none; } }
.game .info .chip { align-self: flex-start; }
.cat .art img.logo, .game .art img.logo { position: absolute; left: 3%; top: 4%; width: 44%; height: auto; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.55)); }
.game .art { position: relative; overflow: hidden; }

/* about contact */
.about .contact { margin-top: 4px; font-weight: 600; }
.about .contact a { color: var(--berry); }

/* feedback form */
.feedback { padding: 24px; margin-block: 20px 34px; }
.feedback h2 { margin: 0; font-family: var(--f-display); font-size: 1.5rem; }
.feedback .lead { margin: 6px 0 16px; color: var(--muted); max-width: 44em; }
.fb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .field legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); font-size: .9em; }
.feedback select, .feedback textarea, .feedback input[type="text"], .feedback input:not([type]) {
  font: 500 1rem var(--f-body); color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 12px; width: 100%; box-sizing: border-box; }
.feedback textarea { resize: vertical; min-height: 84px; }
.feedback select:focus-visible, .feedback textarea:focus-visible, .feedback input:focus-visible { outline: 3px solid var(--berry); outline-offset: 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.stars input, .pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 2rem; line-height: 1; color: #E3D3C6; cursor: pointer; padding: 4px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: var(--sun); text-shadow: 0 2px 0 var(--ink); }
.stars input:focus-visible + label { outline: 3px solid var(--berry); border-radius: 10px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pills label { cursor: pointer; font-weight: 600; padding: 8px 18px; min-height: 44px; display: inline-flex; align-items: center; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; }
.pills input:checked + label { background: var(--ink); color: var(--cream); }
.pills input:focus-visible + label { outline: 3px solid var(--berry); outline-offset: 2px; }
.cf-turnstile { margin-top: 16px; min-height: 65px; }
.fb-msg { min-height: 1.6em; margin: 8px 0; font-weight: 600; }
.fb-msg[data-kind="err"] { color: var(--berry); }
.fb-msg[data-kind="ok"] { color: #2F7A4F; }
.feedback .btn:disabled { opacity: .6; cursor: progress; }
@media (max-width: 640px) { .fb-grid { grid-template-columns: minmax(0, 1fr); } }

/* coming-soon category: grey card with a diagonal ribbon across the art */
.cat.kids .art, .game.kids .art { background: #E2DEDA; position: relative; overflow: hidden; }
.cat.kids .art svg, .game.kids .art svg { filter: grayscale(1) contrast(.85) brightness(1.05); opacity: .75; }
.cat.kids .body, .game.kids .info { background: #F1EEEB; }
.cat.kids h2, .cat.kids p, .game.kids h2, .game.kids p { color: #7C7470; }
.soon-ribbon {
  position: absolute; left: -15%; right: -15%; top: 50%; transform: translateY(-50%) rotate(-14deg);
  padding: 10px 0; text-align: center; background: var(--ink); color: var(--sun);
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1.1rem, 2.6vw, 1.6rem); letter-spacing: .14em;
  border-block: 3px solid var(--cream); box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
}

.cat .game-name { margin: -2px 0 2px; font-family: var(--f-display); font-weight: 700; font-size: 1rem; color: var(--berry); letter-spacing: .01em; }

/* ---------- game detail pages ---------- */
.detail .crumb { display: block; margin-top: 22px; font-weight: 600; color: var(--muted); }
.detail .crumb a { color: var(--muted); text-decoration: none; }
.detail .crumb a:hover { color: var(--ink); text-decoration: underline; }
.detail .crumb span { color: var(--ink); }
.d-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); overflow: hidden; margin-top: 14px; }
.d-hero > img { width: 100%; height: 100%; object-fit: cover; border-right: 3px solid var(--ink); min-height: 240px; }
.d-head { padding: 24px 26px; display: flex; flex-direction: column; gap: 10px; justify-content: center; min-width: 0; }
.d-head h1 { margin: 0; font-family: var(--f-display); font-size: clamp(2rem, 4.5vw, 2.8rem); line-height: 1.35; }
.d-tag { margin: 0; font-size: 1.1rem; line-height: 1.6; color: var(--muted); }
.d-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.d-tags li { font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--peach); border: 2px solid var(--ink); }
.d-head .btn { align-self: flex-start; margin-top: 6px; }
.d-sec { margin-block: 30px; }
.d-sec h2, .d-cta h2 { margin: 0 0 10px; font-family: var(--f-display); font-size: 1.55rem; line-height: 1.4; }
.d-sec p { margin: 0 0 10px; max-width: 44em; line-height: 1.8; }
.d-sec.story { display: flex; gap: 24px; align-items: flex-end; }
.d-text { flex: 1; min-width: 0; }
.d-char { flex: none; width: 160px; height: auto; }
.d-char.round { width: 132px; border-radius: 50%; border: 3px solid var(--ink); background: var(--peach); }
.d-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.d-steps li { counter-increment: step; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 16px 58px; position: relative; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 18px; min-width: 0; }
.d-steps li::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--berry); color: #fff; font-family: var(--f-display); font-weight: 700; display: grid; place-items: center; }
.d-steps b { font-family: var(--f-display); font-size: 1.08rem; }
.d-steps span { line-height: 1.7; color: var(--muted); }
.breeds { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.breeds li { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 18px; min-width: 0; }
.breeds img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.breeds div { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.breeds .tier { font-size: .78rem; font-weight: 700; color: var(--berry); }
.breeds b { font-family: var(--f-display); font-size: 1.05rem; }
.breeds div span:last-child { font-size: .9rem; color: var(--muted); }
.faces { list-style: none; margin: 16px 0 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.faces li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; font-size: .9rem; }
.faces img { width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--peach); }
.chapters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.chapters figure { margin: 0; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 18px; overflow: hidden; min-width: 0; }
.chapters .ba { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--ink); }
.chapters .ba img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.chapters figcaption { padding: 12px 14px 14px; line-height: 1.7; color: var(--muted); }
.chapters figcaption b { display: block; color: var(--ink); font-family: var(--f-display); font-size: 1.05rem; }
.d-sec .note { color: var(--muted); font-weight: 600; margin-top: 10px; }
.faq details { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 16px; padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; line-height: 1.6; }
.faq summary:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px; border-radius: 8px; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.d-cta { padding: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-block: 30px; }
.d-cta h2 { flex-basis: 100%; margin: 0; }
.d-cta p { flex-basis: 100%; margin: 0 0 6px; color: var(--muted); }
@media (max-width: 860px) {
  .d-hero { grid-template-columns: minmax(0, 1fr); }
  .d-hero > img { border-right: 0; border-bottom: 3px solid var(--ink); aspect-ratio: 16 / 9; min-height: 0; height: auto; }
  .d-steps, .chapters { grid-template-columns: minmax(0, 1fr); }
  .d-sec.story { flex-direction: column; align-items: flex-start; }
  .d-char { width: 120px; }
}

/* SEO keyword line inside the h1, styled as a subtitle */
.h1-kicker { display: block; font-family: var(--f-body); font-size: clamp(.9rem, 2vw, 1.05rem); font-weight: 600; line-height: 1.6; color: var(--muted); letter-spacing: .01em; margin-bottom: 4px; }
.h1-sub { display: block; font-family: var(--f-body); font-size: clamp(1rem, 2.2vw, 1.15rem); font-weight: 600; line-height: 1.6; color: var(--muted); margin-top: 4px; }
