/* 주석 웹 v0.7.2 · 데스크톱 브라우저(화면 절반 너비도) · 밝은 바탕 하나 · 글꼴은 앱 안에 둔 Noto Sans KR(바깥에서 내려받지 않음) */

/* Noto Sans KR 2.004 (Adobe-KR 낱벌), © 2014-2021 Adobe (http://www.adobe.com/), SIL Open Font License 1.1.
   전문은 같은 폴더의 OFL-NotoSansKR.txt. 옛한글 자모(U+1100~11FF · A960~A97F · D7B0~D7FF)를 ljmo · vjmo · tjmo 로 이어 붙인다. */
@font-face {
  font-family: "KADH Noto Sans KR";
  src: url("NotoSansKR-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "KADH Noto Sans KR";
  src: url("NotoSansKR-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #fbfaf6;
  --panel: #ffffff;
  --ink: #1f1d1a;
  --muted: #6d675d;
  --line: #d8d2c4;
  --accent: #2c5b87;
  --accent-ink: #ffffff;
  --target-bg: #fff1bd;
  --dialogue-ink: #8a8478;
  --glyph-bg: #fff2b8;     /* 옛한글 안내 칸 */
  --glyph-line: #d99a00;
  --glyph-mark: #ffdd1f;   /* 창 안에서 자모가 든 글자 묶음(<mark>) */
  --faint: #948e82;      /* 끝난 절차 항목의 글자색: 바탕 #fbfaf6 에서 대비 3.1:1(--muted 는 5.4:1) */
  --err: #a1261f;
  --ok: #2c6a3d;
  /* 앱 글꼴이 먼저(옛한글이 이어 붙음). 그 글꼴에 없는 한자 등만 아래 글꼴로 */
  --font-text: "KADH Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-ui: "KADH Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  min-width: 600px;
}
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--panel); color: var(--ink); font: inherit; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.cancel { background: #fde9e6; border-color: #e4a39b; color: var(--err); }
.btn.cancel:hover { border-color: var(--err); }
.btn.off { color: #b3ada1; background: transparent; cursor: default; }
.btn.off:hover { border-color: var(--line); }

/* 로그인 */
.login-page main.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login form { display: flex; flex-direction: column; gap: 10px; width: 260px; }
.login input[type=text], .login input[type=password] {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; font: inherit; background: var(--panel);
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login .alert { margin: 0; color: var(--err); font-size: 14px; }

/* 쪽 알림 */
.plain .msg { max-width: 520px; margin: 18vh auto 0; padding: 0 16px; }

/* 위 줄 한 줄: 왼쪽에 탭(현황판 | 절차), 오른쪽에 id 와 [나가기](id 가 나가기 바로 왼쪽). 탭이 없는 화면(글꼴 시험)은 오른쪽만 */
.topbar {
  display: flex; align-items: center; flex-wrap: wrap; column-gap: 12px; min-height: 52px; padding: 0 24px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar form { margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; margin-left: auto; padding: 8px 0; min-width: 0; }
.who { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
/* 탭: 지금 화면은 아래 줄이 굵고 글자가 진하다. 위 줄의 아래 선에 붙는다 */
.tabs { display: flex; align-self: stretch; gap: 4px; }
.tabs a {
  display: flex; align-items: center; padding: 0 16px; margin-bottom: -1px; border-bottom: 3px solid transparent;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); border-bottom-color: var(--line); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
/* 좁은 쪽(600 아래): 탭 글자 간격만 줄인다 */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; column-gap: 8px; }
  .tabs { gap: 0; }
  .tabs a { padding: 0 10px; }
}
/* 현황판 · 절차 화면은 360 같은 아주 좁은 쪽에서도 가로로 넘치지 않는다(위 줄은 줄바꿈) */
.board-page, .procedure-page { min-width: 0; }

/* 현황판 */
.board { max-width: 980px; margin: 24px auto; padding: 0 24px; }
/* 맨 위 절차: 한 단계 한 줄. 맡은 묶음이 있는 단계만 진하게 */
.steps { margin: 0 0 20px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.steps ol { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 4px 0; }
.steps li.later { color: var(--muted); }
.step-no { font-weight: 700; min-width: 3.6em; }
.step-title { font-weight: 600; min-width: 5.5em; }
.step-note { font-size: 14px; }
.step-tag { font-size: 12px; color: var(--accent-ink); background: var(--accent); border-radius: 3px; padding: 0 6px; }
.card-head h2 .step-no { color: var(--muted); font-size: 15px; min-width: 0; }
.board .empty { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.card-head h2 { margin: 0 12px 0 0; font-size: 18px; }
.stat { color: var(--muted); }
.stat.done-all { color: var(--ok); font-weight: 600; }
.warn { color: var(--err); margin: 10px 0 0; }
.items { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.items li a {
  display: flex; align-items: baseline; gap: 6px; padding: 4px 10px; border: 1px solid var(--line);
  border-radius: 4px; text-decoration: none; color: var(--ink); min-width: 92px;
}
.items li.done a { background: #f1f6ef; border-color: #c4d6bf; }
.items li a:hover { border-color: var(--accent); }
.items .no { font-weight: 600; min-width: 1.6em; }
.items .state { font-size: 12px; color: var(--muted); }
.items .ans { font-size: 13px; }

/* 주석 화면 */
.annot-page { overflow: hidden; }
.app { display: flex; flex-direction: column; height: 100vh; }
.top { flex: 0 0 60%; min-height: 150px; display: flex; overflow: hidden; background: var(--panel); }
/* 위 왼쪽 창과 오른쪽 칸 사이 경계(끌면 JS 가 오른쪽 width 를 위 너비의 % 로 바꿈) */
.vsplit { flex: 0 0 8px; background: var(--line); cursor: col-resize; border-left: 1px solid #c4bdad; border-right: 1px solid #c4bdad; }
.vsplit:hover, .vsplit:focus { background: var(--accent); outline: none; }
/* 오른쪽: 처음 400px(해설 화면 720px)이되 좁은 화면에서는 위 너비의 50%(해설 62%)까지. 왼쪽 창에 120px 은 남긴다 */
.sidewrap { flex: 0 0 auto; width: min(400px, 50%); max-width: calc(100% - 128px); min-width: 200px; display: flex; overflow: hidden; }
.top.review .sidewrap { width: min(720px, 62%); }
.sidewrap > .side { flex: 1 1 0; min-width: 0; }
.sidewrap > .side:first-child { border-left: 0; }
.win { flex: 1 1 0; min-width: 120px; overflow: auto; padding: 18px 28px 28px; font-family: var(--font-text); font-size: 18px; line-height: 1.9; }
.winwrap { flex: 1 1 0; min-width: 120px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.winwrap .win { flex: 1 1 auto; min-height: 0; min-width: 0; }
/* 옛한글 자모가 든 문항: 창 바로 위의 안내 칸. 눈에 띄게(노란 바탕 · 굵은 아래 선), 안 고르면 저장되지 않음 */
.glyphbox {
  flex: 0 0 auto; max-height: 55%; overflow: auto; padding: 10px 16px 8px; background: var(--glyph-bg);
  border-bottom: 3px solid var(--glyph-line); font-family: var(--font-ui); font-size: 14px; line-height: 1.55;
}
.glyphbox.err { background: #fde9e6; border-bottom-color: var(--err); }
.glyph-msg { margin: 0 0 6px; font-weight: 600; }
.glyph-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; }
.glyph-opts label.opt { display: inline-flex; align-items: center; gap: 4px; margin: 0 14px 2px 0; cursor: pointer; }
.glyph-opts .req { margin-left: 0; }
.win mark { background: var(--glyph-mark); color: inherit; border-radius: 2px; padding: 0 1px; box-shadow: 0 0 0 1px #d6b400; }
.item-id { font-family: var(--font-ui); font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ln { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ln.blank { min-height: 1.1em; }
.ln.dialogue { color: var(--dialogue-ink); }
.ln.target { background: var(--target-bg); border-radius: 3px; padding: 2px 6px; margin-left: -6px; }
.ln.target .mark { font-weight: 600; }

.side { border-left: 1px solid var(--line); padding: 14px 18px; overflow: auto; background: var(--bg); }
.side h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.row { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.row legend { padding: 0; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.row label.opt { display: inline-flex; align-items: center; gap: 4px; margin: 0 14px 4px 0; cursor: pointer; }
.row.off { opacity: 0.45; }
.hot {
  display: inline-block; min-width: 1.3em; text-align: center; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; background: var(--panel);
}
.row input[type=text] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font: inherit; background: var(--panel); }
.row input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#row-reason label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.req { margin-left: 8px; color: var(--err); font-weight: 600; }
.req[hidden] { display: none; }
.count { display: block; text-align: right; font-size: 12px; color: var(--muted); }
.ro { padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); min-height: 2.2em; }
.ro .none { color: var(--faint); }
.errors { margin: 0 0 12px; padding: 8px 12px 8px 28px; background: #fbe9e7; border: 1px solid #e3b4af; border-radius: 4px; color: var(--err); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pos { margin-left: 8px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.keybox dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; margin: 0 0 12px; }
.keybox dt { color: var(--muted); }
.keybox dd { margin: 0; }
.explain { margin: 0 0 14px; }

.splitter { flex: 0 0 8px; background: var(--line); cursor: row-resize; border-top: 1px solid #c4bdad; border-bottom: 1px solid #c4bdad; }
.splitter:hover, .splitter:focus { background: var(--accent); outline: none; }

/* 아래 창: 왼쪽 절반 규칙 · 오른쪽 절반 예시. 예시를 닫으면 규칙이 너비를 다 쓴다 */
.lower { flex: 1 1 0; min-height: 0; display: flex; background: var(--panel); }
.book { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); }
.exbook { border-left: 1px solid var(--line); }
.lower.ex-closed .exbook { display: none; }
.book-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 18px; padding: 6px 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.book-head .btn.small { margin-left: auto; padding: 1px 10px; font-size: 13px; }
.cb-nav a { margin-right: 10px; font-size: 13px; }
.cb-body { position: relative; flex: 1 1 0; overflow: auto; padding: 4px 28px 32px; max-width: 100%; font-family: var(--font-text); }
.cb-body h2 { font-size: 18px; margin: 22px 0 8px; font-family: var(--font-ui); }
.cb-body h3 { font-size: 16px; margin: 18px 0 6px; font-family: var(--font-ui); }
.cb-body p, .cb-body li { margin: 6px 0; }
/* 줄 안 코드: 라틴 글자는 고정폭, 한글은 앱 글꼴로 */
.cb-body code, code.val { background: #f1eee6; padding: 0 4px; border-radius: 3px; font-size: 0.92em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "KADH Noto Sans KR", monospace; }
.cb-table { border-collapse: collapse; margin: 8px 0; max-width: 100%; }
.cb-table th, .cb-table td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; vertical-align: top; }
.cb-table th { background: var(--bg); font-family: var(--font-ui); }
.cb-code { background: #f6f3ea; border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; overflow: auto; margin: 6px 0; }
/* 코드 블록(예시의 창): 줄은 그대로 두되 반쪽 너비에서 길면 접어 보인다. 옛한글이 이어 붙도록 앱 글꼴 */
.cb-code code { background: transparent; padding: 0; font-family: var(--font-text); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 절차 화면: 번호 붙은 한 줄 “짧은 구: 한 줄 설명”. 끝난 것은 글자색(--faint)과 굵기로 옅게, 진행 중은 끝에 꼬리표 */
.procedure { max-width: 860px; margin: 24px auto; padding: 0 24px; }
.procedure h2 { margin: 0 0 4px; font-size: 18px; }
.procedure .updated { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.procedure .empty { color: var(--muted); }
.proc { margin: 0; padding: 0 0 0 2.4em; }
.proc li { position: relative; padding: 5px 0 5px 4px; }
.proc li::marker { font-variant-numeric: tabular-nums; }
.proc .proc-title { font-weight: 600; }
.proc li.proc-done { color: var(--faint); }
.proc li.proc-done .proc-title { font-weight: 400; }
.proc-tag { display: inline-block; font-size: 12px; line-height: 1.6; color: var(--accent-ink); background: var(--accent); border-radius: 3px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; }

/* 각주 낱말: 용어 글(점선 밑줄) + 위첨자 번호. 마우스를 올리거나(:hover) 초점이 오면(:focus · :focus-within, 키보드 · 터치) 각주 글이 뜬다.
   JS 없이 CSS 만. 뜨는 상자는 그 항목(li) 안쪽 너비에 맞춰 바로 아래에 붙으므로 어느 너비에서도 화면 밖으로 넘치지 않는다 */
.fn { cursor: help; border-bottom: 1px dotted currentColor; }
.fn:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.fn-no { font-size: 0.72em; font-weight: 400; line-height: 0; vertical-align: super; margin-left: 1px; }
.fn-tip {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 20; max-width: 30em; margin-top: 2px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); font-size: 13px; font-weight: 400; line-height: 1.55; cursor: default; overflow-wrap: anywhere;
}
.fn:hover .fn-tip, .fn:focus .fn-tip, .fn:focus-within .fn-tip { display: block; }
/* 아래 ‘주’ 목록: 화면에 쓰인 각주만, “n. 용어: 설명” */
.fn-list { margin: 22px 0 0; padding: 12px 0 0 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.fn-list h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.fns { margin: 0; padding: 0 0 0 2em; }
.fns li { padding: 2px 0; }
.fn-term { font-weight: 600; }

/* 글꼴 시험 */
.fonttest { max-width: 1000px; margin: 24px auto; padding: 0 24px; }
.ft-table { border-collapse: collapse; width: 100%; }
.ft-table th { text-align: left; width: 190px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ft-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 22px; line-height: 1.7; white-space: pre-wrap; }
.ftapp { font-family: var(--font-text); }
.ftsys { font-family: system-ui, sans-serif; }
