@font-face { font-family: "LINE Seed Sans TH"; src: url("/fonts/LINESeedSansTH_Rg.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "LINE Seed Sans TH"; src: url("/fonts/LINESeedSansTH_Bd.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "MuseoModerno"; src: url("/fonts/MuseoModerno-VariableFont_wght.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("/fonts/Outfit-VariableFont_wght.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

/* BX CI: ดำ / เขียวมะนาว / ขาว — หัวเป็นแถบดำ เนื้อหาพื้นขาว */
:root {
  --black: #000000;
  --lime: #BDC432;
  --lime-ink: #6d7212;
  --lime-soft: #f3f5dc;
  --white: #ffffff;
  --paper: #f6f6f2;
  --line: #e1e2d8;
  --muted: #62645a;
  --ok: #2e7d32;
  --warn: #a35f00;
  --bad: #b3261e;
  --font-th: "LINE Seed Sans TH", "Noto Sans Thai", Tahoma, sans-serif;
  --font-display: "MuseoModerno", "Outfit", var(--font-th);
  --font-en: "Outfit", var(--font-th);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--white); color: var(--black); font: 16px/1.65 var(--font-en); font-family: "Outfit", "LINE Seed Sans TH", Tahoma, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

.topbar { background: var(--black); color: var(--white); padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); border-bottom: 4px solid var(--lime); }
.topbar .in { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar img { height: 24px; display: block; }
.topbar .tag { font-family: var(--font-en); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--lime); white-space: nowrap; }

.wrap { max-width: 760px; margin: 0 auto; padding: 32px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); }
.wrap.wide { max-width: 1100px; }

h1, h2, h3 { line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 40px); letter-spacing: -.01em; }
h1 em { font-style: normal; background: var(--lime); padding: 0 .18em; }
h2 { font-size: 20px; font-weight: 700; }
.eyebrow { font-family: var(--font-en); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--lime-ink); font-weight: 600; }
.lead { color: var(--muted); max-width: 62ch; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.facts div { background: var(--white); padding: 14px 16px; }
.facts b { display: block; font-family: var(--font-display); font-size: 22px; }
.facts span { font-size: 13px; color: var(--muted); }

label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 15px; }
label.f small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 0; background: var(--white); min-height: 48px;
}
input:focus, select:focus, textarea:focus { border-color: var(--black); outline: none; }

.btn { appearance: none; border: 0; background: var(--black); color: var(--lime); font-weight: 700; padding: 13px 22px; min-height: 48px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: #222; }
.btn:disabled { background: #c9c9c2; color: #77786f; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--black); border: 1.5px solid var(--black); }
.btn.ghost:hover { background: var(--paper); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.danger { background: var(--bad); color: var(--white); }

.note { background: var(--lime-soft); border-left: 4px solid var(--lime); padding: 12px 16px; font-size: 15px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }

/* ข้อคำถาม */
.progress { position: sticky; top: 0; z-index: 5; background: var(--white); padding: 12px 0; border-bottom: 1px solid var(--line); }
.progress .bar { height: 6px; background: var(--paper); }
.progress .bar i { display: block; height: 100%; background: var(--lime); width: 0; transition: width .25s; }
.progress .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

.q { padding: 20px 0; border-bottom: 1px solid var(--line); }
.q p { margin: 0 0 12px; font-size: 17px; }
.q p .n { font-family: var(--font-display); color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.q.missing p { color: var(--bad); }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale label { position: relative; cursor: pointer; }
.scale input { position: absolute; opacity: 0; inset: 0; }
.scale span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 6px 4px; border: 1.5px solid var(--line); font-size: 13px; line-height: 1.3; background: var(--white); }
.scale label:hover span { border-color: var(--black); }
.scale input:checked + span { background: var(--black); color: var(--lime); border-color: var(--black); font-weight: 700; }
.scale input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 2px; }
.scale.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; }

/* ชุดบังคับเลือก: 3 ข้อความ เลือก "เหมือนที่สุด" และ "น้อยที่สุด" */
.blk { margin-top: 20px; border: 1.5px solid var(--line); }
.blk.missing { border-color: var(--bad); }
.blk-h { font-family: var(--font-en); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.blk.missing .blk-h { color: var(--bad); }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.opt:first-of-type { border-top: 0; }
.opt-t { font-size: 16px; }
.opt.is-most { background: var(--lime-soft); box-shadow: inset 4px 0 0 var(--lime); }
.opt.is-least { background: var(--paper); }
.opt.is-least .opt-t { color: var(--muted); }
.pick { display: flex; gap: 6px; }
.pick label { position: relative; cursor: pointer; }
.pick input { position: absolute; opacity: 0; inset: 0; }
.pick span { display: flex; align-items: center; justify-content: center; min-height: 40px; min-width: 104px; padding: 4px 10px; border: 1.5px solid var(--line); font-size: 13px; background: var(--white); white-space: nowrap; }
.pick label:hover span { border-color: var(--black); }
.pick input[name^="m"]:checked + span { background: var(--black); color: var(--lime); border-color: var(--black); font-weight: 700; }
.pick input[name^="l"]:checked + span { background: var(--muted); color: var(--white); border-color: var(--muted); font-weight: 700; }
.pick input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 2px; }

.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

.done { text-align: left; }
.done .big { font-family: var(--font-display); font-size: 64px; line-height: 1; color: var(--lime); -webkit-text-stroke: 1.5px var(--black); }

/* HR */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; justify-content: space-between; }
.toolbar .row > * { width: auto; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--paper); font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--lime-soft); }
tbody tr.sel { background: var(--lime-soft); box-shadow: inset 4px 0 0 var(--lime); }
td.num { font-variant-numeric: tabular-nums; font-family: var(--font-display); font-weight: 600; }
.chip { display: inline-block; padding: 2px 10px; font-size: 13px; font-weight: 700; border: 1.5px solid currentColor; }
.chip.good { color: var(--ok); }
.chip.mid { color: var(--warn); }
.chip.poor { color: var(--bad); }
.chip.flag { color: var(--bad); border-style: dashed; }
.mini { display: inline-flex; gap: 3px; align-items: end; height: 26px; }
.mini i { width: 9px; background: var(--black); display: block; }
.mini i.lo { background: #b9bab0; }

.detail { border: 1.5px solid var(--black); }
.detail header { background: var(--black); color: var(--white); padding: 18px 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.detail header .fit { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--lime); }
.detail header .fit small { font-size: 14px; color: #c9c9c2; margin-left: 6px; }
.detail .body { padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.trait { display: grid; grid-template-columns: 200px minmax(0, 1fr) 70px; gap: 14px; align-items: center; }
.trait .name b { display: block; }
.trait .name span { font-size: 13px; color: var(--muted); }
.track { position: relative; height: 28px; background: var(--paper); }
.track .band { position: absolute; top: 0; bottom: 0; background: var(--lime-soft); border-left: 2px solid var(--lime); border-right: 2px solid var(--lime); }
.track .val { position: absolute; top: 4px; bottom: 4px; left: 0; background: var(--black); }
.track .ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; pointer-events: none; }
.track .ticks i { width: 1px; background: rgba(0,0,0,.08); }
.trait .score { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.trait .score small { display: block; font-family: var(--font-en); font-size: 12px; font-weight: 400; color: var(--muted); }
.trait .desc { grid-column: 2 / 4; font-size: 14px; color: var(--muted); margin-top: -6px; }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 10px; vertical-align: middle; margin-right: 6px; }
ol.probes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
ol.probes li small { display: block; color: var(--muted); }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.links .link { border: 1px solid var(--line); padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; min-width: 0; }
.links .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.links .txt b { line-height: 1.35; }
.links code { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links .btn { flex: none; white-space: nowrap; }
details summary { cursor: pointer; font-weight: 700; }
footer.site { text-align: center; padding: 24px 16px 40px; font-family: var(--font-display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
  .opt { grid-template-columns: 1fr; gap: 8px; }
  .pick label { flex: 1; }
  .pick span { min-width: 0; }
  .scale { gap: 4px; }
  .scale span { min-height: 58px; font-size: 12px; padding: 4px 2px; }
  .trait { grid-template-columns: minmax(0, 1fr) 60px; }
  .trait .name { grid-column: 1 / 3; }
  .trait .desc { grid-column: 1 / 3; }
  .topbar .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
