/* RN마루 학습 앱 (app.rnmaru.com · quiz2 검수 화면) — 스타일
 *
 * 2026-10 UI 개편: 공개 랜딩(landing/styles.css)과 같은 디자인 시스템을 쓴다.
 *   - 토큰 블록(tokens:begin ~ tokens:end)은 두 파일이 바이트 단위로 같아야 한다.
 *     tools/design_tokens.test.js 가 동일성을 검사한다. 값을 바꿀 때는 두 파일을 함께 고친다.
 *   - 외부 폰트·스크립트 없음(landing/README.md 공개 경계와 같다). OS 내장 폰트만 쓴다.
 *   - app.js 가 쓰는 클래스·id 는 그대로다. 이 파일은 겉모습만 바꾼다.
 *
 * 조판 원칙:
 *   - 한국어 모드(html[lang=ko])에서는 word-break:keep-all 로 어절을 보존한다.
 *     영어 모드(문항·선택지가 영어)에서는 normal 로 되돌린다 — keep-all 은 영어에서
 *     긴 단어의 줄바꿈을 막아 행렬·선택지가 뷰포트를 뚫는다.
 *   - 색은 역할로만 쓴다. 선택 = 먹색, 정답 = 브랜드 녹색, 오답 = 테라코타(악센트),
 *     부분정답 = 황토. 빨강/초록 신호등 대비를 쓰지 않는다.
 */

/* ── tokens:begin ──────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* 잉크 — 순검정 대신 녹색기 있는 먹색. 크림 배경에서 눈이 덜 아프다. */
  --ink: #14231f;
  --ink-2: #435a54;
  --ink-3: #71857f;

  /* 지면 */
  --paper: #faf7f1;
  --surface: #ffffff;
  --surface-2: #f4f1e9;

  /* 선 — 면을 나누는 일은 그림자가 아니라 헤어라인이 한다. */
  --line: #e5e1d7;
  --line-2: #d2ccbe;

  /* 브랜드 */
  --green: #0d5c4a;
  --green-deep: #093b30;
  --green-tint: #edf3f0;
  --green-on-dark: #7fd5bc;

  /* 악센트 — 상태 표시 한 가지 역할로만 쓴다. 장식으로 흩뿌리지 않는다. */
  --accent: #b8502c;
  --accent-tint: #f8ede7;

  /* 부분정답·보류 — 황토. 악센트(오답)와 구분되는 세 번째 상태색. */
  --amber: #8a5a00;
  --amber-tint: #fbf3dc;

  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;

  /* 그림자는 거의 쓰지 않는다. 쓸 때도 번지지 않게. */
  --shadow-sm: 0 1px 2px rgba(20, 35, 31, 0.04);
  --shadow: 0 1px 2px rgba(20, 35, 31, 0.04), 0 12px 32px -16px rgba(20, 35, 31, 0.18);

  --max: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 9vw, 7.5rem);

  --sans:
    Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}
/* ── tokens:end ────────────────────────────────────────────── */

/* 앱 의미 토큰 + 이전 이름 별칭. app.js 와 오래된 규칙이 --primary/--ok/--no 를
   참조하므로 이름은 남기고 값만 새 시스템으로 묶는다. */
:root {
  --bg: var(--paper);
  --card: var(--surface);
  --muted: var(--ink-3);
  --text: var(--ink);
  --primary: var(--green);
  --primary-ink: #ffffff;
  --ok: var(--green);
  --ok-bg: var(--green-tint);
  --no: var(--accent);
  --no-bg: var(--accent-tint);
  --part: var(--amber);
  --part-bg: var(--amber-tint);
  --chart-bg: var(--surface-2);
  --sel: var(--ink);
  --sel-bg: var(--surface-2);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --app-max: 760px;
  --app-pad: clamp(1rem, 3vw, 1.5rem);
}

* { box-sizing: border-box; }

/* ── Safari 횡방향 스크롤 방지 ──────────────────────────────
   페이지(body) 레벨 가로 스크롤을 차단하고, 긴 무공백 토큰
   (파일경로·URL·영문 임상용어)이 뷰포트를 넓히지 않게 래핑한다.
   넓은 NGN 행렬은 .matrix-wrap 내부에서만 가로 스크롤된다. */
html, body { max-width: 100%; overflow-x: hidden; }
body { overflow-wrap: break-word; }
img, svg, video, table, pre, code { max-width: 100%; }
pre, code { overflow-wrap: break-word; white-space: pre-wrap; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html[lang="ko"] body { word-break: keep-all; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* hidden 속성은 항상 이긴다. .controls·.flag-review-panel 처럼 display 를 지정한
 * 클래스가 붙으면 UA 기본 [hidden]{display:none} 보다 우선해 hidden 이 무시된다 —
 * index.html 의 휴면 섹션(단일 문제·사례 선택, 핸들러 없음)이 실제로 보이고 있었다. */
[hidden] { display: none !important; }

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 0 var(--app-pad) 4rem;
}

/* ══════════════════════════════════════════════════════
   헤더 — 워드마크 · 언어 · 계정 · 진행
   화면 폭 전체에 걸친 sticky 바. 진행 막대가 바의 아래 경계선을 겸한다.
   ══════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 0 1.25rem;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.app-header-inner {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 0 var(--app-pad);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand lang"
    "account progress";
  align-items: center;
  column-gap: 0.75rem;
}
/* 둘째 줄(계정 영역 + 진행 문구)은 비어 있으면 높이를 먹지 않는다. 계정 영역은 /api/me 가
   404(인증 꺼짐)일 때 hidden 이라 로컬 프리뷰에서는 안 보였고, 라이브(인증 켜짐)에서
   진행 문구와 같은 grid 영역에 겹쳐 그려졌다(2026-10-09 라이브 캡처). 영역을 분리한다. */
.app-header::after {
  /* 진행 막대 — --diag-progress 는 app.js paintDiagnosticProgress 가 채운다(0~100%).
     값이 없으면 헤어라인만 남는다. 바의 아래 경계선을 겸하므로 border 는 두지 않는다. */
  content: "";
  display: block;
  height: 3px;
  background:
    linear-gradient(90deg, var(--green) var(--diag-progress, 0%), var(--line) var(--diag-progress, 0%));
}
.app-header h1 {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 60px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.wordmark-mark {
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.app-header h1 .sub {
  margin-left: 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.score,
.review-progress {
  grid-area: progress;
  justify-self: end;
  align-self: center;
  padding-bottom: 0.65rem;
  color: var(--ink-3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.score b, .review-progress b { color: var(--ink); font-weight: 700; }
.score .rate { margin-left: 10px; }
/* 진행 문구는 비어 있을 수 있다(진단 시작 전). 빈 줄이 공간을 먹지 않게 한다. */
.review-progress:empty, .review-progress b:empty { display: none; }
/* 진행 문구가 비면(진단 시작 전) 둘째 줄 아래 여백도 없앤다. */
.review-progress:has(> b:empty:only-child) { display: none; }

/* 언어 전환 — 분절 컨트롤. NCLEX 는 영어 시험이라 영어가 기본이다. */
.langbar {
  grid-area: lang;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.langbtn {
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.langbtn:hover { color: var(--ink); }
.langbtn.is-on { background: var(--green); color: #fff; }

/* 헤더 신고 집계 칩(검수 화면) */
.flagchip {
  grid-area: account;
  justify-self: start;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.flagchip b { font-weight: 800; }
.flag-review-chip { border-color: var(--line-2); background: var(--surface); color: var(--ink-2); }

/* 계정 영역(nclex#110) — 헤더 둘째 줄. */
.account-area {
  grid-area: account;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem 0.5rem;
  padding-bottom: 0.65rem;
  font-size: 0.82rem;
}
.account-name {
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}
.account-status { color: var(--ink-3); font-size: 0.76rem; }

/* ══════════════════════════════════════════════════════
   버튼
   ══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease,
    transform 160ms ease, box-shadow 160ms ease;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary,
.btn-next,
.btn-case {
  border-color: var(--green);
  background: var(--green);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover, .btn-next:hover, .btn-case:hover {
  border-color: var(--green-deep);
  background: var(--green-deep);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(13, 92, 74, 0.6);
}
.btn-primary:disabled:hover, .btn-next:disabled:hover { background: var(--green); border-color: var(--green); }
.btn-next { width: 100%; min-height: 52px; font-size: 1rem; }
.btn-account { min-height: 32px; padding: 0.25rem 0.85rem; font-size: 0.78rem; }
.btn-danger { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn-danger:not(:disabled):hover { background: var(--accent); color: #fff; }

/* ══════════════════════════════════════════════════════
   시작 패널 (.controls) — 무료 진단 · 유료 학습 · 검수 대기열
   ══════════════════════════════════════════════════════ */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.ctrl {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 700;
  /* flex item 은 콘텐츠 너비 아래로 줄지 않는다(min-width:auto).
   * 0으로 열어야 안의 select 가 긴 옵션 때문에 부모를 뚫지 않는다 */
  min-width: 0;
}
.ctrl select,
.ctrl input[type="text"] {
  min-height: 42px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  min-width: 110px;
  /* Safari 는 select 너비를 가장 긴 option 에 맞춘다 — 사례 제목이 길어
   * 컨트롤이 카드를 뚫던 자리. 상한을 두고 넘치면 말줄임 */
  max-width: 100%;
  text-overflow: ellipsis;
}
.ctrl select:focus, .ctrl input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}
.ctrl-grow { flex: 1 1 auto; }
.ctrl-grow select { width: 100%; }
.ctrl-toggle { flex-direction: row; align-items: center; gap: 0.45rem; font-weight: 600; }
.ctrl-toggle input[type="checkbox"] { width: 1rem; height: 1rem; margin: 0; accent-color: var(--green); }
.controls-case { margin-top: -6px; }

/* 학습 방식 — 색뿐 아니라 이름과 설명으로도 구분한다. 모드 색은 칩에만 쓴다. */
.controls-mode { --mode-color: var(--green); --mode-soft: var(--green-tint); }
.controls-case { --mode-color: var(--green-deep); --mode-soft: var(--green-tint); }
.controls-review-queue { --mode-color: var(--ink-2); --mode-soft: var(--surface-2); }
.controls-review-queue .btn { margin-left: auto; }
/* 문항 ID 바로 가기(대기열 270+건에서 특정 문항을 찾는 용도). 새로고침 버튼의
 * margin-left:auto 앞에 두어 폼이 왼쪽, 새로고침이 오른쪽 끝에 남는다. */
.controls-review-queue .ctrl-jump { flex-direction: row; align-items: end; gap: 6px; }
.controls-review-queue .ctrl-jump input { width: 13em; font-family: var(--mono); text-transform: uppercase; }
.controls-review-queue .ctrl-jump .btn { margin-left: 0; }

.mode-heading {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.mode-heading h2 { font-size: clamp(1.3rem, 3.4vw, 1.6rem); line-height: 1.25; }
.mode-heading p { margin: 0.35rem 0 0; color: var(--ink-2); font-size: 0.93rem; line-height: 1.7; }
.mode-kind {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--r-xs);
  background: var(--mode-soft);
  color: var(--mode-color);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.controls-mode > .btn-primary,
.controls-mode > .btn-case { min-height: 48px; padding-inline: 1.5rem; font-size: 0.98rem; }

.review-queue-status {
  flex: 1 0 100%;
  margin: 0;
  color: var(--ink-3);
  font-size: 0.82rem;
  line-height: 1.6;
}
.review-queue-status:empty { display: none; }
.review-queue-status.is-ok { color: var(--green); font-weight: 700; }
.review-queue-status.is-notice { color: var(--amber); font-weight: 700; }
.review-queue-status.is-error { color: var(--accent); font-weight: 700; }
/* 시작 패널 밖의 상태 줄(#diagStatus) */
p.review-queue-status { margin: -0.25rem 0 1rem; padding-inline: 0.25rem; }

/* 유료 학습 카드(nclex#560 3단계) — 시작 카드 안의 두 번째 진입점. */
.study-card {
  --mode-color: var(--green-deep);
  --mode-soft: var(--green-tint);
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.study-card .mode-heading { padding-bottom: 0.75rem; border-bottom: 0; }
.study-entitlement { flex: 1 1 auto; margin: 0; color: var(--ink); font-size: 0.9rem; font-weight: 600; }
.study-entitlement:empty { display: none; }
/* 구매 버튼 묶음(nclex#560 4단계) */
.study-purchase { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.purchase-note { flex: 1 0 100%; margin: 0; color: var(--ink-3); font-size: 0.78rem; line-height: 1.6; }
.purchase-note:empty { display: none; }
.purchase-note a { color: var(--green); font-weight: 700; text-underline-offset: 3px; }
/* 내 학습 패널(nclex#542) */
.study-progress { flex: 1 0 100%; margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.study-progress h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.study-progress .progress-table { font-size: 0.82rem; }
.study-progress .progress-table th, .study-progress .progress-table td { padding: 0.45rem 0.6rem; }
.study-progress .progress-table tr[data-status="insufficient"] td { color: var(--ink-3); }
.study-wrong-count { margin: 0.5rem 0; color: var(--ink); font-size: 0.9rem; font-weight: 600; }
.study-wrong-count:empty { display: none; }
.study-progress-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ══════════════════════════════════════════════════════
   문항 카드
   ══════════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.1rem, 3vw, 1.75rem);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
/* 모드는 상단 배너가 글로 말한다. 색 띠는 두지 않는다. */
.card-standalone, .card-case { border-top: 1px solid var(--line); }

/* 풀이 카드의 현재 모드 표시 — 카드 머리 줄. 박스 안의 박스를 피하려 선으로만 나눈다. */
.mode-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}
.mode-banner-standalone { color: var(--ink-2); }
.mode-banner-case { color: var(--green); }
.mode-banner-kind,
.mode-banner-progress {
  padding: 0.22rem 0.6rem;
  border-radius: var(--r-xs);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.mode-banner-kind { background: var(--surface-2); color: var(--ink-2); }
.mode-banner-case .mode-banner-kind { background: var(--green-tint); color: var(--green); }
.mode-banner-progress { background: var(--green); color: #fff; font-variant-numeric: tabular-nums; }
.mode-banner strong { display: block; color: var(--ink); font-size: 0.95rem; font-weight: 700; line-height: 1.35; }
.mode-banner p { margin: 0.1rem 0 0; color: var(--ink-3); font-size: 0.78rem; line-height: 1.5; }

/* 배지 — 영역 / NCJMM 단계 / 유형 / 사례 진행 / 출처 / 검증 */
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 1rem; }
.badge {
  display: inline-block;
  margin: 0;
  padding: 0.22rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: var(--green-tint);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.badge.subject { background: var(--green-tint); color: var(--green); }
.badge.qno { background: var(--surface-2); color: var(--ink-2); }
.badge-step { background: var(--surface-2); color: var(--ink-2); }
.badge-type { background: transparent; border-color: var(--line); color: var(--ink-3); }
.badge-case { background: var(--green); color: #fff; }
/* 출처는 작성 계통, 검증 배지는 self 문항의 3단계 상태를 표시한다. */
.badge-self { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }
.badge-src { background: var(--green-tint); color: var(--green); border-color: #cfe1da; }
.badge-book { background: var(--amber-tint); color: var(--amber); border-color: #ead9a8; }
.badge-verification { font-weight: 700; }
.badge-pending-review { background: var(--accent-tint); color: var(--accent); border-color: #ebc9b8; }
.badge-fallback { background: transparent; border-color: var(--line-2); color: var(--ink-3); }
.verification-unverified { background: var(--accent-tint); color: var(--accent); border-color: #ebc9b8; }
.verification-cited { background: var(--amber-tint); color: var(--amber); border-color: #ead9a8; }
.verification-clinically-reviewed { background: var(--green-tint); color: var(--green); border-color: #cfe1da; }

/* 지문. 줄바꿈 보존(계산 문항 처방 표기). 영어 문항이라 어절 보존 규칙은 걸지 않는다. */
.stem {
  margin: 0.25rem 0 1.1rem;
  font-size: clamp(1.02rem, 2.6vw, 1.1rem);
  font-weight: 500;
  line-height: 1.65;
  white-space: pre-line;
  letter-spacing: -0.01em;
}
.emph { font-weight: 800; }
.hint-inline { margin: 0 0 0.6rem; color: var(--ink-3); font-size: 0.82rem; line-height: 1.6; }
.hint-inline b { color: var(--ink-2); }

/* 영어 원문 병기(이전 구조 호환) */
.stem-en { margin: -6px 0 12px; }
.stem-en summary { cursor: pointer; padding: 3px 0; color: var(--ink-3); font-size: 0.8rem; user-select: none; }
.stem-en summary:hover { color: var(--green); }
.stem-en p {
  margin: 6px 0 0; padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--line-2); border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--surface-2); color: var(--ink-2); font-size: 0.9rem; line-height: 1.6;
}

/* 지문 속 마크다운 표(검사 시계열 등) */
.stem table, .pane table, .cloze table {
  width: 100%; margin: 0.6rem 0; border-collapse: collapse; font-size: 0.88rem; white-space: normal;
}
.stem th, .stem td, .pane th, .pane td, .cloze th, .cloze td {
  padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
}
.stem th, .pane th, .cloze th { color: var(--ink-2); font-size: 0.78rem; font-weight: 700; background: var(--surface-2); }

/* ── 문항 이미지(quiz1 계승) ── */
.qimg-wrap { position: relative; margin-bottom: 1rem; text-align: center; }
.qimg {
  max-width: 100%; height: auto; display: inline-block;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; cursor: zoom-in;
}
.qimg.broken {
  min-height: 120px; min-width: 100%; padding: 20px; cursor: default;
  border-style: dashed; border-color: var(--accent); color: var(--accent); font-size: 0.85rem;
}
.zoom-hint {
  position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgba(20, 35, 31, 0.65); color: #fff; font-size: 0.72rem; pointer-events: none;
}

/* ── 사례연구 차트 — 탭이 문항 진행에 따라 늘어난다 ── */
.chart {
  margin: 0.25rem 0 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.chart-context {
  margin: 0; padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3); background: var(--surface-2); font-size: 0.76rem; font-weight: 700;
}
.chart-context.is-new { color: var(--green); background: var(--green-tint); }
.chart-context.is-carryover { color: var(--amber); background: var(--amber-tint); }
.tabs { display: flex; flex-wrap: wrap; gap: 0; padding: 0 0.4rem; border-bottom: 1px solid var(--line); }
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 0.65rem 0.75rem; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-3); font-size: 0.82rem; font-weight: 700; font-family: inherit;
  transition: color 160ms ease, border-color 160ms ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--green); border-bottom-color: var(--green); }
.pane {
  display: none; padding: 0.9rem 1rem; font-size: 0.93rem; line-height: 1.7;
  white-space: pre-line; overflow-wrap: break-word; color: var(--ink);
}
.pane.is-active { display: block; }

/* ── 선택지 ── */
.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.opts li { margin: 0; }
.opt {
  display: flex; align-items: flex-start; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font-size: 0.95rem; line-height: 1.55; font-family: inherit; cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.opt:hover { border-color: var(--line-2); background: var(--surface-2); }
.opt .num {
  flex: none; width: 24px; height: 24px; margin-top: 0.05rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-2);
  font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums;
  transition: background 140ms ease, color 140ms ease;
}
.opt.is-sel { border-color: var(--sel); background: var(--sel-bg); box-shadow: inset 0 0 0 1px var(--sel); }
.opt.is-sel .num { background: var(--sel); color: #fff; }
.opt.is-correct { border-color: var(--green); background: var(--green-tint); box-shadow: inset 0 0 0 1px var(--green); }
.opt.is-correct .num { background: var(--green); color: #fff; }
.opt.is-wrong { border-color: var(--accent); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.is-wrong .num { background: var(--accent); color: #fff; }
.opt:disabled { cursor: default; }
.opt-multi .num { border-radius: 6px; }

/* 오답 사유 — 동어반복 대신 실제 이유 */
.why {
  margin: 0.4rem 0 0 2.1rem; padding: 0.55rem 0.8rem;
  border-left: 3px solid var(--accent); border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--accent-tint); color: #7a3a22; font-size: 0.85rem; line-height: 1.6;
}

/* ── 행렬 ── 첫 열을 고정해 좁은 화면에서 가로로 밀어도 행 라벨이 남는다. */
.matrix-wrap {
  max-width: 100%; margin: 0.25rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--r);
}
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.matrix th, .matrix td {
  padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); text-align: center;
  vertical-align: middle; overflow-wrap: break-word;
}
.matrix tr:last-child td { border-bottom: 0; }
.matrix th { background: var(--surface-2); color: var(--ink-2); font-size: 0.78rem; font-weight: 700; }
.matrix .rowlab {
  position: sticky; left: 0; z-index: 1;
  min-width: 170px; text-align: left; line-height: 1.5;
  background: var(--surface); box-shadow: 1px 0 0 var(--line);
}
.matrix tr:nth-child(even) td { background: #fcfbf8; }
.matrix tr:nth-child(even) td.rowlab { background: #fcfbf8; }
.cell {
  width: 26px; height: 26px; padding: 0; cursor: pointer;
  border: 2px solid var(--line-2); border-radius: 50%; background: var(--surface);
  transition: border-color 140ms ease, background 140ms ease;
}
.cell:hover { border-color: var(--ink-3); }
.cell-multi { border-radius: 7px; }
.cell.is-sel { border-color: var(--sel); background: var(--sel); box-shadow: inset 0 0 0 3px #fff; }
.cell.is-correct { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.cell.is-wrong { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }

/* trend — 시계열 표 */
.trend-tbl th { background: var(--green-tint); color: var(--green); }
.trend-tbl td { font-variant-numeric: tabular-nums; }
.trend-tbl + .opts { margin-top: 0.9rem; }

/* 결과 요약 표 */
.progress-table .rowlab { min-width: 140px; }

/* ── 빈칸(cloze) ── */
.cloze { font-size: 1.02rem; line-height: 2.2; margin: 0.25rem 0 0.5rem; }
.blank {
  display: inline-block; max-width: 100%; margin: 0 3px; padding: 0.3rem 0.6rem;
  border: 1px solid var(--line-2); border-bottom: 2px solid var(--ink); border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 0.92rem; font-weight: 600;
  line-height: 1.4; vertical-align: baseline;
}
.blank:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.blank.is-correct { border-color: var(--green); background: var(--green-tint); }
.blank.is-wrong { border-color: var(--accent); background: var(--accent-tint); }

/* ── highlight — 본문 토큰 ── */
.hl { font-size: 0.98rem; line-height: 2.05; }
.tok {
  padding: 2px 3px; border-radius: 4px; cursor: pointer;
  border-bottom: 2px dotted var(--line-2); transition: background 120ms ease;
}
.tok:hover { background: var(--surface-2); }
.tok.is-sel { background: var(--surface-2); border-bottom: 2px solid var(--ink); }
.tok.is-correct { background: var(--green-tint); border-bottom: 2px solid var(--green); }
.tok.is-wrong { background: var(--accent-tint); border-bottom: 2px solid var(--accent); }

/* ── bow_tie — 3열 배치 ── */
.bowtie { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; margin: 0.25rem 0; }
.bt-col { padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.bt-col h4 {
  margin: 0 0 0.6rem; color: var(--ink-2); text-align: center;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.01em;
}
.bt-col h4 span { margin-left: 0.25rem; color: var(--green); font-size: 0.72rem; }
.bt-mid { background: var(--green-tint); border-color: #cfe1da; }
.opt-bt { margin-bottom: 0.45rem; padding: 0.6rem 0.7rem; font-size: 0.88rem; }
.opt-bt:last-child { margin-bottom: 0; }

/* ── drag_drop — 순번 뱃지 ── */
.opt-ord .num.ord { font-size: 0.8rem; }
.opt-ord.is-sel .num.ord { background: var(--sel); color: #fff; }

/* ── numeric — 계산 입력 ── */
.numwrap { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0; }
.numin {
  width: 11rem; padding: 0.6rem 0.9rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  font-family: inherit; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.numin:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.numin.is-correct { border-color: var(--green); background: var(--green-tint); }
.numin.is-wrong { border-color: var(--accent); background: var(--accent-tint); }
.unit { color: var(--ink-2); font-size: 0.95rem; font-weight: 600; }

/* ── 판정 ── */
.verdict {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem;
  margin: 1.25rem 0 0; padding: 0.8rem 1rem;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 1rem; font-weight: 800;
}
.verdict.is-ok { background: var(--green-tint); border-color: #cfe1da; color: var(--green); }
.verdict.is-no { background: var(--accent-tint); border-color: #ebc9b8; color: var(--accent); }
.verdict.is-part { background: var(--amber-tint); border-color: #ead9a8; color: var(--amber); }
.verdict .pts {
  margin-left: auto; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75); font-size: 0.85rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.verdict .method { flex: 1 0 100%; margin-top: 0.1rem; color: var(--ink-2); font-size: 0.76rem; font-weight: 500; opacity: 1; }

/* ── 해설 ── */
.rationale {
  margin-top: 1rem; padding: 1.1rem 0 0;
  border-top: 1px solid var(--line); line-height: 1.75;
}
.rationale h3 {
  margin: 0 0 0.75rem; color: var(--green);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em;
}
.rationale p { margin: 0 0 0.7rem; color: var(--ink); font-size: 0.95rem; line-height: 1.78; }
.rationale > p:last-child { margin-bottom: 0; }
.rationale .emph, .rationale b { color: var(--ink); font-weight: 700; }
.rationale .ref { margin: 0.5rem 0 0; color: var(--ink-3); font-size: 0.8rem; line-height: 1.6; }

/* 정답 키 — 해설 맨 위에서 "정답이 무엇인지" 먼저 보여준다 */
.ans-key {
  display: flex; gap: 0.7rem; align-items: flex-start;
  margin: 0 0 0.9rem; padding: 0.7rem 0.85rem;
  border: 1px solid #cfe1da; border-radius: var(--r-sm); background: var(--green-tint);
}
.ans-key-lab {
  flex: none; padding: 0.15rem 0.5rem; border-radius: var(--r-xs);
  background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 800; white-space: nowrap;
}
.ans-key-val { min-width: 0; color: var(--ink); font-size: 0.92rem; font-weight: 600; line-height: 1.6; }
.ans-key-val .ans-chip {
  display: inline-block; margin: 2px 5px 2px 0; padding: 0.1rem 0.5rem;
  border: 1px solid #cfe1da; border-radius: var(--r-xs); background: var(--surface); font-weight: 700;
}
.ans-key-val .ans-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; margin: 0.2rem 0; }
.ans-key-val .ans-row-lab { color: var(--ink-3); font-weight: 500; }
.ans-key-val .ans-row b { color: var(--green); }

.source-basis {
  margin-top: 0.9rem; padding: 0.75rem 0.9rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
}
.source-basis h4 { margin: 0 0 0.3rem; font-size: 0.78rem; color: var(--ink-2); }
.source-basis p { margin: 0; color: var(--ink-3); font-size: 0.78rem; line-height: 1.6; overflow-wrap: anywhere; }

/* ── 카드 하단 액션: 제출 + 신고 ── */
.actions { margin-top: 1.1rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.actions .btn-primary { flex: 1 1 auto; min-height: 48px; }
.btn-flag { flex: 0 0 auto; color: var(--ink-3); font-size: 0.85rem; }
.btn-flag:hover { color: var(--accent); border-color: var(--accent); }
.btn-flag.is-flagged { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }

/* ── 결과 요약(진단·학습 완료) ── */
.diagnostic-summary h2 { font-size: clamp(1.35rem, 3.6vw, 1.7rem); }
.diagnostic-summary .score {
  grid-area: auto; justify-self: auto;
  margin: 0.6rem 0 1.1rem; color: var(--ink-2); font-size: 1rem;
}
.diagnostic-summary .score b { font-size: 1.25rem; }
.diagnostic-summary .actions { margin-top: 1.25rem; }

/* ── 빈 상태·오류 ── */
.empty { text-align: center; padding: 3rem 1.25rem; color: var(--ink-3); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.review-queue-empty, .review-queue-error { text-align: center; }
.review-queue-empty h2, .review-queue-error h2 { margin-top: 0; font-size: 1.15rem; }
.review-queue-empty p, .review-queue-error p { margin-bottom: 0; color: var(--ink-2); line-height: 1.7; }
.review-queue-error .actions { justify-content: center; }
.review-queue-error .actions .btn { flex: 0 1 auto; }

/* ── 결과 영역(quiz1 계승) ── */
.choices { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.choice {
  flex: 1 1 60px; max-width: 90px; padding: 12px 0;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: 1.4rem; font-weight: 700; cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--green); background: var(--green-tint); }
.choice:disabled { cursor: default; }
.choice.correct { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.choice.wrong { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.result-slot { margin-top: 14px; }
.result { padding: 12px 14px; border-radius: var(--r-sm); text-align: center; font-size: 1.05rem; font-weight: 700; }
.result.ok { background: var(--green-tint); color: var(--green); }
.result.no { background: var(--accent-tint); color: var(--accent); }
.explanation { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 0.92rem; }
.explanation h4 { margin: 0 0 6px; font-size: 0.85rem; color: var(--ink-3); }
.explanation.pending p { margin: 0; color: var(--ink-3); }

/* ══════════════════════════════════════════════════════
   푸터 — 다음 버튼 · 안내 · 사업자 고지
   ══════════════════════════════════════════════════════ */
.app-footer { margin-top: 1rem; }
.hint { margin: 0.9rem 0 0.25rem; text-align: center; color: var(--ink-3); font-size: 0.8rem; line-height: 1.6; }
.disclaimer { margin: 0.75rem 0 0; text-align: center; color: var(--ink-3); font-size: 0.78rem; line-height: 1.65; }
.disclaimer b { color: var(--ink-2); }
.attribution {
  margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line);
  color: var(--ink-3); text-align: left;
}
.attribution summary { cursor: pointer; color: var(--ink-2); font-size: 0.8rem; font-weight: 700; }
.attribution-content { margin-top: 0.6rem; font-size: 0.78rem; line-height: 1.6; }
.attribution-notice { margin: 0 0 0.6rem; }
.attribution-error { color: var(--accent); font-weight: 700; }
.attribution-list { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.5rem; }
.attribution-list li { overflow-wrap: anywhere; }
.attribution-list li span { display: block; }
.attribution-list a { color: var(--green); }

/* 사업자·약관 고지 푸터(diagnostic.html, nclex#560 PR B). 랜딩 푸터와 같은 사실·표기.
   라벨과 값은 .nowrap 으로 한 덩어리로 넘긴다. */
.site-footer.legal {
  display: grid;
  gap: 0.2rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.74rem;
  line-height: 1.7;
}
.site-footer.legal p { margin: 0; }
.site-footer.legal strong { color: var(--ink-2); font-weight: 700; }
.site-footer.legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.site-footer.legal a:hover { color: var(--green); }
.site-footer.legal .footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.6rem; font-size: 0.8rem; font-weight: 700; }
.site-footer.legal .footer-links a { color: var(--ink-2); text-decoration: none; }
.site-footer.legal .footer-links a:hover { color: var(--green); text-decoration: underline; }
.nowrap { white-space: nowrap; }

/* ── 라이트박스 ── */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: flex-start; justify-content: center; padding: 24px; overflow: auto;
  background: rgba(20, 35, 31, 0.86); cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); }

/* ══════════════════════════════════════════════════════
   계정 영역·동의 카드·계정 설정 (nclex#110) — diagnostic.html
   ══════════════════════════════════════════════════════ */
.account-panel {
  margin-bottom: 1rem; padding: clamp(1.1rem, 3vw, 1.5rem);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.account-panel h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.account-panel .actions { margin-top: 0.9rem; }
.account-panel .actions .btn-primary { flex: 0 1 auto; min-height: 44px; }
.account-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.consent-panel { background: var(--green-tint); border-color: #cfe1da; }
.consent-intro { margin: 0 0 0.5rem; color: var(--ink-2); font-size: 0.9rem; line-height: 1.7; }
.consent-docs { margin: 0 0 0.6rem; padding-left: 1.1rem; font-size: 0.9rem; line-height: 1.7; }
.consent-docs a { color: var(--green); font-weight: 700; text-underline-offset: 3px; }
.consent-version { margin-left: 0.4rem; color: var(--ink-3); font-size: 0.74rem; font-family: var(--mono); }
.consent-check {
  display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.6rem 0 0;
  font-size: 0.9rem; line-height: 1.6; cursor: pointer;
}
.consent-check input { width: 1rem; height: 1rem; margin: 0.25rem 0 0; accent-color: var(--green); }
.account-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.9rem;
  margin: 0 0 0.3rem; font-size: 0.9rem;
}
.account-facts dt { color: var(--ink-3); }
.account-facts dd { margin: 0; overflow-wrap: anywhere; }
/* 위험 구역: 되돌릴 수 없는 동작임을 눈에 띄게 한다. */
.danger-zone {
  margin-top: 1rem; padding: 0.9rem 1rem;
  border: 1px solid #ebc9b8; border-radius: var(--r-sm); background: var(--accent-tint);
}
.danger-zone h3 { margin: 0 0 0.4rem; color: var(--accent); font-size: 0.95rem; }
.danger-zone p { margin: 0 0 0.6rem; color: var(--ink-2); font-size: 0.86rem; line-height: 1.65; }
.danger-zone label { display: block; margin-bottom: 0.4rem; color: var(--ink-3); font-size: 0.8rem; }
.danger-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.danger-zone input {
  width: 10em; min-height: 40px; padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════
   검수 화면 전용 — 신고 검수 패널 · 면허자 검수 패널 (index.html)
   ══════════════════════════════════════════════════════ */
.flag-review-panel {
  margin-bottom: 1rem; padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid #ebc9b8; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.flag-review-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.9rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line);
}
.flag-review-heading h2 { margin: 0.15rem 0; font-size: 1.05rem; }
.flag-review-heading p { margin: 0; color: var(--ink-3); font-size: 0.84rem; line-height: 1.6; }
.flag-review-toolbar { display: flex; gap: 0.4rem; flex: none; }
.flag-review-toolbar .btn { min-height: 34px; padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.flag-review-panel > .review-queue-status { margin-top: 0.6rem; }
.flag-review-list { display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.flag-review-item { padding: 0.9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.flag-review-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.flag-review-item-head > div { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.flag-review-item-head h3 { margin: 0; font-size: 0.95rem; overflow-wrap: anywhere; font-family: var(--mono); }
.flag-review-state {
  flex: none; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--amber-tint); color: var(--amber); font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
}
.flag-review-state.is-triaged { background: var(--green-tint); color: var(--green); }
.flag-review-rate { flex: none; color: var(--accent); font-size: 1.05rem; font-weight: 800; }
.flag-review-metrics { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; margin: 0.55rem 0; color: var(--ink-3); font-size: 0.78rem; }
.flag-review-metrics b { color: var(--ink); }
.flag-review-metrics .is-warning { color: var(--amber); }
.flag-review-alert {
  margin: 0.55rem 0; padding: 0.5rem 0.65rem; border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--accent-tint); color: #7a3a22;
  font-size: 0.78rem; line-height: 1.55;
}
.flag-review-reasons { margin: 0.55rem 0; padding-left: 1.25rem; display: grid; gap: 0.45rem; }
.flag-review-reasons li { padding-left: 2px; }
.flag-review-reasons p { margin: 0; font-size: 0.87rem; white-space: pre-wrap; }
.flag-review-reasons span, .flag-review-empty-reason { margin: 2px 0 0; color: var(--ink-3); font-size: 0.73rem; }
.flag-review-history {
  margin: 0.6rem 0; padding: 0.5rem 0.65rem; border-left: 3px solid var(--line-2);
  border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--surface-2); color: var(--ink-3);
  font-size: 0.76rem; line-height: 1.55;
}
.flag-review-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0.55rem; }
.flag-review-form label { color: var(--ink-3); font-size: 0.76rem; font-weight: 700; }
.flag-review-form select, .flag-review-form textarea {
  display: block; width: 100%; margin-top: 4px; padding: 0.5rem 0.6rem;
  border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); color: var(--ink); font: inherit;
}
.flag-review-form textarea { min-height: 74px; resize: vertical; line-height: 1.45; }
.flag-review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }
.flag-review-actions .btn { min-height: 34px; padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.flag-review-actions .btn-reject { color: var(--accent); border-color: #ebc9b8; }
.flag-review-actions span { flex: 1 0 100%; color: var(--accent); font-size: 0.76rem; }
.flag-review-clear { padding: 0.9rem; text-align: center; }
.flag-review-clear h3 { margin: 0 0 4px; font-size: 0.95rem; }
.flag-review-clear p { margin: 0; color: var(--ink-3); font-size: 0.82rem; }

/* Cloudflare Access 뒤 quiz2에서만 보이는 면허자 검수 패널 */
.clinical-review {
  margin-top: 1rem; padding: 0.9rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.clinical-review-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.clinical-review-head h3 { margin: 0; font-size: 0.95rem; color: var(--ink); }
.clinical-review-badge {
  flex: none; padding: 0.15rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); font-size: 0.74rem; font-weight: 800;
}
.clinical-review-badge.is-done { border-color: var(--green); background: var(--green-tint); color: var(--green); }
.clinical-review-badge.is-recheck, .clinical-review-badge.is-error { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.clinical-review-badge.is-pending { border-color: #ead9a8; background: var(--amber-tint); color: var(--amber); }
.clinical-review-help, .clinical-review-meta { margin: 0.5rem 0; color: var(--ink-3); font-size: 0.78rem; line-height: 1.6; }
.clinical-review-check { display: flex; align-items: center; gap: 0.45rem; margin: 0.75rem 0 0.55rem; font-size: 0.9rem; font-weight: 700; }
.clinical-review-check input { width: 17px; height: 17px; accent-color: var(--green); }
.clinical-review-comment { display: block; color: var(--ink-3); font-size: 0.8rem; font-weight: 700; }
.clinical-review-comment textarea {
  display: block; width: 100%; min-height: 90px; margin-top: 5px; padding: 0.6rem 0.7rem; resize: vertical;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; line-height: 1.5;
}
.clinical-review-comment textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.clinical-review-comment textarea:disabled { background: var(--surface-2); color: var(--ink-2); opacity: 1; }
.clinical-review-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; flex-wrap: wrap; }
.clinical-review-actions .btn { min-height: 36px; padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.clinical-review-actions span { color: var(--ink-3); font-size: 0.78rem; }
.clinical-paid-pool { margin: 0.6rem 0 0; padding: 0.45rem 0.6rem; border-radius: var(--r-xs); font-size: 0.78rem; font-weight: 800; }
.clinical-paid-pool:empty { display: none; }
.clinical-paid-pool.is-included { color: var(--green); background: var(--green-tint); }
.clinical-paid-pool.is-excluded { color: var(--amber); background: var(--amber-tint); }
.clinical-review-meta { margin-bottom: 0; overflow-wrap: anywhere; }
.clinical-review-meta:empty { display: none; }

/* ══════════════════════════════════════════════════════
   반응형
   ══════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  /* 넓은 화면: 계정 영역을 언어 전환 옆 같은 줄로 올린다. */
  .app-header-inner {
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas:
      "brand account progress lang";
  }
  .account-area { padding-bottom: 0; justify-content: flex-end; }
  .score, .review-progress { padding-bottom: 0; }
  .app-header h1 { min-height: 64px; }
}

@media (max-width: 620px) {
  .flag-review-heading { flex-direction: column; }
  .flag-review-form { grid-template-columns: 1fr; }
  .bowtie { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app-header h1 { font-size: 1rem; }
  .app-header h1 .sub { display: none; }
  .choice { font-size: 1.2rem; }
  /* 좁은 화면에서 행렬 폭·여백을 줄여 내부 가로 스크롤 필요를 최소화 */
  .matrix { font-size: 0.84rem; }
  .matrix th, .matrix td { padding: 0.5rem 0.55rem; }
  .matrix .rowlab { min-width: 140px; }
  .mode-banner { grid-template-columns: auto 1fr; }
  .mode-banner-progress { grid-column: 1; grid-row: 2; justify-self: start; }
  .mode-banner-case > div { grid-column: 2; grid-row: 1 / span 2; }
  .controls-mode > .btn-primary, .controls-mode > .btn-case, .study-card > .btn, .study-purchase .btn { width: 100%; }
  .clinical-review-head { align-items: flex-start; }
  .clinical-review-actions { align-items: flex-start; flex-direction: column; }
  .verdict .pts { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
