/* สัตว์ในอัลกุรอาน — สไตล์หลัก (มือถือเป็นหลัก) */
:root {
  --bg: #f6f3ea; --surface: #ffffff; --surface2: #f0ebdb; --ink: #1d2a27; --muted: #5d6b66; --line: #e3ddcc;
  --brand: #0f5c4d; --brand2: #1f8a70; --top: #0f5c4d; --on-brand: #fff; --gold: #b9851b; --ok: #1b7f4b; --bad: #b3361f;
  --shadow: 0 2px 10px rgba(20, 40, 30, .08); --radius: 16px;
  --font: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}
html[data-theme="dark"] {
  --bg: #0b1714; --surface: #13231f; --surface2: #1a2f29; --ink: #e8f0ec; --muted: #9db3aa; --line: #26403a;
  --brand: #2fae8e; --brand2: #55c9ab; --top: #0e3d33; --on-brand: #04201a; --gold: #e3b556; --ok: #4cc88a; --bad: #ff8a73; --shadow: 0 2px 12px rgba(0, 0, 0, .4);
}
html[data-theme="eye"] {
  --bg: #efe3c7; --surface: #f6ecd5; --surface2: #e8dab8; --ink: #3c3325; --muted: #6f624d; --line: #d6c49b;
  --brand: #55663a; --brand2: #6f8049; --top: #5b6b3a; --on-brand: #fbf5e4; --gold: #98701c; --ok: #3f7a3b; --bad: #9b4025; --shadow: 0 2px 8px rgba(80, 60, 20, .1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.7; padding-bottom: 76px; transition: background .3s, color .3s; }
a { color: var(--brand); } img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; } h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; margin-top: 1.4rem; } h3 { font-size: 1.05rem; }
p { margin: .4rem 0; } ul, ol { padding-left: 1.2rem; margin: .4rem 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; z-index: 100; } .skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } small { font-size: .82rem; } .center { text-align: center; }
.ar { font-family: "KFGQPC Uthmanic Hafs", "Amiri Quran", "Scheherazade New", "Noto Naskh Arabic", serif; line-height: 2; }
.big { font-size: 1.35rem; }
#bluefilter { position: fixed; inset: 0; background: #ff9a1f; mix-blend-mode: multiply; pointer-events: none; z-index: 90; opacity: 0; }

/* ---------- แถบบน/ล่าง ---------- */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .5rem; padding: .55rem .9rem; background: var(--top); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.topbar .logo { font-weight: 700; font-size: 1.05rem; color: inherit; text-decoration: none; flex: 1; display: flex; align-items: center; gap: .45rem; }
.topbar button { background: rgba(255, 255, 255, .16); color: inherit; border: 0; border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .9rem; cursor: pointer; min-height: 36px; }
#nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(0, 0, 0, .08); }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .4rem 0 .35rem; text-decoration: none; color: var(--muted); font-size: 1.25rem; line-height: 1.2; min-height: 56px; }
#nav a small { font-size: .7rem; } #nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
main { max-width: 780px; margin: 0 auto; padding: .9rem 1rem 1.5rem; }
.fade { animation: fade .35s ease; } @keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---------- ส่วนประกอบ ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin: .7rem 0; box-shadow: var(--shadow); }
.card.soft { background: var(--surface2); box-shadow: none; } .card.warnbox { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.note { font-size: .88rem; color: var(--muted); background: var(--surface2); border-radius: 10px; padding: .45rem .7rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; background: var(--brand); color: var(--on-brand); border: 1px solid transparent; border-radius: 999px; padding: .55rem 1.1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px; transition: transform .1s, filter .2s; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: scale(.97); }
.btn.sm { min-height: 38px; padding: .3rem .85rem; font-size: .9rem; } .btn.big { font-size: 1.05rem; padding: .7rem 1.4rem; }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--brand); } .btn.ghost2 { background: rgba(255, 255, 255, .22); color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn.danger { background: var(--bad); color: #fff; } .btn[disabled] { opacity: .5; }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .6rem 0; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding: .3rem 0 .6rem; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem; color: var(--ink); text-decoration: none; font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.pill { display: inline-block; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: .1rem .8rem; font-size: .82rem; }
.bar { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; margin: .4rem 0; } .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius: 999px; transition: width .5s; }
.sk { display: block; height: 1.2em; border-radius: 6px; background: linear-gradient(90deg, var(--surface2), var(--line), var(--surface2)); background-size: 200% 100%; animation: sk 1.3s infinite; } @keyframes sk { to { background-position: -200% 0; } }
.phead { margin-top: .3rem; }
.toasts, #toasts { position: fixed; left: 0; right: 0; bottom: 74px; display: flex; flex-direction: column; align-items: center; gap: .4rem; z-index: 80; pointer-events: none; }
.toast { background: #1d2a27; color: #fff; padding: .5rem 1rem; border-radius: 999px; font-size: .9rem; max-width: 90vw; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); animation: pop .3s; } .toast.out { opacity: 0; transition: opacity .4s; } @keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ---------- หน้าแรก ---------- */
.hero, .ahead, .adv-teaser { position: relative; overflow: hidden; border-radius: 22px; color: #fff; isolation: isolate; }
.hero { margin: .2rem 0 .8rem; min-height: 290px; display: flex; align-items: flex-end; }
.hero .bg, .ahead .bg, .adv-teaser .bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero::after, .ahead::after, .adv-teaser::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(6, 30, 24, .85), rgba(6, 30, 24, .45) 60%, rgba(6, 30, 24, .3)); }
.hero-in, .ahead .in, .adv-teaser .in { padding: 1.1rem 1.2rem; } .hero h1 { font-size: 2.1rem; margin: 0; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.eyebrow { font-size: .8rem; letter-spacing: .04em; opacity: .9; margin: 0; } .lead { opacity: .95; max-width: 34em; } .cta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.level .stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .88rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin: .7rem 0; }
.tile { display: flex; flex-direction: column; gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); } .tile span { font-size: 1.6rem; } .tile small { color: var(--muted); }
.searchbar input { width: 100%; padding: .7rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; min-height: 46px; }
.cat h2 { margin-top: 1.2rem; } .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.acard { position: relative; display: flex; flex-direction: column; gap: .2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .8rem .5rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; } .acard:hover { transform: translateY(-2px); }
.aemo { font-size: 2.3rem; line-height: 1.1; } .atx { display: flex; flex-direction: column; } .atx small { color: var(--muted); font-size: 1rem; } .tick { position: absolute; top: .5rem; right: .6rem; color: var(--ok); font-weight: 700; }

/* ---------- หน้าสัตว์ ---------- */
.ahead { margin-top: .2rem; min-height: 250px; display: flex; align-items: flex-end; } .ahead .emo { width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.22); backdrop-filter: blur(4px); display: grid; place-items: center; font-size: 2.6rem; line-height: 1; margin: .2rem 0 .4rem; animation: float 4s ease-in-out infinite; } @keyframes float { 50% { transform: translateY(-6px); } }
.ahead h1 { margin: 0; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); } .ahead .sub { margin: 0 0 .3rem; opacity: .95; } .back { color: #fff; text-decoration: none; font-size: .9rem; opacity: .9; display: inline-block; margin-bottom: .2rem; }
.tabs { display: flex; gap: .3rem; overflow-x: auto; margin: .7rem 0 .3rem; scrollbar-width: none; position: sticky; top: 52px; z-index: 30; background: var(--bg); padding: .3rem 0; } .tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: .4rem .9rem; border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); font-size: .92rem; } .tabs a.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 700; } .tabs i { font-style: normal; font-size: .75rem; opacity: .75; }
.facts li { margin: .3rem 0; } .steps { list-style: none; padding: 0; position: relative; } .steps li { display: flex; gap: .8rem; padding: .5rem 0; position: relative; }
.steps li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -8px; width: 2px; background: var(--line); } .steps .n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; } .steps p { margin: .1rem 0; color: var(--muted); }
.refs { list-style: none; padding: 0; } .refs li { padding: .4rem 0; border-bottom: 1px dashed var(--line); } .refs li:last-child { border: 0; } .refs p { margin: .1rem 0; color: var(--muted); font-size: .92rem; }
.pager { display: flex; justify-content: space-between; margin: 1.2rem 0; } .pager a { text-decoration: none; background: var(--surface); border: 1px solid var(--line); padding: .4rem .9rem; border-radius: 999px; }
.verse, .hadith { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--gold); border-radius: var(--radius); padding: .8rem 1rem; margin: .8rem 0; box-shadow: var(--shadow); transition: box-shadow .3s; }
.hadith { border-inline-start-color: var(--brand); } .verse.speaking { box-shadow: 0 0 0 3px var(--gold); }
.verse header, .hadith header { display: flex; justify-content: space-between; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.vk, .hk { font-weight: 700; color: var(--brand); } .term { font-size: 1.25rem; color: var(--gold); }
.vtext { font-size: 1.75rem; text-align: right; margin: .6rem 0 .3rem; } html.kfgqpc .vtext { font-size: 1.9rem; } .vth { margin: .3rem 0; } .ctx { font-size: .9rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .4rem; } .warn { font-size: .85rem; color: var(--bad); }
.verse footer, .hadith footer { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; } .play-on, .tts-on { outline: 3px solid var(--gold); }
.hs { font-size: 1.02rem; } .hm { font-size: .88rem; color: var(--muted); } .qsec h2 a { text-decoration: none; color: var(--brand); } .qsec h2 small { color: var(--muted); font-size: 1.1rem; }
.fld { display: block; margin: .6rem 0; } .fld select, .fld input:not([type="range"]) { display: block; width: 100%; margin-top: .25rem; padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; min-height: 44px; } .fld input[type="range"] { width: 100%; accent-color: var(--brand); }
select { padding: .45rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; max-width: 100%; }
.sw { display: flex; gap: .7rem; align-items: flex-start; margin: .7rem 0; } .sw input { width: 22px; height: 22px; margin-top: .25rem; accent-color: var(--brand); } .sw small { display: block; color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; } .board { list-style: none; padding: 0; } .board li { display: flex; gap: .6rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); align-items: center; } .board li b { flex: 1; } .rk { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; } .badges li { background: var(--surface2); border-radius: 999px; padding: .25rem .8rem; border: 1px solid var(--gold); font-size: .9rem; } .prog { list-style: none; padding: 0; } .prog li { padding: .2rem 0; } .prog a { text-decoration: none; }
details.src summary { cursor: pointer; } details.src p { font-size: .92rem; word-break: break-word; }

/* ---------- ผจญภัยและควิซ ---------- */
.timeline { list-style: none; padding: 0; position: relative; margin: 1rem 0; } .timeline::before { content: ""; position: absolute; left: 25px; top: 10px; bottom: 10px; width: 3px; background: linear-gradient(var(--gold), var(--brand)); border-radius: 3px; }
.timeline li { position: relative; margin: .5rem 0; } .timeline a { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; margin-left: 0; box-shadow: var(--shadow); }
.timeline .dot { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--surface2); border: 3px solid var(--gold); z-index: 1; } .timeline .done .dot { border-color: var(--ok); } .timeline .tx { flex: 1; display: flex; flex-direction: column; line-height: 1.4; } .timeline small { color: var(--muted); } .timeline .st { color: var(--brand); font-weight: 700; } .timeline .done .st { color: var(--ok); }
.adv { position: fixed; inset: 0; z-index: 35; overflow-y: auto; color: #fff; padding-top: 52px; } .adv .bg.full { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
.advui { max-width: 780px; margin: 0 auto; padding: .8rem 1rem 6rem; } .advtop { display: flex; justify-content: space-between; align-items: center; } .advtop .emo { font-size: 2.4rem; animation: float 4s ease-in-out infinite; }
.scenecard, .resultcard { background: rgba(8, 24, 20, .72); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .22); border-radius: 20px; padding: 1rem 1.1rem; margin: .8rem 0; color: #f4f8f6; } .scenecard h2 { margin-top: .2rem; } .stext { font-size: 1.08rem; min-height: 6em; line-height: 1.9; }
.resultcard.ok { border-color: #6be0a3; } .resultcard.bad { border-color: #ffb199; } .lesson { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: .6rem .8rem; margin: .6rem 0; } .miniverse .verse { color: var(--ink); } .miniverse .muted, .scenecard .muted, .resultcard .muted { color: #c9d8d2; } .ask { font-weight: 700; margin: .8rem 0 .3rem; }
.adv a { color: #a9f0d1; } .adv .btn { color: var(--on-brand); } .adv .btn.ghost { color: #fff; border-color: #fff; background: transparent; }
.choices { display: grid; gap: .5rem; margin-top: .4rem; } .choice { text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: .7rem .9rem; cursor: pointer; min-height: 48px; line-height: 1.5; transition: border-color .15s, transform .1s; } .choice:hover:not([disabled]) { border-color: var(--brand); } .choice:active { transform: scale(.99); }
.choice.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, var(--surface)); } .choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, var(--surface)); } .choice[disabled] { cursor: default; opacity: .75; } .choice.right[disabled] { opacity: 1; }
.fb { margin-top: .5rem; } .qq { font-size: 1.08rem; } .qmeta { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); }
.advfx { position: fixed; inset: 0; z-index: 36; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(255, 244, 200, .9), rgba(20, 40, 90, .9)); } .advfx.go { animation: portal 1.9s ease; } @keyframes portal { 0% { opacity: 0; } 25% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.portal-msg { text-align: center; padding: 28vh 0 0; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); position: relative; z-index: 37; } .swirl { width: 120px; height: 120px; margin: 0 auto 1rem; border-radius: 50%; border: 6px solid transparent; border-top-color: #ffe9a8; border-bottom-color: #8fd0ff; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.adv-teaser { min-height: 200px; display: flex; align-items: flex-end; }
svg.scene .cloud { animation: drift 40s linear infinite alternate; } @keyframes drift { to { transform: translateX(var(--dx, 80px)); } } svg.scene .wv { animation: wv 6s ease-in-out infinite alternate; } svg.scene .wv2 { animation: wv 8s ease-in-out infinite alternate-reverse; } @keyframes wv { to { transform: translateX(-60px); } } svg.scene .twk { animation: twk 3s ease-in-out infinite; } @keyframes twk { 50% { opacity: .15; } }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } .choices.cols { grid-template-columns: 1fr 1fr; } body { padding-bottom: 80px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

html[data-theme="dark"] .adv .bg.full, html[data-theme="dark"] .hero .bg, html[data-theme="dark"] .ahead .bg { filter: brightness(.7) saturate(.9); }
html[data-theme="eye"] .adv .bg.full, html[data-theme="eye"] .hero .bg, html[data-theme="eye"] .ahead .bg { filter: sepia(.35) saturate(.85) brightness(.95); }
html[data-theme="eye"] .scenecard, html[data-theme="eye"] .resultcard { background: rgba(40, 32, 18, .8); }
