:root {
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0;
  --bg: #ffffff; --bg-alt: #f6f7fb; --brand: #4f46e5; --brand-2: #f59e0b;
  --good: #16a34a; --bad: #dc2626; --radius: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; font-family: "Noto Sans Thai", system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.65; font-size: 16px; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-size: .9em; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.logo b { color: var(--brand); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff; font-weight: 800; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; font-size: .95rem; font-weight: 500; }
.nav a:hover { background: var(--bg-alt); }
.nav .nav-cta { background: var(--ink); color: #fff; }
.nav .nav-cta:hover { background: var(--brand); }
.menu-btn { display: none; border: 0; background: none; font-size: 1.5rem; cursor: pointer; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; transition: transform .1s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.btn-small { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.link-btn { border: 0; background: none; color: var(--c, var(--brand)); font: inherit; font-weight: 600; cursor: pointer; padding: 12px 0 0; }

/* hero */
.hero { padding: 64px 0 56px; background: radial-gradient(1200px 400px at 10% -10%, #eef2ff, transparent), radial-gradient(800px 400px at 100% 0%, #fff7ed, transparent); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--brand); text-transform: uppercase; background: #eef2ff; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.01em; }
.hl { background: linear-gradient(transparent 60%, #fde68a 60%); }
.lead { font-size: 1.1rem; color: var(--ink-2); margin: 16px 0 24px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 32px; margin-top: 32px; }
.hero-stats b { display: block; font-size: 1.9rem; font-weight: 800; }
.hero-stats span { color: var(--muted); font-size: .9rem; }
.exam-cards { display: grid; gap: 16px; }
.exam-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.exam-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.exam-top b { font-size: 1.15rem; }
.badge { font-size: .75rem; background: var(--bg-alt); border-radius: 999px; padding: 3px 10px; color: var(--ink-2); }
.countdown { margin: 8px 0 10px; font-size: 1rem; color: var(--ink-2); }
.countdown b { font-size: 1.6rem; color: var(--brand); }
.countdown small { display: block; color: var(--muted); }
.exam-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: .9rem; }
.exam-card dt { color: var(--muted); }
.exam-card dd { margin: 0; }
.exam-note { font-size: .85rem; color: var(--ink-2); background: #fffbeb; border-radius: 10px; padding: 8px 12px; margin: 12px 0 0; }

/* sections */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
.sec-head { max-width: 760px; margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
.sec-head p { color: var(--ink-2); margin: 10px 0 0; }

/* blueprint */
.readiness { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; }
.readiness-label { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.bar { height: 10px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #7c3aed); transition: width .4s; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: .9rem; margin-bottom: 20px; }
.pri { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.pri-3 { background: #dc2626; } .pri-2 { background: #f59e0b; } .pri-1 { background: #94a3b8; }
.bp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.bp-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.bp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.bp-id { background: var(--c); color: #fff; font-weight: 800; border-radius: 12px; width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.bp-head h3 { font-size: 1.15rem; }
.bp-head small { color: var(--muted); }
.bp-topics { list-style: none; margin: 0; padding: 0; }
.bp-topics li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px dashed var(--line); }
.bp-t b { display: block; font-weight: 600; }
.bp-t small { color: var(--muted); font-size: .85rem; }
.bp-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pri-tag { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pri-tag.p3 { background: #fee2e2; color: #b91c1c; } .pri-tag.p2 { background: #fef3c7; color: #b45309; } .pri-tag.p1 { background: #f1f5f9; color: #475569; }
.lv { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.check input { display: none; }
.check span { display: block; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); cursor: pointer; margin-top: 2px; transition: .15s; }
.check input:checked + span { background: var(--good); border-color: var(--good); box-shadow: inset 0 0 0 3px #fff; }
.old-format { margin-top: 24px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.old-format summary { cursor: pointer; font-weight: 600; }
.map-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .92rem; }
.map-table th, .map-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.map-table th { background: var(--bg-alt); }

/* focus */
.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.focus-col { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.focus-title { font-size: 1.05rem; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid; }
.focus-title.ok { border-color: #dc2626; } .focus-title.mid { border-color: #f59e0b; } .focus-title.no { border-color: #94a3b8; }
.focus-list { list-style: none; margin: 0; padding: 0; }
.focus-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.focus-list li small { color: var(--muted); margin-left: 4px; }
.focus-list.out li b { display: block; text-decoration: line-through; text-decoration-color: #cbd5e1; }
.focus-list.out li small { display: block; margin: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.tips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.tip { background: #fff; border-radius: 12px; padding: 14px 16px; font-size: .9rem; color: var(--ink-2); border-left: 4px solid var(--brand-2); }
.tip b { display: block; color: var(--ink); margin-bottom: 4px; }

/* basics */
.basics-progress { font-weight: 700; margin-bottom: 16px; color: var(--brand); }
.basics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.basic-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: .2s; }
.basic-card.done { border-color: var(--good); background: #f0fdf4; }
.basic-head { display: flex; gap: 10px; align-items: center; }
.basic-head h3 { font-size: 1.05rem; }
.tag { color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; flex: none; }
.why { color: var(--muted); font-size: .88rem; margin: 8px 0; }
.formulas { margin: 0 0 10px; padding: 10px 12px 10px 28px; background: var(--bg-alt); border-radius: 10px; font-size: .9rem; }
.formulas li { margin: 3px 0; }
.pitfalls { font-size: .85rem; color: #9a3412; }
.pitfalls ul { margin: 4px 0 0; padding-left: 18px; }
.basic-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; }
.basic-card.done .mark { background: var(--good); }

/* practice */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .88rem; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-actions { display: flex; gap: 8px; }
.scoreboard { position: sticky; top: 72px; z-index: 5; display: flex; gap: 28px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin-bottom: 16px; box-shadow: var(--shadow); font-size: .95rem; }
.scoreboard b { font-size: 1.1rem; }
.good { color: var(--good); }
.q-list { display: grid; gap: 16px; }
.q-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 20px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; }
.q-no { font-weight: 700; }
.q-topic { color: var(--muted); }
.lvl { margin-left: auto; font-weight: 700; font-size: .75rem; padding: 2px 10px; border-radius: 999px; }
.lvl.l1 { background: #dcfce7; color: #15803d; } .lvl.l2 { background: #fef3c7; color: #b45309; } .lvl.l3 { background: #fee2e2; color: #b91c1c; }
.q-text { font-size: 1.02rem; margin: 10px 0 14px; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: center; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; font: inherit; cursor: pointer; transition: .15s; }
.choice span { width: 26px; height: 26px; border-radius: 8px; background: var(--bg-alt); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.choice:hover:not(:disabled) { border-color: var(--c); }
.choice:disabled { cursor: default; color: var(--ink); }
.choice.right { border-color: var(--good); background: #f0fdf4; }
.choice.right span { background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: #fef2f2; }
.choice.wrong span { background: var(--bad); color: #fff; }
.solution { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: #fef2f2; font-size: .93rem; }
.solution.ok { background: #f0fdf4; }
.solution p { margin: 4px 0 0; }
.empty { color: var(--muted); }

/* plan */
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.plan-card h3 { font-size: 1.15rem; }
.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); }
.when { font-weight: 700; color: var(--brand); font-size: .9rem; }
.timeline b { display: block; font-weight: 600; font-size: .95rem; }
.timeline small { color: var(--muted); }

/* downloads */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.dl-card { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); transition: .15s; }
.dl-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.dl-icon { width: 52px; height: 52px; border-radius: 14px; background: #eef2ff; color: var(--brand); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; flex: none; }
.dl-card h3 { font-size: 1rem; }
.dl-card p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.dl-tag { font-size: .7rem; font-weight: 700; color: var(--brand-2); text-transform: uppercase; }
.dl-go { margin-left: auto; font-weight: 700; font-size: .85rem; color: var(--brand); white-space: nowrap; }

.footer { padding: 32px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.footer p { margin: 4px 0; }

/* responsive */
@media (max-width: 960px) {
  .hero-grid, .bp-grid, .plan-grid, .focus-grid { grid-template-columns: 1fr; }
  .basics-grid { grid-template-columns: repeat(2, 1fr); }
  .tips { grid-template-columns: repeat(2, 1fr); }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: #fff; padding: 12px 20px; border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
}
@media (max-width: 600px) {
  .basics-grid, .tips, .choices { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  .scoreboard { gap: 14px; font-size: .85rem; }
  .bp-topics li { grid-template-columns: auto 1fr; }
  .bp-meta { grid-column: 2; flex-direction: row; align-items: center; }
}

.stat { display: block; margin-top: 6px; color: var(--muted); }
.dl-meta { display: block; margin-top: 4px; font-size: .75rem; color: var(--muted); }

/* mode note + history */
.mode-note { background: #eef2ff; color: var(--ink-2); border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; font-size: .92rem; }
.mode-note .link-btn { padding: 0 0 0 8px; }
.btn-exam { background: var(--ink); }
.history { margin-top: 28px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.history h3 { font-size: 1.05rem; margin-bottom: 10px; }
.history table { width: 100%; border-collapse: collapse; font-size: .88rem; white-space: nowrap; }
.history th, .history td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }

/* exam overlay */
.exam { position: fixed; inset: 0; z-index: 50; background: var(--bg-alt); overflow-y: auto; }
.exam-bar { position: sticky; top: 0; z-index: 2; background: var(--ink); color: #fff; }
.exam-bar-inner { display: flex; align-items: center; gap: 14px; height: 60px; }
.exam-progress { color: #cbd5e1; font-size: .9rem; margin-left: auto; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 999px; }
.timer.low { background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
.exam-close { border: 0; background: none; color: #fff; font-size: 1.3rem; cursor: pointer; padding: 4px 8px; }
.exam-body { padding-top: 24px; padding-bottom: 64px; display: grid; gap: 16px; }
.exam-start { text-align: center; padding: 40px 0; }
.exam-start h2 { font-size: 1.6rem; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 720px; margin: 24px auto 0; }
.preset { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 24px 16px; font: inherit; cursor: pointer; transition: .15s; }
.preset:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.preset b { display: block; font-size: 1.15rem; }
.preset span { color: var(--muted); }
.choice.picked { border-color: var(--brand); background: #eef2ff; }
.choice.picked span { background: var(--brand); color: #fff; }
.exam-foot { text-align: center; padding: 12px 0; }
.result { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.result-top { display: flex; gap: 24px; align-items: center; }
.result-top h2 { font-size: 1.3rem; }
.result-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ring { --p: 0; flex: none; width: 120px; height: 120px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #fff 78%, transparent 79%), conic-gradient(var(--brand) calc(var(--p) * 1%), var(--bg-alt) 0); }
.ring b { font-size: 1.7rem; line-height: 1; }
.ring small { color: var(--muted); }
.area-bars { display: grid; gap: 10px; margin-top: 22px; }
.area-bar { display: grid; grid-template-columns: 220px 1fr 50px; gap: 12px; align-items: center; font-size: .92rem; }
.area-bar b { text-align: right; }
.review-h { margin-top: 24px; font-size: 1.05rem; }

@media (max-width: 600px) {
  .chip-group { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex: none; }
  .filter-actions { flex-wrap: wrap; }
  .preset-grid { grid-template-columns: 1fr; }
  .result-top { flex-direction: column; text-align: center; }
  .result-actions { justify-content: center; }
  .area-bar { grid-template-columns: 1fr 44px; }
  .area-bar .bar { grid-column: 1 / -1; grid-row: 2; }
  .exam-bar-inner { gap: 8px; }
  .exam-bar-inner > b { font-size: .9rem; }
  .exam-progress { display: none; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
}

[hidden] { display: none !important; }
