:root {
  --navy: #1F3764; --blue: #2E5AAC; --green: #1B7A3D; --red: #B02A1F; --amber: #B06A00;
  --bg: #F3F6FB; --card: #FFFFFF; --ink: #1d2433; --muted: #5d6779; --line: #D8E0EE;
  --green-bg: #E6F4EA; --red-bg: #FDECEA; --blue-bg: #E7EEFA;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Sarabun", "TH SarabunPSK", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 18px; line-height: 1.55;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.brand-mark { width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 26px; flex: none; }
.brand-name { font-weight: 700; color: var(--navy); font-size: 20px; line-height: 1.2; }
.brand-name span { font-weight: 400; color: var(--muted); font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
h1 { margin: 0 0 2px; font-size: 28px; line-height: 1.25; color: var(--navy); }
h2 { color: var(--navy); }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.err { color: var(--red); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip { background: var(--blue-bg); color: var(--navy); border-radius: 999px; padding: 2px 12px; font-size: 15px; font-weight: 600; }

label { display: block; font-weight: 600; margin: 14px 0 4px; color: var(--navy); }
input[type=text], select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 3px solid #b9cdf0; border-color: var(--blue); }

.btn {
  display: inline-block; font: inherit; font-weight: 700; color: #fff; background: var(--blue);
  border: 0; border-radius: 12px; padding: 12px 22px; margin-top: 16px; cursor: pointer; min-height: 48px;
}
.btn:hover { background: var(--navy); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn.ghost:hover { background: var(--blue-bg); }

.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0 6px; }
.sticky-row { display: flex; justify-content: space-between; font-weight: 600; color: var(--navy); font-size: 16px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .25s; }

.level-h { margin: 22px 0 8px; font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lv1 { color: var(--green); } .lv2 { color: var(--amber); } .lv3 { color: var(--red); }

.q { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.q.unanswered { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-bg); }
.q-text { font-weight: 600; margin-bottom: 8px; }
.q-no { color: var(--blue); margin-right: 6px; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin: 6px 0;
  border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice:hover { background: #f7f9fd; }
.choice input { margin-top: 6px; width: 18px; height: 18px; flex: none; accent-color: var(--blue); }
.choice.picked { border-color: var(--blue); background: var(--blue-bg); }
.num-in { width: 160px; text-align: center; font-size: 22px; font-weight: 700; }

.submit-box { text-align: center; margin-top: 18px; }
.submit-box .btn { margin-top: 6px; }

.result-top { text-align: center; }
.score { font-size: 64px; line-height: 1.1; color: var(--navy); font-weight: 700; }
.score span { font-size: 28px; color: var(--muted); font-weight: 400; }
.res-msg { font-size: 20px; font-weight: 600; margin: 4px 0 6px; }
.result-top .chips { justify-content: center; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.review-h { margin: 22px 0 8px; font-size: 22px; }

.rv { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.rv.ok { border-left-color: var(--green); }
.rv.bad { border-left-color: var(--red); }
.rv .tag { font-weight: 700; }
.rv.ok .tag { color: var(--green); } .rv.bad .tag { color: var(--red); }
.rv .right { background: var(--green-bg); border-radius: 8px; padding: 4px 10px; margin-top: 6px; }
.rv .why { color: var(--muted); font-size: 16px; margin-top: 6px; }

.foot { text-align: center; color: var(--muted); font-size: 15px; margin-top: 24px; }
.foot a { color: var(--blue); }

@media (max-width: 480px) {
  body { font-size: 17px; }
  h1 { font-size: 24px; }
  .score { font-size: 54px; }
  .btn { width: 100%; }
  .actions .btn { width: 100%; }
}
