/* Flipped 혼자 읽기 가이드 — 스타일
   순백 바탕 · 1px 괘선 · 한국어 인터페이스 · 편집지/독서노트 톤
   인쇄(@media print)에서 같은 데이터를 미니멀 PDF로 뽑을 수 있게 구성했습니다. */

:root {
  --ink: #141414;
  --ink-2: #3f3f46;
  --muted: #75757c;
  --faint: #a1a1aa;
  --line: #e5e7eb;
  --wash: #fafafa;
  --bg: #ffffff;
  --serif: "AppleMyungjo", "Nanum Myeongjo", "Noto Serif KR", "Noto Serif CJK KR", "Source Han Serif K", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

button { font-family: inherit; color: inherit; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── 헤더 ───────────────────────────────────────────── */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.head-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 34px;
  padding-bottom: 18px;
}

.titles h1 {
  font-family: var(--serif);
  font-size: 1.62rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.titles .back-home {
  display: inline-block;
  margin-bottom: 9px;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.titles .back-home:hover {
  color: var(--ink);
  border-bottom-color: var(--line);
}

.titles .sub {
  margin-top: 7px;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* 홈(서재): 돋움 계열 큰 제목 + 한 줄 부제 */
body.view-library .titles h1 {
  font-family: var(--sans);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

body.view-library .titles .sub {
  margin-top: 10px;
}

.sub-seg { display: inline; }
.sub-pipe { color: var(--faint); font-weight: 400; }

body.view-library .notice { display: none; }

.notice {
  flex: none;
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.head-bar {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
  padding-bottom: 0;
}

.mode-tabs {
  display: flex;
  gap: 22px;
  flex: none;
}

.mode-tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 1px 9px;
  margin-bottom: -1px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.mode-tabs button:hover { color: var(--ink); }

.mode-tabs button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.progress {
  flex: 1 1 220px;
  min-width: 180px;
  padding-bottom: 12px;
}

.progress-text {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.progress-text .sep { color: var(--faint); }

.progress .bar {
  margin-top: 7px;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.progress .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.25s ease;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex: none;
  padding-bottom: 10px;
}

.line-btn {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 12px;
  font-size: 0.78rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.line-btn:hover { border-color: var(--ink); color: var(--ink); }
.line-btn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

.line-btn.solid {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.line-btn.solid:hover { background: #000; }

.pace-panel {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  padding-bottom: 22px;
}

.pace-fields {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.field { display: block; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.date-input, .select-input {
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 10px;
  min-width: 210px;
}

.date-input:focus, .select-input:focus { outline: none; border-color: var(--ink); }

.pace-note {
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ── 레이아웃 ───────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 34px 26px 60px 0;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.toc-week {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.toc-list { margin-bottom: 26px; }

.toc-item button {
  appearance: none;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  padding: 7px 6px 7px 9px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 8px;
  box-shadow: inset 2px 0 0 transparent;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.toc-item button:hover { background: var(--wash); }

.toc-item .t-label {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.toc-item .t-sub {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--faint);
}

.toc-item .t-check {
  align-self: center;
  font-size: 0.72rem;
  color: var(--faint);
}

.toc-item.active button {
  box-shadow: inset 2px 0 0 var(--ink);
  background: var(--wash);
}

.toc-item.active .t-label { color: var(--ink); font-weight: 600; }

.toc-item.locked .t-label { color: var(--faint); }
.toc-item.locked .t-sub { color: #c4c4ca; }

.mobile-toc { display: none; }

.storage-warn {
  max-width: 720px;
  margin: 26px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--ink);
  background: var(--wash);
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink-2);
}

/* ── 본문 ───────────────────────────────────────────── */

#main { min-width: 0; padding-left: 56px; }

.day {
  max-width: 720px;
  padding: 42px 0 30px;
}

.day-kicker {
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.day h2 {
  font-family: var(--serif);
  font-size: 2.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.day-meta {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.day-rule {
  height: 0;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 30px 0 0;
}

.block {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.block:last-of-type { border-bottom: 0; }

.block h3 {
  margin-bottom: 18px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.block h3 .h3-sub {
  margin-left: 8px;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--faint);
}

/* 읽을 분량 */
.reading-line {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.reading-line span + span::before {
  content: "·";
  margin: 0 7px;
  color: var(--faint);
}

.reading-note {
  margin-top: 12px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--ink-2);
}

/* 어휘 */
.vocab-tools {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: -4px 0 4px;
}

.vocab-hint {
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
}

.toggle-btn {
  appearance: none;
  flex: none;
  background: none;
  border: 0;
  padding: 2px 0;
  font-size: 0.76rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--ink);
}

.vpage { margin-top: 24px; }

.vpage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.vpage-head .p {
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.vpage-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.vitem { border-bottom: 1px solid var(--line); }
.vitem:last-child { border-bottom: 0; }

.vitem-head {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: none;
  border: 0;
  padding: 12px 0;
  text-align: left;
  cursor: pointer;
}

.vitem-head .w {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.5;
  color: var(--ink);
}

.vitem-head .pos {
  flex: none;
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.vitem-head .peek {
  margin-left: auto;
  flex: none;
  font-size: 0.7rem;
  color: var(--faint);
}

.vitem.open .vitem-head .peek { visibility: hidden; }

.vitem-body {
  display: none;
  padding: 0 0 14px;
}

.vitem.open .vitem-body { display: block; }

.vitem-body .ko {
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.vitem-body .note {
  margin-top: 5px;
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--muted);
}

/* 질문 */
.q {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.q:first-of-type { border-top: 0; padding-top: 0; }

.q-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.q-no {
  flex: none;
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.q-label {
  display: block;
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--ink);
}

.q-hint {
  margin: 4px 0 12px;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--muted);
}

/* 읽기 전 질문만 있는 날(Day 0)의 짧은 리드 */
.q-lead {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--ink-2);
}

textarea {
  display: block;
  width: 100%;
  min-height: 116px;
  padding: 13px 15px;
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.8;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  resize: vertical;
}

textarea:focus { outline: none; border-color: var(--ink); }

.q-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-height: 1.25em;
  margin-top: 7px;
}

.q-foot .line-btn {
  padding: 5px 11px;
  font-size: 0.75rem;
}

.save-state {
  margin-right: auto;
  font-size: 0.71rem;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.save-state.on { opacity: 1; }

/* 저장한 답 보기 상태 */
.saved-answer {
  padding: 2px 0 2px 13px;
  border-left: 2px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.print-answer { display: none; }

.print-head, .print-foot { display: none; }

/* 돌아보기 */
.review-lead {
  font-size: 0.94rem;
  line-height: 1.9;
  color: var(--ink-2);
}

.review-choices {
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--muted);
}

.review-choices b { font-weight: 400; color: var(--faint); }

.review-field { margin-top: 26px; }
.review-field:first-of-type { margin-top: 22px; }

.review-field .rf-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}

/* 관련 콘텐츠 */
.related-lead {
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--muted);
}

.related-warn {
  color: var(--ink-2);
}

.related-list {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.related-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.related-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.related-link {
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.related-meta {
  flex: none;
  font-size: 0.76rem;
  color: var(--muted);
}

.related-note {
  margin-top: 6px;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.related-spoiler summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--ink-2);
  padding: 2px 0;
}

.related-spoiler[open] summary {
  margin-bottom: 12px;
}

/* 일차 이동 */
.day-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 34px 0 8px;
  border-top: 1px solid var(--line);
}

.nav-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 0.82rem;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}

.nav-btn:hover { color: var(--ink); }
.nav-btn span { display: block; font-size: 0.71rem; color: var(--faint); }
.nav-btn[disabled] { color: #d4d4d8; cursor: default; }
.nav-btn.next { text-align: right; margin-left: auto; }

/* 잠금 */
.locked-view {
  max-width: 720px;
  padding: 64px 0 80px;
}

.locked-view .lock-kicker {
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.locked-view h2 {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  margin-top: 12px;
  line-height: 1.4;
}

.locked-view p {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 46ch;
}

.locked-view .lock-note {
  font-size: 0.84rem;
  color: var(--faint);
}

.locked-actions { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 독서노트 뷰 ───────────────────────────────────── */

.notes { max-width: 760px; padding: 42px 0 40px; }

.notes h2 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.notes-meta { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

.notes-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 6px;
}

.notes-note { font-size: 0.74rem; color: var(--faint); margin-top: 8px; }

.note-day {
  border-top: 1px solid var(--line);
  padding: 28px 0 6px;
}

.note-day:first-of-type { margin-top: 26px; }

.note-day h3 {
  font-family: var(--serif);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.5;
}

.note-day .nd-meta {
  margin-top: 4px;
  font-size: 0.73rem;
  color: var(--faint);
}

.note-q {
  margin-top: 18px;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.note-a {
  margin-top: 8px;
  padding-left: 13px;
  border-left: 2px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  margin-top: 30px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.empty p { font-size: 0.9rem; color: var(--muted); }
.empty p + p { margin-top: 8px; }

/* ── 푸터 ───────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.connect { max-width: 720px; padding: 38px 0 10px; }

.connect-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.connect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.connect-name { font-size: 0.88rem; color: var(--ink); }
.connect-desc { margin-top: 2px; font-size: 0.77rem; line-height: 1.6; color: var(--muted); }
.status { flex: none; font-size: 0.73rem; color: var(--faint); white-space: nowrap; }

.colophon {
  padding: 26px 0 46px;
  border-top: 1px solid var(--line);
  font-size: 0.71rem;
  line-height: 1.9;
  color: var(--faint);
}

.colophon strong { font-weight: 600; color: var(--muted); }

/* ── 계정 · 기기 간 동기화 ─────────────────────────── */

.head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex: none;
}

.acct { line-height: 1.2; }
.acct-btn { font-size: 0.73rem; letter-spacing: 0.02em; }

.connect-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.acct-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.9);
}

.acct-card {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 22px 22px 20px;
}

.acct-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.acct-head h2 {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.acct-body { margin-top: 14px; }
.acct-lead { font-size: 0.8rem; line-height: 1.7; color: var(--ink-2); }
.acct-lead b { font-weight: 600; }
.acct-google { display: block; width: 100%; text-align: center; margin-top: 16px; padding: 9px 12px; }
.acct-or { margin: 15px 0 12px; font-size: 0.72rem; color: var(--faint); text-align: center; }
.acct-label { display: block; margin-bottom: 6px; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.03em; }

.acct-row { display: flex; gap: 8px; }
.acct-row input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--ink);
  background: var(--bg);
}
.acct-row input:focus { outline: none; border-color: var(--ink); }
.acct-row .line-btn { flex: none; }

.acct-state {
  margin: 16px 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--muted);
}

.acct-msg {
  margin-top: 12px;
  font-size: 0.76rem;
  line-height: 1.65;
  color: var(--ink-2);
  min-height: 1.2em;
}
.acct-msg:empty { display: none; }

/* ── 모바일 ─────────────────────────────────────────── */

@media (max-width: 880px) {
  .wrap { padding: 0 20px; }

  .head-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 26px;
    padding-bottom: 14px;
  }

  .titles h1 { font-size: 1.36rem; }
  body.view-library .titles h1 { font-size: 1.85rem; }
  body.view-library .titles .sub { font-size: 0.78rem; }
  .notice { text-align: left; }
  .head-side { align-items: flex-start; gap: 4px; }

  .connect-row { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .connect-side { width: 100%; justify-content: space-between; }

  .acct-panel { align-items: flex-start; padding: 16px 14px; }
  .acct-card { max-height: calc(100vh - 32px); padding: 18px 16px 16px; }

  .head-bar { gap: 12px; padding-bottom: 12px; }
  .mode-tabs { width: 100%; gap: 18px; }
  .mode-tabs button { font-size: 0.8rem; }
  .progress { flex: 1 1 100%; order: 1; padding-bottom: 4px; }
  .head-actions { order: 2; flex: 1 1 100%; margin-left: 0; padding: 6px 0 0; }
  .head-actions .line-btn { flex: 1 1 0; text-align: center; padding: 9px 10px; font-size: 0.76rem; }

  .pace-fields { gap: 14px; }
  .vocab-tools { flex-direction: column; align-items: flex-start; gap: 10px; }
  .vocab-tools .toggle-btn { align-self: flex-start; }
  .date-input, .select-input { min-width: 0; width: 100%; }

  .layout { grid-template-columns: 1fr; }
  #main { padding-left: 0; }
  .sidebar { display: none; }

  .mobile-toc {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
    margin-top: 0;
  }

  .mobile-toc summary {
    cursor: pointer;
    font-size: 0.82rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
  }

  .mobile-toc summary::-webkit-details-marker { display: none; }
  .mobile-toc summary::after {
    content: "▾";
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.1;
    transition: transform 0.15s ease;
  }
  .mobile-toc[open] summary::after { content: "▴"; }
  .mt-count { color: var(--faint); font-size: 0.74rem; margin-left: 6px; margin-right: auto; }
  .mobile-toc nav { padding-top: 14px; }

  .day { padding: 30px 0 20px; }
  .day h2 { font-size: 1.62rem; }
  .day-kicker { margin-bottom: 9px; }

  .block { padding: 26px 0; }
  .vitem-head .w { font-size: 1rem; }
  .notes h2 { font-size: 1.55rem; }
  .day-nav { gap: 10px; }
}

/* ── 인쇄 / PDF ─────────────────────────────────────── */

.print-only { display: none; }

@media print {
  @page {
    size: A4;
    margin: 18mm 16mm 20mm;
  }

  html, body {
    background: #fff !important;
    color: #000;
  }

  body {
    font-size: 10.2pt;
    line-height: 1.65;
  }

  .site-header,
  .site-footer,
  .acct-panel,
  .sidebar,
  .mobile-toc,
  .day-nav,
  .vocab-tools,
  .head-actions,
  .pace-panel,
  .connect,
  .line-btn,
  .toggle-btn,
  .notes-actions,
  .notes-note,
  .save-state,
  .q-foot,
  .vitem-head .peek,
  .day-rule {
    display: none !important;
  }

  .print-only { display: block; }

  .layout { display: block; }
  .wrap { max-width: none; padding: 0; margin: 0; }

  #main { display: block; padding-left: 0; }

  .day, .notes, .locked-view {
    max-width: none;
    padding: 0;
  }

  .day + .day { break-before: page; }

  .day h2, .notes h2 { font-size: 17pt; }

  .block {
    padding: 12pt 0;
    border-bottom: 1px solid #d9d9d9;
    break-inside: auto;
  }

  .block h3 {
    font-size: 9pt;
    margin-bottom: 8pt;
    break-after: avoid;
  }

  .reading-chapter { font-size: 12pt; }

  /* 어휘는 인쇄에서 항상 펼친 상태 */
  .vitem-body { display: block !important; padding-bottom: 6pt; }
  .vitem-body .ko { font-size: 9.6pt; }
  .vitem-body .note { font-size: 8.8pt; color: #333; }
  .vitem { break-inside: avoid; }
  .vitem-head { padding: 5pt 0 2pt; cursor: default; }
  .vitem-head .w { font-size: 10.4pt; }
  .vitem-head .pos { font-size: 8pt; }

  .vpage-head { break-after: avoid; }
  .vpage-head::after { background: #d9d9d9; }

  /* 답변은 textarea 대신 인쇄용 미러를 사용 */
  textarea { display: none !important; }

  .saved-answer { display: none !important; }

  .print-answer {
    display: block !important;
    white-space: pre-wrap;
    font-size: 9.6pt;
    line-height: 1.8;
    padding: 6pt 0 2pt;
    min-height: 0;
    overflow-wrap: anywhere;
  }

  .print-answer:empty {
    min-height: 40pt;
    border-bottom: 1px solid #e2e2e2;
  }

  .q { break-inside: avoid; padding: 10pt 0; border-top: 1px solid #d9d9d9; }
  .q-label { font-size: 10.6pt; }
  .q-hint { font-size: 8.6pt; color: #555; }

  .blank-lines {
    display: block !important;
    height: 44pt;
    border-bottom: 1px solid #e2e2e2;
  }

  .notes-actions, .notes-meta { display: none !important; }
  .note-day { break-inside: avoid; }

  a { color: #000; text-decoration: none; }

  /* 인쇄 머리글 */
  .print-head {
    display: block;
    border-bottom: 1.5px solid #000;
    padding-bottom: 6pt;
    margin-bottom: 14pt;
  }

  .print-head .ph-title {
    font-family: var(--serif);
    font-size: 13pt;
    font-weight: 600;
  }

  .print-head .ph-meta {
    margin-top: 2pt;
    font-size: 8pt;
    color: #444;
  }

  .print-foot {
    display: block;
    margin-top: 14pt;
    padding-top: 6pt;
    border-top: 1px solid #d9d9d9;
    font-size: 7.6pt;
    color: #666;
  }

  /* 전체 인쇄(PDF 패키지) 모드 */
  body.printing-all .app { display: none !important; }
  body.printing-all #printAll { display: block !important; }
}

#printAll { display: none; }

#printAll .pa-cover {
  border-bottom: 2px solid #000;
  padding-bottom: 22pt;
  margin-bottom: 26pt;
}

#printAll .pa-cover h1 {
  font-family: var(--serif);
  font-size: 24pt;
  font-weight: 600;
  line-height: 1.3;
}

#printAll .pa-cover .pa-sub { margin-top: 6pt; font-size: 10pt; color: #444; }
#printAll .pa-cover .pa-notice { margin-top: 12pt; font-size: 8.5pt; color: #666; }

#printAll .pa-day { break-before: page; }

#printAll .pa-howto {
  margin-top: 14pt;
  font-size: 9pt;
  line-height: 1.75;
  color: #333;
  max-width: 120mm;
}

#printAll .pa-schedule {
  margin-top: 18pt;
  padding-top: 10pt;
  border-top: 1px solid #000;
}

#printAll .pa-sched-title {
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 6pt;
}

#printAll .pa-sched-cols { column-count: 2; column-gap: 24pt; }

#printAll .pa-sched-group { break-inside: avoid; margin-bottom: 7pt; }

#printAll .pa-sched-week {
  font-size: 8pt;
  color: #666;
  margin-top: 8pt;
  break-after: avoid;
}

#printAll .pa-sched-cols .pa-sched-week:first-child { margin-top: 0; }

#printAll .pa-sched-item {
  font-size: 8.6pt;
  line-height: 1.65;
  color: #222;
  break-inside: avoid;
}

#printAll .pa-sched-item b { font-weight: 600; }

#printAll .pa-scope { color: #444; }

#printAll .pa-day-kicker { font-size: 8.5pt; color: #555; letter-spacing: 0.05em; }

#printAll .pa-day h2 {
  font-family: var(--serif);
  font-size: 17pt;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 4pt;
}

#printAll .pa-day .pa-meta { margin-top: 4pt; font-size: 8.5pt; color: #555; }

#printAll .pa-section { margin-top: 11pt; }

#printAll .pa-section h3 {
  font-size: 9pt;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #000;
  padding-bottom: 3pt;
  margin-bottom: 8pt;
}

#printAll .pa-vpage { margin-top: 8pt; font-size: 8pt; color: #666; }
#printAll .pa-vitem { padding: 3pt 0; border-bottom: 1px solid #ededed; break-inside: avoid; }
#printAll .pa-vitem .pa-v-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5pt; }
#printAll .pa-vitem .w { font-family: var(--serif); font-size: 10pt; }
#printAll .pa-vitem .pos { font-size: 7.6pt; color: #666; }
#printAll .pa-vitem .pa-dash { font-size: 8pt; color: #bbb; }
#printAll .pa-vitem .ko { font-size: 9.2pt; }
#printAll .pa-vitem .note { font-size: 8.1pt; color: #555; line-height: 1.6; }

#printAll .pa-q { margin-top: 8pt; break-inside: avoid; }
#printAll .pa-q .pa-q-label { font-size: 10pt; line-height: 1.6; }
#printAll .pa-q .pa-q-hint { font-size: 8.2pt; color: #666; margin-top: 2pt; }
#printAll .pa-q .pa-lines { margin-top: 6pt; }
#printAll .pa-q .pa-answer {
  margin-top: 6pt;
  padding: 4pt 0;
  border-bottom: 1px solid #d9d9d9;
  font-size: 9.4pt;
  white-space: pre-wrap;
  min-height: 12pt;
}

#printAll .pa-q .pa-answer.blank {
  height: 30pt;
  border-bottom: 1px solid #d9d9d9;
}

#printAll .pa-section p {
  font-size: 9.4pt;
  line-height: 1.7;
}

/* ── 서재 구조 (두 권) ──────────────────────────────── */

.head-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.book-nav {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.78rem;
  flex-wrap: wrap;
  min-width: 0;
}

.text-btn {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.text-btn:hover { color: var(--ink); border-bottom-color: var(--ink); }

.book-sep { color: var(--faint); }

.book-switch { display: flex; gap: 6px 18px; flex-wrap: wrap; min-width: 0; }

.book-switch button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.book-switch button:hover { color: var(--ink); }

.book-switch button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

body.view-library .layout,
body.view-notes .layout {
  grid-template-columns: minmax(0, 1fr);
}

body.view-library .sidebar,
body.view-notes .sidebar { display: none; }

body.view-library #main,
body.view-notes #main { padding-left: 0; }

body.view-library .mobile-toc,
body.view-notes .mobile-toc { display: none; }

/* 서재 화면 */

.library {
  max-width: 760px;
  padding: 32px 0 56px;
}

.library h2 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

/* 서재 소제목: 본문 돋움 계열의 작은 머리말 */
.library .shelf-heading {
  margin: 4px 0 16px;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: var(--ink);
}

.shelf {
  margin-top: 0;
  border-top: 1px solid var(--line);
}

.shelf-item {
  display: block;
  padding: 28px 0 26px;
  border-bottom: 1px solid var(--line);
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shelf-head .shelf-title {
  flex: 1 1 auto;
  min-width: 0;
}

.shelf-btn {
  flex: none;
  min-width: 0;
  padding: 12px 13px;
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  border-radius: 1px;
}

.shelf-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.shelf-meta {
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.shelf-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 20px;
  margin-top: 18px;
}

.shelf-progress {
  margin-top: 0;
  font-size: 0.74rem;
  color: var(--faint);
}

.shelf-bar {
  grid-column: 1 / -1;
  margin-top: 3px;
  height: 2px;
  max-width: 260px;
  background: var(--line);
  overflow: hidden;
}

.shelf-bar i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.shelf-next {
  margin-top: 0;
  font-size: 0.71rem;
  line-height: 1.55;
  color: var(--faint);
  text-align: right;
}

.library-note {
  margin-top: 26px;
  font-size: 0.72rem;
  color: var(--faint);
}

/* 독서노트 범위 */

.notes-scope {
  display: flex;
  gap: 20px;
  margin-top: 18px;
}

.notes-scope button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 3px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.notes-scope button:hover { color: var(--ink); }

.notes-scope button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.book-group { margin-top: 42px; }

.book-group-title {
  padding-bottom: 9px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: 1.24rem;
  font-weight: 600;
  line-height: 1.4;
}

.book-group-title span {
  margin-left: 10px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}

.book-group .note-day:first-of-type { margin-top: 0; }

@media (max-width: 880px) {
  .head-left { width: 100%; gap: 10px; }
  .book-nav { flex-direction: column; align-items: flex-start; gap: 8px; }
  .book-sep { display: none; }
  .book-switch { gap: 6px 12px; flex-wrap: wrap; }
  .book-switch button { font-size: 0.76rem; }

  .library { padding: 24px 0 40px; }
  .library h2 { font-size: 1.55rem; }
  .library .shelf-heading { margin: 2px 0 14px; font-size: 0.92rem; }

  .shelf-item { padding: 24px 0 22px; }

  .shelf-head {
    align-items: center;
    gap: 12px;
  }

  .shelf-title { font-size: 1.28rem; }

  .shelf-btn {
    min-width: 0;
    padding: 10px 12px;
  }

  .shelf-foot {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .shelf-next { text-align: left; }
  .shelf-bar { max-width: none; }

  .notes-scope { gap: 16px; }
}

@media print {
  .book-nav,
  .book-switch,
  .notes-scope,
  .shelf-btn,
  .shelf-bar,
  .library-note { display: none !important; }

  .library { max-width: none; padding: 0; }
  .shelf-item { break-inside: avoid; padding: 10pt 0; }
  .shelf-progress { margin-top: 6pt; }
  .book-group { break-before: auto; }
  .book-group-title { break-after: avoid; }
}
