/* sparfirst: แดชบอร์ดสว่าง การ์ดมีภาพประกอบสีพาสเทล */
:root {
  --bg: #f7f9ff;
  --surface: #fff;
  --ink: #14213d;
  --ink-2: #33405e;
  --muted: #5f6b85;
  --line: #e7ebf5;
  --primary: #2f5bff;
  --navy: #16306b;
  --gold: #f2b01e;
  --gold-soft: #fff4d6;
  --primary-ink: #2246e6;
  --primary-soft: #edf2ff;
  --good: #12b76a;
  --good-soft: #ecfdf3;
  --bad: #f04438;
  --bad-soft: #fef3f2;
  --warn-soft: #fffaeb;

  --violet: #8b5cf6;
  --sky: #38a8f0;
  --blue: #2f5bff;
  --orange: #ff8a3d;
  --yellow: #f5b014;
  --pink: #f05fa8;
  --green: #22b573;

  --r-card: 20px;
  --r-inner: 12px;
  --r-btn: 12px;
  --shadow: 0 0 0 1px rgba(16, 24, 40, .05), 0 1px 2px -1px rgba(16, 24, 40, .06), 0 4px 12px 0 rgba(16, 24, 40, .04);
  --shadow-hover: 0 0 0 1px rgba(16, 24, 40, .07), 0 2px 4px -1px rgba(16, 24, 40, .08), 0 12px 28px 0 rgba(16, 24, 40, .08);
  --font-head: 'Prompt', 'Anuphan', system-ui, sans-serif;
  --font-body: 'Anuphan', system-ui, sans-serif;
  --side-w: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--navy); font-family: var(--font-head); line-height: 1.3; margin: 0 0 .5rem; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.6rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.55rem, 2.6vw, 1.8rem); font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 .75rem; text-wrap: pretty; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.num, .total, .timer, .stats dt { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.ic { flex: none; }

/* ---------- โครงหน้า ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: rgba(247, 249, 255, .86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.main { padding: 20px 16px 104px; max-width: 1180px; margin: 0 auto; }
.main > section, .main > .agrid, .main > .dash, .main > .card, .main > .list { margin-bottom: 32px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.brand .wordmark { display: block; height: 22px; width: auto; }
.brand small { margin-top: 3px; }
.brand small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.2; }
.brand span { display: block; line-height: 1.2; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 12px;
  color: var(--muted); font-size: .72rem; font-weight: 500;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.on { color: var(--primary); }
.tabbar a.on .ic { background: var(--primary-soft); border-radius: 999px; padding: 3px 14px; box-sizing: content-box; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .topbar, .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100vh; align-self: start;
    padding: 24px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
  }
  .side .brand { padding: 0 8px 18px; }
  .side-label { margin: 8px 12px 4px; font-size: .75rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px;
    min-height: 44px; padding: 0 12px; border-radius: var(--r-btn);
    color: var(--ink-2); font-weight: 500;
    transition: background-color .15s ease-out, color .15s ease-out;
  }
  .side-nav a:hover { background: var(--bg); text-decoration: none; }
  .side-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .side-card {
    margin-top: auto; padding: 16px; border-radius: 16px;
    background: linear-gradient(150deg, #5b77ff, var(--primary));
    color: #fff; font-size: .9rem;
  }
  .side-card p { margin-bottom: 12px; color: rgba(255, 255, 255, .88); }
  .side-card b { color: #fff; font-family: var(--font-head); font-size: 1rem; }
  .side-card .btn { background: #fff; color: var(--primary); box-shadow: none; }
  .main { padding: 32px 32px 56px; width: 100%; }
}

/* ---------- ปุ่ม ป้าย ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--r-btn);
  background: var(--surface); color: var(--ink);
  font: 600 .95rem/1 var(--font-body);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease-out, box-shadow .15s ease-out, background-color .15s ease-out;
}
.btn:hover { text-decoration: none; box-shadow: var(--shadow-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: #2b52f0; color: #fff; box-shadow: 0 1px 2px rgba(20, 33, 61, .12), 0 4px 10px -4px rgba(20, 33, 61, .28); }
.btn.primary:hover { background: linear-gradient(135deg, var(--primary-ink), #4a6dff); }
.btn.white { background: #fff; color: var(--primary); }
.btn.lg { min-height: 52px; padding: 0 22px 0 24px; font-size: 1rem; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .85rem; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.4;
  background: var(--surface); color: var(--ink-2);
}
.pill.on { background: var(--primary-soft); color: var(--primary); }
.pill.muted { background: #f2f4f7; color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: #b54708; }

.card { background: var(--surface); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); }
.card.note { color: var(--ink-2); }

/* สีประจำวิชา */
.t-violet { --tone: var(--violet); --tone-soft: #f3efff; --tone-ink: #5b3fd1; }
.t-sky { --tone: var(--sky); --tone-soft: #eaf6fe; --tone-ink: #0d649f; }
.t-blue { --tone: var(--blue); --tone-soft: var(--primary-soft); --tone-ink: #2246e6; }
.t-orange { --tone: var(--orange); --tone-soft: #fff2e9; --tone-ink: #a8420c; }
.t-yellow { --tone: var(--yellow); --tone-soft: #fff8e1; --tone-ink: #845800; }
.t-pink { --tone: var(--pink); --tone-soft: #fff0f7; --tone-ink: #b0245f; }
.t-green { --tone: var(--green); --tone-soft: #e9f9f1; --tone-ink: #0d7347; }

.f-ic, .chip-ic {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--tone-soft); color: var(--tone-ink, var(--tone));
}

/* ---------- หน้าแรก ---------- */
.hero { display: grid; gap: 32px; align-items: center; padding: 8px 0 8px; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: 1.08; margin: 16px 0; letter-spacing: -.02em; }
.hero h1 span { color: var(--primary); }
.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 34em; }
.stats { display: flex; gap: 28px; margin: 28px 0 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stats dd { margin: 0; color: var(--muted); font-size: .88rem; }

.hero-demo { position: relative; padding: 24px 0 8px; }
.demo { position: relative; z-index: 1; padding: 24px; }
.demo-label { font-size: .8rem; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.demo .q { font-size: 1.05rem; }
.demo .after .btn { margin-top: 12px; }
.float {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-hover);
  font-size: .8rem; font-weight: 600; color: var(--ink-2);
}
.float .ic { color: var(--primary); }
.f1 { top: 0; right: 12px; }
.f2 { bottom: -10px; left: 12px; }
.f2 .ic { color: var(--orange); }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.1fr .9fr; gap: 48px; padding: 24px 0 16px; }
  .f1 { right: -12px; }
  .f2 { left: -20px; }
}

.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 14px; }
.sec-head h2 { flex: none; }
.sec-head h2 { margin: 0; }
.sec-head p { margin: 0; }
.sec-head a { font-weight: 600; font-size: .92rem; }

.chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 10px; flex: none;
  padding: 6px 18px 6px 6px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink); font-weight: 600; font-size: .92rem;
  transition: box-shadow .15s ease-out, transform .12s ease-out;
}
.chip:hover { text-decoration: none; box-shadow: var(--shadow-hover); }
.chip:active { transform: scale(.97); }
.chip-ic { width: 40px; height: 40px; border-radius: 10px; }

/* ---------- การ์ดภาพประกอบ ---------- */
.agrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.acard {
  display: flex; flex-direction: column;
  padding: 8px; border-radius: var(--r-card);
  background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink);
  transition: box-shadow .2s ease-out, transform .2s ease-out;
}
a.acard:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
a.acard:active { transform: scale(.985); }
.acard-art {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: var(--r-inner);
  background: var(--tone);
}
.acard-art::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 100% 0, rgba(255, 255, 255, .28), transparent 55%);
}
.art { position: relative; display: block; width: 100%; height: 100%; }
.acard-art .pill { position: absolute; top: 10px; left: 10px; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.acard-art .pill.on { background: #fff; color: var(--ink); }
.acard-art .pill.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.acard-body { display: flex; flex-direction: column; flex: 1; padding: 14px 10px 8px; }
.acard-body h3 { margin-bottom: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .88rem; margin-bottom: 12px; }
.acard-cta { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 600; font-size: .92rem; }
.acard.soon .acard-art { filter: saturate(.55); }
.acard.soon { color: var(--ink-2); }

.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.feature { padding: 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); }
.feature h3 { margin: 14px 0 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

.cta-band {
  position: relative; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 28px; border-radius: 24px;
  background: linear-gradient(135deg, #5b77ff, var(--primary) 60%, #2f47d8);
  color: #fff;
}
.cta-band::after { content: ""; position: absolute; right: -60px; top: -80px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); margin: 0; }
.cta-band .btn { position: relative; z-index: 1; }

/* ---------- แบนเนอร์หัวหน้า ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: .5; }
.banner {
  position: relative; overflow: hidden;
  display: grid; gap: 8px; align-items: center;
  padding: 24px; border-radius: 24px; margin-bottom: 24px;
  background: var(--tone); color: #fff;
}
.banner::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 120% at 100% 0, rgba(255, 255, 255, .25), transparent 60%); }
.banner > * { position: relative; }
.banner h1 { color: #fff; margin-bottom: 8px; }
.banner .lead { color: rgba(255, 255, 255, .92); font-size: 1rem; margin: 0; }
.kicker { display: inline-block; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-size: .8rem; font-weight: 600; }
.banner-art { display: none; }
.banner.t-yellow, .banner.t-orange { color: var(--ink); }
.banner.t-yellow h1, .banner.t-orange h1 { color: var(--ink); }
.banner.t-yellow .lead, .banner.t-orange .lead { color: rgba(16, 24, 40, .78); }
.banner.t-yellow .kicker, .banner.t-orange .kicker { background: rgba(255, 255, 255, .5); }
@media (min-width: 700px) {
  .banner { grid-template-columns: 1fr 300px; padding: 28px 32px; }
  .banner-art { display: block; margin: -8px -12px -16px 0; }
}

/* ---------- แดชบอร์ด ---------- */
.dash { display: grid; gap: 16px; }
@media (min-width: 800px) { .dash { grid-template-columns: 1fr 1fr; } }

.stat-card, .status-card { display: flex; align-items: center; gap: 18px; }
.stat-card h3, .status-card h3 { margin-bottom: 4px; }
.stat-card p, .status-card p { margin: 0; font-size: .92rem; }
.ring { position: relative; flex: none; width: 88px; height: 88px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-bg { stroke: #eef0f5; }
.ring-fg { stroke: transparent; transition: stroke-dasharray .8s ease-out; }
.ring.has .ring-fg { stroke: var(--orange); }
.ring.has.ok .ring-fg { stroke: var(--good); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks .ic { color: var(--good); background: var(--good-soft); border-radius: 50%; padding: 3px; box-sizing: content-box; margin-top: 1px; }

.hist { list-style: none; padding: 0; margin: 0; }
.hist li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.hist li:last-child { border-bottom: 0; }
.res { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- รายการหัวข้อ ---------- */
.list { display: grid; gap: 12px; }
.row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
  transition: box-shadow .15s ease-out, transform .12s ease-out;
}
.row:hover { text-decoration: none; box-shadow: var(--shadow-hover); }
.row:active { transform: scale(.99); }
.row-main { flex: 1; min-width: 0; }
.row-main h3 { margin: 0 0 2px; }
.row-main p { margin: 0; font-size: .9rem; }

/* ---------- ข้อสอบ ---------- */
.practice-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.practice-start h3 { margin-bottom: 2px; }
.practice-start p { margin: 0; }
#practice { margin-bottom: 32px; }

.qlist { list-style: none; padding: 0; margin: 0; }
.qitem { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.qitem:first-child { padding-top: 4px; }
.qitem:last-child { border-bottom: 0; padding-bottom: 4px; }
.qitem > div { flex: 1; min-width: 0; }
.qno {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary);
  font: 600 .88rem/1 var(--font-head); font-variant-numeric: tabular-nums;
}
.qtext { font-weight: 500; white-space: pre-line; }
.choices.static { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; color: var(--ink-2); }
.choices.static b { color: var(--muted); font-weight: 600; margin-right: 4px; }
details summary {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 10px; background: var(--bg); cursor: pointer;
  font-size: .88rem; font-weight: 600; color: var(--primary); list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 10px; }
details p { font-size: .95rem; }

.law { margin: 12px 0 0; padding: 14px 16px; border-radius: var(--r-inner); background: #f4f6fd; border: 1px solid #e3e8f7; font-size: .92rem; }
.law p:last-child { margin-bottom: 0; }

.quiz { background: var(--surface); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.quiz-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.progress { height: 8px; border-radius: 999px; background: #eef0f5; overflow: hidden; margin-bottom: 20px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6d86ff, var(--primary)); transition: width .3s ease-out; }
.q { font-size: 1.12rem; font-weight: 500; margin-bottom: 16px; white-space: pre-line; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 8px 14px 8px 8px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  font: 500 1rem/1.4 var(--font-body); text-align: left; cursor: pointer;
  transition: border-color .15s ease-out, background-color .15s ease-out, transform .12s ease-out;
}
.opt:hover:not(:disabled) { border-color: #c7d0ff; background: #fafbff; }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt:disabled { cursor: default; }
.opt .k {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--bg); color: var(--ink-2); font-weight: 600;
}
.opt.sel { border-color: var(--primary); background: var(--primary-soft); }
.opt.sel .k { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.right .k { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }

.explain { margin-top: 16px; padding: 14px 16px; border-radius: 14px; font-size: .95rem; }
.explain.good { background: var(--good-soft); }
.explain.good strong { color: #067647; }
.explain.bad { background: var(--bad-soft); }
.explain.bad strong { color: #b42318; }
.quiz > h2 { margin-top: 28px; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.verdict { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; margin: 0; }

.timer { padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-top: 20px; }
.navgrid button {
  min-height: 40px; border: 0; border-radius: 10px;
  background: var(--bg); color: var(--ink-2);
  font: 600 .85rem/1 var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer;
}
.navgrid button.done { background: var(--primary-soft); color: var(--primary); }
.navgrid button.cur { box-shadow: inset 0 0 0 2px var(--primary); }

.mock-start .btn { margin-top: 4px; }

.scorecard { border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); margin-bottom: 8px; }
.scorecard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px; background: var(--bad-soft); }
.scorecard-head.pass { background: var(--good-soft); }
.scorecard-head .label { margin: 0 0 2px; font-size: .85rem; color: var(--muted); }
.scorecard-head .verdict { color: #b42318; }
.scorecard-head.pass .verdict { color: #067647; }
.total { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; }
.scorecard table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.scorecard th, .scorecard td { padding: 10px 20px; border-top: 1px solid var(--line); text-align: left; }
.scorecard th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.scorecard .n { text-align: right; font-variant-numeric: tabular-nums; }
.rule { margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

/* ---------- หน้าข้อความ ---------- */
.prose { max-width: 760px; padding: 28px; }
.prose ol, .prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- หน้าแรก: การ์ดสนามสอบ ---------- */
.exams { display: grid; gap: 16px; }
@media (min-width: 900px) { .exams { grid-template-columns: 1fr 1fr; } }
.exam-card { display: flex; flex-direction: column; padding: 8px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); }
.exam-art { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 7; border-radius: var(--r-inner); background: var(--tone); }
.exam-art .art { height: 100%; }
.exam-art .pill { position: absolute; top: 10px; left: 10px; background: #fff; color: var(--ink); }
.exam-art .pill.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.exam-body { padding: 14px 10px 10px; }
.exam-body h3 { font-size: 1.2rem; margin-bottom: 4px; }
.exam-body h3 a { color: var(--ink); }
.exam-subjects { list-style: none; padding: 0; margin: 4px 0 6px; display: grid; gap: 2px; }
.exam-subjects a { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--ink-2); font-size: .95rem; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); }
/* ---------- ชุดฝึก ---------- */
.sets { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 32px; }
.set-card { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.set-card > div { flex: 1; }
.set-card h3 { margin: 0; }
.set-card p { margin: 0; font-size: .85rem; }
.set-card .btn { min-height: 40px; padding: 0 14px; }
.set-list { margin-bottom: 12px; }
.set-list > summary { font-size: 1rem; color: var(--ink); background: none; padding: 0; min-height: 40px; }

/* ---------- เฉลยในรายการข้อสอบ ---------- */
.choices.static li { padding: 6px 10px; border-radius: 10px; transition: background-color .15s ease-out; }
.qitem.revealed .choices.static li.correct { background: var(--good-soft); color: #067647; font-weight: 600; }
.qitem.revealed .choices.static li.correct b { color: #067647; }
.qitem.revealed .choices.static li.correct::after { content: " ✓"; }
.ans-note { margin: 2px 0 8px 10px; padding: 10px 14px; border: 1px solid #cdeedd; border-radius: 10px; background: #f3fcf7; color: var(--ink-2); font-size: .95rem; }
.ans-note p:last-child { margin-bottom: 0; }
.ans-note .law { margin-top: 10px; }
.reveal { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--bg); color: var(--primary); font: 600 .88rem/1 var(--font-body); cursor: pointer; }
.qitem.revealed .reveal { color: var(--muted); }

/* ---------- บทความสำหรับข้ออ่าน ---------- */
.passage { white-space: pre-line; margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; background: #f8f9fc; box-shadow: inset 0 0 0 1px var(--line); font-size: .97rem; line-height: 1.75; color: var(--ink-2); }
.passage-item { list-style: none; padding: 18px 0 0; }
.passage-label { margin: 0 0 6px; font-size: .8rem; font-weight: 600; color: var(--primary); }

/* ลิงก์ไปหัวข้อ/วิชาอื่นท้ายหน้า */
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.links .chip { padding: 8px 14px; font-size: 15px; }

/* ---------- หัวหน้าสนามสอบ ---------- */
.xhero {
  display: grid; gap: 20px; align-items: center;
  padding: 24px 20px; border-radius: var(--r-card);
  background: linear-gradient(120deg, #e4ecff 0%, #f0e8ff 55%, #fff3d9 100%);
  box-shadow: var(--shadow);
}
.xhero .kicker { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .7); color: var(--navy); font-size: .8rem; font-weight: 600; }
.xhero h1 { margin-bottom: 8px; }
.xhero .lead { color: var(--ink-2); max-width: 60ch; }
.xstatus { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: .9rem; }
.xstatus .ic { color: var(--gold); margin-top: 3px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 12px 10px; text-align: center; box-shadow: var(--shadow); }
.kpi b { display: block; font: 700 1.5rem/1.2 var(--font-head); color: var(--primary); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--muted); }
@media (min-width: 900px) {
  .xhero { grid-template-columns: 1fr 340px; padding: 30px 32px; }
}

/* ---------- รายการชุดข้อสอบ ---------- */
.setbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.fchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; max-width: 100%; }
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; border: 0; cursor: pointer; font: 600 .9rem/1 var(--font-body);
  padding: 10px 16px; border-radius: 999px; min-height: 40px;
  background: var(--tone-soft, var(--surface)); color: var(--tone-ink, var(--ink-2));
  box-shadow: inset 0 0 0 1px rgba(20, 33, 61, .05);
  transition: transform .12s ease-out, box-shadow .15s ease-out;
}
.fchip:active { transform: scale(.96); }
.fchip.on { background: var(--navy); color: #fff; box-shadow: none; }
.fchip.t-yellow { color: var(--tone-ink); }
.setsearch {
  flex: 1 1 200px; max-width: 280px; margin-left: auto; min-height: 40px;
  border: 1px solid var(--line); border-radius: 12px; padding: 0 14px;
  font: 400 .95rem var(--font-body); color: var(--ink); background: var(--surface);
}
.setsearch:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.setlist { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.sl-head, .sl-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; }
.sl-head { display: none; }
.sl-row { color: var(--ink); border-top: 1px solid var(--line); transition: background-color .15s ease-out; }
.sl-row:first-of-type, .sl-head + .sl-row { border-top: 0; }
.sl-row:hover { background: #f8faff; text-decoration: none; }
.sl-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone-ink, var(--tone)); font: 700 1.05rem var(--font-head); }
.sl-ico.t-yellow, .sl-subj.t-yellow { color: var(--tone-ink); }
.sl-name { min-width: 0; }
.sl-name b { display: block; font: 600 1rem/1.35 var(--font-head); color: var(--navy); }
.sl-name small { display: none; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.sl-meta { display: block; font-style: normal; color: var(--muted); font-size: .82rem; }
.sl-meta i { font-style: normal; }
.sl-meta .ok, .sl-st.ok { color: var(--good); font-weight: 600; }
.sl-meta .low, .sl-st.low { color: #c4320a; font-weight: 600; }
.sl-subj, .sl-n, .sl-st { display: none; }
.sl-go {
  justify-self: end; padding: 9px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; white-space: nowrap;
  background: #2b52f0; color: #fff; box-shadow: 0 1px 2px rgba(20, 33, 61, .12), 0 4px 10px -4px rgba(20, 33, 61, .28);
}
.sl-go.again { background: var(--surface); color: var(--primary); box-shadow: inset 0 0 0 1.5px #c9d5ff; }
.sl-row:active .sl-go { transform: scale(.96); }
.sl-empty { padding: 20px; margin: 0; text-align: center; }
@media (min-width: 760px) {
  .sl-head, .sl-row { grid-template-columns: 40px 1fr 150px 76px 96px 110px; padding: 12px 20px; }
  .sl-head { display: grid; padding: 10px 20px; background: #fbfcff; border-bottom: 1px solid var(--line); font-size: .78rem; font-weight: 600; color: var(--muted); }
  .sl-name small { display: block; }
  .sl-meta { display: none; }
  .sl-subj { display: inline-block; justify-self: start; padding: 3px 10px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink, var(--tone)); font-size: .8rem; font-weight: 600; }
  .sl-n { display: block; font-variant-numeric: tabular-nums; }
  .sl-st { display: inline-block; justify-self: start; padding: 3px 10px; border-radius: 999px; background: #f1f3f9; color: var(--muted); font-size: .8rem; font-weight: 600; }
  .sl-st.ok { background: var(--good-soft); }
  .sl-st.low { background: var(--bad-soft); }
}

/* ---------- ส่วนท้ายเว็บ ---------- */
.site-foot {
  margin-top: 56px; padding: 36px 20px 24px; border-radius: 28px;
  background: linear-gradient(120deg, #e4ecff 0%, #f0e8ff 55%, #fff3d9 100%);
}
.sf-head { text-align: center; margin-bottom: 26px; }
.sf-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; margin-bottom: 6px; }
.sf-head h2 span { color: var(--primary); }
.sf-head p { color: var(--ink-2); margin: 0; }
.sf-cards { display: grid; gap: 14px; margin-bottom: 30px; }
.sf-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); transition: box-shadow .15s ease-out, transform .15s ease-out; }
.sf-card:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.sf-card .sf-t { font-size: 1.15rem; margin: 6px 0 0; }
.sf-card p { color: var(--muted); font-size: .92rem; margin: 0; }
.sf-more { margin-top: auto; padding-top: 8px; display: inline-flex; gap: 6px; align-items: center; color: var(--primary); font-weight: 600; font-size: .9rem; }
.sf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 0 4px 22px; }
.sf-cols h3 { margin: 0 0 10px; font: 700 1rem var(--font-head); }
.sf-cols h3 a { color: var(--navy); }
.sf-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sf-cols li a { color: var(--ink-2); font-size: .9rem; }
.sf-bottom { border-top: 1px solid rgba(20, 33, 61, .08); padding: 16px 4px 0; color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; }
.sf-bottom p { margin: 0; }
@media (min-width: 760px) {
  .site-foot { padding: 48px 40px 28px; }
  .sf-cards { grid-template-columns: repeat(3, 1fr); }
  .sf-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 759px) { .setsearch { max-width: none; margin-left: 0; flex-basis: 100%; } }

/* โลโก้เต็ม */
.brand-full { flex-direction: column; align-items: flex-start; gap: 2px; }
.brand-full img { display: block; height: auto; }
.side .brand-full { padding: 0 8px 18px; }
.side .brand-full small { padding-left: 4px; }
.topbar .brand-full img { width: 120px; }
.sf-logo { display: block; margin: 0 auto 14px; width: 220px; height: auto; }

/* footer เต็มขอบข้างและขอบล่าง: ให้ .main กว้างเต็ม แล้วจำกัดความกว้างที่เนื้อหาแทน */
.main { max-width: none; }
.main > *:not(.site-foot) { max-width: none; margin-left: auto; margin-right: auto; }
.site-foot { margin: 56px -16px -104px; border-radius: 0; padding: 40px 16px calc(104px + 16px); }
.site-foot > * { max-width: none; margin-left: auto; margin-right: auto; }
@media (min-width: 760px) { .site-foot { padding-left: 32px; padding-right: 32px; } }
@media (min-width: 1024px) { .site-foot { margin: 64px -32px -56px; padding: 52px 32px 32px; } }

/* ================= หน้าแรกแบบใหม่ (รองรับหลายสนาม) ================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.circ { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.circ:hover { text-decoration: none; background: var(--primary-soft); color: var(--primary); }
.hsec { margin-bottom: 22px; }
.hsec .sec-head { margin-bottom: 12px; }
.more { font-weight: 600; font-size: .92rem; white-space: nowrap; }

.home-top { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.gsearch { position: relative; flex: 1; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.gsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 1rem var(--font-body); color: var(--ink); height: 100%; }
.gsearch:focus-within { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.gresults { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border-radius: 16px; box-shadow: 0 12px 32px rgba(20, 33, 61, .14), 0 0 0 1px var(--line); padding: 6px; max-height: 60vh; overflow: auto; }
.gresults a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--ink); }
.gresults a:hover { background: #f5f7ff; text-decoration: none; }
.gresults b { display: block; font-weight: 600; color: var(--navy); }
.gresults small { color: var(--muted); font-size: .82rem; }
.gresults .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); flex: none; }
.gresults p { margin: 0; padding: 12px; }
@media (max-width: 1023px) { .hide-sm { display: none; } }

.xchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 14px; margin: 0 -2px -12px; }
.xchips::-webkit-scrollbar { display: none; }
.xchip { flex: none; display: inline-flex; gap: 6px; align-items: center; min-height: 42px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer; background: var(--surface); color: var(--ink-2); font: 600 .95rem var(--font-body); box-shadow: inset 0 0 0 1px var(--line); transition: transform .12s ease-out, background-color .15s ease-out; }
.xchip:hover { text-decoration: none; background: #f5f7ff; }
.xchip:active { transform: scale(.96); }
.xchip.on { background: var(--navy); color: #fff; box-shadow: 0 4px 12px rgba(22, 48, 107, .25); }
.xchip.all { color: var(--primary); }

.hbanner { position: relative; overflow: hidden; display: flex; align-items: center; min-height: 168px; padding: 22px 20px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #0f2152 0%, #1f3f8f 100%); margin-bottom: 10px; }
.hb-text { position: relative; z-index: 1; max-width: 62%; }
.hb-k { margin: 0 0 2px; font-size: .82rem; color: #c8d3f5; }
.hb-t { margin: 0; color: #fff; font-size: 1.35rem; line-height: 1.3; }
.hb-d { margin: 4px 0 14px; font-size: .85rem; color: #c8d3f5; }
.btn.gold { background: var(--gold); color: #1b1b1b; box-shadow: 0 6px 16px -4px rgba(242, 176, 30, .55); }
.btn.gold:hover { background: #ffc23a; }
.hb-art { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 130px; height: 136px; }
.sheet { position: absolute; width: 92px; height: 116px; border-radius: 12px; background: #fff; box-shadow: 0 10px 22px rgba(0, 0, 0, .28); padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.sheet.s1 { right: 8px; top: 12px; transform: rotate(9deg); opacity: .35; }
.sheet.s2 { right: 24px; top: 4px; transform: rotate(-4deg); }
.sheet .ln { display: block; height: 6px; border-radius: 3px; background: #e7ebf5; }
.sheet .op { display: block; height: 9px; border-radius: 5px; background: linear-gradient(90deg, #cfd6e8 0 9px, transparent 9px 14px, #eef1f7 14px); }
.sheet .op.ok { background: linear-gradient(90deg, #12a46b 0 9px, transparent 9px 14px, #eef1f7 14px); }
.timer { position: absolute; right: 0; bottom: 6px; display: inline-flex; gap: 4px; align-items: center; background: var(--gold); color: #1b1b1b; font-weight: 700; font-size: .72rem; padding: 5px 9px; border-radius: 999px; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }
.freeline { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 2px 18px; color: var(--muted); font-size: .85rem; }
.freeline span { display: inline-flex; gap: 4px; align-items: center; }
.freeline .ic { color: var(--good); }

.hsubs { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.hsubs::-webkit-scrollbar { display: none; }
.hsub { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--ink); }
.hsub:hover { text-decoration: none; }
.hs-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone-ink, var(--tone)); font: 700 1.4rem var(--font-head); transition: transform .12s ease-out; }
.hsub:active .hs-ic { transform: scale(.96); }
.hs-ic.t-yellow { color: var(--tone-ink); }
.hsub b { display: block; font-weight: 600; font-size: .8rem; line-height: 1.25; }
.hsub small { display: none; color: var(--muted); font-size: .78rem; }

.rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rcard { position: relative; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s ease-out, transform .15s ease-out; }
.rcard:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.rc-pic { height: 96px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone-ink, var(--tone)); font: 700 2.4rem var(--font-head); position: relative; }
.rc-pic.t-yellow { color: var(--tone-ink); }
.rc-tag { position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: 999px; background: #fff; color: var(--navy); font: 600 .72rem var(--font-body); }
.rc-body { padding: 10px 12px 12px; }
.rc-body b { display: block; font: 600 .92rem/1.35 var(--font-head); }
.rc-link { color: var(--navy); }
.rc-link::after { content: ""; position: absolute; inset: 0; }
.rc-link:hover { text-decoration: none; }
.rc-body small { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.rc-bar { height: 5px; margin-top: 8px; border-radius: 3px; background: #eef1f7; overflow: hidden; }
.rc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--good); }
.rc-bar.low i { background: #f79009; }
.fav { position: absolute; z-index: 2; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: #fff; color: #9aa2b6; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); transition: transform .12s ease-out, color .15s ease-out; }
.fav:active { transform: scale(.9); }
.fav.on { color: #ff4d6d; }
.fav.on svg { fill: currentColor; }

.about-band { display: grid; gap: 18px; align-items: center; padding: 22px 20px; border-radius: 22px; background: linear-gradient(120deg, #e4ecff 0%, #f0e8ff 55%, #fff3d9 100%); }
.about-band h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 8px 0; }
.about-band h2 span { color: var(--primary); }
.about-band .lead { color: var(--ink-2); margin: 0; }
.kpis.wide { margin: 0 0 26px; max-width: 640px; }

/* แถวรายการชุด: ทั้งแถวกดได้ด้วยลิงก์ที่ยืดเต็มแถว และมีปุ่มหัวใจ */
.sl-row { position: relative; }
.sl-link { color: inherit; }
.sl-link::after { content: ""; position: absolute; inset: 0; }
.sl-link:hover { text-decoration: none; }
.sl-row .fav { position: relative; top: auto; right: auto; box-shadow: none; background: transparent; width: 40px; height: 40px; }
.sl-head, .sl-row { grid-template-columns: 40px 1fr auto 40px; }

@media (min-width: 640px) {
  .rgrid { grid-template-columns: repeat(3, 1fr); }
  .hsubs { display: grid; grid-template-columns: repeat(5, 1fr); overflow: visible; }
  .hsub { width: auto; padding: 14px 8px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
  .hsub small { display: block; }
  .hbanner { min-height: 200px; padding: 28px 32px; }
  .hb-t { font-size: 1.7rem; }
  .hb-art { right: 32px; transform: translateY(-50%) scale(1.2); transform-origin: right center; }
}
@media (min-width: 760px) {
  .sl-head, .sl-row { grid-template-columns: 40px 1fr 150px 76px 96px 110px 40px; }
  .about-band { grid-template-columns: 1fr 1fr; padding: 32px; }
}
@media (min-width: 1024px) {
  .rgrid { grid-template-columns: repeat(4, 1fr); }
  .hsub { flex-direction: row; text-align: left; gap: 12px; padding: 12px 14px; }
  .hs-ic { width: 46px; height: 46px; border-radius: 14px; font-size: 1.15rem; }
  .hsub b { font-size: .92rem; }
}
.rgrid[data-rec] .rcard:nth-child(n+5) { display: none; }
@media (min-width: 640px) and (max-width: 1023px) { .rgrid[data-rec] .rcard:nth-child(n+5) { display: block; } }

/* การ์ดสนามสอบในหน้าแรก (เพิ่มสนามได้ไม่จำกัด) */
.xgrid { display: grid; gap: 14px; margin-bottom: 12px; }
.xcard { position: relative; display: grid; grid-template-columns: 1fr; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s ease-out, transform .15s ease-out; }
.xcard:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.xc-art { display: grid; place-items: center; background: var(--tone); overflow: hidden; }
.xc-art { height: 112px; }
.xc-art svg { width: 100%; height: 100%; }
.xc-actions .btn { flex: 1; justify-content: center; }
.xc-body { padding: 14px 16px; min-width: 0; }
.xc-body h3 { margin: 0; font-size: 1.05rem; }
.xc-link { color: var(--navy); }
.xc-link:hover { text-decoration: none; }
.xc-meta { margin: 2px 0 8px; color: var(--muted); font-size: .85rem; }
.xc-subs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.xc-subs span { padding: 2px 9px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink, var(--tone)); font-size: .75rem; font-weight: 600; }
.xc-subs .t-yellow { color: var(--tone-ink); }
.xc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 640px) {
  .xgrid { grid-template-columns: repeat(2, 1fr); }
  .xcard { grid-template-columns: 1fr; }
  .xc-art { height: 150px; }
  .xc-art svg { width: 100%; height: 100%; }
  .xc-body { padding: 16px 18px 18px; }
  .xc-body h3 { font-size: 1.15rem; }
}
@media (min-width: 1200px) { .xgrid { grid-template-columns: repeat(3, 1fr); } }
.rgrid[data-rec] .rcard:nth-child(n+5) { display: none; }
@media (min-width: 640px) and (max-width: 1023px) { .rgrid[data-rec] .rcard:nth-child(n+5) { display: block; } }

/* ================= แบนเนอร์เคลื่อนไหว (หน้าแรก) ================= */

.mb{--ink:#14213d;--muted:#5f6b85;--navy:#16306b;--pri:#2f5bff;--gold:#f2b01e;--good:#12a46b;--goodbg:#e3f8ee;--line:#e7ebf5;--L:16s}


.mb{margin:0 0 8px;position:relative;overflow:hidden;border-radius:32px;background:#eef2ff;min-height:420px;display:grid;grid-template-columns:1.05fr 1fr;align-items:center;padding:0 48px;isolation:isolate}
/* moving gradient blobs */
.mb-blob{position:absolute;border-radius:50%;filter:blur(50px);opacity:.75;z-index:-1}
.mb-b1{width:420px;height:420px;background:#c9d6ff;left:-80px;top:-120px;animation:float1 14s ease-in-out infinite alternate}
.mb-b2{width:360px;height:360px;background:#ead9ff;right:10%;bottom:-160px;animation:float2 12s ease-in-out infinite alternate}
.mb-b3{width:280px;height:280px;background:#ffe9b8;right:-60px;top:-60px;animation:float1 16s ease-in-out infinite alternate-reverse}
@keyframes float1{to{transform:translate(80px,60px) scale(1.1)}}
@keyframes float2{to{transform:translate(-90px,-40px) scale(1.15)}}
/* kinetic headline */
.mb-kin{font-weight:700;line-height:1.1;color:var(--navy)}
.mb-kin .mb-l1{display:block;font-size:30px;color:var(--muted);font-weight:600;margin-bottom:6px}
.mb-roll{display:block;height:1.35em;overflow:hidden;font-size:72px;letter-spacing:-.02em;line-height:1.35}
.mb-roll span{display:block;color:#2246e6;animation:roll var(--L) cubic-bezier(.7,0,.2,1) infinite}
@keyframes roll{0%,19%{transform:translateY(0)}25%,44%{transform:translateY(-20%)}50%,69%{transform:translateY(-40%)}75%,94%{transform:translateY(-60%)}100%{transform:translateY(-80%)}}
.mb-sub{margin-top:14px;font-size:17px;color:var(--muted)}
.mb-sub b{color:var(--navy)}
/* scene */
.mb-scene{position:relative;height:420px;perspective:1100px}
.mb-phone{position:absolute;left:50%;top:50%;width:230px;height:400px;margin:-200px 0 0 -115px;border-radius:36px;background:#fff;box-shadow:0 30px 60px rgba(22,48,107,.22),0 0 0 7px #101828;transform:rotateY(-14deg) rotateX(6deg);animation:sway var(--L) ease-in-out infinite;padding:40px 14px 14px;transform-style:preserve-3d;overflow:hidden}
.mb-phone:before{content:"";position:absolute;top:12px;left:50%;width:70px;height:18px;margin-left:-35px;border-radius:10px;background:#101828}
@keyframes sway{0%,100%{transform:rotateY(-14deg) rotateX(6deg) translateY(0)}50%{transform:rotateY(-6deg) rotateX(3deg) translateY(-8px)}}
.mb-q{font-size:13px;font-weight:600;margin-bottom:10px;line-height:1.4}
.mb-opt{display:flex;gap:8px;align-items:center;padding:8px 10px;border-radius:11px;border:1.5px solid var(--line);margin-bottom:6px;font-size:13px}
.mb-opt i{font-style:normal;width:22px;height:22px;border-radius:7px;background:#f1f3f9;display:grid;place-items:center;font-size:12px;font-weight:700}
.mb-opt.mb-ok{animation:ok var(--L) ease infinite}
@keyframes ok{0%,8%{border-color:var(--line);background:#fff}11%,92%{border-color:var(--good);background:var(--goodbg)}96%,100%{border-color:var(--line);background:#fff}}
.mb-exp{font-size:12px;color:#0b6b46;background:var(--goodbg);border-radius:9px;padding:7px 9px;margin-top:6px;animation:fadeup var(--L) ease infinite}
@keyframes fadeup{0%,11%{opacity:0;transform:translateY(8px)}15%,92%{opacity:1;transform:none}96%,100%{opacity:0}}
.mb-tap{position:absolute;left:150px;top:118px;width:34px;height:34px;border-radius:50%;border:2px solid var(--pri);background:rgba(47,91,255,.18);animation:tap var(--L) ease infinite}
@keyframes tap{0%,3%{opacity:0;transform:scale(1.8)}6%{opacity:1;transform:scale(1)}8%{transform:scale(.8)}11%,100%{opacity:0;transform:scale(1.2)}}
.mb-score{position:absolute;left:14px;right:14px;bottom:14px;border-radius:14px;background:linear-gradient(135deg,#2f5bff,#6d7dff);color:#fff;padding:12px;text-align:center;animation:pop var(--L) cubic-bezier(.16,1,.3,1) infinite}
.mb-score b{display:block;font-size:26px}.mb-score small{font-size:12px;opacity:.9}
@keyframes pop{0%,55%{opacity:0;transform:scale(.6)}60%,92%{opacity:1;transform:scale(1)}96%,100%{opacity:0;transform:scale(.9)}}
/* floating chips */
.mb-chip{position:absolute;background:#fff;border-radius:16px;box-shadow:0 16px 34px rgba(22,48,107,.16);padding:10px 14px;font-weight:600;font-size:14px;display:flex;gap:8px;align-items:center;white-space:nowrap;opacity:0}
.mb-c1{left:2%;top:14%;animation:in1 var(--L) cubic-bezier(.16,1,.3,1) infinite}
.mb-c2{right:0;top:24%;animation:in2 var(--L) cubic-bezier(.16,1,.3,1) infinite}
.mb-c3{left:-4%;bottom:12%;max-width:240px;white-space:normal;font-weight:400;font-size:12.5px;line-height:1.5;flex-direction:column;align-items:flex-start;animation:in3 var(--L) cubic-bezier(.16,1,.3,1) infinite}
.mb-c4{right:4%;bottom:16%;animation:in4 var(--L) cubic-bezier(.16,1,.3,1) infinite}
.mb-c1 .mb-big{font-size:22px;color:var(--navy)}
.mb-gold{background:var(--gold);color:#1b1b1b}
.mb-c3 em{font-style:normal;font-size:12px;font-weight:700;color:var(--navy);background:#fff4d6;border-radius:7px;padding:2px 8px}
.mb-c3 p{margin-top:6px}.mb-c3 span{background:linear-gradient(transparent 60%,#ffe7a3 60%);background-repeat:no-repeat;animation:hl var(--L) ease infinite}
@keyframes hl{0%,79%{background-size:0 100%}86%,100%{background-size:100% 100%}}
@keyframes in1{0%,2%{opacity:0;transform:translate(-30px,10px) scale(.8)}6%,22%{opacity:1;transform:none}25%,100%{opacity:0;transform:translate(-10px,-10px) scale(.95)}}
@keyframes in2{0%,8%{opacity:0;transform:translate(30px,10px) scale(.8)}12%,47%{opacity:1;transform:none}50%,100%{opacity:0;transform:translate(10px,-10px) scale(.95)}}
@keyframes in4{0%,49%{opacity:0;transform:translate(30px,20px) scale(.8)}53%,72%{opacity:1;transform:none}75%,100%{opacity:0;transform:translateY(-10px) scale(.95)}}
@keyframes in3{0%,74%{opacity:0;transform:translate(-30px,20px) scale(.85)}78%,95%{opacity:1;transform:none}99%,100%{opacity:0}}
.mb-t{font-variant-numeric:tabular-nums}
/* sparkles */
.mb-spark{position:absolute;width:10px;height:10px;background:var(--gold);clip-path:polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%);opacity:0;animation:sp var(--L) ease infinite}
@keyframes sp{0%,58%{opacity:0;transform:scale(0) rotate(0)}62%{opacity:1;transform:scale(1.4) rotate(90deg)}70%,100%{opacity:0;transform:scale(.4) rotate(180deg) translateY(-30px)}}
@media(max-width:700px){.mb{grid-template-columns:1fr;padding:30px 20px 0;min-height:auto}.mb-roll{font-size:48px}.mb-kin .mb-l1{font-size:22px}.mb-sub{font-size:15px}.mb-scene{height:440px;margin-top:6px}.mb-c3{left:0}.mb-c1{left:0}}
@media (prefers-reduced-motion:reduce){.mb *{animation:none!important}.mb-chip{opacity:1}}

:where(.mb) :where(p,h2,b,span,i,em,div){margin:0;box-sizing:border-box}
.mb.paused *,.mb.paused{animation-play-state:paused!important}

/* ================= เริ่มซ้อมรายหัวข้อ ================= */
.tstart { display: grid; gap: 16px; align-items: center; padding: 22px; margin-bottom: 22px; }
.tstart h2 { margin: 0 0 4px; }
.tstart .muted { margin: 0 0 12px; }
.ts-prog { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
.ts-prog .rc-bar { margin: 0; height: 8px; }
.ts-act { display: flex; gap: 10px; align-items: center; }
.ts-act .btn { flex: 1; justify-content: center; }
.fav.static { position: static; width: 52px; height: 52px; flex: none; box-shadow: inset 0 0 0 1px var(--line); }
.linkbtn { justify-self: start; border: 0; background: none; padding: 0; color: var(--muted); font: 400 .85rem var(--font-body); text-decoration: underline; cursor: pointer; }
@media (min-width: 760px) {
  .tstart { grid-template-columns: 1fr auto; padding: 26px 30px; }
  .ts-act .btn { flex: none; }
}

/* แบนเนอร์อยู่บนสุดของหน้าแรก: บนมือถือย่อให้เตี้ยลง ไม่ดันการ์ดสนามสอบลงไปไกล */
.mb { margin-bottom: 18px; }
@media (max-width: 700px) {
  /* มือถือ: ข้อความซ้าย มือถือข้อสอบขวา ตัดขอบล่าง เห็นข้อสอบครบ */
  .mb { grid-template-columns: 1.1fr 1fr; gap: 4px; padding: 0 0 0 18px; min-height: 0; height: 250px; align-items: center; border-radius: 24px; }
  .mb .mb-l1 { font-size: 13px; margin-bottom: 2px; }
  .mb .mb-roll { font-size: 30px; }
  .mb .mb-sub { font-size: 13px; margin-top: 8px; line-height: 1.45; }
  .mb .mb-scene { height: 250px; margin: 0 14px 0 0; perspective: 700px; }
  .mb .mb-phone { left: 0; top: 22px; margin: 0; width: 156px; height: 330px; padding: 30px 10px 10px; border-radius: 26px; box-shadow: 0 18px 36px rgba(22,48,107,.2), 0 0 0 5px #101828; }
  .mb .mb-phone:before { top: 9px; width: 54px; height: 14px; margin-left: -27px; }
  .mb .mb-q { font-size: 10.5px; margin-bottom: 7px; }
  .mb .mb-opt { padding: 5px 8px; font-size: 12px; margin-bottom: 4px; border-radius: 9px; }
  .mb .mb-opt i { width: 18px; height: 18px; font-size: 9.5px; border-radius: 6px; }
  .mb .mb-exp { font-size: 9.5px; padding: 5px 7px; margin-top: 4px; }
  .mb .mb-score { display: none; }
  .mb .mb-tap { left: 96px; top: 84px; width: 24px; height: 24px; }
  .mb .mb-chip { font-size: 12px; padding: 6px 9px; border-radius: 12px; }
  .mb .mb-c1 { left: auto; right: 6px; top: 10px; }
  .mb .mb-c1 .mb-big { font-size: 15px; }
  .mb .mb-c2 { right: auto; left: -46px; top: auto; bottom: 18px; }
  .mb .mb-c4 { right: -6px; bottom: 14px; }
  .mb .mb-c3 { display: none; }
  .mb .mb-spark { display: none; }
}
@media (min-width: 701px) { .mb { padding-top: 12px; padding-bottom: 12px; } }

/* แบนเนอร์ชิดขอบ: ยืดออกเท่าระยะ padding ของ .main ทั้งซ้าย ขวา และบน */
.main > .mb { max-width: none; margin: -20px -16px 18px; border-radius: 0; }
@media (min-width: 1024px) { .main > .mb { margin: -32px -32px 24px; } }
@media (max-width: 700px) {
  .mb .mb-c2 { left: -54px; top: 14px; bottom: auto; }
  .mb .mb-c4 { left: -40px; right: auto; bottom: 12px; }
}
@media (min-width: 701px) {
  .main > .mb { padding-left: 32px; padding-right: 32px; }
  .main > .mb .mb-scene { height: 440px; }
}

@media (min-width: 1500px) { .xgrid { grid-template-columns: repeat(4, 1fr); } .rgrid { grid-template-columns: repeat(5, 1fr); } }


/* ================= Impeccable pass: adapt · colorize · quieter · distill · typeset · polish ================= */
/* adapt: หัวข้อภาษาไทยยาวต้องตัดบรรทัดได้ ไม่ดันหน้าให้ล้นจอ */
h1, h2, h3, h4 { overflow-wrap: anywhere; min-width: 0; }
.sec-head h2 { flex: 0 1 auto; }
.crumbs a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 2px; }
/* colorize: ปุ่มหลักใช้สีทึบที่ตัวขาวอ่านผ่าน 4.5:1 เงามีระยะ ไม่เรืองแสง */
.btn.primary, .sl-go { background: #2b52f0; box-shadow: 0 1px 2px rgba(20, 33, 61, .12), 0 4px 10px -4px rgba(20, 33, 61, .28); }
.btn.primary:hover, .sl-row:hover .sl-go { background: #2246e6; }
.sl-go.again { background: var(--surface); color: #2246e6; box-shadow: inset 0 0 0 1.5px #c9d5ff; }
.fchip.on { background: var(--navy); color: #fff; box-shadow: none; }
.xchip.on { box-shadow: none; }
.more, .sf-more, a.chip { color: #2246e6; }
.mb-score { background: var(--navy) !important; }
.mb-score small { opacity: 1; color: #dfe6ff; }
/* quieter: คำใหญ่สีทึบ ไม่ไล่สี; ไม่เน้นสีคำเดียวในหัวข้อ */
.sf-head h2 span, .about-band h2 span { color: inherit; }
.timer, .mb-gold, .btn.gold { box-shadow: 0 2px 6px rgba(20, 33, 61, .18); }
/* distill: แบนเนอร์หน้าวิชา/หัวข้อเป็นพื้นสว่าง เข้ากับหน้าแรก และไม่สูงจนดันปุ่มลง */
.banner { background: var(--tone-soft); color: var(--ink); border: 1px solid rgba(20, 33, 61, .06); }
.banner::before { display: none; }
.banner h1, .banner.t-yellow h1, .banner.t-orange h1 { color: var(--navy); }
.banner .lead, .banner.t-yellow .lead, .banner.t-orange .lead { color: var(--ink-2); max-width: 68ch; }
@media (max-width: 699px) { .banner { padding: 18px; } .banner .lead { font-size: .95rem; } }
/* distill: กล่องตัวเลขในหัวสนามสอบไม่ซ้อนการ์ดในการ์ด */
.xhero .kpi { background: rgba(255, 255, 255, .55); box-shadow: none; }
/* distill: footer เป็นข้อความเรียบ ไม่ใช่การ์ดไอคอนเรียงกัน */
.sf-head { margin-bottom: 22px; }
.sf-head p { color: var(--ink-2); }
.sf-cards { gap: 0; margin-bottom: 26px; }
.sf-card { background: none; box-shadow: none; border-radius: 0; padding: 16px 4px; border-top: 1px solid rgba(20, 33, 61, .1); }
.sf-card:hover { box-shadow: none; transform: none; }
.sf-card:hover .sf-t { color: #2246e6; }
@media (min-width: 760px) { .sf-cards { gap: 28px; } }
/* typeset: ตัวหนังสือในแบนเนอร์มือถือไม่เล็กกว่า 11px */
@media (max-width: 700px) {
  .mb .mb-sub { font-size: 13px; }
  .mb .mb-l1 { font-size: 14px; }
  .mb .mb-chip { font-size: 12px; }
  .mb .mb-q { font-size: 12px; }
  .mb .mb-opt { font-size: 12px; }
  .mb .mb-opt i { font-size: 12px; }
  .mb .mb-exp { font-size: 12px; }
  .mb .mb-phone { width: 168px; }
}
/* polish: พื้นผิวของเบราว์เซอร์ใช้สีของแบรนด์ */
::selection { background: #ffe7a3; color: var(--ink); }
:root { accent-color: var(--primary); caret-color: var(--primary); }
a { text-underline-offset: 3px; }
