/* =========================================================
   현대 히브리어 학습 앱 — 마태복음으로 배우는 현대 히브리어
   Design System | main.css
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Serif:ital,wght@0,400;0,600;0,700;1,400&family=Frank+Ruhl+Libre:wght@400;500;700&family=Heebo:wght@300;400;500;700&display=swap');

/* ── CSS 변수 ── */
:root {
  --bg:          #07090f;
  --surface:     #0d1220;
  --surface-2:   #131b2e;
  --surface-3:   #1a243d;
  --border:      #1e2e4a;
  --border-2:    #2a4070;

  --blue:        #4a90d9;
  --blue-light:  #7ab8f5;
  --blue-dark:   #2255a0;
  --blue-glow:   rgba(74,144,217,0.12);

  --teal:        #38bdf8;
  --teal-l:      #7dd3fc;
  --teal-dark:   #0284c7;

  --gold:        #e2b96a;
  --gold-light:  #f5d48a;
  --gold-dark:   #9a7030;

  --text:        #e8f0fe;
  --text-muted:  #8ca8c8;
  --text-dim:    #4e6a8a;
  --text-inv:    #07090f;

  --he-font:     'Frank Ruhl Libre', 'Heebo', serif;
  --font-ui:     'Inter', sans-serif;
  --font-serif:  'Noto Serif', serif;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   20px;
  --radius-xl:   28px;

  --shadow-sm:   0 2px 8px rgba(0,0,0,0.5);
  --shadow:      0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.7);
  --shadow-blue: 0 0 30px rgba(74,144,217,0.18);

  --transition:  all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* iOS: 폰트 크기 자동 조정 방지 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS 터치 최적화 */
a, button, [role="button"], input, select, textarea, label {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-muted); line-height: 1.8; margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--blue-light); }

code, .mono {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.88em;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--teal-l);
}

/* 히브리어 텍스트 */
.he {
  font-family: var(--he-font);
  font-size: 1.3em;
  color: var(--blue-light);
  direction: rtl;
  unicode-bidi: bidi-override;
  letter-spacing: 0.02em;
}
.he-lg {
  font-family: var(--he-font);
  color: var(--blue);
  direction: rtl;
  unicode-bidi: bidi-override;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-dark); }

/* ── Navigation ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 64px;
  background: rgba(7,9,15,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}

.navbar-brand .brand-he {
  font-family: var(--he-font);
  font-size: 1.5rem;
  color: var(--blue-light);
  direction: rtl;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin-left: auto;
}

.navbar-links a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  background: var(--blue-glow);
  color: var(--blue-light);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--blue-light);
  color: var(--text-inv);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(74,144,217,0.4);
}

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue-dark);
}
.btn-outline:hover {
  background: var(--blue-glow);
  border-color: var(--blue);
  color: var(--blue-light);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card-blue {
  border-color: var(--blue-dark);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(74,144,217,0.05) 100%);
}
.card-blue:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-blue);
}

/* ── Module Cards ── */
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  opacity: 0;
  transition: var(--transition);
}
.module-card:hover {
  border-color: var(--blue-dark);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.module-card:hover::before { opacity: 1; }

/* 모듈별 상단 색상 */
.module-card.mod-grammar::before  { background: linear-gradient(90deg, transparent, #4a90d9, transparent); }
.module-card.mod-reader::before   { background: linear-gradient(90deg, transparent, #38bdf8, transparent); }
.module-card.mod-vocab::before    { background: linear-gradient(90deg, transparent, #e2b96a, transparent); }
.module-card.mod-alphabet::before { background: linear-gradient(90deg, transparent, #a78bfa, transparent); }
.module-card.mod-conversation::before { background: linear-gradient(90deg, transparent, #34d399, transparent); }
.module-card.mod-speech::before   { background: linear-gradient(90deg, transparent, #34d399, transparent); }

.module-card .module-icon { font-size: 2.2rem; line-height: 1; }
.module-card .module-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.module-card .module-sub {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}
.module-card .module-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}
.module-card .module-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Progress Bar ── */
.progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Badge / Tag ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-blue   { background: rgba(74,144,217,0.15); color: var(--blue-light); border: 1px solid rgba(74,144,217,0.3); }
.badge-teal   { background: rgba(56,189,248,0.12); color: var(--teal-l);    border: 1px solid rgba(56,189,248,0.25); }
.badge-gold   { background: rgba(226,185,106,0.12); color: var(--gold);     border: 1px solid rgba(226,185,106,0.25); }
.badge-violet { background: rgba(167,139,250,0.12); color: #c4b5fd;         border: 1px solid rgba(167,139,250,0.25); }
.badge-dim    { background: var(--surface-2); color: var(--text-dim);       border: 1px solid var(--border); }

/* ── POS Color Coding (품사 색상) ── */
.pos-noun   { color: #60a5fa; } /* 파랑 */
.pos-verb   { color: #4ade80; } /* 초록 */
.pos-adj    { color: #c084fc; } /* 보라 */
.pos-prep   { color: #f87171; } /* 빨강 */
.pos-pron   { color: #fbbf24; } /* 금 */
.pos-conj   { color: #22d3ee; } /* 청록 */
.pos-num    { color: #fb923c; } /* 주황 */
.pos-adv    { color: #a3e635; } /* 연녹 */
.pos-part   { color: #e879f9; } /* 핑크 */

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.divider-blue {
  border-color: transparent;
  background: linear-gradient(90deg, transparent, var(--blue-dark), transparent);
  height: 1px;
}

/* ── Section ── */
.section { padding: 4rem 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.5rem;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.section-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5rem; }
@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Table ── */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  background: var(--surface-2);
  color: var(--blue);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody td:first-child { color: var(--text); font-weight: 500; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Example Block (히브리어 예문) ── */
.example-block {
  background: var(--surface-2);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.example-he {
  font-family: var(--he-font);
  font-size: 1.3rem;
  color: var(--blue-light);
  direction: rtl;
  text-align: right;
  margin-bottom: 0.4rem;
  line-height: 1.6;
}
.example-trans {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.example-ko {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Chip (문법 태그) ── */
.chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(74,144,217,0.12);
  color: var(--blue-light);
  border: 1px solid rgba(74,144,217,0.22);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Quiz / Flashcard ── */
.quiz-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: var(--transition);
}
.quiz-he {
  font-family: var(--he-font);
  font-size: 3rem;
  color: var(--blue-light);
  direction: rtl;
  margin-bottom: 1rem;
  line-height: 1.3;
}

/* ── Sidebar Layout ── */
.page-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
  margin-top: 64px;
}
.page-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 1rem;
}
.page-content {
  padding: 2rem 2.5rem;
  max-width: 860px;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,144,217,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(74,144,217,0); }
}

.fade-in { animation: fadeInUp 0.5s ease both; }
.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }
.fade-in-delay-4 { animation-delay: 0.4s; }
.fade-in-delay-5 { animation-delay: 0.5s; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-he     { font-family: var(--he-font); direction: rtl; }
.text-blue   { color: var(--blue); }
.text-teal   { color: var(--teal); }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.rtl  { direction: rtl; }

/* ═══════════════════════════════════════════
   검색 오버레이 (전체 모듈 공통)
═══════════════════════════════════════════ */
.search-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.search-btn:hover { border-color: var(--blue-dark); color: var(--blue); background: var(--blue-glow); }
.search-btn .search-kbd {
  padding: 0.1rem 0.35rem;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.search-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.search-overlay.open { display: flex; }
.search-modal {
  background: var(--surface-2);
  border: 1px solid var(--blue-dark);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 640px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.search-input-icon { color: var(--text-dim); font-size: 1.1rem; flex-shrink: 0; }
.search-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 1rem; font-family: var(--font-ui);
}
.search-input::placeholder { color: var(--text-dim); }
.search-close-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 1rem; cursor: pointer; padding: 0.2rem 0.4rem;
  border-radius: 4px; transition: var(--transition);
}
.search-close-btn:hover { background: var(--surface-3); color: var(--text); }
.search-results { max-height: 60vh; overflow-y: auto; padding: 0.5rem 0; }
.search-group-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--blue-dark); text-transform: uppercase;
  padding: 0.6rem 1.25rem 0.3rem;
}
.search-result-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.6rem 1.25rem; cursor: pointer; transition: var(--transition);
  border-bottom: 1px solid rgba(30,46,74,0.5);
  text-decoration: none; color: inherit;
}
.search-result-item:hover { background: var(--blue-glow); }
.search-result-he { font-family: var(--he-font); font-size: 1.3rem; color: var(--blue-light); flex-shrink: 0; min-width: 2.5rem; text-align: right; direction: rtl; }
.search-result-body { flex: 1; }
.search-result-title { font-size: 0.9rem; color: var(--text); margin-bottom: 0.15rem; }
.search-result-title mark { background: rgba(74,144,217,0.2); color: var(--blue-light); border-radius: 2px; padding: 0 2px; }
.search-result-sub { font-size: 0.78rem; color: var(--text-dim); }
.search-result-tag {
  padding: 0.15rem 0.4rem; border-radius: 4px;
  font-size: 0.68rem; font-weight: 600; flex-shrink: 0;
  background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--border);
  align-self: flex-start;
}
.search-empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--text-dim); font-size: 0.9rem; }
.search-hint { padding: 0.8rem 1.25rem; font-size: 0.75rem; color: var(--text-dim); border-top: 1px solid var(--border); display: flex; gap: 1.5rem; }
.search-hint span { display: flex; align-items: center; gap: 0.3rem; }

/* ═══════════════════════════════════════════
   모바일 반응형 (네비게이션 + 햄버거)
═══════════════════════════════════════════ */
.nav-hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm); transition: var(--transition);
  margin-left: auto;
}
.nav-hamburger:hover { background: var(--surface-3); }
.nav-hamburger span { display: block; height: 2px; background: var(--text-muted); border-radius: 2px; transition: var(--transition); }
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-drawer {
  display: none;
  position: fixed; top: 64px; left: 0; right: 0;
  background: rgba(7,9,15,0.97);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 999;
  padding: 1rem 1.5rem;
  flex-direction: column; gap: 0.3rem;
  animation: slideDown 0.2s ease;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 500; color: var(--text-muted);
  transition: var(--transition);
}
.nav-drawer a:hover, .nav-drawer a.active { background: var(--blue-glow); color: var(--blue-light); }

@media (max-width: 768px) {
  .navbar { padding: 0 1rem; gap: 0.75rem; }
  .navbar-links { display: none; }
  .nav-hamburger { display: flex; }
  .section { padding: 2rem 0; }
  .container { padding: 0 1rem; }
  .page-layout { grid-template-columns: 1fr; }
  .page-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .page-content { padding: 1.25rem 1rem; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
  .section-title { font-size: 1.5rem; }
  .btn { min-height: 44px; padding: 0.65rem 1.1rem; font-size: 0.85rem; }
  /* 카드 */
  .card { padding: 1rem; }
  .module-card { padding: 1.25rem; }
  /* 테이블 */
  table { font-size: 0.82rem; }
  thead th, tbody td { padding: 0.5rem 0.65rem; }
}

/* ── iOS 안전영역 대응 ── */
@supports (padding: max(0px)) {
  .navbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .nav-drawer {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ═══════════════════════════════════════════
   공통 모바일 사이드바 드로어 패턴
   각 페이지의 사이드바에 .mobile-sidebar 클래스 추가 시 동작
═══════════════════════════════════════════ */

/* 사이드바 열기 버튼 (모바일에서만 표시) */
.mobile-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: var(--transition);
  min-height: 36px;
}
.mobile-sidebar-toggle:hover { border-color: var(--blue-dark); color: var(--blue); background: var(--blue-glow); }
.mobile-sidebar-toggle svg { flex-shrink: 0; }

/* 모바일 배경 오버레이 */
.mobile-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
  z-index: 150;
}
.mobile-sidebar-backdrop.open { display: block; }

/* 모바일 탑바 (사이드바 있는 페이지용) */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 64px;
  z-index: 80;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1rem;
  align-items: center;
  gap: 0.75rem;
}
.mobile-topbar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .mobile-sidebar-toggle { display: flex; }
  .mobile-topbar { display: flex; }
}

/* ════════════════════════════════════════
   PRINT STYLES — 공통
   ════════════════════════════════════════ */
@media print {
  /* 기본 리셋: 밝은 배경, 어두운 텍스트 */
  *, *::before, *::after {
    background: white !important;
    color: #111 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 히브리어 폰트 유지 */
  .he, [lang="he"], [dir="rtl"] {
    font-family: 'Frank Ruhl Libre', 'David', 'Arial Hebrew', serif !important;
    color: #1a1a2e !important;
  }

  /* 숨길 요소들 */
  .navbar, .nav-drawer, .nav-hamburger,
  .search-btn, .search-overlay,
  button, .btn,
  .footer,
  audio, video,
  [aria-hidden="true"] {
    display: none !important;
  }

  /* 링크 URL 숨기기 */
  a[href]::after { content: none !important; }

  /* 페이지 여백 */
  @page {
    margin: 1.5cm 1.8cm;
    size: A4;
  }

  body { font-size: 11pt; line-height: 1.5; }

  /* 페이지 나누기 */
  h1, h2, h3 { page-break-after: avoid; }
  table { page-break-inside: avoid; }

  /* 테이블 테두리 표시 */
  table, th, td {
    border: 1px solid #bbb !important;
  }
  th { background: #f0f0f0 !important; }
}
