/* ===== 9Q depression screening page (standalone, reuses styles.css tokens) ===== */
:root {
  --ck-accent: #0f766e;
  --ck-accent-ink: #ffffff;
  --ck-tint: #e3f2f0;
  --ck-tint-2: #f1f8f7;
  --ck-edge: #6b7280;
  --ck-note-bg: #e9f1fa;
  --ck-note-edge: #2f6fa8;
  --ck-seg-1: #6bbfb3;
  --ck-seg-2: #6aa6d8;
  --ck-seg-3: #8d83d9;
  --ck-seg-4: #b45f9c;
  --ck-w: 960px;
  --ck-col: 132px;
}
html[data-theme="dark"] {
  --ck-accent: #5fd3c6;
  --ck-accent-ink: #0b2b27;
  --ck-tint: rgba(95, 211, 198, .14);
  --ck-tint-2: rgba(95, 211, 198, .05);
  --ck-edge: #9a9a95;
  --ck-note-bg: rgba(106, 166, 216, .14);
  --ck-note-edge: #86b9e8;
  --ck-seg-1: #5fb3a8;
  --ck-seg-2: #5f98c9;
  --ck-seg-3: #8077cc;
  --ck-seg-4: #b0619a;
}

.ck-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Top bar ---------- */
.ck-top {
  max-width: var(--ck-w); margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 24px) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ck-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); border-radius: 8px;
}
.ck-back:hover { color: var(--ink); }
.ck-tools { display: flex; align-items: center; gap: 10px; }
.ck-lang {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line);
}
.ck-lang button {
  min-width: 44px; height: 34px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.ck-lang button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.ck a:focus-visible, .ck button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- Page ---------- */
.ck-wrap {
  max-width: var(--ck-w); margin: 0 auto;
  padding: clamp(20px, 4vh, 40px) clamp(16px, 4vw, 24px) 190px;
}
.ck-title { font-size: clamp(26px, 4.6vw, 46px); line-height: 1.1; letter-spacing: -.025em; max-width: 20ch; }
html[data-lang="th"] .ck-title { line-height: 1.25; letter-spacing: -.01em; max-width: 24ch; }
.ck-title:focus { outline: none; }
.ck-privacy {
  display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 0; padding: 12px 14px;
  border-radius: 12px; background: var(--ck-tint); color: var(--ink);
  font-size: 14px; font-weight: 500; line-height: 1.5;
}
.ck-privacy svg { flex: none; margin-top: 2px; color: var(--ck-accent); }
.ck-prompt { margin: 22px 0 0; font-size: clamp(17px, 2.4vw, 20px); font-weight: 600; line-height: 1.45; }

/* ---------- Table (desktop) ---------- */
.ck-table { margin-top: 18px; }
.ck-head, .ck-row {
  display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, var(--ck-col));
}
.ck-head {
  position: sticky; top: 0; z-index: 3;
  background: var(--ck-accent); color: var(--ck-accent-ink);
  border-radius: 14px 14px 0 0;
}
.ck-hq { padding: 14px 18px; display: flex; align-items: center; font-size: 14px; font-weight: 600; }
.ck-hc {
  padding: 10px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; font-size: 14px; line-height: 1.3;
}
.ck-hc b { font-weight: 600; }
.ck-hc i { font-style: normal; font-size: 12px; opacity: .92; }
.ck-hc span { margin-top: 2px; font: 500 12px var(--f-mono); opacity: .92; }
.ck-rows { background: var(--surface); border-radius: 0 0 14px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.ck-row { border-bottom: 1px solid var(--line); transition: background .25s; scroll-margin: 90px 0 150px; }
.ck-row:nth-child(even) { background: var(--ck-tint-2); }
.ck-row:last-child { border-bottom: 0; border-radius: 0 0 14px 14px; }
.ck-q { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; font-size: 16px; font-weight: 500; line-height: 1.5; }
.ck-n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 500 13px var(--f-mono); background: var(--ck-tint); color: var(--ck-accent);
}
.ck-row.done .ck-n { background: var(--ck-accent); color: var(--ck-accent-ink); }
.ck-opt {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 64px; cursor: pointer; transition: background .2s;
}
.ck-opt:hover { background: var(--ck-tint); }
.ck-opt.on { background: var(--ck-tint); }
.ck-opt input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.ck-box {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none;
  border: 2px solid var(--ck-edge); background: var(--surface); color: var(--ck-accent-ink);
  transition: background .2s, border-color .2s;
}
.ck-box svg { width: 16px; height: 16px; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s var(--ease); }
.ck-opt input:checked ~ .ck-box { background: var(--ck-accent); border-color: var(--ck-accent); }
.ck-opt input:checked ~ .ck-box svg { opacity: 1; transform: none; }
.ck-opt input:focus-visible ~ .ck-box { outline: 2px solid var(--ink); outline-offset: 3px; }
.ck-ot, .ck-sc {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Item 9 alert / result alert ---------- */
.ck-q9slot:empty { display: none; }
.ck-q9slot { margin-top: 14px; }
.ck-alert {
  display: flex; gap: 14px; padding: 18px 18px 18px 16px; border-radius: 14px;
  background: var(--ck-note-bg); color: var(--ink);
  box-shadow: inset 4px 0 0 var(--ck-note-edge), inset 0 0 0 1px var(--line);
  animation: ckIn .45s var(--ease);
}
.ck-alert > svg { flex: none; width: 24px; height: 24px; margin-top: 2px; color: var(--ck-note-edge); }
.ck-alert p { margin: 0; font-size: 16px; line-height: 1.65; }
.ck-alert p + p { margin-top: 10px; font-size: 15px; }
.ck-alert a, .ck-help a, .ck-foot a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Result ---------- */
.ck-result {
  scroll-margin-top: 16px;
  margin-top: 30px; padding: clamp(18px, 4vw, 34px); border-radius: 20px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  animation: ckIn .5s var(--ease);
}
.ck-result[hidden] { display: none; }
.ck-r-head { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
html[data-lang="th"] .ck-r-head { letter-spacing: 0; text-transform: none; font-size: 15px; }
.ck-r-head:focus { outline: none; }
.ck-score { margin: 6px 0 0; display: flex; align-items: baseline; gap: 10px; font-weight: 700; line-height: 1; }
.ck-score b { font-size: clamp(52px, 11vw, 80px); letter-spacing: -.03em; font-weight: 700; }
.ck-score span { font-size: clamp(18px, 3vw, 24px); color: var(--ink-2); font-weight: 500; }
.ck-meter { margin: 22px 0 0; padding: 0 14px; }
.ck-meter-in { position: relative; padding-top: 38px; }
.ck-segs { display: flex; gap: 3px; height: 14px; }
.ck-segs span { border-radius: 4px; }
.ck-segs span:first-child { border-radius: 999px 4px 4px 999px; }
.ck-segs span:last-child { border-radius: 4px 999px 999px 4px; }
.ck-s-none { background: var(--ck-seg-1); }
.ck-s-mild { background: var(--ck-seg-2); }
.ck-s-moderate { background: var(--ck-seg-3); }
.ck-s-severe { background: var(--ck-seg-4); }
.ck-marker {
  position: absolute; top: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  transition: left .6s var(--ease);
}
.ck-marker span {
  min-width: 30px; padding: 3px 8px; border-radius: 999px; text-align: center;
  background: var(--ink); color: var(--on-ink); font: 600 13px var(--f-mono);
}
.ck-marker::after {
  content: ""; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid var(--ink);
}
.ck-scale { display: flex; gap: 3px; margin-top: 6px; }
.ck-scale span { font: 500 12px var(--f-mono); color: var(--ink-2); text-align: center; }
.ck-band { margin: 24px 0 0; font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.ck-band-bar { display: block; width: 44px; height: 5px; border-radius: 3px; margin-bottom: 12px; }
.ck-explain { margin: 8px 0 0; font-size: 17px; line-height: 1.65; color: var(--ink-2); }
.ck-result .ck-alert { margin-top: 22px; }
.ck-h3 { margin: 26px 0 8px; font-size: 18px; font-weight: 700; }
.ck-recs { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 16px; line-height: 1.65; }
.ck-recs li::marker { color: var(--ck-accent); }

.ck-help {
  margin-top: 24px; padding: 18px; border-radius: 14px;
  background: var(--ck-tint); box-shadow: inset 0 0 0 1px var(--line);
}
.ck-help h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.ck-help-lead { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.ck-help ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ck-help li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 10px 12px;
  border-radius: 10px; background: var(--surface); font-size: 15px; line-height: 1.5;
}
.ck-help li a { font-size: 17px; font-family: var(--f-mono); font-weight: 500; }
.ck-help--strong { box-shadow: inset 0 0 0 2px var(--ck-accent); }
.ck-help--strong li a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--ck-accent); color: var(--ck-accent-ink); text-decoration: none; font-size: 18px; font-weight: 600;
}

.ck-soft { margin: 22px 0 0; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.ck-hug { margin: 26px 0 0; padding: 18px 18px 18px 20px; border-radius: 14px; background: var(--ck-tint-2); box-shadow: inset 4px 0 0 var(--ck-accent), inset 0 0 0 1px var(--line); }
.ck-hug p { margin: 0; font-size: 17px; line-height: 1.7; }
.ck-hug blockquote { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 16px; font-style: italic; line-height: 1.65; color: var(--ink-2); }
.ck-disc { margin: 22px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }

/* ---------- Footer ---------- */
.ck-foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.ck-foot-lines { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.ck-foot-note { margin: 12px 0 0; font-size: 13px; line-height: 1.6; }

/* ---------- Sticky bar ---------- */
.ck-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px clamp(16px, 4vw, 24px) calc(10px + env(safe-area-inset-bottom));
  background: var(--nav-solid);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 -1px 0 var(--line), 0 -10px 30px rgb(0 0 0 / calc(.06 * var(--sh)));
}
.ck-bar-in { max-width: var(--ck-w); margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.ck-stat { display: flex; align-items: center; gap: 22px; flex: 1; min-width: 0; }
.ck-prog { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.ck-prog-track { width: 90px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.ck-prog-track span { display: block; height: 100%; width: 0; background: var(--ck-accent); border-radius: 3px; transition: width .35s var(--ease); }
.ck-total { font-size: 14px; font-weight: 600; white-space: nowrap; }
.ck-total strong { font: 700 22px var(--f-sans); margin-left: 4px; }
.ck-hint { margin: 0; font-size: 13px; color: var(--ink-2); flex: 1; min-width: 0; }
.ck-hint:empty { display: none; }
.ck-btns { display: flex; gap: 10px; flex: none; }
.ck-btns .btn { height: 44px; padding: 0 20px; font-size: 15px; }
#seeBtn[disabled] { opacity: .4; cursor: not-allowed; }
#seeBtn[disabled]:hover { box-shadow: none; }

@keyframes ckIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile: each question is a card ---------- */
@media (max-width: 760px) {
  .ck-head { display: none; }
  .ck-rows { display: grid; gap: 14px; background: none; box-shadow: none; border-radius: 0; }
  .ck-row,
  .ck-row:nth-child(even) {
    grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; border: 0; border-radius: 16px;
    background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  }
  .ck-row:last-child { border-radius: 16px; }
  .ck-q { grid-column: 1 / -1; padding: 0 0 4px; }
  .ck-opt {
    justify-content: flex-start; gap: 10px; min-height: 60px; padding: 10px 12px; border-radius: 12px;
    box-shadow: inset 0 0 0 1.5px var(--line);
  }
  .ck-opt.on { box-shadow: inset 0 0 0 2px var(--ck-accent); }
  .ck-ot {
    position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; white-space: normal;
    display: flex; flex-direction: column; min-width: 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-2);
  }
  .ck-ot b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
  .ck-sc {
    position: static; width: auto; height: auto; margin: 0 0 0 auto; overflow: visible; clip-path: none;
    align-self: flex-start; font: 500 12px var(--f-mono); color: var(--ink-2);
  }
  .ck-wrap { padding-bottom: 170px; }
  .ck-bar-in { flex-wrap: wrap; gap: 8px; }
  .ck-stat { flex: 1 1 100%; justify-content: space-between; gap: 12px; }
  .ck-prog-track { width: 70px; }
  .ck-hint { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  .ck-btns { flex: 1 1 100%; }
  .ck-btns .btn { flex: 1; padding: 0 12px; }
  .ck-meter { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ck-result, .ck-alert { animation: none; }
  .ck-box, .ck-box svg, .ck-opt, .ck-row, .ck-marker, .ck-prog-track span, .ck-lang button { transition: none; }
}
