/* TCM·STUDY: "The Help-Centre Document" (see DESIGN.md).
   One family (Pretendard), white ground, cool grey panels, green = MC/active, blue = CC only. */
@font-face {
  font-family: "Pretendard";
  src: url("fonts/Pretendard-Variable-KSX1001.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
:root {
  --font-body: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f4f6f8;
  --soft-2: #e9edf1;
  --ink: #171d24;
  --ink-2: #3c4651;
  --muted: #66707b;
  --line: #e3e7eb;
  --accent: #0f7a5c;
  --accent-ink: #0b6249;
  --accent-soft: #e5f3ee;
  --on-accent: #ffffff;
  --cc: #3d5bd9;
  --cc-soft: #e8edfc;
  --caution: #8a5a00;
  --caution-soft: #fff4dc;
  --bad: #c53a2c;
  --bad-soft: #fbe9e6;
  --ok: #1f7a4a;
  --ok-soft: #e6f4ec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111417; --surface: #111417; --soft: #1b2025; --soft-2: #252c33; --ink: #eef1f4; --ink-2: #c6cdd4; --muted: #949ea8; --line: #2a3138;
    --accent: #4cc39b; --accent-ink: #6fd3b0; --accent-soft: #15302a; --on-accent: #0b1f19; --cc: #8ea3f5; --cc-soft: #1e2645;
    --caution: #f0c060; --caution-soft: #33290f; --bad: #f08a7d; --bad-soft: #3a1f1c; --ok: #6ccf98; --ok-soft: #16301f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111417; --surface: #111417; --soft: #1b2025; --soft-2: #252c33; --ink: #eef1f4; --ink-2: #c6cdd4; --muted: #949ea8; --line: #2a3138;
  --accent: #4cc39b; --accent-ink: #6fd3b0; --accent-soft: #15302a; --on-accent: #0b1f19; --cc: #8ea3f5; --cc-soft: #1e2645;
  --caution: #f0c060; --caution-soft: #33290f; --bad: #f08a7d; --bad-soft: #3a1f1c; --ok: #6ccf98; --ok-soft: #16301f; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.75; letter-spacing: -0.005em;
  word-break: keep-all; overflow-wrap: break-word;
}
::selection { background: var(--accent-soft); color: var(--ink); }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-body); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.2vw, 2.6rem); letter-spacing: -0.025em; line-height: 1.3; }
h2 { font-size: 1.6rem; letter-spacing: -0.02em; line-height: 1.4; }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.5; }
p { margin: 0; }
b, strong { font-weight: 650; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
html[data-lang="en"] .ko, html[data-lang="ko"] .en { display: none !important; }

.wrap {
  max-width: 1080px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.read { max-width: 720px; }

/* page opener */
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 20px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs svg { width: 14px; height: 14px; }
.lead { font-size: 19px; color: var(--ink-2); line-height: 1.7; margin-top: 16px; max-width: 40em; }
.meta, .src { font-size: 14px; color: var(--muted); }
.meta { margin-top: 14px; }

/* header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 24px; padding-block: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: 20px; flex-wrap: wrap; margin-right: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; padding: 4px 12px; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* footer */
.site-foot { background: var(--soft); padding-block: 40px; color: var(--muted); font-size: 14px; margin-top: 40px; }
.site-foot .wrap { display: flex; flex-direction: column; gap: 8px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  border-radius: 10px; padding: 0 22px; font: inherit; font-size: 16px; font-weight: 650;
  text-decoration: none; cursor: pointer; border: 0; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--soft); color: var(--ink); }
.btn-ghost:hover { background: var(--soft-2); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

/* panels, callouts */
.panel { background: var(--soft); border-radius: 16px; padding: 24px 28px; }
.callout { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding: 16px 18px; border-radius: 12px; font-size: 15px; }
.callout svg { width: 20px; height: 20px; margin-top: 3px; }
.callout.info { background: var(--soft); }
.callout.info svg { color: var(--accent); }
.callout.caution { background: var(--caution-soft); }
.callout.caution svg { color: var(--caution); }

/* tables */
.table-wrap { overflow-x: auto; scrollbar-color: var(--soft-2) transparent; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; white-space: nowrap; }

/* closing next-step card */
.next { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px; border-radius: 16px; background: var(--ink); color: var(--bg); text-decoration: none; transition: transform .15s; }
.next:hover { transform: translateY(-2px); }
.next strong { display: block; font-size: 1.15rem; }
.next small { display: block; font-size: 14px; opacity: .8; margin-top: 2px; }
.next svg { width: 24px; height: 24px; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .next { background: var(--soft); color: var(--ink); } :root:not([data-theme="light"]) .next svg { color: var(--accent); } }
:root[data-theme="dark"] .next { background: var(--soft); color: var(--ink); }
:root[data-theme="dark"] .next svg { color: var(--accent); }

/* answer options (diagnostic) */
.opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opts li { margin: 0; }
.opt-tile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; min-height: 52px; transition: border-color .15s, background .15s, transform .1s; }
.opt-tile:hover { border-color: var(--muted); }
.opt-tile:active { transform: scale(0.995); }
.opt-tile:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-tile input { position: absolute; opacity: 0; pointer-events: none; }
.opt-tile .k { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 14px; font-weight: 700; color: var(--ink-2); }
.opt-tile:has(input:checked) .k { background: var(--accent); color: var(--on-accent); }

/* rendered markdown (explanations) */
.md { display: flex; flex-direction: column; gap: 10px; font-size: 16px; line-height: 1.75; }
.md > * { margin: 0; }
.md table { font-size: 15px; }
.md blockquote { margin: 0; padding: 12px 16px; background: var(--soft); border-radius: 10px; color: var(--ink-2); }
.md ul, .md ol { padding-left: 1.3em; }

/* first-visit chooser */
.chooser { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(11, 15, 19, 0.55);
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.chooser .box { background: var(--surface); border-radius: 16px; padding: 28px; max-width: 440px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.chooser h3 { font-size: 1.3rem; }
.chooser .opt { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px 18px; border: 0; border-radius: 12px; background: var(--soft); color: var(--ink); font: inherit; cursor: pointer; transition: background .15s; }
.chooser .opt:hover { background: var(--soft-2); }
.chooser .opt strong { font-size: 1.05rem; }
.chooser .opt span { color: var(--ink-2); font-size: 15px; }

@media (max-width: 700px) {
  .site-head { position: static; }
  .site-head .wrap { gap: 10px 16px; }
  .nav { order: 3; width: 100%; gap: 6px 16px; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .lead { font-size: 17px; }
  h2 { font-size: 1.4rem; }
  .panel { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* account link in header */
.acct { color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; }
.acct:hover { color: var(--ink); }
.acct[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* form fields */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 15px; font-weight: 600; }
.field input {
  font: inherit; font-size: 17px; min-height: 52px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
  transition: border-color .15s;
}
.field input:hover { border-color: var(--muted); }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.field .hint { font-size: 14px; color: var(--muted); }
.field .err { font-size: 14px; color: var(--bad); }
@media (max-width: 700px) { .acct { margin-left: auto; } }
