﻿@charset "UTF-8";
/* ความสนุก: มาสคอต เกม ตราสะสม และภาพเคลื่อนไหว */
:root { --sun: #F6B93B; --sky: #4FA3E0; --coral: #EF6F5E; --leaf: #6BBF59; --grape: #8E5CC4; --fun: 'Mali', 'Kanit', sans-serif; }

@media (max-width: 1080px) {
  .menu-btn { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 70px;
    flex-direction: column; background: var(--forest); padding: 8px 16px 16px; border-bottom: 4px solid var(--khaki);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 10px; }
}
.count-pill { background: var(--coral); color: #fff; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 99px; margin-left: 2px; }

/* มาสคอต */
.mascot { display: block; overflow: visible; }
.mascot .m-all { animation: m-bob 2.8s ease-in-out infinite; transform-origin: 100px 225px; }
.mascot .m-eyes { animation: m-blink 5s infinite; transform-origin: 100px 86px; }
.mascot.wave .m-arm { animation: m-wave 1.3s ease-in-out infinite; transform-origin: 136px 150px; }
.mascot.cheer .m-all { animation: m-jump .8s ease-in-out infinite; }
.mascot.cheer .m-arm { animation: m-wave .8s ease-in-out infinite; transform-origin: 136px 150px; }
.mascot .m-spark { animation: m-twinkle 1.2s ease-in-out infinite; }
.mascot.think .m-head { animation: m-tilt 2.4s ease-in-out infinite; transform-origin: 100px 120px; }
@keyframes m-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes m-jump { 0%, 100% { transform: translateY(0) scaleY(1); } 15% { transform: translateY(0) scaleY(.94); } 45% { transform: translateY(-16px) scaleY(1.03); } }
@keyframes m-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes m-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-24deg); } }
@keyframes m-twinkle { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@keyframes m-tilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.bubble {
  position: relative; background: #fff; color: var(--ink); font: 500 16.5px/1.55 var(--fun);
  border: 3px solid var(--forest); border-radius: 22px; padding: 12px 18px; box-shadow: 0 5px 0 var(--forest);
}
.bubble::after {
  content: ''; position: absolute; left: 34px; bottom: -14px; width: 20px; height: 20px; background: #fff;
  border-right: 3px solid var(--forest); border-bottom: 3px solid var(--forest); transform: rotate(45deg);
}
.bubble.big { font-size: clamp(17px, 2.4vw, 21px); }
.bubble a { color: var(--purple); }

/* ฮีโร่: หิ่งห้อย ภาพค่าย และน้องเสือแอบดู */
.hero .wrap { position: relative; z-index: 1; }
.fireflies { position: absolute; inset: 0; pointer-events: none; }
.fireflies i {
  position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #FFE58A;
  box-shadow: 0 0 10px 3px rgba(255, 220, 110, .65); opacity: 0; animation: firefly 7s ease-in-out infinite;
}
@keyframes firefly { 0%, 100% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 50% { transform: translate(18px, -22px); } 70% { opacity: .8; } 90% { transform: translate(-10px, -40px); } }
.camp-scene { position: absolute; left: 0; right: 0; bottom: 14px; width: 100%; height: 120px; pointer-events: none; opacity: .9; }
.camp-scene .fire { animation: flicker 1.1s ease-in-out infinite alternate; transform-origin: 694px 118px; }
@keyframes flicker { from { transform: scale(1, 1); } to { transform: scale(1.08, 1.15); } }
.peek { position: absolute; right: -26px; bottom: -34px; width: 118px; z-index: 2; }
.peek:hover .mascot { transform: scale(1.06); transition: transform .2s; }
@media (max-width: 860px) { .peek { width: 96px; right: -8px; bottom: -28px; } }

/* หน้าแรก: ลานกิจกรรม */
.play-teaser {
  display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: center; margin: 46px 0;
  background: #FFF6D8; border: 3px solid var(--sun); border-radius: 28px; padding: 26px 30px;
  box-shadow: 0 8px 0 #E8A92A; position: relative; overflow: hidden;
}
.play-teaser::before { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(246, 185, 59, .25); }
.teaser-mascot { position: relative; }
.teaser-mascot .mascot { width: 170px; margin: 76px auto 0; }
.teaser-mascot .bubble { position: absolute; top: 0; left: 0; right: 0; font-size: 14.5px; padding: 8px 12px; }
.play-teaser h2 { font-family: var(--fun); color: #9A5B00; display: flex; gap: 10px; align-items: center; position: relative; }
.play-teaser p { color: #6B4A12; position: relative; }
@media (max-width: 760px) {
  .play-teaser { grid-template-columns: 1fr; padding: 20px 18px; }
  .teaser-mascot .mascot { width: 130px; }
}

/* ปุ่มสไตล์การ์ตูน */
.btn.chunky { background: var(--sun); color: #5A3A00; box-shadow: 0 5px 0 #C98A12; transition: transform .08s, box-shadow .08s; font-family: var(--fun); }
.btn.chunky:active:not([disabled]) { transform: translateY(4px); box-shadow: 0 1px 0 #C98A12; }
.btn[disabled] { opacity: .45; cursor: default; }

/* การ์ดเกม */
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.games.mini { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 14px; }
.game-card {
  --g: var(--leaf);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; cursor: pointer; text-decoration: none;
  background: #fff; color: var(--ink); border: 3px solid var(--g); border-radius: 22px; padding: 18px;
  box-shadow: 0 6px 0 var(--g); transition: transform .15s, box-shadow .15s; font: inherit;
}
.game-card:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 10px 0 var(--g); }
.game-card:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--g); }
.game-card.on { background: color-mix(in srgb, var(--g) 14%, #fff); }
.game-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--g); color: #fff; transform: rotate(-6deg); }
.game-card:hover .game-ic { animation: wiggle .5s ease-in-out; }
.game-ic .ic { width: 30px; height: 30px; stroke-width: 2; }
.game-card b { font: 600 19px/1.3 var(--fun); }
.game-card > span:not(.game-ic):not(.play-now) { font-size: 14.5px; color: var(--muted); line-height: 1.5; }
.play-now { margin-top: auto; font: 600 14.5px var(--fun); color: var(--g); display: flex; gap: 4px; align-items: center; filter: brightness(.8); }
.games.mini .game-card { padding: 12px; align-items: center; text-align: center; border-radius: 18px; }
.games.mini .game-ic { width: 44px; height: 44px; }
.games.mini .game-card b { font-size: 15.5px; }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 25% { transform: rotate(8deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(6deg); } }

/* หน้าลานกิจกรรม */
.play-hero { background: linear-gradient(180deg, #BFE3F7 0%, #E5F4FB 70%, var(--paper) 100%); overflow: hidden; }
.play-hero .wrap { display: grid; grid-template-columns: 1fr 240px; gap: 24px; align-items: end; padding-top: 34px; padding-bottom: 10px; }
.hero-mascot { width: 230px; }
.play-progress { margin: 24px 0 10px; font: 600 16px var(--fun); color: var(--forest); }
.play-progress .bar { height: 14px; background: #fff; border: 2px solid var(--forest); margin-top: 6px; }
.play-progress .bar span { background: linear-gradient(90deg, var(--sun), var(--coral)); }
.sound-btn { font: 500 14.5px var(--fun); border: 2px solid var(--forest); background: #fff; border-radius: 99px; padding: 7px 14px; cursor: pointer; color: var(--forest); display: inline-flex; gap: 6px; align-items: center; }
.sound-btn + .sound-btn { margin-left: 8px; }
@media (max-width: 640px) {
  .play-hero .wrap { grid-template-columns: 1fr 110px; gap: 10px; }
  .hero-mascot { width: 120px; }
}

.game-area { scroll-margin-top: 90px; margin-top: 26px; }
.game-area:empty { display: none; }
.game-box { background: #fff; border: 3px solid var(--forest); border-radius: 24px; padding: 20px 22px; box-shadow: 0 6px 0 var(--forest); max-width: 860px; margin: 0 auto; }
.game-box h3 { font-family: var(--fun); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-box .from { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13.5px; margin: 6px 0; }
.game-box.empty { text-align: center; color: var(--muted); }
.hud { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font: 500 15px var(--fun); color: var(--forest); }
.hearts { display: inline-flex; gap: 3px; }
.hearts span { color: #D9D2C0; }
.hearts span.on { color: var(--coral); }
.hearts span.on .ic { fill: var(--coral); }
.streak { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); }
.streak.hot { color: #E8590C; animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.opt.pop { animation: pop .35s ease-out; }
@keyframes pop { 50% { transform: scale(1.04); } }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.stars { display: inline-flex; gap: 6px; }
.stars span { color: #DCD3BC; }
.stars span .ic { width: 44px; height: 44px; }
.stars span.on { color: #E8A01A; animation: star-in .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.stars span.on .ic { fill: var(--sun); }
.stars span.on:nth-child(2) { animation-delay: .15s; }
.stars span.on:nth-child(3) { animation-delay: .3s; }
@keyframes star-in { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }

.game-end { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; background: #fff; border: 3px solid var(--forest); border-radius: 24px; padding: 20px 24px; box-shadow: 0 6px 0 var(--forest); max-width: 760px; margin: 0 auto; }
.game-end .end-mascot { width: 160px; }
.game-end h3 { font: 600 24px/1.3 var(--fun); margin: 8px 0 4px; }
.game-end .score { font: 600 42px/1 var(--fun); display: block; color: var(--forest); }
@media (max-width: 560px) {
  .game-end { grid-template-columns: 1fr; text-align: center; }
  .game-end .end-mascot { margin: 0 auto; width: 130px; }
  .game-end .btns { justify-content: center; }
}

/* จับคู่ปริศนา */
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 600px) { .mgrid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.mcard { aspect-ratio: 3/3.4; perspective: 900px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.mcard-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mcard.flip .mcard-in, .mcard.done .mcard-in { transform: rotateY(180deg); }
.mface { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px; overflow: hidden; }
.mface.back { background: var(--forest); color: var(--khaki); box-shadow: inset 0 0 0 4px var(--forest), inset 0 0 0 6px var(--khaki); }
.mface.back .ic { width: 42%; height: 42%; }
.mface.front { transform: rotateY(180deg); background: #FFF6D8; border: 3px solid var(--sun); font: 500 clamp(11.5px, 1.8vw, 14.5px)/1.4 var(--body); color: var(--ink); }
.mface.front.term { background: #E6F3FC; border-color: var(--sky); font: 600 clamp(13px, 2.2vw, 17px)/1.3 var(--fun); }
.mface.front small { font: 500 11px var(--fun); color: var(--muted); margin-bottom: 4px; }
.mcard.done .mface.front { background: #E4F5DF; border-color: var(--leaf); }

/* เรียงไทม์ไลน์ */
.olist { display: grid; gap: 10px; margin-top: 12px; }
.ocard { display: flex; gap: 14px; align-items: center; text-align: left; background: var(--paper); border: 2.5px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); transition: transform .15s; }
.ocard:hover:not([disabled]) { transform: translateX(4px); border-color: var(--grape); }
.ocard b { font-family: var(--head); font-weight: 500; display: block; }
.ocard small { color: var(--muted); display: flex; gap: 5px; align-items: center; }
.onum { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 2.5px dashed var(--grape); display: grid; place-items: center; font: 600 18px var(--fun); color: #fff; }
.ocard.picked { border-color: var(--grape); background: #F3ECFA; }
.ocard.picked .onum { background: var(--grape); border-style: solid; animation: pop .3s; }
.ocard.right { border-color: var(--leaf); background: #E4F5DF; }
.ocard.wrong { border-color: var(--coral); background: #FCE6E2; }
.order-result { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 16px; font: 600 20px var(--fun); }

/* ถูกหรือผิด */
.qcard { text-align: center; background: #E6F3FC; border: 3px solid var(--sky); border-radius: 20px; padding: 22px 18px; margin: 10px 0 16px; }
.qcard b { font: 600 clamp(22px, 3.4vw, 30px)/1.3 var(--fun); display: block; }
.qcard span { font: 500 14px var(--fun); color: var(--muted); }
.qcard p { font-size: 18px; margin: 4px 0 0; }
.qcard em { display: block; margin-top: 10px; font-style: normal; font-size: 15px; color: var(--c-skills); }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tf-btn { font: 600 22px var(--fun); padding: 16px; border-radius: 18px; border: 0; cursor: pointer; color: #fff; display: flex; gap: 8px; justify-content: center; align-items: center; transition: transform .08s, box-shadow .08s; }
.tf-btn .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.tf-btn.yes { background: var(--leaf); box-shadow: 0 6px 0 #4A9A3A; }
.tf-btn.no { background: var(--coral); box-shadow: 0 6px 0 #C94D3D; }
.tf-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.tf-btn.right { outline: 5px solid #FFD447; animation: pop .35s; }
.tf-btn.wrong { opacity: .6; }

/* สมุดสะสมตรา */
.patches { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px 14px; }
.patch-wrap { text-align: center; }
.patch-wrap a { display: block; }
.patch { display: block; width: 96px; height: 96px; margin: 0 auto 6px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .18)); transition: transform .2s; }
.patch:not(.on) { opacity: .75; }
.patch.on { animation: patch-shine 3s ease-in-out infinite; }
.patch-wrap:hover .patch { transform: scale(1.08) rotate(-4deg); }
.patch-wrap b { font: 600 14.5px/1.3 var(--fun); display: block; }
.patch-wrap small { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: block; }
.patch-wrap:not(.on) b { color: var(--muted); }
@keyframes patch-shine { 0%, 100% { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .18)); } 50% { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .18)) drop-shadow(0 0 10px rgba(255, 210, 80, .8)); } }

/* แจ้งเตือนได้ตรา */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); cursor: pointer;
  display: flex; gap: 14px; align-items: center; width: min(440px, calc(100% - 32px));
  background: #fff; border: 3px solid var(--sun); border-radius: 22px; padding: 12px 18px; box-shadow: 0 6px 0 #E8A92A, 0 14px 30px rgba(0, 0, 0, .2);
  animation: toast-in .5s cubic-bezier(.3, 1.5, .5, 1);
}
.toast.out { animation: toast-out .5s forwards; }
.toast .patch { width: 74px; height: 74px; margin: 0; flex: none; }
.toast small { font: 600 13.5px var(--fun); color: #C27C00; display: block; }
.toast b { font: 600 19px var(--fun); display: block; }
.toast span { font-size: 14px; color: var(--muted); }
@keyframes toast-in { from { transform: translate(-50%, 140%); } to { transform: translate(-50%, 0); } }
@keyframes toast-out { to { transform: translate(-50%, 160%); opacity: 0; } }

/* น้องเสือมุมจอ */
.buddy { position: fixed; right: 14px; bottom: 14px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.buddy.buddy-in .buddy-btn { animation: buddy-in .8s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes buddy-in { from { transform: translateY(150%) scale(.5); } to { transform: none; } }
.buddy-btn { width: 78px; height: 86px; border: 0; background: none; padding: 0; cursor: pointer; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); transition: transform .15s; }
.buddy-btn .mascot { width: 100%; height: 100%; }
.buddy-btn:hover { transform: scale(1.06); }
.buddy-bubble {
  position: relative; width: min(300px, calc(100vw - 40px)); background: #fff; border: 3px solid var(--forest); border-radius: 20px;
  padding: 12px 16px 14px; box-shadow: 0 5px 0 var(--forest); font-family: var(--fun); animation: toast-pop .3s cubic-bezier(.3, 1.5, .5, 1);
}
.buddy-bubble[hidden] { display: none; }
.buddy-bubble small { color: var(--coral); font-weight: 600; font-size: 14px; }
.buddy-bubble b { display: block; font-size: 22px; color: var(--forest); line-height: 1.3; }
.buddy-bubble p { margin: 2px 0 8px; font-family: var(--body); font-size: 15px; line-height: 1.55; }
.buddy-bubble a { font-size: 14.5px; display: inline-flex; gap: 4px; align-items: center; }
.buddy-x { position: absolute; top: 6px; right: 6px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; }
.buddy-more { float: right; font: 600 13.5px var(--fun); background: var(--sun); border: 0; border-radius: 99px; padding: 5px 12px; cursor: pointer; color: #5A3A00; box-shadow: 0 3px 0 #C98A12; }
.buddy-hide { display: block; clear: both; margin-top: 8px; border: 0; background: none; padding: 0; font: 13px var(--body); color: var(--muted); text-decoration: underline; cursor: pointer; }
footer { padding-bottom: 100px; }
@keyframes toast-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) { .buddy-btn { width: 60px; height: 66px; } }

/* พลุกระดาษ */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }

/* เลื่อนจอแล้วค่อยๆ ปรากฏ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease var(--d, 0ms), transform .5s ease var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* สีสันบนหน้าแรก */
.stat:nth-child(1) .ic { color: #2F6A3D; background: #E2F2DC; }
.stat:nth-child(2) .ic { color: #24486F; background: #E2EEF9; }
.stat:nth-child(3) .ic { color: #A43A2C; background: #FBE5E1; }
.stat:nth-child(4) .ic { color: #8A5A00; background: #FFF1CC; }
.cat:hover .badge-ic { animation: wiggle .5s ease-in-out; }
.bk:hover .bk-cat { animation: wiggle .5s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .buddy, .toast, .confetti, .fireflies, .camp-scene, .peek, .ph-deco { display: none !important; }
  footer { padding-bottom: 34px; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- โหมดห้องเรียน (ฉายขึ้นจอ แข่งเป็นหมู่) ---------- */
.class-banner { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding: 18px 22px; border-radius: 22px; background: #FFF6D8; border: 3px solid var(--sun); box-shadow: 0 5px 0 #C98A12; color: var(--ink); text-decoration: none; }
.class-banner .game-ic { --g: var(--coral); flex: none; }
.class-banner b { display: block; font: 600 20px var(--fun); color: var(--forest); }
.class-banner small { display: block; color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.class-banner .play-now { margin-left: auto; flex: none; }
@media (max-width: 640px) { .class-banner { flex-wrap: wrap; } .class-banner .play-now { margin-left: 0; } }

body.class-mode footer, body.class-mode .buddy { display: none; }
.class-head { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.class-head h1 { font: 600 clamp(24px, 3.4vw, 34px) var(--fun); color: var(--forest); display: flex; gap: 10px; align-items: center; margin: 0 0 6px; }
.class-head p { margin: 0; color: var(--muted); max-width: 720px; }
.class-mascot { width: 110px; flex: none; }
.class-card { background: #fff; border: 2.5px solid var(--line); border-radius: 20px; padding: 16px 20px; margin-bottom: 16px; }
.class-card h3 { font-family: var(--fun); display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.class-card .filters { margin-bottom: 10px; }
.class-card.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .class-card.row2 { grid-template-columns: 1fr; } .class-mascot { width: 80px; } }
@media (max-width: 560px) { .class-head { flex-direction: column; text-align: center; } .class-head h1 { justify-content: center; } .class-guide summary { flex-wrap: wrap; } .guide-grid { padding: 0 12px 14px; } }
.class-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.class-name { display: flex; align-items: center; gap: 8px; border: 2.5px solid var(--t); border-radius: 14px; padding: 6px 10px; background: #fff; }
.class-name span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--t); color: #fff; display: grid; place-items: center; font: 600 15px var(--head); }
.class-name input { border: 0; font: 500 16px var(--head); width: 100%; min-width: 0; background: transparent; color: var(--ink); }
.class-name input:focus { outline: none; }
.class-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-bottom: 8px; }
.class-book { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14.5px; line-height: 1.35; }
.class-book:has(input:checked) { border-color: var(--forest-2); background: var(--forest-l); }
.class-book.off { opacity: .5; cursor: default; }
.class-book input { margin-top: 3px; accent-color: var(--forest); width: 18px; height: 18px; flex: none; }
.class-book small { display: block; color: var(--muted); font-size: 12.5px; }
.class-go { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; margin: 24px 0 10px; text-align: center; }
.btn.big { font-size: 20px; padding: 14px 28px; border-radius: 18px; }

.cls-play { max-width: 1280px; margin: 0 auto; padding: clamp(12px, 2vw, 26px) clamp(14px, 2.4vw, 32px) 30px; }
.cls-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.cls-top .from { flex: 1 1 auto; margin: 0; font-size: 15px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.cls-count { font: 600 20px var(--fun); color: var(--forest); }
.cls-timer { display: inline-flex; gap: 6px; align-items: center; font: 600 26px var(--head); color: var(--forest); background: #fff; border: 3px solid var(--forest); border-radius: 99px; padding: 2px 16px; min-width: 104px; justify-content: center; }
.cls-timer.hurry { color: #fff; background: var(--coral); border-color: var(--coral); animation: pulse .5s ease-in-out infinite; }
.cls-top .btn { padding: 7px 14px; font-size: 14.5px; }
.cls-bar { height: 10px; background: #fff; border: 2px solid var(--forest); border-radius: 99px; margin: 12px 0 0; overflow: hidden; }
.cls-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--coral)); }
.cls-q { font: 600 clamp(26px, 3.6vw, 46px)/1.3 var(--head); color: var(--ink); margin: clamp(16px, 3vh, 32px) 0; text-align: center; }
.cls-opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.6vw, 18px); }
@media (max-width: 760px) { .cls-opts { grid-template-columns: 1fr; } }
.cls-opt { display: flex; align-items: center; gap: 14px; padding: clamp(12px, 1.8vw, 20px); background: #fff; border: 3px solid var(--line); border-radius: 20px; font: 500 clamp(17px, 2vw, 26px)/1.35 var(--body); transition: opacity .3s, transform .3s; }
.cls-letter { flex: none; width: clamp(40px, 4vw, 56px); height: clamp(40px, 4vw, 56px); border-radius: 14px; display: grid; place-items: center; color: #fff; font: 600 clamp(22px, 2.6vw, 32px) var(--head); }
.cls-opt:nth-child(1) .cls-letter { background: var(--coral); }
.cls-opt:nth-child(2) .cls-letter { background: var(--sky); }
.cls-opt:nth-child(3) .cls-letter { background: var(--sun); }
.cls-opt:nth-child(4) .cls-letter { background: var(--leaf); }
.cls-opt.right { border-color: var(--c-skills); background: var(--forest-l); transform: scale(1.02); box-shadow: 0 0 0 4px rgba(107, 191, 89, .35); }
.cls-opt.dim { opacity: .35; }
.cls-foot { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin-top: clamp(16px, 3vh, 30px); }
@media (max-width: 760px) { .cls-foot { grid-template-columns: 1fr; } }
.cls-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cls-team { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 10px 12px; border-radius: 18px; border: 3px solid var(--t); background: #fff; color: var(--ink); cursor: pointer; font-family: var(--head); }
.cls-team:disabled { cursor: default; opacity: 1; }
.cls-team b { font-weight: 500; font-size: clamp(15px, 1.5vw, 19px); text-align: center; }
.cls-score { font: 600 clamp(30px, 3.4vw, 44px)/1 var(--head); color: var(--t); }
.cls-key { position: absolute; top: 6px; left: 8px; font-size: 12px; color: var(--muted); }
.cls-plus { font-size: 13.5px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.cls-team:not(:disabled):hover { box-shadow: 0 4px 0 var(--t); }
.cls-team.got { background: var(--t); color: #fff; animation: pop .35s ease-out; }
.cls-team.got .cls-score, .cls-team.got .cls-plus, .cls-team.got .cls-key { color: #fff; }
.cls-actions { display: flex; align-items: flex-end; gap: 10px; }
.cls-mascot { width: 92px; }
@media (max-width: 760px) { .cls-mascot { width: 70px; } .cls-actions { justify-content: flex-end; } }

.cls-end { text-align: center; }
.cls-end-mascot { width: 150px; margin: 0 auto; }
.cls-end h2 { font: 600 clamp(30px, 4vw, 48px) var(--fun); color: var(--forest); margin: 8px 0; }
.cls-winner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 18px; }
.cls-winner span { background: var(--t); color: #fff; font: 600 clamp(24px, 3vw, 36px) var(--head); padding: 6px 22px; border-radius: 99px; }
.cls-rank { list-style: none; padding: 0; margin: 0 auto 24px; max-width: 560px; counter-reset: r; }
.cls-rank li { counter-increment: r; display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 8px; background: #fff; border: 3px solid var(--t); border-radius: 16px; font: 500 20px var(--head); }
.cls-rank li::before { content: counter(r); width: 34px; height: 34px; border-radius: 50%; background: var(--t); color: #fff; display: grid; place-items: center; font-size: 17px; flex: none; }
.cls-rank li span { margin-left: auto; color: var(--t); font-weight: 600; }
.cls-rank li.win { box-shadow: 0 0 0 4px rgba(246, 185, 59, .5); }
.cls-again { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* คู่มือคุณครูในโหมดห้องเรียน */
.class-guide { background: #FFF6D8; border: 3px solid var(--sun); border-radius: 20px; margin-bottom: 16px; box-shadow: 0 5px 0 #E3B04B; }
.class-guide summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 20px; font: 600 clamp(18px, 2.2vw, 22px) var(--fun); color: var(--forest); }
.class-guide summary::-webkit-details-marker { display: none; }
.class-guide summary small { margin-left: auto; font: 500 13.5px var(--body); color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 0 20px 20px; }
@media (max-width: 860px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-grid section { background: #fff; border-radius: 16px; padding: 14px 18px; border: 2px solid #F0DDA4; }
.guide-grid h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 600 18px var(--fun); color: var(--forest); }
.guide-grid h4 span { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--coral); color: #fff; font: 600 16px var(--head); }
.guide-grid section:nth-child(2) h4 span { background: var(--sky); }
.guide-grid section:nth-child(3) h4 span { background: var(--grape); }
.guide-grid section:nth-child(4) h4 span { background: var(--leaf); }
.guide-grid ul, .guide-grid ol { margin: 0; padding-left: 22px; line-height: 1.65; font-size: 15.5px; }
.guide-grid li { margin-bottom: 4px; }
.guide-grid li::marker { color: var(--forest-2); font-weight: 600; }
.guide-keys { margin-top: 12px; padding-top: 10px; border-top: 2px dashed #F0DDA4; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14.5px; }
.guide-keys b { width: 100%; font-family: var(--head); font-weight: 500; color: var(--forest); }
kbd { display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 8px; background: #fff; font: 600 13px var(--head); color: var(--ink); }
