/* ─────────────────────────────────────────────
   보고서·에세이 편집기 화면 + 인쇄 스타일 (기초회로실험·물리학및실험2·주제연구 세 앱 공용)
   style.css 다음에 로드. 색·폰트는 style.css의 --c-* 토큰만 쓴다.
   essay 표지·개요 상자용 명조 폰트만 예외로 아래에서 직접 불러온다(주제연구 전용, 다른 두 앱은 미사용).
   ───────────────────────────────────────────── */
@import url('/_vendor/fonts/google/noto-serif-kr.css');

body { min-height: 100vh; }
/* 배경 블롭(style.css body::before)은 편집기에서는 과하므로 톤을 낮춘다 */
body::before { opacity: .55; }

/* ══════════════ 상단 툴바 ══════════════ */
.report-toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--glass-hi);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,.14);
}
.rt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rt-lbl { font-size: .72rem; font-weight: 700; color: var(--muted); margin-right: 4px; }

.rt-btn {
  font-family: inherit; font-size: .82rem; font-weight: 700; color: var(--ink-2);
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 14px; cursor: pointer; transition: border-color .15s, background .15s;
  line-height: 1.3;
}
.rt-btn:hover { border-color: var(--accent-line); color: var(--strong-ink); }
.rt-btn.rt-icon { padding: 7px 12px; min-width: 34px; text-align: center; }
.rt-btn.rt-primary { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.rt-btn.rt-primary:hover { filter: brightness(1.06); }
a.rt-btn.rt-home { text-decoration: none; }

/* 칸(profile) 표시 — 두 사람이 같이 쓰는 앱(기초회로실험)에서만 채워진다. 다른 칸으로 가는 링크 포함 */
.rt-profile { font-size: .85em; color: var(--muted); }
.rt-profile b { color: var(--strong-ink); }
.rt-profile a { color: var(--accent-line); text-decoration: none; }
.rt-profile a:hover { text-decoration: underline; }
.rt-profile[hidden] { display: none; }

.rt-idsel { display: flex; align-items: center; gap: 6px; }
#rt-id-select {
  font-family: inherit; font-size: .85rem; font-weight: 700; color: var(--ink);
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 10px;
}
.rt-filename {
  font-size: .78rem; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace;
  background: var(--glass); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 6px 10px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rt-source-badge { font-size: .74rem; color: var(--muted); margin-left: auto; }

.rt-group { display: flex; align-items: center; gap: 6px; }
.rt-table-tool input[type="number"] {
  width: 46px; padding: 6px 6px; border-radius: 7px; border: 1px solid var(--line);
  font-family: inherit; font-size: .82rem; background: var(--glass); color: var(--ink); text-align: center;
}
.rt-table-tool .rt-x { color: var(--muted); font-size: .8rem; }

.rt-math-help-wrap { position: relative; }
.rt-math-help-pop {
  position: absolute; top: 110%; left: 0; z-index: 60; width: 300px;
  background: var(--c-surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.28); padding: 14px 16px; font-size: .84rem; color: var(--ink-2);
}
.rt-math-help-pop p { margin: 0 0 10px; line-height: 1.6; }
.rt-math-help-pop code { background: var(--glass-2); padding: 1px 5px; border-radius: 5px; }
.rt-toggle { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--strong-ink); cursor: pointer; }

.rt-status { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.rt-status.ok { color: var(--green-ink); }
.rt-status.err { color: var(--red-ink); font-weight: 700; }
.rt-status.pending { color: var(--amber-ink); }

.rt-help-note { font-size: .72rem; color: var(--muted); margin-left: 4px; }
/* essay 모드 전용 — 다른 두 앱은 report.config.js에 coverLayout:'essay'가 없어 JS가 hidden을 유지한다 */
#rt-guide-toggle[hidden] { display: none; }
.rt-charcount { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.rt-charcount[hidden] { display: none; }
#theme-toggle-btn { margin-left: auto; }
.rt-row3 #theme-toggle-btn {
  border: 1px solid var(--line); background: var(--glass-2);
  border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
#rt-ref-toggle.rt-active { border-color: var(--accent-line); color: var(--strong-ink); background: var(--glass-2); }

/* 좁은 화면에서 flex 항목이 내용 폭만큼 늘어나 가로 넘침을 만들지 않도록 */
.rt-row, .rt-group, .rt-btn, .rt-idsel, #rt-id-select, .rt-filename { min-width: 0; }

@media (max-width: 900px) {
  .report-toolbar { padding: 8px 12px; }
  .rt-filename { max-width: 46vw; }
  .rt-source-badge { margin-left: 0; width: 100%; order: 9; }
}
@media (max-width: 480px) {
  .rt-filename { max-width: 40vw; }
  .rt-help-note { display: none; }
  /* 도움말 팝업은 트리거 버튼 위치에 매이지 않고 화면 폭에 맞춰 고정한다(375px 넘침 방지) */
  .rt-math-help-pop { position: fixed; left: 10px; right: 10px; top: auto; width: auto; }
}

/* ══════════════ 초안 파일 vs 저장본 충돌 안내 ══════════════ */
.rt-conflict-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--amber-bg); border-bottom: 1px solid var(--amber-line);
  padding: 9px 20px; font-size: .82rem; color: var(--strong-ink);
}
.rt-conflict-banner[hidden] { display: none; }
.rt-conflict-msg { flex: 1 1 auto; font-weight: 700; }

/* ══════════════ 반반 화면 ══════════════ */
.rt-body { display: flex; align-items: stretch; min-height: calc(100vh - 120px); }
.rt-body .paper-wrap { flex: 1 1 auto; min-width: 0; min-height: 0; }
.ref-splitter {
  flex: 0 0 auto; width: 7px; cursor: col-resize; background: var(--line);
  position: relative;
}
.ref-splitter:hover, .ref-splitter:active { background: var(--accent-line); }
.ref-panel {
  flex: 0 0 auto; width: 42%; min-width: 0; max-width: 70%;
  display: flex; flex-direction: column; background: var(--c-surface);
  border-left: 1px solid var(--line);
}
.ref-panel-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.ref-panel-btns { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.ref-panel-btn { font-size: .78rem; padding: 6px 10px; }
.ref-panel-btn.rt-active { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.ref-panel-url {
  font-size: .7rem; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace;
  padding: 2px 10px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-panel-frame { flex: 1 1 auto; width: 100%; height: 100%; border: 0; background: #fff; }

.rt-body.ref-closed .ref-panel, .rt-body.ref-closed .ref-splitter { display: none; }
.rt-body.ref-closed .paper-wrap { flex: 1 1 100%; }

@media (max-width: 900px) {
  .rt-body { flex-direction: column; min-height: 0; }
  .ref-splitter { display: none; }
  .ref-panel { width: 100% !important; max-width: none; height: 40vh; border-left: 0; border-top: 1px solid var(--line); }
  .rt-body.ref-closed .ref-panel { display: none; }
}

/* ══════════════ 종이 ══════════════ */
.paper-wrap {
  min-height: calc(100vh - 120px);
  display: flex; justify-content: center;
  padding: 36px 20px 100px;
  background: var(--c-sunk);
}
.paper {
  width: 210mm; max-width: 100%; min-height: 297mm;
  background: #ffffff; color: #1c1c1c;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  border-radius: 4px;
  padding: 22mm 18mm;
  font-size: 10.7pt; line-height: 1.65;
}
.paper * { color: #1c1c1c; }

.cover { text-align: center; border-bottom: 2px solid #333; padding-bottom: 16px; margin-bottom: 22px; }

/* hwp 배포 양식과 같은 3줄 구조:
   1줄) 과목 <N>강 <종류>   2줄) 실험 제목 · 제출일 · 실험일   3줄) 학번 · 이름 · 조원 · 조 */
.cover-line1 {
  font-size: .88rem; letter-spacing: .04em; color: #333; font-weight: 700;
  margin-bottom: 10px;
}
.cover-line1 .cv-course { color: #555; }
.cover-line1 .cv-week {
  display: inline-block; min-width: 14px; border-bottom: 1px dotted #999;
  padding: 0 2px; outline: none; font-weight: 800; color: #1c1c1c;
}
.cover-line1 .cv-week:focus { border-bottom: 1px solid #333; background: rgba(0,0,0,.03); }
.cover-line1 .cv-kind { margin-left: 4px; color: #444; }

.cover-line2 {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: 6px 16px; margin: 2px 0 16px;
}
.cover-line2 .cv-title { font-size: 1.35rem; font-weight: 800; }
.cover-line2 .cv-dot { color: #aaa; font-weight: 400; }
.cover-line2 .cv-f { font-size: .86rem; }

.cover-line3 {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  font-size: .86rem;
}

.cv-f { display: flex; align-items: baseline; gap: 6px; }
.cv-k { color: #666; font-weight: 700; }
.cv-v {
  min-width: 60px; display: inline-block; border-bottom: 1px dotted #999;
  padding: 0 4px; outline: none;
}
.cv-v:focus { border-bottom: 1px solid #333; background: rgba(0,0,0,.03); }
.cv-v:empty::before { content: attr(data-placeholder); color: #999; }

/* ── 표지 — phys 레이아웃(물리학및실험2): 담당교수 줄 · 큰 제목 · 조/학과/학번/이름 · 조원(여러 줄) ── */
.cover-line1-phys { font-size: .88rem; letter-spacing: .04em; color: #555; font-weight: 700; margin-bottom: 6px; }
.cover-line2-phys {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: 6px 14px; font-size: .86rem; color: #444; margin-bottom: 14px;
}
.cover-line2-phys .cv-v-static { font-weight: 700; color: #1c1c1c; }
.cover-title-phys { font-size: 1.35rem; font-weight: 800; margin: 4px 0 16px; }
.cover-line3-phys {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: 6px 10px; font-size: .86rem; margin-bottom: 10px;
}
.cover-line3-phys .cv-v { min-width: 40px; }
.cover-line4-phys { display: flex; justify-content: center; align-items: baseline; gap: 8px; font-size: .86rem; }
.cv-members-multi {
  min-width: 200px; max-width: 520px; text-align: left; white-space: pre-line;
  border-bottom: 1px dotted #999; padding: 2px 6px; outline: none; display: inline-block;
}
.cv-members-multi:focus { border-bottom: 1px solid #333; background: rgba(0,0,0,.03); }

.sec { margin: 0 0 26px; }
.sec-head { font-size: 1.05rem; font-weight: 800; margin: 0 0 10px; padding-bottom: 4px; border-bottom: 1px solid #ccc; }
.sec-body { outline: none; min-height: 60px; }
.sec-body p { margin: 8px 0; }
.sec-body p.hint { color: #999; font-style: italic; }
.sec-body ul, .sec-body ol { margin: 8px 0; padding-left: 22px; }
.sec-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .92em; display: block; overflow-x: auto; max-width: 100%; }
.sec-body table caption { display: block; width: 100%; text-align: left; font-size: .86em; margin-bottom: 4px; color: #555; white-space: normal; }
.sec-body table thead, .sec-body table tbody { display: table; width: 100%; }
.sec-body table th, .sec-body table td { border: 1px solid #888; padding: 5px 9px; }
.sec-body table th { background: #f0f0f0; font-weight: 700; }
.sec-body table td.rt-cell-focus, .sec-body table th.rt-cell-focus { outline: 2px solid #9a4913; outline-offset: -2px; }
.sec-body figure { margin: 14px 0; text-align: center; position: relative; }
.sec-body figure img { max-width: 100%; height: auto; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; }
.sec-body figure figcaption { font-size: .82em; color: #666; margin-top: 6px; outline: none; }
.sec-body figure.rt-drop-target { outline: 2px dashed #9a4913; outline-offset: 4px; }

/* 사진 자리 표시(figure.ph) — 사진이 아직 없는 자리. 클릭·붙여넣기·드롭으로 채운다 */
.sec-body figure.ph {
  border: 2px dashed #9a4913; border-radius: 8px; background: rgba(154,73,19,.04);
  padding: 26px 14px; cursor: pointer; text-align: center;
}
.sec-body figure.ph:hover { background: rgba(154,73,19,.09); }
.sec-body figure.ph::before {
  content: "📷 여기를 클릭하거나 Ctrl+V로 캡처를 붙여넣기";
  display: block; color: #9a4913; font-weight: 700; font-size: .86em; margin-bottom: 8px;
}
.sec-body figure.ph figcaption { color: #777; font-size: .82em; }
.sec-body:focus { box-shadow: inset 0 0 0 1px rgba(154,73,19,.35); border-radius: 4px; }

.paper.rt-dragover { outline: 3px dashed #9a4913; outline-offset: -8px; }

/* 사진 폭 조절 팝업 */
.rt-img-resize-pop {
  position: fixed; z-index: 70; display: flex; gap: 4px;
  background: var(--c-surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 5px; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.rt-img-resize-pop button {
  font-family: inherit; font-size: .78rem; font-weight: 700; color: var(--ink-2);
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; cursor: pointer;
}
.rt-img-resize-pop button:hover { border-color: var(--accent-line); }

.paper { position: relative; }

/* 조판된 수식 칩 — 누르면 원문으로 돌아가 편집 */
.math-chip { cursor: pointer; border-radius: 4px; }
/* 화면 폭이 좁을 때 긴 수식 줄은 종이 밖으로 넘치지 않고 문단 안에서 가로 스크롤 */
@media screen { .sec-body p { overflow-x: auto; overflow-y: hidden; padding: 4px 0 6px; margin: 0; } }
.math-chip:hover { background: rgba(160, 110, 40, .12); }

@media (max-width: 900px) {
  .paper { padding: 14mm 8mm; font-size: 10.2pt; }
  .cover-fields { gap: 6px 14px; font-size: .8rem; }
}
@media (max-width: 560px) {
  .paper { padding: 10mm 5mm; }
}

/* ══════════════ 학교 공식 hwp 양식(기초회로실험 결과·예비보고서) ══════════════
   물리학및실험2(coverLayout: 'phys')는 건드리지 않는다 — 이 아래 규칙은 전부 .paper.form-hwp3 로 한정한다. */
.paper.form-hwp3 {
  font-family: "HCR Batang", "함초롬바탕", "Batang", "바탕", serif;
}

.paper.form-hwp3 .cover { border: 0; padding: 0; text-align: left; margin-bottom: 14px; }

.paper.form-hwp3 .cover-tbl {
  width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0;
}
.paper.form-hwp3 .cover-tbl td {
  border: 1px solid #000; padding: 6px 8px; vertical-align: middle; text-align: left;
  font-size: 10pt; font-weight: 400; color: #000;
}
.paper.form-hwp3 .cover-tbl .cv-title-cell { width: 45%; font-size: 12pt; }
.paper.form-hwp3 .cover-tbl .cv-key { width: 17%; font-size: 12pt; white-space: nowrap; }
.paper.form-hwp3 .cover-tbl .cv-val { font-size: 10pt; }
.paper.form-hwp3 .cover-tbl .cv-members-line { font-size: 10pt; margin-top: 2px; }

/* 표지 안 편집 가능한 칸 — 공식 양식에는 밑줄이 없다. 포커스일 때만 옅게 표시 */
.paper.form-hwp3 .cover-tbl .cv-v { border-bottom: 0; padding: 0 2px; }
.paper.form-hwp3 .cover-tbl .cv-v:focus { border-bottom: 0; background: rgba(0,0,0,.03); }

/* 본문: 함초롬바탕 10pt·양쪽 정렬 */
.paper.form-hwp3 .sec-body { font-size: 10pt; line-height: 1.6; text-align: justify; color: #000; }
.paper.form-hwp3 .sec-body p { margin: 2px 0; }

/* 절 제목("1. 실험 결과") — 밑줄·테두리 없이 굵게만 */
.paper.form-hwp3 .sec-head { font-size: 10pt; font-weight: 700; border: 0; padding: 0; margin: 14px 0 4px; color: #000; }
/* 소제목("1-1. …") — 본문 안 h4, 굵기 없음 */
.paper.form-hwp3 .sec-body h4 { font-size: 10pt; font-weight: 400; margin: 10px 0 2px; color: #000; }
/* 마지막 절(결과 분석)은 글이 몰려 있어 문단·소제목 간격을 넓힌다. 앞 절은 그림 배치가 빠듯해 그대로 둔다 */
.paper.form-hwp3 .sec:last-of-type .sec-body p { margin: 3px 0; }
.paper.form-hwp3 .sec:last-of-type .sec-body h4 { margin: 12px 0 3px; }

/* 표 — 옅은 회색 배경 없이 검은 실선 테두리만 */
.paper.form-hwp3 .sec-body table th,
.paper.form-hwp3 .sec-body table td { border: 1px solid #000; padding: 3px 6px; font-size: 10pt; color: #000; }
.paper.form-hwp3 .sec-body table th { background: none; font-weight: 400; }
/* 기본 규칙의 display:block + 안쪽 100% 폭은 테두리만큼 오른쪽이 잘린다 — 양식에서는 보통 표로 */
.paper.form-hwp3 .sec-body table { display: table; width: 100%; font-size: 10pt; overflow: visible; }
.paper.form-hwp3 .sec-body table thead { display: table-header-group; }
.paper.form-hwp3 .sec-body table tbody { display: table-row-group; }
.paper.form-hwp3 .sec-body table caption { display: table-caption; }
/* 수식이 섞인 문단은 양쪽 정렬하면 낱말 사이가 벌어진다 */
.paper.form-hwp3 .sec-body p:has(.math-chip) { text-align: left; }
.paper.form-hwp3 .cover-tbl .cv-week { min-width: 0; margin: 0; padding: 0; }
.paper.form-hwp3 .sec-body table caption { font-size: 10pt; color: #000; text-align: left; }

/* 사진 캡션·이미지 — 테두리·둥근 모서리 없음 */
.paper.form-hwp3 .sec-body figure figcaption { font-size: 10pt; color: #000; }
.paper.form-hwp3 .sec-body figure img { border: 0; border-radius: 0; }

/* ══════════════ essay 표지·본문(주제연구 학술 에세이) ══════════════
   기초회로실험(form-hwp3)·물리학및실험2(phys)는 건드리지 않는다 — 이 아래 규칙은 전부 .paper.form-essay 로 한정한다. */
.paper.form-essay {
  font-family: 'Noto Serif KR', "HCR Batang", "함초롬바탕", "Batang", "바탕", serif;
}
.paper.form-essay .cover { border: 0; padding: 0 0 18px; text-align: left; margin-bottom: 26px; }

.cv-essay-titlewrap { text-align: center; margin-bottom: 22px; }
.cv-essay-title {
  font-size: 1.7rem; font-weight: 800; line-height: 1.4; outline: none; padding: 2px 8px; border-radius: 6px;
}
.cv-essay-title:empty::before { content: attr(data-placeholder); color: #999; font-weight: 700; }
.cv-essay-title:focus { background: rgba(0,0,0,.03); }
.cv-essay-subtitle {
  display: block; font-size: 1.02rem; color: #555; margin-top: 8px; outline: none; padding: 2px 8px; border-radius: 6px;
}
.cv-essay-subtitle:empty::before { content: attr(data-placeholder); color: #999; }
.cv-essay-subtitle:focus { background: rgba(0,0,0,.03); }

.cv-essay-info {
  margin-left: auto; width: max-content; max-width: 100%;
  display: flex; flex-direction: column; gap: 3px; text-align: right; font-size: .86rem; color: #333;
}
.cv-essay-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; }
.cv-essay-row .cv-k { color: #777; font-weight: 700; min-width: 52px; text-align: left; }
.cv-essay-row .cv-v, .cv-essay-row .cv-v-static { min-width: 90px; outline: none; }
.cv-essay-row .cv-v { border-bottom: 1px dotted #999; padding: 0 2px; }
.cv-essay-row .cv-v:focus { border-bottom: 1px solid #333; background: rgba(0,0,0,.03); }

.paper.form-essay .sec-body { font-size: 11pt; line-height: 1.6; }
.paper.form-essay .sec-label {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: #9a4913; background: rgba(154,73,19,.08); border-radius: 5px; padding: 2px 8px; margin-bottom: 6px;
}
.paper.form-essay .sec-title {
  font-size: 1.12rem; font-weight: 800; margin: 0 0 10px; outline: none; padding: 2px 4px 6px;
  border-bottom: 1px solid #ccc;
}
.paper.form-essay .sec-title:empty::before { content: attr(data-placeholder); color: #999; font-weight: 500; }
.paper.form-essay .sec-title:focus { background: rgba(0,0,0,.03); }
.paper.form-essay .sec-body:empty::before { content: attr(data-placeholder); color: #999; font-style: italic; }
.paper.form-essay .sec-charcount { text-align: right; font-size: .72rem; color: #999; margin-top: 4px; }

/* 개요 상자 — 화면 전용, contenteditable 아님, 인쇄 안 됨(§ 인쇄 규칙에서 숨김) */
.sec-guide { margin: 0 0 10px; border: 1px solid #e2d4b8; background: #fbf6ec; border-radius: 8px; padding: 2px 12px; }
.sec-guide-summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: #8a5a12; padding: 7px 0; list-style: none; }
.sec-guide-summary::-webkit-details-marker { display: none; }
.sec-guide-summary::before { content: "▸ "; }
.sec-guide[open] .sec-guide-summary::before { content: "▾ "; }
.sec-guide-body { padding: 0 0 10px; font-size: .82rem; color: #5a4a30; }
.sg-block { margin: 6px 0; }
.sg-label { display: inline-block; font-weight: 800; font-size: .74rem; color: #9a4913; margin-right: 6px; }
.sg-block p, .sg-block ul { margin: 3px 0 0; }
.sg-block ul { padding-left: 20px; }
.sg-block li { margin: 2px 0; }
.sg-caution { color: #a13d2e; }

@media (max-width: 900px) {
  .cv-essay-info { margin-left: 0; width: 100%; text-align: left; }
  .cv-essay-row { justify-content: flex-start; }
}

/* ══════════════ 인쇄 ══════════════ */
@page { size: A4; margin: 18mm 16mm; }
@media print {
  html, body { background: #fff; }
  .report-toolbar, .rt-conflict-banner, .ref-panel, .ref-splitter,
  .rt-img-resize-pop, .rt-math-help-pop, .sec-body p.hint, .sec-body span.hint,
  .sec-label, .sec-guide, .sec-charcount { display: none !important; }
  /* :empty::before 는 CSS 생성 콘텐츠라 화면 전용 자리 표시라도 인쇄에 그대로 찍힌다 — 명시적으로 지운다 */
  .sec-title:empty, .cv-essay-title:empty, .cv-essay-subtitle:empty { display: none !important; }
  .sec-body:empty::before, .cv-essay-title:empty::before, .cv-essay-subtitle:empty::before,
  .sec-title:empty::before { content: none !important; }
  .rt-body { display: block; min-height: 0; }
  .paper-wrap { min-height: 0; padding: 0; background: #fff; display: block; }
  .paper {
    width: auto; max-width: none; min-height: 0; margin: 0; padding: 0;
    box-shadow: none; border-radius: 0; font-size: 10.5pt; line-height: 1.6;
  }
  .cover { page-break-inside: avoid; }
  .sec-head { page-break-after: avoid; }
  /* 소제목이 쪽 맨 아래에 홀로 걸리지 않게 — 제목과 바로 뒤 설명 한 문단을 다음 그림·표와 같은 쪽에 묶는다 */
  .sec-body h3, .sec-body h4, .sec-body h4 + p { break-after: avoid; page-break-after: avoid; }
  .sec-body table, .sec-body figure { page-break-inside: avoid; }
  .sec-body table th, .sec-body table td { border: 1px solid #000; padding: 4pt 6pt; }
  .cv-v { border-bottom: none; }
  .math-chip { background: none !important; }

  /* 물리학및실험2 보고서 작성 예시자료 지시 — 본문 10pt·단락 뒤 8pt·줄간 1.08·첫 줄 들여쓰기 */
  :root[data-print-style="phys"] .paper { font-size: 10pt; line-height: 1.08; }
  :root[data-print-style="phys"] .sec-body p { margin: 0 0 8pt; text-indent: 1em; }
  :root[data-print-style="phys"] .sec-body p:first-child { text-indent: 0; }
  :root[data-print-style="phys"] .sec:last-of-type .sec-body p { text-indent: 0; } /* 참고문헌 목록은 들여쓰기 없음 */

  /* 주제연구 학술 에세이 — A4·여백 약 26mm(=@page 좌우 16mm+padding 10mm)·명조 11pt·줄간격 160%·문단 첫 줄 들여쓰기.
     본문 폰트 크기는 화면·인쇄 공통으로 위 .paper.form-essay .sec-body 에서 11pt로 고정했으므로 여기서는 padding만 맞춘다.
     실측(긴 한국어 문장 반복·word-break:keep-all): 줄당 45~51자, 평균 48자 — "40~50자 안쪽" 목표에 대체로 들되
     낱말 경계상 가끔 51자까지 간다. 문장 길이가 섞인 실제 원고에서는 더 고르게 나온다. */
  :root[data-print-style="essay"] .paper { padding: 10mm; }
  :root[data-print-style="essay"] .sec-body { line-height: 1.6; }
  :root[data-print-style="essay"] .sec-body p { text-indent: 1em; margin: 0 0 8pt; }
  :root[data-print-style="essay"] .cv-essay-row .cv-v { border-bottom: none; }

  /* 사진 자리 표시는 인쇄에서 안내 상자를 걷어내고 한 줄 경고만 남긴다 */
  .sec-body figure.ph {
    border: none; background: none; padding: 4pt 0; text-align: left; cursor: default;
  }
  .sec-body figure.ph::before {
    content: "[사진 삽입 필요]"; color: #000; font-weight: 700; font-size: 10.5pt; margin-bottom: 0;
  }
  .sec-body figure.ph figcaption { display: none; }
}

/* 교재형 결과표(table.tb) — 교재 .4 실험 표와 같은 색·병합 구조 (2026-09-25 사용자 결정)
   th.tb-h = 파란 머리줄, .tb-s = 하늘색 항목칸, th.tb-diag = 대각선 머리칸(span.tr 오른쪽 위 / span.bl 왼쪽 아래) */
.paper .sec-body table.tb { table-layout: fixed; }
.paper .sec-body table.tb th, .paper .sec-body table.tb td { text-align: center; vertical-align: middle; border: 1px solid #7f93b5; }
.paper .sec-body table.tb .tb-h { background: #1f3fe0; color: #fff; font-weight: 400; }
.paper .sec-body table.tb .tb-s { background: #3fcdf0; color: #0a2540; font-weight: 400; }
.paper .sec-body table.tb th.tb-diag { position: relative; height: 2.6em; padding: 0;
  background: #1f3fe0 linear-gradient(to top right, transparent calc(50% - 0.6px), #fff calc(50% - 0.6px), #fff calc(50% + 0.6px), transparent calc(50% + 0.6px)); }
.paper .sec-body table.tb th.tb-diag .tr { position: absolute; right: 6px; top: 3px; font-size: .85em; }
.paper .sec-body table.tb th.tb-diag .bl { position: absolute; left: 6px; bottom: 3px; font-size: .85em; }
.paper .sec-body table.tb, .paper .sec-body table.tb * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
