/* ===========================================================
   HTML5 eBook Viewer v4  (viewer.css)
   모든 스타일은 .ebv 컨테이너 아래에만 적용됩니다.
   =========================================================== */
.ebv, .ebv * { box-sizing: border-box; }
.ebv {
  --bg: #f0eee6; --panel: #ffffff; --fg: #333; --muted: #7a7f8a; --menu-fg: #3a3f4a;
  --accent: #2c3e50; --accent2: #3f7cc8; --btn: #ffffff; --btn-fg: #333; --dark: #464646;
  --border: rgba(0,0,0,.08); --hover: rgba(0,0,0,.05); --page-bg: #ffffff; --shadow: rgba(0,0,0,.28);
  position: fixed; inset: 0; z-index: 1000; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 14px; line-height: 1.4; user-select: none; -webkit-user-select: none;
}
.ebv[data-theme="dark"]   { --bg:#2b2d33; --panel:#33363e; --fg:#eef0f4; --muted:#a0a5b1; --menu-fg:#e8eaf0; --accent:#4f8cff; --accent2:#4f8cff; --btn:#3d4049; --btn-fg:#fff; --dark:#1e2026; --border:rgba(255,255,255,.1); --hover:rgba(255,255,255,.07); --shadow:rgba(0,0,0,.6); }
.ebv[data-theme="black"]  { --bg:#111; --panel:#1b1b1b; --fg:#f0f0f0; --muted:#8c8c8c; --menu-fg:#eee; --accent:#fff; --accent2:#777; --btn:#2a2a2a; --btn-fg:#fff; --dark:#000; --border:rgba(255,255,255,.1); --hover:rgba(255,255,255,.07); --shadow:rgba(0,0,0,.7); }
.ebv[data-theme="wood"]   { --bg:#6d4b33; --panel:#fbf6ee; --fg:#3a2a1e; --muted:#8a7461; --menu-fg:#3a2a1e; --accent:#8b5a2b; --accent2:#c58b4a; --btn:#fbf6ee; --btn-fg:#3a2a1e; --dark:#3a2416; --shadow:rgba(0,0,0,.5); }
.ebv[data-theme="navy"]   { --bg:#e6ecf7; --panel:#fff; --fg:#1b2a4a; --muted:#6d7b96; --menu-fg:#1b2a4a; --accent:#1d3461; --accent2:#3b6fb6; --btn:#fff; --btn-fg:#1d3461; --dark:#1d3461; }
.ebv[data-theme="forest"] { --bg:#e8efe9; --panel:#fff; --fg:#1f3326; --muted:#6b8272; --menu-fg:#1f3326; --accent:#2f4a39; --accent2:#4f8a63; --btn:#fff; --btn-fg:#2f4a39; --dark:#2f4a39; }
.ebv[data-theme="rose"]   { --bg:#f6e9ee; --panel:#fff; --fg:#3a2a30; --muted:#8a6f78; --menu-fg:#3a2a30; --accent:#d9537a; --accent2:#d9537a; --btn:#fff; --btn-fg:#3a2a30; --dark:#5a2a3a; }
.ebv[data-theme="paper"]  { --bg:#efe8da; --panel:#fbf7ee; --fg:#3a342a; --muted:#8a8172; --menu-fg:#3a342a; --accent:#b8742f; --accent2:#b8742f; --btn:#fbf7ee; --btn-fg:#3a342a; --dark:#5a4a32; }
.ebv.custom-bg { background: var(--custom-bg); }

.ebv button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ebv input, .ebv textarea, .ebv select { font: inherit; color: var(--fg); background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; outline: none; }
.ebv[data-theme="dark"] input, .ebv[data-theme="dark"] textarea, .ebv[data-theme="dark"] select, .ebv[data-theme="black"] input, .ebv[data-theme="black"] textarea, .ebv[data-theme="black"] select { background: rgba(255,255,255,.08); }
.ebv select option { color: #222; background: #fff; }
.ebv input:focus, .ebv textarea:focus { border-color: var(--accent2); }
.ebv svg { width: 22px; height: 22px; fill: currentColor; stroke: none; display: block; }
.ebv .hidden { display: none !important; }
.ebv-ibtn { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; position: relative; color: var(--fg); opacity: .9; }
.ebv-ibtn:hover { background: var(--hover); opacity: 1; }
.ebv-ibtn.on { color: var(--accent2); background: var(--hover); }
.ebv [data-tip]:hover::before { content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #222; color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 50; }
.ebv-ibtn[data-tip]:hover::before { right: auto; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); }

/* ================= 무대 ================= */
.ebv-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; contain: layout style; }
.ebv-stage.panning { cursor: grabbing; }
/* 평소(100%)에는 합성 레이어를 만들지 않아 원본 해상도로 또렷하게 그리고, 확대 중에만 will-change 로 부드럽게 */
.ebv-frame { position: absolute; left: 0; top: 0; transform-origin: center center; }
/* will-change 는 전환·드래그 이동 중에만: 계속 걸어 두면 크롬이 100% 로 그린 그림을 늘려 보여 확대 시 흐려짐 */
.ebv-frame.zoom-anim { transition: transform .16s ease-out, width .16s ease-out, height .16s ease-out, left .16s ease-out, top .16s ease-out; }
.ebv-frame.moving { will-change: transform; }
.ebv-book { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }

/* ================= 스킨 2: 상단 툴바 ================= */
.ebv-topbar { position: absolute; left: 0; right: 0; top: 0; height: 56px; background: var(--panel); box-shadow: 0 1px 6px rgba(32,33,36,.16); display: flex; align-items: center; gap: 10px; padding: 0 14px; z-index: 46; }
.ebv-topbar .tlw { flex: 1; min-width: 0; display: flex; align-items: center; }
/* 왼쪽 로고/제목: 글씨(로고) 크기만큼만 클릭 영역, 회색 배경 없음 */
.ebv-topbar .tl { display: inline-flex; align-items: center; flex: 0 1 auto; max-width: 100%; padding: 2px 0; border-radius: 0; text-align: left; position: relative; background: none; }
.ebv-topbar .tl:hover { background: none; }
.ebv-topbar .tl:hover .tt { text-decoration: underline; text-underline-offset: 3px; }
.ebv-topbar .tl img { max-height: 40px; max-width: 220px; display: block; }
.ebv-topbar .tl .tt { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.ebv-topbar .tl[data-tip]:hover::before { left: 0; right: auto; top: calc(100% + 4px); transform: none; }
.ebv-topbar .tm { display: flex; align-items: center; gap: 2px; }
.ebv-topbar .tm .ebv-ibtn { width: 42px; height: 42px; }
.ebv-topbar .tm .ebv-ibtn svg { width: 26px; height: 26px; }
.ebv-topbar .tr { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; min-width: 0; }
.ebv-topbar .tnav { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.ebv-topbar .tnav .ebv-ibtn { width: 32px; height: 32px; }
.ebv-topbar .tnav input { width: 64px; text-align: center; padding: 5px 4px; font-weight: 700; }
.ebv-topbar .tnav span { color: var(--muted); font-size: 13px; margin: 0 4px; }
.ebv-topbar .tbooks { max-width: 300px; min-width: 150px; padding: 8px 32px 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23666' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 8px center/18px; -webkit-appearance: none; appearance: none; font-weight: 600; cursor: pointer; }
.ebv[data-theme="light"].skin-topbar { --bg: #ffffff; }
.ebv.skin-topbar .ebv-stage { top: 56px; }
.ebv.skin-topbar .ebv-fabs { display: none; }
.ebv.skin-topbar .ebv-rail { top: 50%; bottom: auto; transform: translateY(-50%); }
/* 패널은 무대(.ebv-stage) 안에 있고 무대가 이미 툴바 아래(56px)에서 시작하므로 top:0 이 툴바 바로 아래 = 책 위쪽과 같은 높이 */
.ebv.skin-topbar .ebv-menu, .ebv.skin-topbar .ebv-panel, .ebv.skin-topbar .ebv-dim { top: 0; }
.ebv.skin-topbar .ebv-menu, .ebv.skin-topbar .ebv-panel { border-radius: 0; }

/* 로고 (있을 때만) */
.ebv-brand { position: absolute; left: 16px; top: 12px; z-index: 8; }
.ebv-brand img { max-height: 42px; max-width: 170px; display: block; }

/* 오른쪽 세로 레일: 확대 바 + 원형 버튼(목차·전체화면·메뉴)을 한 줄로 세로 가운데 정렬 */
.ebv-rail { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 40; }
.ebv-fabs { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ebv-fab { width: 50px; height: 50px; border-radius: 50%; background: var(--btn); color: var(--btn-fg); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: transform .12s, box-shadow .12s; position: relative; }
.ebv-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.22); }
.ebv-fab svg { width: 24px; height: 24px; }
.ebv-fab.main { width: 58px; height: 58px; background: var(--accent2); color: #fff; }
.ebv-fab.main svg { width: 28px; height: 28px; }
.ebv-fab.on { color: var(--accent2); }
.ebv-fab.main.on { background: var(--accent); }

/* 좌우 화살표 */
.ebv-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 120px; display: flex; align-items: center; justify-content: center; color: var(--fg); opacity: .5; z-index: 7; }
.ebv-arrow:hover { opacity: 1; }
.ebv-arrow.prev { left: 1.5%; } .ebv-arrow.next { right: 1.5%; }
/* 확대 바(오른쪽 세로)가 있으면 다음 화살표를 그 왼쪽으로 옮겨 겹치지 않게 */
.ebv.has-zoom .ebv-arrow.next { right: 80px; }
.ebv-arrow svg { width: 40px; height: 40px; }
.ebv-arrow.disabled { opacity: .1; pointer-events: none; }

/* 오른쪽 세로 확대 바 (본문 영역을 가리지 않도록 옆에 둠) */
/* 반투명 유리 느낌의 기둥: 뒤 내용이 살짝 비쳐 화면을 덜 가림 */
.ebv-zoomctl { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; padding: 6px 5px; overflow: hidden;
  background: rgba(255,255,255,.72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: .5px solid rgba(0,0,0,.07); border-radius: 23px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.10); }
.ebv[data-theme="dark"] .ebv-zoomctl, .ebv[data-theme="black"] .ebv-zoomctl { background: rgba(40,40,44,.72); border-color: rgba(255,255,255,.10); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.45); }
/* 버튼: 누르면 살짝 눌리는 감 */
.ebv-zoomctl .ebv-ibtn { width: 32px; height: 32px; border-radius: 50%; opacity: .82; transition: background .18s, opacity .18s, transform .12s; }
.ebv-zoomctl .ebv-ibtn svg { width: 19px; height: 19px; }
.ebv-zoomctl .ebv-ibtn:hover { background: rgba(120,120,128,.12); opacity: 1; }
.ebv-zoomctl .ebv-ibtn:active { background: rgba(120,120,128,.2); transform: scale(.92); }
.ebv-zoomctl .ebv-ibtn[disabled] { opacity: .3; cursor: default; transform: none; }
.ebv-zoomctl .ebv-ibtn[disabled]:hover, .ebv-zoomctl .ebv-ibtn[disabled]:active { background: none; opacity: .3; transform: none; }
/* 세로 슬라이더: 고정 크기 틀(24×148) 안에 회전한 슬라이더를 넣어 옆으로 튀어나오지 않게 함 */
.ebv-zoomctl .zsw { position: relative; width: 24px; height: 148px; }
.ebv-zoomctl .zs { -webkit-appearance: none; appearance: none; position: absolute; left: 50%; top: 50%; width: 148px; height: 4px; margin: 0; background: rgba(120,120,128,.18); border-radius: 2px; padding: 0; border: 0; transform: translate(-50%, -50%) rotate(-90deg); }
.ebv-zoomctl .zs::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: .5px solid rgba(0,0,0,.04); cursor: grab; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .12s; }
.ebv-zoomctl .zs::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: .5px solid rgba(0,0,0,.04); cursor: grab; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); }
.ebv-zoomctl .zs:active::-webkit-slider-thumb { transform: scale(1.12); cursor: grabbing; }
/* 배율 숫자: 눌러서 원래 크기로 */
.ebv-zoomctl .zp { cursor: pointer; min-width: 40px; padding: 2px 0; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: -.01em; color: rgba(60,60,67,.62); font-variant-numeric: tabular-nums; border-radius: 7px; transition: background .15s, color .15s; }
.ebv-zoomctl .zp:hover { background: rgba(120,120,128,.12); color: rgba(60,60,67,.9); }
.ebv[data-theme="dark"] .ebv-zoomctl .zp, .ebv[data-theme="black"] .ebv-zoomctl .zp { color: rgba(235,235,245,.62); }
.ebv[data-theme="dark"] .ebv-zoomctl .zp:hover, .ebv[data-theme="black"] .ebv-zoomctl .zp:hover { color: rgba(235,235,245,.92); }
.ebv-zoomctl .zx { visibility: hidden; }
.ebv.zoomed .ebv-zoomctl .zx { visibility: visible; }
.ebv.zoomed .ebv-tabs { display: none; }
.ebv.zoomed .ebv-leaf { box-shadow: 0 4px 16px rgba(0,0,0,.18); }

/* 하단 페이지 바 — 모바일에서만 */
.ebv-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; display: none; align-items: center; justify-content: center; gap: 6px; background: var(--panel); border-top: 1px solid var(--border); z-index: 30; }
.ebv-bottom .ebv-ibtn { width: 40px; height: 40px; }
.ebv-pageno { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ebv-pageno input { width: 62px; text-align: center; padding: 5px; font-weight: 600; }
.ebv-pageno span { color: var(--muted); font-size: 13px; }

/* ================= 책 / 페이지 ================= */
.ebv-leaves { position: absolute; inset: 0; }
.ebv-leaf { position: absolute; top: 0; height: 100%; width: 50%; background: var(--page-bg); overflow: hidden; }
.ebv-leaf.left  { left: 0;   box-shadow: -1px 0 0 #e9e9e9, -2px 0 0 #dcdcdc, -3px 0 0 #d0d0d0, 0 10px 34px var(--shadow); }
.ebv-leaf.right { left: 50%; box-shadow: 1px 0 0 #e9e9e9, 2px 0 0 #dcdcdc, 3px 0 0 #d0d0d0, 0 10px 34px var(--shadow); }
.ebv-book.single .ebv-leaf.left { width: 100%; box-shadow: 1px 0 0 #e9e9e9, 2px 0 0 #dcdcdc, 3px 0 0 #d0d0d0, 0 10px 34px var(--shadow); }
.ebv-book.single .ebv-leaf.right { display: none; }
.ebv-leaf.empty { background: transparent; box-shadow: none !important; }
.ebv-leaf.empty img { display: none; }
.ebv-leaf img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; background: var(--page-bg); }
/* 가운데 책등 음영 — 빌더 옵션(spineShadow)을 켰을 때만 */
.ebv.spine .ebv-leaf.left::after  { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 7%; background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.15)); pointer-events: none; }
.ebv.spine .ebv-leaf.right::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 7%; background: linear-gradient(to left, rgba(0,0,0,0), rgba(0,0,0,.15)); pointer-events: none; }
.ebv-book.single .ebv-leaf.left::after, .ebv-leaf.empty::after { display: none; }

/* 접힘 시트 */
.ebv-sheet { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.ebv-sheet > div { position: absolute; top: 0; height: 100%; transform-origin: 0 0; will-change: transform, clip-path; }
.ebv-sfront { background: var(--page-bg); overflow: hidden; }
.ebv-sfront img, .ebv-sback img { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--page-bg); pointer-events: none; user-select: none; -webkit-user-drag: none; }
/* 드래그 중 브라우저가 그림을 '선택'해 파란 음영을 씌우지 않도록 */
.ebv img { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.ebv img::selection, .ebv *::selection { background: transparent; }
.ebv-stage, .ebv-book, .ebv-leaf, .ebv-sheet { -webkit-touch-callout: none; }
.ebv-sback { background: #f6f6f6; }
.ebv-sback img { transform: scaleX(-1); }
.ebv-sfront .sh, .ebv-sback .sh { position: absolute; inset: 0; pointer-events: none; }
/* 시트에도 페이지와 같은 책등 그림자를 넣어 넘김 중 가운데 그림자가 사라지지 않게 함 */
.ebv-sfront .sp { position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; display: none; }
.ebv.spine .ebv-sfront.side-right .sp { display: block; left: 0; background: linear-gradient(to left, rgba(0,0,0,0), rgba(0,0,0,.15)); }
.ebv.spine .ebv-sfront.side-left .sp { display: block; right: 0; background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.15)); }
.ebv-book.curl-hint { cursor: grab; }
.ebv-book.curl-drag { cursor: grabbing; }
.ebv-leaf.shade::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; animation: ebvShade .5s ease-in-out; opacity: 0; background: rgba(0,0,0,.25); }
@keyframes ebvShade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* 책갈피 리본 */
/* 이미지맵 링크 영역 */
.ebv-hs { position: absolute; z-index: 4; cursor: pointer; border-radius: 3px; transition: background .15s, box-shadow .15s; }
.ebv-hs:hover { background: rgba(63,124,200,.14); box-shadow: 0 0 0 2px rgba(63,124,200,.55); }
.ebv-hs.url:hover { background: rgba(31,157,85,.14); box-shadow: 0 0 0 2px rgba(31,157,85,.6); }
.ebv-leaf.empty .ebv-hs { display: none; }
/* 페이지 음악 표시 */
.ebv-audio { position: absolute; left: 16px; bottom: 20px; z-index: 30; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 30px; background: var(--panel); color: var(--fg); box-shadow: 0 4px 14px rgba(0,0,0,.18); font-size: 13px; font-weight: 600; }
.ebv-audio svg { width: 20px; height: 20px; }
.ebv-audio.blocked { background: var(--accent2); color: #fff; animation: ebvPulse 1.2s ease-in-out infinite; }
@keyframes ebvPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (max-width: 900px) { .ebv-audio { bottom: 60px; left: 10px; } }

/* 책갈피 리본: 페이지 위쪽 가운데 (모서리 넘김 영역과 겹치지 않게) */
.ebv-ribbon { position: absolute; top: -2px; left: 50%; margin-left: -12px; width: 24px; height: 38px; z-index: 3; cursor: pointer; opacity: 0; transition: opacity .2s; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.ebv-leaf:hover .ebv-ribbon { opacity: .45; }
.ebv-leaf.marked .ebv-ribbon { opacity: 1; }
.ebv-ribbon svg { width: 24px; height: 38px; fill: #e74c3c; }
.ebv-leaf.empty .ebv-ribbon { display: none; }

/* 인덱스 탭(북클립) */
.ebv-tabs { position: absolute; left: 100%; top: 20px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.ebv-tab { padding: 9px 12px; min-width: 60px; max-width: 160px; cursor: pointer; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .15s; }
.ebv-tab.shadow { box-shadow: 2px 1px 3px #bbb; }
.ebv-tab:hover { transform: translateX(4px); }
.ebv-tab.on { transform: translateX(5px); }
.ebv-book.single .ebv-tabs { display: none; }

/* ================= 메뉴 시트 ================= */
.ebv-dim { position: absolute; inset: 0; background: rgba(0,0,0,.25); z-index: 44; display: none; }
.ebv-dim.open { display: block; }
.ebv-menu { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; max-width: 90%; background: var(--panel); box-shadow: -4px 0 24px rgba(0,0,0,.18); transform: translateX(105%); transition: transform .25s ease; z-index: 45; display: flex; flex-direction: column; color: var(--menu-fg); border-radius: 18px 0 0 18px; }
.ebv-menu.open { transform: none; }
.ebv-menu .mh { display: flex; align-items: center; gap: 4px; padding: 14px 12px 6px 18px; font-weight: 800; font-size: 17px; }
.ebv-menu .mh .sp { flex: 1; }
.ebv-menu .mh .ebv-ibtn { width: 40px; height: 40px; }
.ebv-menu .ms { display: flex; align-items: center; gap: 4px; margin: 6px 16px 10px; padding: 4px 4px 4px 10px; background: var(--hover); border-radius: 12px; }
.ebv-menu .ms input { flex: 1; background: transparent; border: 0; padding: 7px 4px; font-size: 14px; }
.ebv-menu .ms .ebv-ibtn { width: 34px; height: 34px; }
.ebv-menu .ml { flex: 1; overflow: auto; padding: 4px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.ebv-menu .ml button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; border-radius: 14px; font-size: 13px; color: var(--menu-fg); background: var(--hover); }
.ebv-menu .ml button:hover { background: rgba(63,124,200,.12); color: var(--accent2); }
.ebv-menu .ml button.on { color: var(--accent2); background: rgba(63,124,200,.14); }
.ebv-menu .ml button svg { width: 26px; height: 26px; }
.ebv-menu .msns { display: flex; gap: 8px; padding: 10px 16px; }
.ebv-menu .msns button { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ebv-menu .msns button:hover { box-shadow: 0 2px 8px rgba(32,33,36,.25); }
.ebv-menu .msns button svg { width: 24px; height: 24px; }
.ebv-menu .msns .kakao { background: #fee500; color: #191919; } .ebv-menu .msns .fb { background: #1877f2; color: #fff; } .ebv-menu .msns .x { background: #111; color: #fff; } .ebv-menu .msns .line { background: #06c755; color: #fff; } .ebv-menu .msns .more { background: var(--hover); }
.ebv-menu .mpg { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 12px 16px; }
.ebv-menu .mpg .ebv-ibtn { width: 36px; height: 36px; }
.ebv-menu .mpg input { width: 62px; text-align: center; padding: 6px 4px; }
.ebv-menu .mpg span { color: var(--muted); font-size: 13px; }

/* ================= 패널 (목차=왼쪽, 나머지=오른쪽) ================= */
.ebv-panel { position: absolute; top: 0; bottom: 0; right: 0; width: 340px; max-width: 100%; background: var(--panel); box-shadow: -4px 0 24px rgba(0,0,0,.18); transform: translateX(105%); transition: transform .25s ease; z-index: 42; display: flex; flex-direction: column; border-radius: 18px 0 0 18px; }
.ebv-panel.left { right: auto; left: 0; transform: translateX(-105%); border-radius: 0 18px 18px 0; box-shadow: 4px 0 24px rgba(0,0,0,.18); }
.ebv-panel.open { transform: none; }
.ebv-panel-h { display: flex; align-items: center; gap: 8px; padding: 14px 10px 12px 20px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 16px; }
.ebv-panel-h .back { margin-left: -10px; }
.ebv-panel-h .back::after { content: "메뉴"; font-size: 12px; font-weight: 600; margin-left: -2px; }
.ebv-panel-h .back { width: auto; padding: 0 10px 0 4px; gap: 0; }
.ebv-panel-h span { flex: 1; }
.ebv-panel-b { flex: 1; overflow: auto; padding: 8px; }
.ebv-panel-b::-webkit-scrollbar { width: 8px; } .ebv-panel-b::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
.ebv-list { list-style: none; margin: 0; padding: 0; }
.ebv-list li { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.ebv-list li:hover { background: var(--hover); }
.ebv-list li.on { background: rgba(63,124,200,.12); color: var(--accent2); font-weight: 700; }
.ebv-list li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ebv-list li .p { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ebv-panel.toc .ebv-list li .p { display: none; } /* 목차에는 페이지 번호를 표시하지 않음 */
.ebv-list li.lv2 { padding-left: 30px; font-size: 13px; }
.ebv-list li.lv3 { padding-left: 48px; font-size: 12.5px; }
.ebv-list li.lv1 { font-weight: 600; }
.ebv-list li.has-sub .p { padding: 3px 8px; border-radius: 12px; background: var(--hover); }
.ebv-list li.has-sub .p:hover { background: var(--accent2); color: #fff; }
.ebv-list li .chev { width: 30px; height: 30px; margin: -6px -8px -6px 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.ebv-list li .chev:hover { background: rgba(0,0,0,.08); color: var(--accent2); }
.ebv-list li .chev svg { width: 18px; height: 18px; transition: transform .2s; }
.ebv-list li.open .chev svg { transform: rotate(90deg); }
.ebv-list li.has-sub .p { background: none; padding: 0; }
.ebv-list li.has-sub .p:hover { background: none; color: var(--muted); }
.ebv-list li.open .chev { transform: rotate(90deg); }
.ebv-list .sub { list-style: none; margin: 0 0 4px; padding: 0 0 0 6px; display: none; border-left: 2px solid var(--border); margin-left: 14px; }
.ebv-list .sub.open { display: block; }
.ebv-list .sub li { padding: 8px 10px 8px 16px; font-weight: 400; }
.ebv-list .sub li.lv3 { padding-left: 34px; }
.ebv-list li img { width: 44px; height: 58px; object-fit: cover; border-radius: 3px; background: #fff; box-shadow: 0 2px 6px var(--shadow); }
.ebv-list li .del { opacity: .5; } .ebv-list li .del:hover { opacity: 1; color: #e74c3c; }
.ebv-empty { color: var(--muted); text-align: center; padding: 34px 14px; font-size: 13px; line-height: 1.7; }
.ebv-search-box { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.ebv-search-box input { flex: 1; }
.ebv-search-r { display: block !important; padding: 10px 12px !important; }
.ebv-search-r .p { display: block; margin-bottom: 3px; font-weight: 700; color: var(--accent2); }
.ebv-search-r .s { font-size: 12.5px; color: var(--muted); white-space: normal; line-height: 1.5; }
.ebv-search-r mark { background: #ffe066; color: #222; border-radius: 2px; padding: 0 1px; }
.ebv-count { padding: 6px 12px; font-size: 12px; color: var(--muted); }

/* 썸네일 드로어 */
.ebv-thumbs { position: absolute; left: 0; right: 0; bottom: 0; height: 190px; background: var(--panel); box-shadow: 0 -2px 14px rgba(32,33,36,.18); transform: translateY(105%); transition: transform .25s ease; z-index: 41; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; }
.ebv-thumbs.open { transform: none; }
.ebv-thumbs .ebv-panel-h { padding: 8px 10px 6px 20px; font-size: 14px; }
.ebv-thumbs-s { flex: 1; overflow-x: auto; overflow-y: hidden; display: flex; gap: 12px; padding: 8px 14px; align-items: center; }
.ebv-thumbs-s::-webkit-scrollbar { height: 8px; } .ebv-thumbs-s::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
.ebv-th { flex: 0 0 auto; width: 84px; cursor: pointer; text-align: center; font-size: 11px; color: var(--muted); }
.ebv-th .im { width: 84px; height: 110px; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 8px var(--shadow); border: 3px solid transparent; display: flex; align-items: center; justify-content: center; }
.ebv-th img { max-width: 100%; max-height: 100%; display: block; }
.ebv-th.on .im { border-color: var(--accent2); }
.ebv-th.on { color: var(--accent2); font-weight: 700; }

/* ================= 모달 / 토스트 / 로딩 ================= */
.ebv-modal { position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 60; display: none; align-items: center; justify-content: center; }
.ebv-modal.open { display: flex; }
.ebv-modal .box { background: var(--panel); border-radius: 16px; padding: 22px; width: 380px; max-width: 92%; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.ebv-modal h3 { margin: 0 0 12px; font-size: 16px; }
.ebv-modal .mu { color: var(--muted); }
.ebv-modal .opt { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ebv-modal .opt:hover { background: var(--hover); }
.ebv-modal .opt input[type=radio] { accent-color: var(--accent2); width: 16px; height: 16px; }
.ebv-modal .opt input[type=number] { padding: 5px 6px; }
.ebv-modal .qrw { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: 10px; width: 150px; margin: 12px auto 0; border: 1px solid var(--border); }
.ebv-modal .row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ebv-btn { padding: 10px 14px; border-radius: 10px; background: var(--hover); border: 1px solid var(--border); font-size: 13px; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; }
.ebv-btn:hover { border-color: var(--accent2); }
.ebv-btn.primary { background: var(--accent2); color: #fff; border-color: transparent; }
.ebv-btn svg { width: 18px; height: 18px; }
.ebv-toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); background: rgba(30,30,34,.92); color: #fff; padding: 9px 16px; border-radius: 30px; font-size: 13px; opacity: 0; transition: .25s; pointer-events: none; z-index: 70; white-space: nowrap; }
.ebv-toast.show { opacity: 1; transform: translateX(-50%); }
.ebv-loading { position: absolute; inset: 0; background: var(--bg); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; transition: opacity .5s; }
.ebv-loading.done { opacity: 0; pointer-events: none; }
.ebv-loading .lt { font-size: 20px; font-weight: 700; max-width: 80%; text-align: center; }
.ebv-loading .ls { font-size: 12px; color: var(--muted); }
.ebv-loading img { width: 120px; border-radius: 3px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.ebv-spin { width: 36px; height: 36px; border: 3px solid rgba(0,0,0,.1); border-top-color: var(--accent2); border-radius: 50%; animation: ebvSpin .9s linear infinite; }
@keyframes ebvSpin { to { transform: rotate(360deg); } }

/* 공유 패널 */
.ebv-share .link { display: flex; gap: 6px; margin-bottom: 14px; }
.ebv-share .link input { flex: 1; font-size: 12px; }
.ebv-share .sns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.ebv-share .sns button { justify-content: center; padding: 11px 8px; font-weight: 600; border: 0; color: #fff; border-radius: 10px; }
.ebv-share .sns .kakao { background: #fee500; color: #191919; } .ebv-share .sns .fb { background: #1877f2; } .ebv-share .sns .x { background: #111; } .ebv-share .sns .line { background: #06c755; } .ebv-share .sns .band { background: #21c531; } .ebv-share .sns .native { background: var(--hover); color: var(--fg); border: 1px solid var(--border); }
.ebv-share .qr { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: 10px; width: 150px; margin: 0 auto; border: 1px solid var(--border); }
.ebv-share .qr img, .ebv-share .qr canvas { display: block; }
.ebv-share .hint { color: var(--muted); font-size: 12px; margin-top: 12px; text-align: center; line-height: 1.6; }
/* 메모 패널 */
.ebv-memo textarea { width: 100%; min-height: 120px; resize: vertical; margin-top: 8px; }
.ebv-memo .sel { display: flex; gap: 6px; align-items: center; }
.ebv-memo .sel select { flex: 1; }
.ebv-memo h4 { margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ebv-memo .ebv-list li { display: block; }
.ebv-memo .ebv-list li .m { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; max-height: 3em; overflow: hidden; }

/* ================= 반응형 ================= */
@media (max-width: 900px) {
  .ebv-bottom { display: flex; }
  .ebv-stage { bottom: 48px; }
  .ebv-arrow { display: none; }
  .ebv-panel { width: 100%; border-radius: 0; }
  .ebv-tabs { display: none; }
  .ebv-zoomctl { display: none; }
  .ebv.zoomed .ebv-zoomctl { display: flex; padding: 6px 4px; }
  .ebv.zoomed .ebv-zoomctl .zs { display: none; }
  .ebv-rail { top: auto; bottom: 12px; right: 12px; transform: none; gap: 8px; }
  .ebv-fabs { gap: 8px; }
  .ebv-fab { width: 44px; height: 44px; } .ebv-fab.main { width: 52px; height: 52px; }
  .ebv-brand img { max-height: 32px; }
  .ebv-menu { width: 100%; max-width: 100%; border-radius: 0; }
  .ebv-topbar { padding: 0 8px; gap: 6px; }
  .ebv-topbar .tm .ebv-ibtn:not(.always) { display: none; }
  .ebv-topbar .tnav { display: none; }
  .ebv-topbar .tbooks { min-width: 0; max-width: 46vw; }
  .ebv-topbar .tl img { max-height: 32px; max-width: 130px; }
}
@media (max-width: 480px) { .ebv-thumbs { height: 160px; } }

/* ================= 인쇄 ================= */
.ebv-print { display: none; }
@media print {
  /* 뷰어 페이지는 body 가 height:100%; overflow:hidden 이라 그대로 두면 첫 장만 인쇄됩니다 */
  html, body { background: #fff !important; margin: 0; height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; display: block !important; }
  body > *:not(.ebv-print) { display: none !important; }
  .ebv-print { display: block !important; background: #fff; }
  .ebv-print img { display: block; width: 100%; max-height: 98vh; object-fit: contain; margin: 0 auto; page-break-after: always; break-after: page; page-break-inside: avoid; break-inside: avoid; }
  .ebv-print img:last-child { page-break-after: auto; break-after: auto; }
}
