/* ============================================================
   LMS Games — สไตล์เกมการเรียนรู้
   ใช้ตัวแปรร่วมกับ site.css / lms.css

   หลักคิดของดีไซน์:
   • สนามเกมต้องดู "เป็นสนาม" ไม่ใช่กล่องขาวลอยบนพื้นขาว
   • ตัวอักษรในเกมใช้น้ำหนัก 400–600 (ทั้งเว็บใช้ 300 ซึ่งบางเกินไปเวลาเล่นเร็ว ๆ)
   • ทุกตัวเลือกมี "ป้ายกำกับ" (A B C / 1 2 3) ให้ชี้คุยกันในห้องเรียนได้
   • สองฝั่งของเกมจับคู่ใช้คนละสี จะได้ไม่สับสนว่าอันไหนคำถามอันไหนคำตอบ
   ============================================================ */

:root {
  --g-ink:   #0f172a;
  --g-line:  #e2e8f0;
  --g-soft:  #f8fafc;
  --g-muted: #64748b;
  --g-ok:    #16a34a;
  --g-warn:  #d97706;
  --g-bad:   #dc2626;

  /* สีประจำเกม — คุมโทนให้ตัวอักษรขาวอ่านออกทุกสี */
  --g-c1: #4f46e5;
  --g-c2: #0284c7;
  --g-c3: #0d9488;
  --g-c4: #b45309;
  --g-c5: #be123c;
  --g-c6: #a21caf;
}

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.game-side { display: flex; flex-direction: column; }

.game-head { margin-bottom: 20px; }
.game-head h1 { margin: 10px 0 8px; font-size: clamp(22px, 3vw, 30px); }
.game-desc { color: var(--muted, #64748b); line-height: 1.8; margin: 0; }

/* ---------- สนามเกม ---------- */
.game-stage {
  position: relative;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--primary, #2563eb) 9%, transparent) 0, transparent 42%),
    radial-gradient(circle at 88% 92%, color-mix(in srgb, var(--accent, #22c55e) 9%, transparent) 0, transparent 42%),
    linear-gradient(180deg, #fbfcfe, #f2f5fa);
  border: 1px solid var(--g-line);
  border-radius: var(--r-xl, 28px);
  padding: 24px;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  font-weight: 400;                 /* ทั้งเว็บใช้ 300 — ในเกมต้องหนากว่านี้ถึงจะอ่านทัน */
  box-shadow: inset 0 1px 0 #fff, 0 10px 30px -22px rgba(15, 23, 42, .5);
}

/* ---------- แถบสถานะ ---------- */
.game-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 2px dashed color-mix(in srgb, var(--g-line) 80%, transparent);
}
.game-stat {
  min-width: 104px;
  padding: 9px 18px;
  background: #fff;
  border: 1px solid var(--g-line);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 2px 6px -3px rgba(15, 23, 42, .18);
}
.game-stat-label { display: block; font-size: 12px; font-weight: 400; color: var(--g-muted); }
.game-stat-value {
  display: block;
  font-size: 21px; font-weight: 600; line-height: 1.3;
  color: var(--primary, #2563eb);
  font-variant-numeric: tabular-nums;
}

/* ---------- หน้าจอสรุปผล ---------- */
.game-result { text-align: center; padding: 44px 20px; margin: auto 0; }
.game-result > i { font-size: 60px; margin-bottom: 14px; display: block; }
.game-result.good > i { color: var(--g-ok); }
.game-result.soso > i { color: var(--g-warn); }
.game-result h2 { margin: 6px 0 16px; font-size: 26px; font-weight: 600; }
.game-result-score {
  font-size: 46px; font-weight: 700; margin: 0; line-height: 1.15;
  color: var(--primary, #2563eb);
  font-variant-numeric: tabular-nums;
}
.game-result-score span { font-size: 19px; font-weight: 400; color: var(--g-muted); }
.game-result-pct { font-size: 16px; margin: 6px 0 10px; font-weight: 500; }
.game-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.game-saving { font-size: 12.5px; margin: 16px 0 0; }

/* ============================================================
   ป้ายกำกับตัวเลือก (ใช้ร่วมหลายเกม)
   ============================================================ */
.g-chip {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background .14s ease, color .14s ease;
}

/* ============================================================
   1) จับคู่
   ============================================================ */
.match-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; flex: 1; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-col-head {
  align-self: center;
  font-size: 13px; font-weight: 600;
  margin: 0 0 6px;
  padding: 5px 18px;
  border-radius: 99px;
  color: #fff;
}
.match-col:nth-child(1) .match-col-head { background: var(--g-c1); }
.match-col:nth-child(2) .match-col-head { background: var(--g-c3); }

.match-tile {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  color: var(--g-ink);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(15, 23, 42, .25);
  transition: transform .13s ease, box-shadow .13s ease, border-color .13s ease, background .13s ease;
}
/* ต้องยกเว้นป้ายกำกับ ไม่งั้นมันจะถูกยืดเท่ากับข้อความ (ป้ายก็เป็น span เหมือนกัน) */
.match-tile > span:not(.g-chip) { flex: 1; min-width: 0; }
.match-tile img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 40px; }

/* ฝั่งซ้าย = คราม / ฝั่งขวา = เขียวน้ำทะเล */
.match-col:nth-child(1) .match-tile { border-left: 5px solid var(--g-c1); }
.match-col:nth-child(1) .g-chip { background: color-mix(in srgb, var(--g-c1) 14%, #fff); color: var(--g-c1); }
.match-col:nth-child(2) .match-tile { border-left: 5px solid var(--g-c3); }
.match-col:nth-child(2) .g-chip { background: color-mix(in srgb, var(--g-c3) 14%, #fff); color: var(--g-c3); }

.match-tile:hover:not(.done) { transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgba(15, 23, 42, .4); }

.match-tile.picked {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary, #2563eb) 18%, transparent);
  transform: translateY(-2px);
}
.match-tile.done {
  border-color: #86efac;
  border-left-color: var(--g-ok) !important;
  background: #f0fdf4;
  color: #166534;
  cursor: default;
  box-shadow: none;
  opacity: .8;
}
.match-tile.done .g-chip { background: var(--g-ok) !important; color: #fff !important; }
.match-tile.done .g-chip::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }
.match-tile.done .g-chip > span { display: none; }

.match-tile.wrong {
  border-color: #fca5a5;
  background: #fef2f2;
  animation: gameShake .35s;
}
@keyframes gameShake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ============================================================
   2) ควิซ
   ============================================================ */
.quizg-area { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 660px; margin: 0 auto; width: 100%; }
.quizg-img { max-height: 170px; object-fit: contain; margin: 0 auto 16px; display: block; }
.quizg-q {
  font-size: 22px; font-weight: 500; line-height: 1.6;
  text-align: center; margin-bottom: 26px;
  color: var(--g-ink);
}
.quizg-options { display: grid; gap: 11px; }
.quizg-option {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 18px;
  border: 2px solid transparent;
  border-left: 5px solid var(--g-c2);
  border-radius: 14px;
  background: #fff;
  font: inherit; font-size: 16px; font-weight: 400; line-height: 1.55;
  text-align: left; color: var(--g-ink); cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(15, 23, 42, .25);
  transition: transform .13s ease, box-shadow .13s ease, border-color .13s ease, background .13s ease;
}
.quizg-option > span:not(.g-chip) { flex: 1; min-width: 0; }
.quizg-option .g-chip { background: color-mix(in srgb, var(--g-c2) 14%, #fff); color: var(--g-c2); }
.quizg-option:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgba(15, 23, 42, .4); }
.quizg-option.right {
  border-color: var(--g-ok); border-left-color: var(--g-ok);
  background: #f0fdf4; color: #14532d;
}
.quizg-option.right .g-chip { background: var(--g-ok); color: #fff; }
.quizg-option.wrong {
  border-color: var(--g-bad); border-left-color: var(--g-bad);
  background: #fef2f2; color: #7f1d1d;
}
.quizg-option.wrong .g-chip { background: var(--g-bad); color: #fff; }

/* ============================================================
   3) ตีตัวตุ่น
   ============================================================ */
.whack-wrap { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.whack-target {
  text-align: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--g-c1), color-mix(in srgb, var(--g-c1) 60%, var(--g-c2)));
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 10px 24px -14px var(--g-c1);
}
.whack-target-label { display: block; font-size: 12px; opacity: .85; margin-bottom: 2px; }
.whack-target strong { font-size: 22px; font-weight: 600; line-height: 1.5; }

.whack-field { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; flex: 1; }
.whack-hole {
  position: relative;
  min-height: 104px;
  border-radius: 18px;
  /* หลุมดิน — ไล่สีให้ดูลึก */
  background:
    radial-gradient(ellipse 78% 46% at 50% 100%, #94a3b8 0 60%, transparent 61%),
    linear-gradient(180deg, #eef2f7, #e2e8f0);
  overflow: hidden;
  box-shadow: inset 0 -6px 12px -6px rgba(15, 23, 42, .35);
}
.whack-mole {
  position: absolute;
  inset: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(165deg, #fbbf24, #d97706);
  color: #fff;
  font: inherit;
  font-size: 15px; font-weight: 500; line-height: 1.45;
  text-align: center;
  text-shadow: 0 1px 2px rgba(120, 53, 15, .5);
  cursor: pointer;
  transform: translateY(118%);
  transition: transform .2s cubic-bezier(.34, 1.5, .64, 1);
  box-shadow: 0 6px 14px -8px rgba(120, 53, 15, .9), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.whack-mole.up { transform: translateY(0); }
.whack-mole:hover.up { filter: brightness(1.06); }
.whack-mole.hit {
  background: linear-gradient(165deg, #4ade80, #16a34a);
  text-shadow: 0 1px 2px rgba(20, 83, 45, .5);
  transform: scale(.92);
}
.whack-mole.miss {
  background: linear-gradient(165deg, #f87171, #b91c1c);
  animation: gameShake .3s;
}

/* ============================================================
   4) บัตรคำ
   ============================================================ */
.fc-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.fc-card {
  position: relative;
  width: min(100%, 480px);
  min-height: 280px;
  border: 0; padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 1200px;
  font: inherit;
}
.fc-side {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 32px 28px;
  border-radius: 24px;
  backface-visibility: hidden;
  transition: transform .5s;
  box-shadow: 0 18px 40px -22px rgba(15, 23, 42, .7);
}
.fc-front { background: #fff; border: 2px solid var(--g-line); transform: rotateY(0deg); }
.fc-back {
  background: linear-gradient(150deg, var(--g-c1), var(--g-c2));
  color: #fff;
  transform: rotateY(180deg);
}
.fc-card.flipped .fc-front { transform: rotateY(-180deg); }
.fc-card.flipped .fc-back  { transform: rotateY(0deg); }
.fc-side img { max-height: 92px; object-fit: contain; }
.fc-label {
  font-size: 11.5px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 12px; border-radius: 99px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
.fc-text { font-size: 23px; line-height: 1.6; font-weight: 500; text-align: center; }
.fc-hint { font-size: 12.5px; opacity: .6; margin-top: 4px; }
.fc-nav { display: flex; align-items: center; gap: 16px; }
.fc-counter { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--g-muted); min-width: 72px; text-align: center; }

/* ============================================================
   5) วงล้อสุ่ม
   ============================================================ */
.wheel-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.wheel-stage { position: relative; width: min(100%, 380px); aspect-ratio: 1; }
.wheel-pointer {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 38px; color: #dc2626; z-index: 3;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35));
}
.wheel-disc {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 10px solid #fff;
  box-shadow: 0 16px 40px -14px rgba(15, 23, 42, .6), inset 0 0 0 3px rgba(255, 255, 255, .5);
  transition: transform 4s cubic-bezier(.17, .67, .18, .99);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
/* ดุมกลางวงล้อ */
.wheel-stage::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px -3px rgba(15, 23, 42, .5), inset 0 0 0 3px color-mix(in srgb, var(--primary, #2563eb) 25%, #fff);
  z-index: 2;
  pointer-events: none;
}
.wheel-label {
  position: absolute;
  top: 50%; left: 50%;
  transform-origin: 0 0;
  width: 44%;
  padding-left: 17%;
  margin-top: -9px;
  font-size: var(--wheel-label-size, 13.5px);
  font-weight: 600;                       /* ตัวบางอ่านไม่ออกบนพื้นสี */
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.wheel-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wheel-result {
  text-align: center;
  min-height: 76px;
  display: flex; flex-direction: column; gap: 3px; justify-content: center;
}
.wheel-result-label { font-size: 12px; color: var(--g-muted); }
.wheel-result strong {
  font-size: 27px; font-weight: 600;
  color: var(--primary, #2563eb);
  animation: wheelPop .4s cubic-bezier(.34, 1.5, .64, 1);
}
@keyframes wheelPop { 0% { transform: scale(.7); opacity: 0; } }
.wheel-result-match { font-size: 14.5px; color: var(--g-muted); }
.wheel-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--g-muted); }
.wheel-opt input { width: auto; }

/* ============================================================
   6) เปิดกล่องสุ่ม
   ============================================================ */
.boxg-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.boxg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 14px;
  width: 100%;
  flex: 1;
  align-content: start;
}
.boxg-box {
  position: relative;
  min-height: 132px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 16px 13px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(155deg, var(--bc, #4f46e5), color-mix(in srgb, var(--bc, #4f46e5) 65%, #000));
  color: #fff;
  font: inherit;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 22px -12px var(--bc, #4f46e5);
  transition: transform .16s ease, box-shadow .16s ease;
}
/* ริบบิ้นกล่องของขวัญ */
.boxg-box:not(.open)::before {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 7px), rgba(255,255,255,.32) calc(50% - 7px) calc(50% + 7px), transparent calc(50% + 7px)),
    linear-gradient(0deg, transparent calc(50% - 7px), rgba(255,255,255,.32) calc(50% - 7px) calc(50% + 7px), transparent calc(50% + 7px));
  pointer-events: none;
}
.boxg-box:hover:not(.open) { transform: translateY(-4px) scale(1.03); box-shadow: 0 16px 28px -12px var(--bc, #4f46e5); }
.boxg-num { font-size: 26px; font-weight: 700; position: relative; z-index: 1; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.boxg-icon { font-size: 20px; opacity: .8; position: relative; z-index: 1; }
.boxg-box.open {
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--bc, #4f46e5) 45%, #fff);
  border-top: 5px solid var(--bc, #4f46e5);
  color: var(--g-ink);
  cursor: default;
  box-shadow: 0 4px 14px -8px rgba(15, 23, 42, .5);
  animation: boxPop .32s;
}
@keyframes boxPop { 0% { transform: rotateY(85deg); } 100% { transform: rotateY(0); } }
.boxg-box img { max-height: 48px; object-fit: contain; }
.boxg-term { font-size: 16px; font-weight: 600; line-height: 1.45; }
.boxg-match { font-size: 12.5px; color: var(--g-muted); line-height: 1.5; }
.boxg-info { font-size: 13.5px; font-weight: 400; }

/* ============================================================
   กระดานคะแนน
   ============================================================ */
.game-best { display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px; }
.game-best strong { font-size: 27px; font-weight: 600; color: var(--primary, #2563eb); }
.game-best span { font-size: 14px; color: var(--g-muted); }

.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.leaderboard li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 14px;
}
.leaderboard li.me { background: color-mix(in srgb, var(--primary, #2563eb) 9%, transparent); font-weight: 500; }
.lb-rank {
  flex: 0 0 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--g-soft);
  border: 1px solid var(--g-line);
  font-size: 12px; font-weight: 600;
}
.lb-rank.rank-1 { background: #fde68a; border-color: #f59e0b; color: #78350f; }
.lb-rank.rank-2 { background: #e2e8f0; border-color: #94a3b8; color: #334155; }
.lb-rank.rank-3 { background: #fed7aa; border-color: #fb923c; color: #7c2d12; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }
.lb-score small { display: block; font-size: 11px; font-weight: 400; color: var(--g-muted); }

/* ============================================================
   ประวัติการเล่นของผู้เรียน (แถบข้างหน้าเกม)
   ============================================================ */
.play-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.play-history li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--g-line);
  background: #fff;
  font-size: 13.5px;
}
.play-history li.is-best {
  border-color: #fcd34d;
  background: #fffbeb;
}
.ph-round {
  flex: 0 0 30px;
  display: grid; place-items: center;
  height: 30px;
  border-radius: 8px;
  background: var(--g-soft);
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--g-muted);
}
.play-history li.is-best .ph-round { background: #fde68a; color: #78350f; }
.ph-round i { font-size: 9px; }
.ph-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ph-main strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.ph-main .lms-bar { height: 5px; margin: 2px 0 0; }
.ph-meta { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.ph-meta small { display: block; font-size: 11px; font-weight: 400; color: var(--g-muted); white-space: nowrap; }

/* ============================================================
   หลังบ้าน — ตารางผลการเล่น
   ============================================================ */
.game-results .gr-row { cursor: pointer; }
.game-results .gr-row:hover { background: var(--g-soft); }
.game-results .gr-caret { text-align: center; color: var(--g-muted); }
.game-results td.num { text-align: center; }
.game-results td.num small { display: block; font-size: 11px; }
.game-results .gr-detail > td { background: var(--g-soft); padding: 0 14px 14px 0; }
.gr-rounds { margin: 0; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.gr-rounds th { font-size: 12px; }
.gr-rounds td.num { text-align: center; font-variant-numeric: tabular-nums; }
.gr-rounds tr.is-best { background: #fffbeb; }
.gr-rounds tr.is-best i { color: #d97706; font-size: 11px; }

/* ============================================================
   หลังบ้าน — ตัวเลือกแม่แบบเกม + ตารางเนื้อหา
   ============================================================ */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tpl-card {
  position: relative;
  display: flex; flex-direction: column; gap: 5px;
  padding: 18px 16px;
  border: 2px solid var(--lms-line, #e5e9f0);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tpl-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary, #2563eb) 45%, var(--lms-line, #e5e9f0));
  box-shadow: var(--lms-sh-2, 0 8px 24px -10px rgba(15, 23, 42, .18));
}
.tpl-card:disabled { cursor: default; opacity: .75; }
.tpl-card.active {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb) 6%, #fff);
}
.tpl-card > i { font-size: 22px; color: var(--primary, #2563eb); margin-bottom: 4px; }
.tpl-card strong { font-size: 15px; font-weight: 500; }
.tpl-card small { font-size: 12.5px; color: var(--lms-text-muted, #64748b); line-height: 1.6; }
.tpl-flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tpl-check {
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 11px;
}
html[data-theme="dark"] .tpl-card { background: #1e293b; }

.game-items input[type="text"] {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--lms-line, #e5e9f0);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: inherit;
}
.game-items input[type="text"]:focus {
  outline: 2px solid color-mix(in srgb, var(--primary, #2563eb) 30%, transparent);
  border-color: var(--primary, #2563eb);
}
.game-items td { vertical-align: middle; padding: 6px 8px; }
.game-items .row-no { color: var(--lms-text-muted, #64748b); font-size: 13px; text-align: center; }
.game-items .media-field { display: flex; gap: 4px; align-items: center; }
.game-items .media-field input { flex: 1; min-width: 0; font-size: 12.5px; }
.game-items-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.import-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.import-form select {
  padding: 9px 12px;
  border: 1px solid var(--lms-line, #e5e9f0);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: inherit;
}

/* ============================================================
   จอเล็ก
   ============================================================ */
@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .game-stage { padding: 16px; border-radius: 22px; }
  .match-wrap { grid-template-columns: 1fr; gap: 22px; }
  .match-tile { padding: 11px 13px; font-size: 15px; }
  .match-tile img { width: 32px; height: 32px; flex-basis: 32px; }
  .g-chip { flex-basis: 26px; width: 26px; height: 26px; font-size: 13px; }
  .whack-field { gap: 9px; }
  .whack-hole { min-height: 86px; }
  .whack-mole { font-size: 13px; }
  .whack-target strong { font-size: 18px; }
  .game-stat { min-width: 88px; padding: 8px 13px; }
  .game-stat-value { font-size: 18px; }
  .quizg-q { font-size: 18px; }
  .quizg-option { font-size: 15px; padding: 12px 14px; }
  .boxg-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .wheel-stage { width: min(100%, 300px); }
}
