/* ============================================================
   style.css — 어사문 한자 따라쓰기 활동지
   디자인: 어사문 유자컨셉 (레몬 · 초록 · 크림 컬러 시스템)
   벤치마킹: teacher/TracingLetters/style.css
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Gaegu&family=Nanum+Pen+Script&display=swap');

/* ── 어사문 유자 디자인 토큰 ── */
:root {
  /* Primary — 레몬 */
  --color-yuja-lemon: #FFE135;
  --color-yuja-lemon-amber: #F5C800;
  --color-yuja-lemon-tint: #FEFCE8;

  /* Secondary — 초록 */
  --color-yuja-forest: #142814;
  --color-yuja-forest-mid: #1E3D1E;
  --color-leaf-green: #4CAA48;
  --color-leaf-green-mid: #388E3C;
  --color-leaf-green-deep: #2D7A29;
  --color-leaf-green-light: #B8E0B5;
  --color-leaf-green-tint: #E8F5E7;

  /* Canvas */
  --color-canvas: #FFFFFF;
  --color-canvas-cream: #F7F6F3;
  --color-surface: #F1F0EE;
  --color-hairline: #E8E7E4;
  --color-hairline-strong: #D3D1CB;

  /* Text */
  --color-ink-deep: #1A1A1A;
  --color-ink: #37352F;
  --color-charcoal: #4B4945;
  --color-slate: #6F6E69;
  --color-steel: #9B9A97;
  --color-on-dark: #FFFFFF;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: rgba(15, 15, 15, 0.08) 0px 4px 12px 0px;
  --shadow-mockup: rgba(15, 15, 15, 0.18) 0px 20px 40px -8px;

  /* Typography */
  --font-primary: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* 활동지 전용 */
  --hanja-cell-bg: #FFFDE7;      /* 표제한자 대칸 배경 (연노랑) */
  --hanja-cell-border: #4CAA48;  /* 표제한자 대칸 테두리 (초록) */
  --section-label-bg: #E8F5E7;   /* 섹션 레이블 배경 */
  --section-label-color: #2D7A29;/* 섹션 레이블 텍스트 */
  --vocab-header-bg: #FEFCE8;    /* 어휘 블록 헤더 배경 */
}

/* ── 리셋 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 기본 Body ── */
body {
  font-family: var(--font-primary);
  background-color: var(--color-canvas-cream);
  color: var(--color-ink);
  line-height: 1.6;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────
   상단 네비게이션
───────────────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  background-color: var(--color-canvas);
  height: 60px;
  border-bottom: 1px solid var(--color-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-card);
  gap: 12px;
}

/* 돌아가기 아이콘 — 퀴즈 활동지와 같은 자리·크기 (2026-10-12) */
.nav-back {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-right: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-charcoal);
  text-decoration: none;
  transition: background-color 120ms ease;
}
.nav-back:hover { background: var(--color-surface); }

.nav-brand {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-ink-deep);
  white-space: nowrap;
}

.nav-brand .nav-logo {
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-brand .nav-logo img {
  width: 20px;
  height: 20px;
  display: block;
}

/* 인쇄 버튼 — 퀴즈 활동지(.yj-btn--primary.yj-btn--sm)와 같은 모양 (2026-10-13)
   ⚠ 두 화면이 같은 값이어야 한다. 한쪽을 고치면 quizsheet/style.css 의 #qs-print 도 같이. */
.nav-print {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #F5C800 0%, #F08C1E 100%);
  color: #16181A;
  box-shadow: 0 3px 10px rgba(240, 140, 30, .30);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}
.nav-print:hover { filter: brightness(.96); }
.nav-print:active { transform: scale(.97); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────
   앱 레이아웃 (설정 패널 + 미리보기)
───────────────────────────────────────────────────────── */
.app-container {
  display: flex;
  flex: 1;
  width: 100vw;
  max-width: 100%;
  height: calc(100vh - 60px);
  margin: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

/* 넓은 화면 — 본문을 화면 높이에 묶어 좌측 설정과 우측 미리보기가 **따로** 스크롤되게 (2026-10-12)
   ⚠ 위 flex: 1 1 0% 는 body(min-height) 안에서 내용 높이만큼 늘어나 문서 전체가 스크롤됐다. */
@media (min-width: 1101px) {
  .app-container {
    flex: 0 0 auto;
    height: calc(100dvh - 60px);
  }
}

/* ── 설정 패널 (좌측 사이드바) ── */
.settings-panel {
  width: 380px;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  background-color: var(--color-canvas);
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--color-hairline);
  padding: 20px 18px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}

/* 섹션 탭 내비게이션 */
.section-nav {
  display: flex;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.section-btn {
  flex: 1;
  padding: 7px 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-charcoal);
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.section-btn.active {
  background-color: var(--color-canvas);
  color: var(--color-ink-deep);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.settings-content { flex: 1; }

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── 폼 요소 ── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-between {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-charcoal);
}

.form-input, .form-select, .form-textarea {
  background-color: var(--color-canvas);
  color: var(--color-ink);
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 150ms ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-yuja-lemon-amber);
  box-shadow: 0 0 0 3px rgba(245, 200, 0, 0.15);
}

.w-auto { width: auto; }
.text-center { text-align: center; }

/* 한자 선택 전용 */
.hanja-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hanja-selector .vol-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  cursor: pointer;
  transition: all 150ms ease;
  flex-shrink: 0;
}

.hanja-selector .vol-nav-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-leaf-green);
}

.hanja-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-yuja-lemon-tint);
  border: 1px solid var(--color-yuja-lemon-amber);
  border-radius: var(--radius-md);
  min-height: 48px;
}

.hanja-preview-card .hanja-char {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-ink-deep);
  line-height: 1;
}

.hanja-preview-card .hanja-info {
  font-size: 13px;
  color: var(--color-charcoal);
  line-height: 1.4;
}

.hanja-preview-card .hanja-id {
  font-size: 11px;
  color: var(--color-steel);
}

/* 검색 영역 */
.search-row {
  display: flex;
  gap: 6px;
}

.search-row .form-input { flex: 1; }

.search-results {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: var(--color-canvas);
  display: none;
}

.search-result-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 100ms ease;
  border-bottom: 1px solid var(--color-hairline);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--color-surface); }
.search-result-item .sr-hanja { font-size: 18px; font-weight: 700; width: 28px; }
.search-result-item .sr-info { color: var(--color-charcoal); }
.search-result-item .sr-id { color: var(--color-steel); font-size: 11px; }

/* 버튼 그룹 */
.btn-group {
  display: flex;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.btn-group .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  color: var(--color-charcoal);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  font-weight: 500;
}

.btn-group .btn.active {
  background-color: var(--color-canvas);
  color: var(--color-ink-deep);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.btn-group .btn:hover:not(.active) {
  background: rgba(0,0,0,0.04);
}

/* 숫자 컨트롤 */
.number-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-ghost {
  background: transparent;
  color: var(--color-slate);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background 150ms ease;
  font-weight: 600;
}

.btn-ghost:hover { background-color: var(--color-surface); }

/* 토글 스위치 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--color-hairline-strong);
  transition: .2s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider { background-color: var(--color-leaf-green); }
input:checked + .slider:before { transform: translateX(18px); }

/* 범위 슬라이더 */
.form-range {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--color-hairline-strong);
  outline: none;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--color-yuja-lemon-amber);
  cursor: pointer;
}

.text-caption-bold { font-size: 12px; font-weight: 700; }
.text-slate { color: var(--color-slate); }

/* 기본 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 150ms ease;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-md);
  gap: 6px;
  white-space: nowrap;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--color-yuja-lemon-amber);
  color: #FFFFFF;
  font-size: 14px;
  padding: 10px 20px;
  height: 42px;
}

.btn-primary:hover { background: #e0b300; }

.btn-secondary {
  background: transparent;
  color: var(--color-ink);
  border: 1px solid var(--color-hairline-strong);
  font-size: 13px;
  padding: 8px 16px;
  height: 38px;
}

.btn-secondary:hover { background: var(--color-surface); }

.btn-outline {
  background: transparent;
  color: var(--color-leaf-green-deep);
  border: 1px solid var(--color-leaf-green);
  font-size: 13px;
  padding: 8px 16px;
  height: 38px;
}

.btn-outline:hover {
  background: var(--color-leaf-green-tint);
}

.btn-sm { font-size: 12px; padding: 5px 10px; height: 28px; }

/* ── 미리보기 영역 (우측) ── */
.preview-region {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  min-width: 0;
  position: relative;
  background-color: #F0EFEA;
  padding: 16px 20px 40px;
}

/* ── 확대 / 축소 툴바 (2026-09-26 추가) ── */
.zoom-toolbar {
  position: sticky;
  top: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-hairline);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.zoom-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-charcoal);
  cursor: pointer;
  transition: all 120ms ease;
  font-family: inherit;
}

.zoom-btn:hover {
  background: var(--color-surface);
  color: var(--color-ink-deep);
}

.zoom-btn-reset {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
}

.zoom-level {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-slate);
  min-width: 44px;
  text-align: center;
  user-select: none;
}

.preview-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
  width: 100%;
}

.preview-scale-wrapper {
  display: flex;
  flex-direction: column;
  gap: 28px;
  justify-content: flex-start;
  align-items: center;
  transform-origin: top center;
  transition: transform 0.15s ease;
  padding-top: 16px;
}

/* A4 페이지 */
.page-container {
  background-color: var(--color-canvas);
  width: 210mm;
  height: 297mm;
  max-width: 210mm;
  max-height: 297mm;
  box-sizing: border-box;
  box-shadow: var(--shadow-mockup);
  padding: 12mm 14mm 12mm;
  border: 1px solid var(--color-hairline);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-container.landscape {
  width: 297mm;
  height: 210mm;
  max-width: 297mm;
  max-height: 210mm;
  aspect-ratio: 297 / 210;
}

/* 페이지 삭제 버튼 */
.btn-delete-page {
  position: absolute;
  top: 6mm;
  right: 8mm;
  background-color: var(--color-surface);
  color: var(--color-charcoal);
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.page-container:hover .btn-delete-page { opacity: 1; }
.btn-delete-page:hover { background: #ffeaea; color: #d32f2f; }

/* ─────────────────────────────────────────────────────────
   활동지 인쇄 헤더
───────────────────────────────────────────────────────── */
.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3mm;
  padding-bottom: 2mm;
  border-bottom: 2px solid var(--color-yuja-lemon-amber);
  flex-shrink: 0;
}

.ws-header__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-header__logo {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ws-header__logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.ws-header__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-ink-deep);
}

.ws-header__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-charcoal);
}

.ws-header__name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--color-ink-deep);
  white-space: nowrap;
}

.ws-header__date { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--color-ink-deep); white-space: nowrap; }
.ws-date-space { display: inline-block; width: 26mm; }

.ws-name-space {
  display: inline-block;
  width: 32mm; /* 이름을 여유롭게 적을 수 있는 충분한 빈 여백 (약 120px) */
  min-width: 100px;
}

/* ─────────────────────────────────────────────────────────
   표제한자 섹션 (훈음 메인 + 한자 서브 + 뜻1~3과 예문 가독성 해설)
───────────────────────────────────────────────────────── */
.ws-hanja-section {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 3.5mm;
  margin-bottom: 2.5mm;
  padding: 2.2mm 3.2mm;
  background: #FAFDF9;
  border: 1px solid var(--color-leaf-green-light);
  border-radius: 6px;
  flex-shrink: 0;
}

/* 좌측 단: 상단 [권연번 + 한자], 하단 [한자훈음 매우 크게 (복수 시 줄바꿈)] */
.ws-hanja-col-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-right: 3.5mm;
  border-right: 1px solid rgba(76, 170, 72, 0.25);
  flex-shrink: 0;
  width: 145px;
  min-width: 135px;
  max-width: 165px;
}

/* 우측 단: 뜻 목록 */
.ws-hanja-col-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 상단 행: 권연번(좌) + 한자(우) */
.ws-hanja-top-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.ws-hanja-vol-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-leaf-green-mid);
  line-height: 1;
}

/* 한자는 권연번 우측에 작고 덜 중요하게 배치 */
.ws-hanja-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-slate);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.15;
}

/* 하단 한자훈음 컨테이너 */
.ws-huneum-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.ws-huneum-item {
  font-weight: 800;
  color: var(--color-leaf-green-deep);
  letter-spacing: -0.02em;
  word-break: keep-all;
}

/* 훈음이 1개일 때: 매우 크고 또렷하게 (기존 22px -> 26px) */
.ws-huneum-container.count-1 .ws-huneum-item {
  font-size: 26px;
  line-height: 1.12;
}

/* 훈음이 2개일 때: 2줄로 정갈하게 배치 */
.ws-huneum-container.count-2 .ws-huneum-item {
  font-size: 18px;
  line-height: 1.25;
}

/* 훈음이 3개 이상일 때: 3줄로 깔끔하게 배치 */
.ws-huneum-container.count-3 .ws-huneum-item {
  font-size: 14.5px;
  line-height: 1.22;
}

.ws-meanings-list {
  display: flex;
  flex-direction: column;
  gap: 1.2mm;
}

.ws-meaning-item {
  font-size: 10.5px;
  line-height: 1.35;
}

.ws-meaning-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.ws-meaning-num {
  font-weight: 700;
  color: var(--color-leaf-green-mid);
  flex-shrink: 0;
}

.ws-meaning-tit {
  font-weight: 700;
  color: var(--color-ink-deep);
  flex-shrink: 0;
}

.ws-meaning-sep {
  color: var(--color-steel);
  flex-shrink: 0;
}

.ws-meaning-def {
  color: var(--color-charcoal);
}

.ws-meaning-ex {
  padding-left: 14px;
  font-size: 9.5px;
  color: var(--color-slate);
  margin-top: 0.3mm;
}

/* 우측 단: QR코드 박스 (좌우 너비 확장 및 QR 크기 최대화) */
.ws-hanja-col-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  min-width: 86px;
  padding-left: 3mm;
  border-left: 1px solid rgba(76, 170, 72, 0.25);
  flex-shrink: 0;
  box-sizing: border-box;
}

.ws-hanja-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 100%;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}

.ws-hanja-qr-frame {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 5px;
  border: 1px solid var(--color-hairline);
  padding: 1.5px;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 2px;
}

.ws-hanja-qr-frame svg,
.ws-hanja-qr-frame img,
.ws-hanja-qr-img {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: crispEdges;
}

/* QR 라이브러리를 못 실었을 때 — 키 없는 주소를 글자로(PNG 폴백 철수 · 2026-10-11) */
.ws-hanja-qr-url {
  font-size: 7px;
  line-height: 1.2;
  word-break: break-all;
  color: var(--color-slate);
}

.ws-hanja-qr-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--color-leaf-green-deep);
  letter-spacing: -0.03em;
  white-space: nowrap;
  line-height: 1;
  margin: 0;
  padding: 0;
}

/* ─────────────────────────────────────────────────────────
   학습어휘 설명 섹션 (표제한자 아래에 모아보기)
   순서: 번호.어휘 / [구성한자] / 풀이 / 구분 / 뜻
───────────────────────────────────────────────────────── */
.ws-vocabs-summary-section {
  display: flex;
  flex-direction: column;
  gap: 1.2mm;
  margin-bottom: 2.5mm;
  padding: 2mm 3mm;
  background: #FAF9F5;
  border-left: 3.5px solid var(--color-yuja-lemon-amber);
  border-top: 1px solid rgba(230, 220, 200, 0.7);
  border-right: 1px solid rgba(230, 220, 200, 0.7);
  border-bottom: 1px solid rgba(230, 220, 200, 0.7);
  border-radius: 4px;
  flex-shrink: 0;
}

.ws-vocab-summary-item {
  font-size: 10px;
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
}

.ws-vsum-title {
  font-weight: 800;
  color: var(--color-ink-deep);
}

.ws-vsum-comp {
  font-weight: 700;
  color: var(--color-leaf-green-deep);
}

.ws-vsum-anal {
  color: var(--color-charcoal);
}

.ws-vsum-bar {
  color: #CBD5E1;
  font-weight: 300;
  font-size: 9px;
  margin: 0 3px;
  user-select: none;
}

.ws-vsum-def {
  color: var(--color-slate);
}

/* ─────────────────────────────────────────────────────────
   '나의 문장' 섹션 (칸이 남을 때)
───────────────────────────────────────────────────────── */
.ws-mysentence-block {
  margin-top: 2.5mm;
}

.ws-mysentence-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-leaf-green-deep);
  margin-bottom: 1mm;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─────────────────────────────────────────────────────────
   격자 따라쓰기
───────────────────────────────────────────────────────── */
.ws-grid-label {
  display: none !important; /* 영역 제목 제거 (요구사항 7) */
}

.ws-grid-row {
  display: flex;
  margin-bottom: 0;
  padding-left: 1px; /* 좌측 테두리 잘림 방지 */
}

.ws-grid-row + .ws-grid-row {
  margin-top: 0;
}

.ws-char-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-hairline-strong);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin-left: -1px;
  margin-top: -1px;
  flex: 1 1 0;
  min-width: 0;
}

.ws-char-cell:first-child {
  margin-left: 0; /* 첫 번째 칸 좌측 테두리 음수 마진 방지 */
}

/* 숫자 입력칸 증감 스핀 버튼 숨김 (숫자 잘림 방지) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* 중심선 가이드 */
.ws-char-cell.guide-center::before,
.ws-char-cell.guide-center::after {
  content: '';
  position: absolute;
  background: rgba(200, 200, 200, 0.5);
  z-index: 1;
}

.ws-char-cell.guide-center::before {
  top: 50%; left: 0; right: 0; height: 1px;
}

.ws-char-cell.guide-center::after {
  left: 50%; top: 0; bottom: 0; width: 1px;
}

/* 십자 가이드 (사선 포함) */
.ws-char-cell.guide-cross::before,
.ws-char-cell.guide-cross::after {
  content: '';
  position: absolute;
  background: rgba(200, 200, 200, 0.5);
  z-index: 1;
}

.ws-char-cell.guide-cross::before {
  top: 50%; left: 0; right: 0; height: 1px;
}

.ws-char-cell.guide-cross::after {
  left: 50%; top: 0; bottom: 0; width: 1px;
}

.ws-char-cell.guide-cross {
  background-image:
    linear-gradient(to bottom right, transparent 48%, rgba(200,200,200,0.4) 49%, rgba(200,200,200,0.4) 51%, transparent 52%),
    linear-gradient(to top right, transparent 48%, rgba(200,200,200,0.4) 49%, rgba(200,200,200,0.4) 51%, transparent 52%);
}

/* 원형 가이드 */
.ws-char-cell.guide-circle::before {
  content: '';
  position: absolute;
  top: 8%; left: 8%; right: 8%; bottom: 8%;
  border: 1px dashed var(--color-hairline-strong);
  border-radius: 50%;
  z-index: 1;
}

/* 빈 연습칸 스타일 */
.ws-char-cell.practice-cell {
  background: #FCFCFA;
}

.ws-char-text {
  position: relative;
  z-index: 2;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ws-char-text.tracing {
  color: #555;
  opacity: 0.28;
}

/* 마침표 및 쉼표 좌하단 배치 (원고지 표기법: 큰 네모의 좌하단, 그 작은 네모 안의 좌하단) */
.ws-char-cell.punct-period .ws-char-text {
  position: absolute;
  left: 7%;
  bottom: 8%;
  line-height: 1;
}

/* 연습줄 간격 */
.ws-practice-gap {
  display: block;
}

/* ─────────────────────────────────────────────────────────
   예문 블록
───────────────────────────────────────────────────────── */
.ws-example-block {
  margin-bottom: 2mm;
}

.ws-example-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1mm;
}

.ws-example-vocab-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-leaf-green-deep);
  background: var(--color-leaf-green-tint);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-leaf-green-light);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   밑줄형 레이아웃
───────────────────────────────────────────────────────── */
.ws-line-row {
  display: flex;
  flex-wrap: wrap;
}

.ws-line-row .ws-char-cell {
  border: none;
  border-bottom: 1px solid var(--color-hairline-strong);
  aspect-ratio: auto;
  height: auto;
  padding-bottom: 2px;
}

/* ─────────────────────────────────────────────────────────
   채우기 전략 블록
───────────────────────────────────────────────────────── */
.ws-fill-block {
  margin-top: 2mm;
  padding: 2mm 3mm;
  border: 1px dashed var(--color-hairline-strong);
  border-radius: var(--radius-sm);
  background: #FAFAF8;
}

.ws-fill-label {
  font-size: 9px;
  color: var(--color-steel);
  font-weight: 600;
  margin-bottom: 1mm;
  letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────────────────
   활동지 푸터
───────────────────────────────────────────────────────── */
.ws-footer {
  margin-top: auto;
  padding-top: 2.5mm;
  border-top: 1px solid var(--color-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ws-footer__brand {
  font-size: 9px;
  color: var(--color-steel);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ws-footer__brand span {
  color: var(--color-leaf-green-mid);
  font-weight: 700;
}

.ws-footer__page {
  font-size: 9px;
  color: var(--color-steel);
}

/* 렌더 영역 */
.render-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  margin-bottom: 3.5mm; /* 푸터와의 넉넉한 분리 여백 확보 */
}

/* ─────────────────────────────────────────────────────────
   로딩 상태
───────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247,246,243,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 12px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-hairline);
  border-top-color: var(--color-yuja-lemon-amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-slate);
}

/* ─────────────────────────────────────────────────────────
   반응형
───────────────────────────────────────────────────────── */
/* 컴퓨터 권장 안내 — 좁은 화면에서만 (2026-10-11) */
.pc-note { display: none; }

@media (max-width: 1100px) {
  /* 문서 전체가 스크롤되면 보기 막대가 상단바 밑으로 숨지 않게 그 아래에 멈춘다(2026-10-13) */
  .yjpv { top: 68px; }
  .pc-note {
    display: block;
    padding: 12px 16px;
    background: var(--color-yuja-lemon-tint);
    border-bottom: 1px solid var(--color-hairline);
    color: var(--color-ink-deep);
    font-size: 13px;
    line-height: 1.5;
    word-break: keep-all;
    /* 이 페이지는 좁은 화면에서 본문이 화면보다 넓어진다(기존) — 안내만큼은 화면 폭 안에 */
    max-width: 100vw;
    box-sizing: border-box;
    position: sticky;
    left: 0;
  }

  .app-container {
    flex-direction: column;
  }

  .settings-panel {
    width: 100%;
    position: static;
    height: auto;
    max-height: 500px;
  }
}

/* ─────────────────────────────────────────────────────────
   스크롤바
───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-hairline-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-steel); }

/* ─────────────────────────────────────────────────────────
   인쇄 전용 (@media print)
───────────────────────────────────────────────────────── */
@media print {
  html, body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  .top-nav,
  .settings-panel,
  .btn-delete-page,
  #btnAddPage,
  .loading-overlay,
  .zoom-toolbar,
  .no-print,
  .preview-content-wrapper > *:not(.preview-scale-wrapper) {
    display: none !important;
  }

  .app-container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  .preview-region {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    background: white !important;
    background-color: white !important;
  }

  .preview-content-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: block !important;
    background: white !important;
  }

  .preview-scale-wrapper {
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    background: white !important;
  }

  .page-container {
    width: 210mm !important;
    height: 296.5mm !important; /* 297mm에서 0.5mm 여유를 주어 브라우저 서브픽셀 오차로 인한 빈 2번째 페이지 생성 방지 */
    min-height: 0 !important;
    max-width: 210mm !important;
    max-height: 296.5mm !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
    padding: 12mm 14mm 12mm !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: page !important;
    break-after: page !important;
  }

  .page-container:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .page-container.landscape {
    width: 297mm !important;
    height: 209.5mm !important;
    min-height: 0 !important;
    max-width: 297mm !important;
    max-height: 209.5mm !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}
