:root {
  --ink: #1b2340;
  --ink-soft: #4a5275;
  --line: #dde1ee;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --indigo: #2f3fa0;
  --indigo-soft: #e7eaf8;
  --gold: #c8971c;
  --gold-soft: #fbf1d6;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --ok: #1f7a4d;
  --radius-lg: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Anuphan", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: var(--indigo); }
img, iframe { max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 18px 80px; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: var(--ink); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand span { font-weight: 400; opacity: .7; font-size: .9rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.who { opacity: .85; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 4px; }

/* ---------- forms & buttons ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px;
  margin-bottom: 18px;
}
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth h1 { font-size: 1.6rem; }
label { display: block; font-weight: 500; margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; font: inherit; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
input:focus { border-color: var(--indigo); outline: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px 20px; border-radius: 999px; border: 0;
  background: var(--indigo); color: #fff; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 20px; }
.btn.gold { background: var(--gold); color: #1b1300; }
.btn.ghost { background: var(--indigo-soft); color: var(--indigo); }
.msg { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
.msg.err { background: var(--danger-soft); color: var(--danger); }
.msg.ok { background: #e6f4ec; color: var(--ok); }

/* ---------- status screens ---------- */
.state { text-align: center; padding: 40px 22px; }
.state .icon { font-size: 2.6rem; line-height: 1; margin-bottom: 12px; }

/* ---------- course summary ---------- */
.course-head h1 { margin-bottom: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.fact { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; }
.fact b { display: block; font-size: 1.5rem; line-height: 1.2; }
.fact span { font-size: .85rem; color: var(--ink-soft); }
.fact.gold { background: var(--gold-soft); }
.meter { height: 10px; border-radius: 99px; background: var(--indigo-soft); overflow: hidden; margin-top: 16px; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

.notice { border-left: 4px solid var(--gold); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 10px; }
.notice h3 { margin-bottom: 2px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li + li { border-top: 1px solid var(--line); }
.list-plain li { padding: 10px 0; }

/* ---------- the lesson path (signature element) ---------- */
.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path::before {
  content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px;
  width: 3px; background: var(--line);
}
.step { position: relative; }
.step a, .step div.row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px 10px 0; text-decoration: none; color: inherit;
  border-radius: var(--radius-sm);
}
.step a:hover .step-title { text-decoration: underline; }
.dot {
  position: relative; z-index: 1; flex: 0 0 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: .82rem; font-weight: 700;
  background: #eceef5; color: #9aa0b8; border: 3px solid var(--bg);
}
.step.completed .dot {
  background: radial-gradient(circle at 35% 30%, #f6dc8a, var(--gold) 60%, #9c7410);
  color: #3a2a00;
}
.step.unlocked .dot { background: #fff; color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo); }
.step-body { min-width: 0; }
.step-title { font-weight: 600; display: block; }
.step.locked .step-title { color: #9aa0b8; font-weight: 500; }
.step-sub { font-size: .85rem; color: var(--ink-soft); }

/* ---------- lesson page ---------- */
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.player { position: relative; padding-top: 56.25%; background: #000; margin: 14px 0 18px; }
.player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.timer { display: flex; align-items: center; gap: 14px; }
.timer .meter { flex: 1; margin: 0; }
.timer b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer-note { margin-top: 12px; padding: 10px 14px; background: var(--gold-soft); border-radius: var(--radius-sm); font-size: .92rem; }
.timer-note b { display: block; }
.timer-note span { color: var(--ink-soft); }
.note { white-space: pre-wrap; overflow-wrap: anywhere; }
.done-banner {
  background: var(--gold-soft); border: 1px solid #ecd28a; border-radius: var(--radius-lg);
  padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.checklist { list-style: none; padding: 0; margin: 10px 0 0; }
.checklist li { padding: 2px 0; }

.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.q.wrong { background: var(--danger-soft); margin: 0 -22px; padding: 14px 22px; }
.q p { font-weight: 600; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin: 6px 0; cursor: pointer; font-weight: 400; }
.choice input { margin-top: 6px; }
.choice:has(input:checked) { border-color: var(--indigo); background: var(--indigo-soft); }

.admin-bar { background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: .92rem; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 1.55rem; }
  .panel { padding: 18px; }
  .q.wrong { margin: 0 -18px; padding: 14px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- signup ---------- */
.reg { max-width: 640px; margin: 0 auto; }
.countdown { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 8px 0 12px; color: var(--indigo); }
.dots { display: flex; gap: 6px; margin: 4px 0 14px; }
.dots i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.dots i.on { background: var(--gold); }
.consent-body { margin: 10px 0 6px; }
.ticks { list-style: none; padding: 0; margin: 0 0 12px; }
.ticks li { position: relative; padding: 6px 0 6px 30px; border-bottom: 1px dashed var(--line); }
.ticks li::before { content: "✓"; position: absolute; left: 4px; top: 6px; color: var(--ok); font-weight: 700; }
.warnlist li::before { content: "!"; color: var(--danger); left: 9px; }
.callout { background: var(--gold-soft); border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; }
.callout p { margin: 4px 0 0; }
.tiers { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: .95rem; }
.tiers th, .tiers td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tiers th { background: var(--indigo-soft); }
.tiers td:first-child { white-space: nowrap; font-weight: 600; }
.ack { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; font-weight: 500; cursor: pointer; }
.ack input { width: 20px; height: 20px; margin-top: 3px; flex: 0 0 auto; }
.navrow { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.qbar {
  position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); margin: -24px -18px 16px;
}
.qbar b { display: block; font-size: 1.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.qbar .small { opacity: .75; }
.qtier { font-size: .82rem; color: #f6dc8a; }
.qtime { text-align: right; }
.qbar.hurry .qtime b { color: #ff9b8f; }
.reg form h2 { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }
.reg form h1 + h2 { border-top: 0; margin-top: 8px; }
.field { margin-bottom: 4px; }
.field textarea { width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.hint { font-size: .85rem; color: var(--ink-soft); margin: 4px 0 0; }
input[type=tel], input[type=date], input[type=time], input[type=file] {
  width: 100%; font: inherit; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pkgs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pkg { margin: 0; cursor: pointer; }
.pkg input { position: absolute; opacity: 0; }
.pkg span { display: block; border: 2px solid var(--line); border-radius: var(--radius-lg); padding: 14px; height: 100%; }
.pkg b { display: block; font-size: 1.05rem; }
.pkg em { display: block; font-style: normal; font-size: 1.5rem; font-weight: 700; color: var(--indigo); }
.pkg small { color: var(--ink-soft); }
.pkg input:checked + span { border-color: var(--gold); background: var(--gold-soft); }
.pkg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.pay { background: var(--bg); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 8px; }
.amount { font-size: 1.1rem; margin: 0; }
.amount b { font-size: 2rem; color: var(--indigo); }
.paygrid { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; margin-top: 8px; }
.qr { text-align: center; }
.qr img { width: 100%; border-radius: var(--radius-sm); display: block; margin-bottom: 8px; }
.acct p { margin: 0 0 4px; }
.accno { font-size: 1.3rem; font-weight: 700; letter-spacing: .5px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.slipimg { max-width: 220px; max-height: 320px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: 8px; }
.overlay { position: fixed; inset: 0; background: rgba(27,35,64,.55); display: grid; place-items: center; padding: 18px; z-index: 30; }
.overlay .panel { max-width: 420px; }
.receipt .rc, .rc { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; text-align: left; margin: 16px 0; }
.rc dt { color: var(--ink-soft); }
.rc dd { margin: 0; overflow-wrap: anywhere; }
.rc .ref { font-weight: 700; letter-spacing: 1px; font-size: 1.15rem; }
.rc .big { font-weight: 700; font-size: 1.15rem; color: var(--indigo); }
.warn { color: var(--danger); }
@media (max-width: 520px) {
  .paygrid { grid-template-columns: 1fr; }
  .qr img { max-width: 240px; margin: 0 auto 8px; }
  .pkgs { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .qbar { grid-template-columns: auto 1fr; }
  .qtime { grid-column: 2; grid-row: 1; }
  .qtier { grid-column: 1 / -1; }
}

/* ---------- signup gate ---------- */
.gate-title { text-align: center; margin: 8px 0 16px; }
.gate { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gate-card { text-align: center; margin-bottom: 10px; display: flex; flex-direction: column; }
.gate-card .btn { margin-top: auto; }
.gate-card.live { border: 2px solid var(--gold); background: #fffdf6; }
.gate-who { font-weight: 700; font-size: 1.1rem; margin: 0 0 2px; }
.gate-when { color: var(--ink-soft); font-size: .92rem; margin: 0 0 6px; }
.gate-open { color: var(--ok); font-weight: 700; font-size: 1.4rem; margin: 10px 0 14px; }
.gate-card .countdown { font-size: 1.7rem; }
.info { margin-top: 18px; }
.info-block { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.info-block h3 { font-size: 1.05rem; margin-bottom: 6px; }
@media (max-width: 560px) { .gate { grid-template-columns: 1fr; } }

.answer { margin-top: 8px; padding: 10px 12px; background: var(--gold-soft); border-radius: var(--radius-sm); font-size: .92rem; }
.answer b { color: #6b5000; }
.q.ok .choice:has(input:checked) { border-color: var(--ok); background: #e6f4ec; }
.topbar-right a.btn-link { color: inherit; }

.stepper { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #eceef5; color: #8c93ad; font-size: .9rem; font-weight: 500; }
.stepper li .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #d8dbe8; color: #6f7595; font-size: .78rem; font-weight: 700; }
.stepper li.on { background: var(--ink); color: #fff; }
.stepper li.on .n { background: var(--gold); color: #2a2000; }
.stepper li.passed { background: var(--gold-soft); color: #6b5000; cursor: pointer; }
.stepper li.passed .n { background: var(--gold); color: #2a2000; }
.step-pane h2 { margin-top: 0; }
#stepnav { margin-top: 4px; }
#stepnav .btn:disabled { background: #d8dbe8; color: #6f7595; }

@media (max-width: 560px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: 1rem; }
  .brand span { display: none; }
  .topbar-right { gap: 10px; font-size: .85rem; }
  .who { display: none; }
  .stepper { gap: 6px; }
  .stepper li { padding: 6px 10px; font-size: .82rem; }
}

.step.maintenance .step-title { color: var(--ink-soft); font-weight: 600; }
.step.maintenance .step-sub { color: #8a6b00; }
.step.maintenance .dot { background: var(--gold-soft); color: #8a6b00; }

.bigcall { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 16px 18px; margin: 10px 0 14px; }
.bigcall b { display: block; font-size: 1.15rem; line-height: 1.45; }
.bigcall span { display: block; margin-top: 6px; color: #f6dc8a; }

.howback { background: var(--surface); border: 2px solid var(--gold); border-radius: var(--radius-lg); padding: 16px 18px; margin: 16px 0; text-align: left; }
.howback h3 { margin: 0 0 8px; font-size: 1.05rem; }
.howback-steps { margin: 0 0 8px; padding-left: 22px; }
.howback-steps li { padding: 2px 0; }
.howback p { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.howback.compact { border-width: 1px; border-color: var(--line); background: #fffdf6; }
.howback.compact h3 { font-size: .98rem; }
.howback.compact li, .howback.compact p { font-size: .88rem; }

.pwguide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; margin-top: 16px; text-align: left; }
.pwguide h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pwcase { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; }
.pwcase > b { display: block; margin-bottom: 4px; }
.pwcase ul { margin: 0; padding-left: 18px; font-size: .9rem; }
.pwcase li { padding: 2px 0; }
