/* ห้องเรียนคิดเลขเร็ว — ธีม "โรงยิมตัวเลข"
   ฉากเฉพาะห้องนี้: กรมท่าเข้ม + ส้มพลังงาน · กรอบทอง #C9A227 คงที่ทั้งเว็บ
   กฎ GPU อ่อน: ห้าม backdrop-filter blur / background-attachment: fixed */
:root {
  --gold: #C9A227;
  --gold-soft: #E8CE7A;
  --bg: #101A2B;
  --bg-card: #1A2740;
  --bg-deep: #0B1220;
  --orange: #FF8A3D;
  --orange-deep: #E06A1B;
  --green: #4CC38A;
  --red: #E5654F;
  --blue: #5AA7E8;
  --text: #F2EFE6;
  --text-dim: #A8B3C7;
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Sarabun', 'Prompt', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg) radial-gradient(circle at 20% 0%, #16233C 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 60px; }

/* ---------- แผนที่ไต่เลเวล ---------- */
.level-map-section { margin: 4px 0 18px; }
.level-map-note { color: var(--text-dim); font-size: .84rem; margin: -4px 0 10px; }
.level-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.level-node { min-height: 76px; border: 1px solid #2C3B5C; border-radius: 12px; background: var(--bg-card); color: var(--text); padding: 7px 4px; text-decoration: none; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.level-node.open { border-color: var(--orange); box-shadow: inset 0 0 0 1px rgba(255,138,61,.2); }
.level-node.passed { border-color: var(--green); background: #173B37; }
.level-node.locked { opacity: .52; }
.level-no { font-size: 1.05rem; font-weight: 800; color: var(--gold-soft); }
.level-title { font-size: .66rem; line-height: 1.2; }
.level-tag { font-size: .61rem; color: var(--text-dim); }
.level-node.open .level-tag { color: var(--orange); }
.level-node.passed .level-tag { color: #8FE1BB; }
.reward-card { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--gold); border-radius: var(--radius); background: #2D2940; color: var(--text); line-height: 1.5; }
.reward-card small { color: var(--text-dim); }

/* ---------- header ---------- */
.gym-head {
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #1D2B49 0%, #14203A 100%);
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 14px;
}
.gym-head h1 { font-size: 1.5rem; color: var(--gold-soft); letter-spacing: .5px; }
.gym-head .sub { color: var(--text-dim); font-size: .9rem; margin-top: 2px; }

/* ---------- belt + streak ---------- */
.status-row { display: flex; gap: 10px; margin-bottom: 14px; }
.status-card {
  flex: 1; background: var(--bg-card); border: 1px solid #2C3B5C;
  border-radius: var(--radius); padding: 12px; text-align: center;
}
.status-card .big { font-size: 1.35rem; font-weight: 700; }
.status-card .lbl { font-size: .78rem; color: var(--text-dim); }
.belt-chip {
  display: inline-block; padding: 3px 14px; border-radius: 999px;
  font-weight: 700; border: 2px solid var(--gold);
}

/* ---------- ปุ่มหลัก ---------- */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  border-radius: var(--radius); font-family: inherit; text-align: center;
  text-decoration: none; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-hero {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: #fff; font-size: 1.3rem; font-weight: 800; padding: 20px;
  border: 2px solid var(--gold); box-shadow: 0 6px 18px rgba(255, 138, 61, .25);
  margin-bottom: 14px;
}
.btn-hero small { display: block; font-size: .85rem; font-weight: 500; opacity: .9; }
.btn-menu {
  background: var(--bg-card); color: var(--text); border: 1px solid #2C3B5C;
  padding: 14px 16px; font-size: 1.02rem; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; text-align: left;
}
.btn-menu .ico { font-size: 1.4rem; }
.btn-menu .desc { font-size: .8rem; color: var(--text-dim); display: block; }
.btn-menu:hover { border-color: var(--gold); }

/* ---------- ห้องท่องสูตรคูณ หน้าแรก ---------- */
.chant-front-card{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:12px 14px;
  align-items:center;
  margin:0 0 14px;
  padding:16px;
  border-radius:var(--radius);
  border:1px solid rgba(255,195,77,.74);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,195,77,.30), transparent 10rem),
    linear-gradient(135deg,#102a50,#0b5f66 58%,#173b37);
  box-shadow:0 12px 26px rgba(0,0,0,.18);
  color:var(--text);
}
.chant-front-badge{
  width:56px;
  height:56px;
  display:grid;
  place-items:center;
  border-radius:18px;
  background:linear-gradient(135deg,var(--gold),var(--orange));
  color:#1a1608;
  font-size:1.6rem;
  box-shadow:0 8px 18px rgba(255,138,61,.24);
}
.chant-front-copy h2{
  margin:0 0 4px;
  color:var(--gold-soft);
  font-size:1.16rem;
}
.chant-front-copy p{
  margin:0;
  color:#d9e6ef;
  font-size:.9rem;
  line-height:1.5;
}
.chant-front-tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:9px;
}
.chant-front-tags span{
  padding:4px 8px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.13);
  color:#ffe0a0;
  font-size:.72rem;
}
.chant-front-btn{
  grid-column:1/-1;
  background:linear-gradient(135deg,var(--orange),var(--orange-deep));
  color:#fff;
  font-weight:850;
  padding:13px 16px;
  border:1px solid var(--gold);
}

/* ---------- รายการบท ---------- */
.unit-block { margin-bottom: 12px; }
.unit-head {
  color: var(--gold-soft); font-weight: 700; font-size: .95rem;
  padding: 8px 4px 4px; border-bottom: 1px dashed #35466B; margin-bottom: 6px;
}
.lesson-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid #2C3B5C;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 6px;
  color: var(--text); text-decoration: none; font-size: .95rem;
}
.lesson-row.locked { opacity: .45; pointer-events: none; }
.lesson-row .tagx {
  margin-left: auto; font-size: .72rem; padding: 2px 10px;
  border-radius: 999px; background: #24345A; color: var(--text-dim); white-space: nowrap;
}
.lesson-row .tagx.ready { background: #1F4634; color: var(--green); }

/* ---------- หน้าฝึก ---------- */
.progress-bar { height: 10px; background: #22314F; border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 999px; transition: width .3s ease; }
.session-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-dim); margin-bottom: 14px; }
.phase-chip { color: var(--gold-soft); font-weight: 600; }

.q-card {
  background: var(--bg-card); border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 22px 16px; text-align: center; margin-bottom: 14px;
}
.q-card .q-text { font-size: 1.6rem; font-weight: 700; line-height: 1.5; }
.q-card .q-text.small { font-size: 1.15rem; font-weight: 600; }
.combo { color: var(--orange); font-weight: 800; font-size: .95rem; min-height: 1.4em; text-align: center; margin-bottom: 8px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices.single-col { grid-template-columns: 1fr; }
.choice-btn {
  background: var(--bg-deep); color: var(--text); border: 2px solid #33456C;
  border-radius: 14px; padding: 16px 10px; font-size: 1.15rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: border-color .12s ease, transform .08s;
}
.choice-btn:active { transform: scale(.97); }
.choice-btn.correct { border-color: var(--green); background: #14351F; color: var(--green); }
.choice-btn.wrong { border-color: var(--red); background: #3A1F17; color: var(--red); }
.choice-btn:disabled { cursor: default; }

/* ---------- เฉลยทีละขั้น (กระดานทด) ---------- */
.solve-board {
  background: var(--bg-deep); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; text-align: left;
}
.solve-board .sb-head { color: var(--gold-soft); font-weight: 700; margin-bottom: 8px; }
.solve-step {
  display: flex; gap: 10px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed #2C3B5C; font-size: 1.02rem;
  opacity: 0; transform: translateY(4px); transition: opacity .35s ease, transform .35s ease;
}
.solve-step.show { opacity: 1; transform: none; }
.solve-step .no {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--gold);
  color: #1A1608; font-size: .8rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.solve-note { color: var(--text-dim); font-size: .88rem; margin-top: 8px; }

.btn-next {
  background: var(--gold); color: #221A05; font-size: 1.1rem; font-weight: 800;
  padding: 14px; margin-top: 14px;
}
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid #33456C; padding: 12px; margin-top: 8px; font-size: .95rem; }

/* ---------- เวลา ---------- */
.timer { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 700; }
.timer.hot { color: var(--orange); }

/* ---------- หน้าสรุปผล ---------- */
.result-hero { text-align: center; padding: 24px 12px; }
.result-hero .score { font-size: 3rem; font-weight: 800; color: var(--gold-soft); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.result-grid .cell { background: var(--bg-card); border: 1px solid #2C3B5C; border-radius: 12px; padding: 12px; text-align: center; }
.result-grid .cell b { font-size: 1.3rem; display: block; }
.weak-list { margin-top: 8px; }
.weak-item {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border-left: 4px solid var(--orange); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: .92rem;
}
.badge-new-move {
  border: 2px dashed var(--gold); border-radius: var(--radius); background: #241E0C;
  padding: 12px 14px; margin: 12px 0; text-align: center; color: var(--gold-soft);
}

/* ---------- การ์ดท่าไม้ตาย ---------- */
.moves-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .moves-grid { grid-template-columns: 1fr 1fr; } }
.move-card {
  background: linear-gradient(150deg, #1E2C4C 0%, #16223C 100%);
  border: 2px solid var(--gold); border-radius: var(--radius); padding: 16px;
}
.move-card.locked { border-color: #33456C; filter: grayscale(.7); opacity: .6; }
.move-card h3 { color: var(--gold-soft); font-size: 1.1rem; }
.move-card .tagline { font-size: .85rem; color: var(--text-dim); margin-bottom: 8px; }
.move-card .formula {
  background: var(--bg-deep); border-radius: 10px; padding: 8px 12px;
  font-weight: 700; font-size: .98rem; margin-bottom: 6px;
}
.move-card .example { font-size: .9rem; color: var(--blue); }
.move-card .challenge { font-size: .85rem; color: var(--orange); margin-top: 8px; }
.move-card .locked-q { font-size: 2rem; text-align: center; padding: 10px 0; }

/* ---------- สถิติ ---------- */
.chart-card { background: var(--bg-card); border: 1px solid #2C3B5C; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.chart-card h3 { color: var(--gold-soft); font-size: 1rem; margin-bottom: 8px; }
.skill-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .88rem; }
.skill-bar-row .name { flex: 0 0 42%; }
.skill-bar-track { flex: 1; height: 12px; background: #22314F; border-radius: 999px; overflow: hidden; }
.skill-bar-track > div { height: 100%; border-radius: 999px; }
.skill-bar-row .pct { flex: 0 0 44px; text-align: right; font-variant-numeric: tabular-nums; }

.back-link { display: inline-block; color: var(--text-dim); text-decoration: none; font-size: .9rem; margin-bottom: 10px; }
.back-link:hover { color: var(--gold-soft); }
.center-note { text-align: center; color: var(--text-dim); font-size: .85rem; padding: 20px 10px; }
