:root {
  color-scheme: light;
  /* Control sizing scale. One place decides how big tappable controls and
     secondary hints are; the media queries at the end of this file adjust the
     scale for touch and for larger screens. */
  --control-size: 40px;
  --control-icon-size: 18px;
  --control-gap: 5px;
  --hint-size: 11px;
  --ink: #25312c;
  --muted: #78817b;
  --muted-light: #a0a8a1;
  --line: #e8e8e1;
  --canvas: #f7f7f3;
  --white: #fff;
  --green: #426b58;
  --green-dark: #31513f;
  --green-soft: #eaf0ea;
  --sand: #e9d9bf;
  --shadow: 0 18px 50px rgba(43, 55, 46, .08);
  font-family: 'DM Sans', 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
.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; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(75,124,88,.45); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 100; left: 12px; top: -60px; padding: 9px 13px; border-radius: 8px; background: #315d3d; color: #fff; font-size: 12px; text-decoration: none; transition: top .15s ease; }
.skip-link:focus { top: 12px; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: var(--canvas); color: var(--ink); }
body { min-height: 100dvh; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(66, 107, 88, .35); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100dvh; }
.topbar { height: 76px; display: flex; align-items: center; gap: 28px; padding: 0 46px; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 218px; }
.brand-mark { width: 36px; height: 36px; background: var(--green); border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-4deg); box-shadow: 0 5px 12px rgba(49,81,63,.19); }
.brand-mark span { display: block; width: 8px; height: 16px; background: #f4efe4; border-radius: 3px 1px 1px 3px; transform: skewY(-9deg); }
.brand-mark span:last-child { border-radius: 1px 3px 3px 1px; transform: skewY(9deg); }
.brand-mark-img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.brand-wordmark strong { font-size: 17px; letter-spacing: -.04em; }
.brand-wordmark small { margin-top: 4px; font-size: 8px; letter-spacing: .2em; color: #9aa29a; font-weight: 700; }
.local-status { display: flex; align-items: center; gap: 8px; color: #7d877e; font-size: 12px; margin-right: auto; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #78a387; box-shadow: 0 0 0 3px #ebf3ec; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.primary-button, .quiet-button, .settings-top-button, .page-button, .reader-tool-button, .dialog-close { border: 0; cursor: pointer; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.primary-button { min-height: 42px; padding: 0 17px; border-radius: 12px; background: var(--green); color: #fff; font-weight: 600; font-size: 13px; box-shadow: 0 5px 12px rgba(49,81,63,.12); }
.primary-button:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(49,81,63,.2); }
.plus-mark { font-size: 17px; vertical-align: -1px; margin-right: 4px; font-weight: 400; }
.quiet-button { min-height: 39px; padding: 0 13px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-weight: 600; font-size: 12px; }
.quiet-button:hover { background: #dfe9df; }
.sync-top-button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 11px; font-size: 11px; white-space: nowrap; }
.sync-top-button > span:first-child { font-size: 15px; }
.settings-top-button { width: 42px; height: 42px; border-radius: 12px; background: transparent; color: #607067; border: 1px solid var(--line); font-size: 15px; font-weight: 700; }
.settings-top-button:hover { background: #f4f5ef; }
.help-top-button { font-size: 14px; font-weight: 600; }

.workspace { display: grid; grid-template-columns: 236px minmax(0,1fr); max-width: 1600px; min-height: calc(100dvh - 76px); margin: 0 auto; }
.sidebar { padding: 39px 22px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: calc(100dvh - 76px); background: rgba(250,250,247,.7); }
.sidebar-label, .eyebrow { color: #66716a; font-size: var(--hint-size); font-weight: 700; letter-spacing: .19em; margin: 0; }
.sidebar-label { padding: 0 12px 14px; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 43px; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; padding: 0 12px; color: #7a827c; border-radius: 10px; text-align: left; cursor: pointer; font-size: 13px; }
.nav-item:hover { background: #f0f1eb; color: var(--ink); }
.nav-item.is-active { background: #e9efe8; color: var(--green-dark); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 17px; line-height: 1; }
.nav-count { margin-left: auto; color: #55635a; font-size: 11px; }
.sidebar-spacer { flex: 1; min-height: 42px; }
.sync-note { padding: 16px 15px 15px; border: 1px solid #e7e9e1; border-radius: 14px; background: #fffefa; }
.sync-note-top { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #536c5b; }
.sync-note-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: #edf3ed; font-size: 13px; }
.sync-note p { margin: 10px 0 12px; color: #879088; font-size: 11px; line-height: 1.65; }
.sync-chip { padding: 5px 8px; border: 0; border-radius: 7px; background: #f2f3ef; color: #8a938b; font-size: var(--hint-size); font-weight: 600; cursor: pointer; }
.sync-chip:hover { background: #e9ede6; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; margin-top: 19px; padding: 0 5px; }
.device-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #e6ece5; color: var(--green); font-size: 11px; font-weight: 700; }
.device-copy { display: flex; flex-direction: column; gap: 2px; }
.device-copy strong { font-size: 11px; font-weight: 600; }
.device-copy small { color: #a1a8a0; font-size: var(--hint-size); }
.local-lock { margin-left: auto; color: #8eac96; font-size: 8px; }

.main-content { padding: 54px clamp(28px, 5.2vw, 84px) 74px; min-width: 0; }
.page-view { width: min(100%, 1120px); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 35px; }
.page-heading h1 { margin: 9px 0 5px; font-size: clamp(29px, 3vw, 38px); letter-spacing: -.065em; line-height: 1.12; font-weight: 600; }
.heading-subtitle { margin: 0; color: #8b938d; font-size: 13px; }
.heading-import { margin-bottom: 1px; }
.continue-card { min-height: 194px; margin-bottom: 46px; padding: 25px 30px; border-radius: 19px; color: #f6f2e9; background: linear-gradient(112deg, #405d4c 0%, #4d705b 55%, #769178 100%); display: grid; grid-template-columns: minmax(0,1fr) 150px; align-items: center; gap: 30px; position: relative; overflow: hidden; box-shadow: 0 18px 35px rgba(50,81,62,.12); }
.continue-card::after { content: ""; position: absolute; width: 290px; height: 290px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; right: 95px; top: -118px; box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 56px rgba(255,255,255,.025); pointer-events: none; }
.continue-copy { position: relative; z-index: 1; }
.continue-eyebrow { color: rgba(242,243,229,.63); font-size: var(--hint-size); font-weight: 700; letter-spacing: .18em; margin: 0 0 13px; }
.continue-copy h2 { max-width: 620px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin: 0 0 7px; color: #fffdf6; font-size: clamp(19px, 2vw, 25px); letter-spacing: -.04em; font-weight: 600; }
.continue-copy p { margin: 0; color: rgba(243,243,233,.68); font-size: 11px; }
.continue-progress { max-width: 420px; display: flex; align-items: center; gap: 11px; margin-top: 20px; }
.continue-progress-track { height: 4px; flex: 1; border-radius: 8px; background: rgba(255,255,255,.24); overflow: hidden; }
.continue-progress-fill { height: 100%; border-radius: inherit; background: #e8d9b9; }
.continue-progress small { color: rgba(249,246,231,.75); font-size: var(--hint-size); }
.continue-open { position: relative; z-index: 2; justify-self: end; width: 116px; height: 42px; border: 0; border-radius: 11px; background: #faf8ef; color: #45624f; font-weight: 700; font-size: 12px; cursor: pointer; box-shadow: 0 6px 14px rgba(26,43,31,.12); }
.continue-open:hover { background: #fff; transform: translateY(-1px); }
.continue-book-art { position: absolute; right: 160px; top: 50%; width: 76px; height: 95px; transform: translateY(-47%) rotate(8deg); z-index: 1; border-radius: 5px 10px 10px 5px; background: linear-gradient(110deg,#d6c29e,#f2e4c9 14%,#ecdec4 100%); box-shadow: 8px 12px 18px rgba(31,48,34,.22); }
.continue-book-art::before { content: ""; position: absolute; top: 0; bottom: 0; left: 8px; width: 2px; background: rgba(92,78,53,.17); }
.continue-book-art::after { content: ""; position: absolute; top: 27px; left: 22px; right: 13px; height: 2px; background: rgba(97,83,57,.28); box-shadow: 0 8px rgba(97,83,57,.2), 0 16px rgba(97,83,57,.16); }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.library-filters { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: -6px 0 18px; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tab { border: 1px solid #e4e9e1; border-radius: 999px; background: #fff; color: #7c887d; padding: 7px 11px; font-size: 10px; cursor: pointer; }
.filter-tab:hover, .filter-tab.is-active { border-color: #a9c0ac; background: #edf4ed; color: #41674b; }
.sort-select { color: #929c92; font-size: var(--hint-size); white-space: nowrap; }
.sort-select select { border: 1px solid #e4e9e1; border-radius: 7px; padding: 7px 24px 7px 9px; background: #fff; color: #536258; font-size: 10px; }
.library-toolbar > div { display: flex; align-items: baseline; gap: 10px; }
.library-toolbar h2 { margin: 0; font-size: 17px; letter-spacing: -.04em; font-weight: 600; }
.book-total { color: #a0a7a0; font-size: var(--hint-size); }
.search-box { width: min(255px, 42vw); height: 38px; border: 1px solid #e5e7df; border-radius: 10px; display: flex; align-items: center; gap: 8px; background: #fff; padding: 0 10px; color: #aab0a9; }
.search-box:focus-within { border-color: #9db5a3; box-shadow: 0 0 0 3px rgba(66,107,88,.08); }
.search-icon { font-size: 21px; line-height: 1; transform: rotate(-20deg); }
.search-box input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search-box input::placeholder { color: #aeb4ad; }
.search-box kbd { border: 1px solid #eceee7; border-radius: 4px; padding: 2px 4px; color: #afb5ad; font-size: 8px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 16px; }
.book-card { min-width: 0; border: 1px solid #ebede6; border-radius: 15px; padding: 14px; background: #fff; text-align: left; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.book-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(42,55,46,.08); border-color: #dfe7df; }
.book-card-open { width: 100%; border: 0; padding: 0; text-align: left; color: inherit; background: transparent; cursor: pointer; }
.book-card-open:focus-visible { outline-offset: 5px; border-radius: 8px; }
.book-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.book-cover { height: 120px; border-radius: 10px; margin-bottom: 14px; display: grid; place-items: center; position: relative; overflow: hidden; }
.book-cover::before { content: ""; position: absolute; width: 76px; height: 88px; left: calc(50% - 38px); top: 17px; background: var(--cover-page, #ede3ce); border-radius: 4px 9px 9px 4px; box-shadow: 7px 8px 14px rgba(38,48,40,.16); transform: rotate(-3deg); }
.book-cover::after { content: ""; position: absolute; width: 38px; height: 2px; top: 55px; left: calc(50% - 15px); background: var(--cover-mark, #a79776); box-shadow: 0 8px color-mix(in srgb, var(--cover-mark, #a79776) 70%, transparent), 0 16px color-mix(in srgb, var(--cover-mark, #a79776) 48%, transparent); transform: rotate(-3deg); }
.cover-1 { background: linear-gradient(135deg,#e7ede5,#f1f1e8); --cover-page:#cedccf; --cover-mark:#6d8873; }
.cover-2 { background: linear-gradient(135deg,#f1e8df,#f5f0e7); --cover-page:#ead3c2; --cover-mark:#ad826e; }
.cover-3 { background: linear-gradient(135deg,#e6e7ed,#f2eff0); --cover-page:#cfd2e0; --cover-mark:#797e9c; }
.cover-4 { background: linear-gradient(135deg,#e8ece8,#f4f0e7); --cover-page:#d8c9a8; --cover-mark:#92805d; }
.cover-5 { background: linear-gradient(135deg,#eee8df,#f5f2e8); --cover-page:#e2d1ab; --cover-mark:#9b8253; }
.cover-6 { background: linear-gradient(135deg,#e7eeeb,#f1f1e7); --cover-page:#bfd5cf; --cover-mark:#5a8078; }
.book-file-type { position: absolute; bottom: 9px; left: 10px; z-index: 1; color: rgba(69,85,72,.56); font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.book-cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.book-cover-image[hidden] { display: none; }
.book-card-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #303b34; font-size: 13px; font-weight: 600; letter-spacing: -.02em; }
.favorite-mark { margin-right: 4px; color: #d29c4c; }
.book-card-subtitle { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 5px; color: #a0a8a0; font-size: var(--hint-size); }
.book-card-progress { display: flex; align-items: center; gap: 8px; margin-top: 13px; }
.book-card-progress-track { height: 3px; flex: 1; border-radius: 5px; background: #eef0eb; overflow: hidden; }
.book-card-progress-fill { height: 100%; background: #7da187; border-radius: inherit; }
.book-card-progress small { color: #9da59c; font-size: var(--hint-size); }
.library-more-row { grid-column: 1 / -1; display: flex; justify-content: center; padding: 18px 0 6px; }
.library-more-row .quiet-button { min-height: var(--control-size); padding: 0 18px; }
.book-card-bottom { margin-top: 11px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; color: #a3aaa3; font-size: var(--hint-size); }
.book-card-status { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.book-mini-action { border: 0; background: transparent; color: #8ca08e; padding: 3px 5px; cursor: pointer; font-size: 14px; line-height: 1; border-radius: 5px; }
.book-mini-action:hover { color: #52735a; background: #eef3ed; }
.no-search-results { grid-column: 1/-1; padding: 40px 10px; color: #969f96; text-align: center; font-size: 12px; }
.book-remove { border: 0; background: transparent; padding: 3px 5px; color: #a6ada6; cursor: pointer; font-size: 14px; line-height: 1; border-radius: 5px; }
.book-remove:hover { color: #a8574f; background: #fbf0ee; }
.book-share { min-height: var(--control-size); padding: 3px 7px; border: 0; border-radius: 6px; background: #eef3ed; color: #52735a; cursor: pointer; font-size: 9px; white-space: nowrap; }
.book-share:hover { background: #e1ebe0; }
.empty-state { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px 55px; }
.empty-state .eyebrow { margin: 4px 0 9px; }
.empty-state h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.05em; }
.empty-state > p:not(.eyebrow) { max-width: 350px; margin: 0 0 20px; color: #909991; font-size: 12px; line-height: 1.7; }
.empty-illustration { width: 130px; height: 104px; margin-bottom: 20px; position: relative; }
.empty-book { position: absolute; bottom: 12px; width: 44px; height: 64px; border-radius: 4px 8px 8px 4px; background: #d8e2d6; box-shadow: 4px 6px 12px rgba(49,76,56,.13); }
.empty-book::after { content: ""; position: absolute; top: 20px; left: 10px; width: 23px; height: 2px; background: rgba(66,107,88,.38); box-shadow: 0 8px rgba(66,107,88,.24); }
.left-page { left: 24px; transform: rotate(-12deg); background: #d5dfd1; }
.right-page { right: 22px; transform: rotate(11deg); background: #e9d9bf; }
.empty-spark { position: absolute; top: 1px; right: 24px; color: #b5a275; font-size: 19px; }
.bookmarks-page { min-height: 65vh; }
.bookmark-list-page { display: grid; gap: 10px; }
.bookmark-row { width: 100%; border: 1px solid #e9ebe4; background: #fff; border-radius: 12px; display: flex; align-items: center; gap: 14px; padding: 15px 17px; text-align: left; cursor: pointer; }
.bookmark-row:hover { border-color: #c9d8cc; box-shadow: 0 8px 18px rgba(50,75,57,.05); }
.bookmark-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #eff3ed; color: var(--green); font-size: 19px; }
.bookmark-copy { display: flex; flex-direction: column; min-width: 0; gap: 4px; flex: 1; }
.bookmark-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.bookmark-copy small { color: #929c92; font-size: 10px; }
.bookmark-date { color: #aab0a8; font-size: 9px; }
.compact-empty { min-height: 250px; }
.empty-bookmark-icon { margin-bottom: 10px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; color: var(--green); background: #e9f0e8; font-size: 26px; }

.mobile-nav { display: none; }

.reader-view { position: relative; height: 100dvh; background: #efeee8; display: flex; flex-direction: column; overflow: hidden; --reader-bg: #f6f3ed; --reader-text: #34332e; }
.reader-toolbar { height: 69px; flex: 0 0 auto; padding: 0 clamp(14px, 4vw, 54px); display: grid; grid-template-columns: 62px minmax(0,1fr) auto; align-items: center; gap: 10px; background: rgba(255,255,255,.96); border-bottom: 1px solid #e8e7df; z-index: 2; }
.reader-back { justify-self: start; border: 0; background: transparent; color: #6b7a72; display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; letter-spacing: -.02em; }
.reader-back span:first-child { font-size: 20px; line-height: 1; }
.reader-back:hover { color: var(--green-dark); }
.reader-book-heading { display: flex; flex-direction: column; align-items: center; min-width: 0; gap: 3px; }
.reader-book-heading strong { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 600; }
.reader-book-heading small { color: #9aa198; font-size: var(--hint-size); }
.reader-tools { justify-self: end; display: flex; align-items: center; gap: 6px; max-width: 100%; overflow-x: visible; white-space: nowrap; }
.reader-tool-button { min-height: var(--control-size); min-width: var(--control-size); border-radius: 10px; background: transparent; color: #6c7a71; border: 1px solid transparent; font-size: var(--control-icon-size); }
.reader-tool-button span { font-size: 10px; margin-left: 4px; }
.reader-tool-button:hover { color: #3f6249; background: #eef3ed; }
.reader-aa { border-color: #e7e9e2; font-size: 12px; font-weight: 700; }
.reader-tool-reading { display: flex; align-items: center; gap: 6px; }
.reader-progress-track { height: 3px; flex: 0 0 auto; background: #e4e5dd; }
.reader-progress-fill { height: 100%; width: 0; background: #789a7f; transition: width .25s ease; }
.reader-surface { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--reader-bg); scrollbar-color: #d0d2c9 transparent; scrollbar-width: thin; touch-action: pan-y; }
.reader-content { min-height: 100%; width: min(calc(100% - 80px), var(--content-width, 760px)); margin: 0 auto; padding: var(--reader-vertical-margin, 44px) var(--reader-margin, 40px); color: var(--reader-text); font-family: 'Noto Sans KR', 'Malgun Gothic', serif; font-size: var(--reader-font-size, 18px); line-height: var(--reader-line-height, 1.85); letter-spacing: var(--reader-letter-spacing, 0px); white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.reader-content::selection { background: rgba(125,161,135,.28); }
::highlight(tts-current) { background: rgba(245, 194, 74, .55); color: inherit; text-decoration: underline; text-decoration-color: rgba(176, 124, 16, .7); text-decoration-thickness: 2px; }
::highlight(tts-sentence) { background: rgba(245, 194, 74, .16); }
/* 페이지 모드: 스크롤은 즉시 이동하고, 좌우 넘김 효과(아래 keyframes)가 움직임을 담당합니다. */
.reader-surface[data-mode="paged"] { scroll-behavior: auto; }
.reader-surface[data-mode="scroll"] { scroll-behavior: auto; }
.reader-tap-hint { position: fixed; left: 50%; bottom: 91px; transform: translateX(-50%); z-index: 1; pointer-events: none; opacity: .66; border: 1px solid rgba(199,202,190,.7); background: rgba(255,255,252,.78); border-radius: 20px; padding: 7px 12px; color: #868e85; font-size: var(--hint-size); white-space: nowrap; transition: opacity .5s ease; }
.reader-view.hint-hidden .reader-tap-hint { opacity: 0; }
/* 밝기 어둡게 막: 스크롤해도 화면에 고정되도록 fixed 로 두고, 위치·크기는 JS가
   독서 영역(readerSurface)에 맞춰 맞춥니다. (스크롤 컨테이너 안에서 inset:0 로 두면
   막이 내용과 함께 굴러다녀 검정 띠가 어긋나게 비치던 문제 수정) */
.brightness-overlay { position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 5; pointer-events: none; background: #10110f; opacity: 0; }
.reader-footer { height: 60px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(14px, 4vw, 54px); background: rgba(255,255,255,.95); border-top: 1px solid #e8e7df; z-index: 4; }
.page-button { border: 0; background: transparent; color: #6e7b70; font-size: var(--hint-size); cursor: pointer; padding: 0 6px; min-height: var(--control-size); }
.page-button:hover { color: var(--green-dark); }
.reader-footer-center { display: flex; align-items: center; gap: 9px; color: #9aa197; font-size: var(--hint-size); }
.footer-divider { color: #c8ccc4; }
.mode-button { border: 0; background: transparent; color: #697c6e; cursor: pointer; font-size: var(--hint-size); padding: 0 8px; min-height: var(--control-size); }
.mode-button:hover { text-decoration: underline; }

.app-dialog { border: 0; padding: 0; background: transparent; width: min(92vw, 520px); max-width: 520px; color: var(--ink); }
/* backdrop-filter(블러)는 일부 Android GPU에서 배경이 새까맣게 그려지는 문제가 있어
   반투명 색만 사용합니다. (검은 막처럼 보이던 원인 중 하나) */
.app-dialog::backdrop { background: rgba(26,34,29,.42); }
.dialog-card { padding: 26px 28px 24px; background: #fff; border: 1px solid rgba(255,255,255,.7); border-radius: 20px; box-shadow: 0 25px 80px rgba(33,43,36,.2); max-height: calc(100vh - 28px); overflow: auto; }
@supports (height: 100dvh) { .dialog-card { max-height: calc(100dvh - 28px); } }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-heading h2 { margin: 7px 0 0; font-size: 21px; letter-spacing: -.05em; }
.dialog-close { width: 30px; height: 30px; border-radius: 9px; background: #f5f6f2; color: #79837b; font-size: 21px; line-height: 1; }
.dialog-close:hover { background: #ecefe9; }
.settings-group { padding: 16px 0; border-top: 1px solid #f0f1ec; }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.setting-row > span:first-child { display: flex; flex-direction: column; gap: 3px; }
.setting-row strong { font-size: 12px; font-weight: 600; }
.setting-row small { color: #8d988e; font-size: var(--hint-size); }
.setting-label { display: block; color: #657168; font-size: 11px; font-weight: 600; margin-bottom: 9px; }
.range-value { color: #78907e; font-size: var(--hint-size); font-weight: 700; }
.setting-range { display: block; width: 100%; margin: 11px 0 1px; accent-color: #5e836a; }
.two-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-settings > label { min-width: 0; }
.setting-help { align-self: end; color: var(--muted-text); font-size: .82rem; line-height: 1.45; padding: 0 2px 10px; }
.theme-options { display: flex; gap: 9px; }
.theme-choice { min-width: 76px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 9px; border: 1px solid #ebede7; background: #fff; color: #8a938b; cursor: pointer; font-size: 9px; }
.theme-choice.is-selected { border-color: #8aa891; color: #496852; background: #f6faf5; }
.theme-swatch { width: 17px; height: 17px; border: 1px solid rgba(0,0,0,.06); border-radius: 50%; }
.paper-swatch { background: #f6f3ed; }
.sepia-swatch { background: #eadcc4; }
.night-swatch { background: #222a27; }
.settings-bottom-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; }
.settings-bottom-row select { width: 100%; height: 34px; padding: 0 9px; border: 1px solid #e8eae3; border-radius: 8px; background: #fbfcf9; color: #5f6e62; font-size: 10px; }
.orientation-setting select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #e8eae3; border-radius: 8px; background: #fbfcf9; color: #5f6e62; font-size: 11px; }
.brightness-setting { min-width: 0; }
.settings-footnote { margin: 2px 0 0; color: #9aa39a; font-size: var(--hint-size); line-height: 1.6; }
.tts-engine-setting { display: grid; gap: 10px; }
.tts-engine-setting > label { display: grid; gap: 2px; }
.tts-engine-setting select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #e8eae3; border-radius: 8px; background: #fbfcf9; color: #5f6e62; font-size: 11px; }
.tts-pack-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid #e1e9df; border-radius: 10px; background: #f8fbf7; }
.tts-pack-card > div:first-child { min-width: 0; display: grid; gap: 4px; }
.tts-pack-card strong { color: #516b58; font-size: var(--hint-size); }
.tts-pack-card small { color: #8a988d; font-size: var(--hint-size); line-height: 1.45; }
.tts-pack-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tts-pack-actions select { width: 126px; height: 31px; font-size: var(--hint-size); }
.tts-pack-actions .quiet-button { min-height: var(--control-size); padding: 0 9px; font-size: var(--hint-size); white-space: nowrap; }
.settings-backup { display: grid; gap: 5px; margin-top: 13px; padding: 12px; border: 1px solid #e7ebe4; border-radius: 10px; background: #fbfcf9; }
.settings-backup strong { color: #657168; font-size: var(--hint-size); }
.settings-backup small { color: #929c94; font-size: var(--hint-size); line-height: 1.55; }
.settings-backup > div { display: flex; gap: 7px; margin-top: 3px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-actions .primary-button { min-width: 112px; min-height: 38px; }
.bookmark-modal-list { max-height: 50vh; overflow: auto; display: grid; gap: 8px; }
.bookmark-modal-entry { display: flex; align-items: stretch; gap: 5px; }
.bookmark-modal-entry .bookmark-modal-row { flex: 1; }
.bookmark-modal-row { width: 100%; padding: 11px 12px; display: flex; align-items: center; gap: 9px; text-align: left; border: 1px solid #eceee8; border-radius: 10px; background: #fff; cursor: pointer; }
.bookmark-modal-row:hover { background: #f7f9f5; border-color: #d4e0d5; }
.bookmark-modal-row strong { display: block; font-size: var(--hint-size); }
.bookmark-modal-row small { display: block; margin-top: 4px; color: #9aa39a; font-size: var(--hint-size); }
.bookmark-modal-row .bookmark-glyph { color: #668872; font-size: var(--control-icon-size); }
.bookmark-delete { width: 32px; flex: 0 0 32px; border: 0; border-radius: 9px; background: #f7f5f1; color: #a1a89f; cursor: pointer; font-size: 18px; }
.bookmark-delete:hover { color: #a8574f; background: #fbf0ee; }
.bookmark-empty-text { margin: 5px 0 10px; padding: 22px; text-align: center; color: #a0a79f; font-size: var(--hint-size); }
.bookmark-actions { justify-content: flex-start; }
.accessibility-settings { display: grid; gap: 10px; }
.history-dialog { width: min(92vw, 560px); max-height: 90vh; overflow: auto; }
.history-intro { margin: -8px 0 14px; color: #8d988e; font-size: var(--hint-size); line-height: 1.6; }
.history-filter { display: flex; align-items: center; justify-content: space-between; color: #68766b; font-size: var(--hint-size); margin-bottom: 12px; }
.history-filter select { border: 1px solid #e2e8e1; border-radius: 8px; padding: 7px 9px; color: #536258; background: #fff; }
.history-list { display: grid; gap: 7px; max-height: 48vh; overflow: auto; }
.history-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #e8ece6; border-radius: 10px; background: #fcfdfb; }
.history-row-button { width: 100%; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.history-row-button:hover { border-color: #b8cdbb; background: #f4f8f3; }
.history-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #edf3ec; color: #5f8066; }
.history-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.history-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--hint-size); }
.history-copy small, .history-row time { color: #9aa39b; font-size: var(--hint-size); }
.history-row time { white-space: nowrap; }
.history-empty { padding: 28px 10px; text-align: center; color: #9aa39b; font-size: var(--hint-size); }
body[data-accessibility="high-contrast"] { --ink: #101712; --muted: #425347; }
body[data-accessibility="high-contrast"] .reader-surface { --reader-bg: #fff; --reader-text: #000; }
body[data-accessibility="high-contrast"] .book-card, body[data-accessibility="high-contrast"] .bookmark-row { border-color: #68766b; }
body[data-accessibility="high-contrast"] .reader-content { font-weight: 500; }
body.accessibility-large-text .main-content { font-size: 1.08em; }
body.accessibility-large-text .nav-item, body.accessibility-large-text button, body.accessibility-large-text input, body.accessibility-large-text select { font-size: 1.04em; }
.find-dialog { width: min(92vw, 440px); }
.find-input { width: 100%; box-sizing: border-box; height: 42px; padding: 0 13px; border: 1px solid #dfe5dc; border-radius: 10px; background: #fbfcf9; color: #465248; font-size: 13px; outline: none; }
.find-input:focus { border-color: #8aa891; box-shadow: 0 0 0 3px rgba(112,148,121,.12); }
.find-result { min-height: 18px; margin: 11px 0 0; color: #8c978e; font-size: var(--hint-size); }
.find-actions { justify-content: flex-end; }
.help-copy h3 { margin: 16px 0 6px; color: #51675a; font-size: 12px; }
.help-copy p { margin: 0; color: #879188; font-size: 11px; line-height: 1.8; }
.help-dialog { width: min(92vw, 470px); }
.sync-dialog { width: min(94vw, 570px); max-height: 90vh; overflow: auto; }
.share-dialog { width: min(92vw, 470px); max-height: 90vh; overflow: auto; }
.sync-dialog .dialog-card { padding-bottom: 22px; }
.sync-intro { margin: -8px 0 18px; color: #879188; font-size: var(--hint-size); line-height: 1.75; }
.sync-section { margin-top: 11px; padding: 14px; border: 1px solid #e7ebe4; border-radius: 13px; background: #fff; }
.sync-section h3 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; color: #425b49; font-size: 12px; }
.sync-section h3 small { color: #9aa49b; font-size: var(--hint-size); font-weight: 400; }
.sync-section p { margin: 0 0 10px; color: #909a91; font-size: var(--hint-size); line-height: 1.6; }
.sync-overview, .sync-pending-card { margin: 13px 0; padding: 14px 15px; border: 1px solid #dfe8df; border-radius: 13px; background: linear-gradient(135deg, #f7faf6, #fff); }
.sync-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sync-overview-head > div { display: grid; gap: 4px; }
.sync-overview-head small { color: #8e9b90; font-size: var(--hint-size); }
.sync-overview-head strong { color: #405b47; font-size: 12px; }
.sync-overview > p { margin: 10px 0; color: #859187; font-size: var(--hint-size); }
.sync-pending-card p { margin: 10px 0 6px; color: #6d7c70; font-size: var(--hint-size); }
.sync-pending-card > small { color: #9aa49b; font-size: var(--hint-size); }
.sync-section-inbox { border-color: #dce8dc; background: #fbfefa; }
.sync-section-outbox { border-color: #eee4d5; background: #fffdfa; }
.sync-state-pill { display: inline-flex; align-items: center; width: max-content; padding: 5px 8px; border-radius: 99px; color: #4e7458; background: #eaf3e9; font-size: 9px; font-weight: 700; white-space: nowrap; }
.sync-state-pill.is-pending { color: #8b6a36; background: #f7f0df; }
.sync-field { display: grid; gap: 6px; margin: 10px 0; color: #6c796f; font-size: var(--hint-size); font-weight: 600; }
.sync-field input, .sync-field select { width: 100%; height: 38px; border: 1px solid #e6e9e1; border-radius: 9px; padding: 0 11px; color: #3a463d; background: #fbfcf9; font-size: 11px; outline: none; }
.sync-field input:focus, .sync-field select:focus { border-color: #91ad98; box-shadow: 0 0 0 3px rgba(66,107,88,.08); }
.share-file-name { margin: -8px 0 16px; color: #526c59; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.share-privacy-note { margin: 14px 0; padding: 11px 12px; border-radius: 9px; background: #f7f5ef; color: #858b80; font-size: 10px; line-height: 1.7; }
.share-recipient-field { min-width: 0; margin: 0; padding: 10px 11px 11px; border: 1px solid #e6e9e1; border-radius: 10px; }
.share-recipient-field legend { padding: 0 5px; color: #6c796f; font-size: var(--hint-size); font-weight: 600; }
.share-recipient-field legend small { color: #9ba49c; font-weight: 400; }
.share-recipient-list { display: grid; gap: 3px; max-height: 180px; overflow: auto; }
.share-recipient-option { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 5px 7px; border-radius: 7px; color: #53675a; font-size: 11px; cursor: pointer; }
.share-recipient-option:hover { background: #f4f6f1; }
.share-recipient-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.sync-action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sync-action-row .primary-button, .sync-action-row .quiet-button { min-height: var(--control-size); font-size: var(--hint-size); }
.sync-code-box { margin: 12px 0; border: 1px dashed #b6c7b5; border-radius: 12px; padding: 15px; text-align: center; background: #f7faf5; }
.sync-code-box small { display: block; color: #879488; font-size: var(--hint-size); }
.sync-code-value { display: block; margin: 9px 0; color: #365541; font-size: clamp(16px, 4vw, 22px); letter-spacing: .11em; font-weight: 700; overflow-wrap: anywhere; }
.sync-code-expiry { display: block; color: #9aa39a; font-size: var(--hint-size); }
.sync-message { display: grid; gap: 9px; margin: 10px 0; padding: 11px 12px; border: 1px solid #dce8db; border-radius: 10px; background: #f0f4ee; color: #617569; font-size: 10px; line-height: 1.65; }
.sync-message.error { border-color: #efd9d2; color: #925b50; background: #fbf1ed; }
.sync-repair-button { justify-self: start; border: 1px solid #d8b5aa; border-radius: 8px; padding: 7px 10px; color: #8c5145; background: #fff; cursor: pointer; font-size: 10px; font-weight: 600; }
.sync-pairing-list, .sync-device-list, .sync-file-list { display: grid; gap: 7px; margin-top: 10px; }
.sync-device-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; border: 1px solid #eceee8; border-radius: 9px; }
.sync-device-row span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sync-device-row strong { color: #4a5d4f; font-size: 10px; font-weight: 600; }
.sync-device-row small { color: #9ba49c; font-size: 9px; overflow-wrap: anywhere; }
.sync-device-row button { flex: 0 0 auto; border: 0; border-radius: 7px; padding: 6px 8px; color: #8b6159; background: #faf0ed; cursor: pointer; font-size: 9px; }
.sync-device-row button.approve-button { color: #48664f; background: #eaf1e8; }
.sync-device-row button.receive-button { color: #48664f; background: #eaf1e8; }
.sync-file-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.sync-device-row button:hover { filter: brightness(.97); }
.sync-copy-button { border: 1px solid #e0e7de; background: #fff; color: #5a7760; border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 9px; }
.sync-summary-id { display: inline-block; padding: 4px 7px; border-radius: 6px; background: #f1f3ee; color: #77847a; font-family: ui-monospace, monospace; font-size: 9px; overflow-wrap: anywhere; }
.sync-status-line { display: flex; align-items: center; gap: 7px; margin: 10px 0; color: #758276; font-size: var(--hint-size); }
.sync-status-line .status-dot { flex: 0 0 7px; }
.sync-danger-button { border: 1px solid #f0e2dd; border-radius: 9px; padding: 8px 10px; color: #95665d; background: #fffaf8; cursor: pointer; font-size: 9px; }
.sync-divider { height: 1px; margin: 4px 0; background: #edf0e9; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: min(90vw, 420px); padding: 11px 16px; border-radius: 11px; color: #f8faf6; background: #34483a; box-shadow: 0 10px 28px rgba(24,37,27,.2); font-size: 12px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; text-align: center; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.operation-progress { position: fixed; left: 50%; bottom: 82px; z-index: 45; width: min(92vw, 420px); padding: 14px 16px; transform: translateX(-50%); border: 1px solid #e2e8df; border-radius: 13px; color: #43584a; background: rgba(255,255,255,.97); box-shadow: 0 12px 36px rgba(31,47,35,.18); backdrop-filter: blur(14px); }
.operation-progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.operation-progress-heading strong { font-size: 12px; font-weight: 700; }
.operation-progress-heading span { color: #4a7456; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.operation-progress p { margin: 7px 0 10px; color: #849087; font-size: var(--hint-size); line-height: 1.5; }
.operation-progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: #edf1eb; }
.operation-progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #668b6d, #93b592); transition: width .15s ease; }
.operation-progress-track.is-indeterminate .operation-progress-bar { width: 36%; animation: progress-indeterminate 1.1s ease-in-out infinite alternate; }
@keyframes progress-indeterminate { from { transform: translateX(-12%); } to { transform: translateX(190%); } }

@media (min-width: 1500px) { .main-content { padding-top: 68px; } }
@media (max-width: 980px) {
  .topbar { padding: 0 25px; }
  .workspace { grid-template-columns: 205px minmax(0,1fr); }
  .sidebar { padding-left: 16px; padding-right: 16px; }
  .main-content { padding-left: 34px; padding-right: 34px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; }
}
@media (max-width: 720px) {
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); max-width: min(92vw, 420px); }
  .topbar { height: calc(63px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; gap: 12px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 10px; }
  .brand-mark span { height: 14px; width: 7px; }
  .brand-mark-img { width: 27px; height: 27px; border-radius: 7px; }
  .brand-wordmark strong { font-size: 15px; }
  .brand-wordmark small { font-size: 7px; }
  .local-status { display: none; }
  .topbar-actions { margin-left: auto; gap: 7px; }
  .topbar-actions .primary-button { min-height: var(--control-size); padding: 0 11px; font-size: var(--hint-size); }
  .sync-top-button { min-height: var(--control-size); padding: 0 9px; font-size: var(--hint-size); }
  .settings-top-button { width: 36px; height: 36px; font-size: 13px; }
  .workspace { display: block; min-height: calc(100dvh - 63px - env(safe-area-inset-top)); }
  .sidebar { display: none; }
  .main-content { padding: 34px 18px 96px; }
  .page-heading { align-items: flex-start; margin-bottom: 25px; }
  .page-heading h1 { font-size: 30px; }
  .heading-subtitle { font-size: var(--hint-size); }
  .heading-import { display: none; }
  .continue-card { min-height: 218px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 20px 18px; margin-bottom: 32px; }
  .continue-book-art { right: 71px; width: 52px; height: 68px; opacity: .72; }
  .continue-card::after { right: 10px; }
  .continue-copy h2 { max-width: 100%; font-size: 18px; }
  .continue-open { width: 100%; height: 50px; margin-top: auto; font-size: 13px; }
  .continue-progress { margin-top: 16px; }
  .library-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .library-filters { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; overflow: hidden; }
  .filter-tabs { min-width: 0; flex: 1 1 auto; width: auto; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter-tab { flex: 0 0 auto; }
  .sort-select { flex: 0 0 auto; width: auto; display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
  .sort-select select { width: 76px; min-width: 76px; max-width: 76px; padding: 5px 16px 5px 7px; font-size: var(--hint-size); }
  .search-box { width: 100%; }
  .search-box kbd { display: none; }
  .book-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .book-card { padding: 10px; border-radius: 12px; }
  .book-cover { height: 104px; margin-bottom: 11px; }
  .book-cover::before { width: 65px; height: 77px; left: calc(50% - 32px); top: 13px; }
  .book-cover::after { top: 45px; left: calc(50% - 13px); width: 32px; }
  .book-card-title { font-size: var(--hint-size); }
  .book-card-subtitle { font-size: var(--hint-size); }
  .book-card-bottom { font-size: 8px; }
  .empty-state { min-height: 50vh; padding-bottom: 30px; }
  .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(62px + env(safe-area-inset-bottom)); padding: 5px 8px env(safe-area-inset-bottom); z-index: 10; display: flex; align-items: stretch; justify-content: space-around; gap: 4px; background: rgba(255,255,255,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
  .mobile-nav-item { flex: 1; min-width: 0; border: 0; border-radius: 10px; background: transparent; color: #96a097; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
  .mobile-nav-item span { font-size: 18px; line-height: 1; }
  .mobile-nav-item small { font-size: var(--hint-size); }
  .mobile-nav-item.is-active { color: var(--green); }
  .reader-toolbar { height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; grid-template-columns: 62px minmax(0,1fr) 76px; gap: 4px; }
  .reader-back { gap: 3px; font-size: var(--hint-size); }
  .reader-back span:first-child { font-size: inherit; }
  .reader-book-heading strong { font-size: var(--hint-size); }
  .reader-book-heading small { font-size: 8px; }
  .reader-tools { gap: 2px; }
  .reader-tool-button { min-width: var(--control-size); min-height: var(--control-size); font-size: var(--control-icon-size); }
  .reader-tool-button span { display: none; }
  .reader-content { width: 100%; }
  .reader-tap-hint { bottom: calc(73px + env(safe-area-inset-bottom)); font-size: 8px; }
  .reader-footer { height: calc(52px + env(safe-area-inset-bottom)); padding: 0 16px env(safe-area-inset-bottom); }
  .page-button { font-size: var(--hint-size); }
  .reader-footer-center { font-size: var(--hint-size); gap: 6px; }
  .mode-button { font-size: var(--hint-size); }
  .dialog-card { padding: 22px 19px 18px; border-radius: 18px; }
  .operation-progress { bottom: calc(74px + env(safe-area-inset-bottom)); padding: 12px 14px; }
  .two-settings { gap: 15px; }
  .setting-help { padding-bottom: 6px; }
  .theme-options { gap: 6px; }
  .theme-choice { min-width: 0; flex: 1; padding: 7px 5px; justify-content: center; }
  .settings-bottom-row { grid-template-columns: 1fr 1fr; gap: 15px; }
  .tts-pack-card { align-items: stretch; flex-direction: column; }
  .tts-pack-actions { width: 100%; }
  .tts-pack-actions select { flex: 1; width: auto; }
  .tts-pack-actions .quiet-button { flex: 0 0 auto; }
}
@media (max-width: 390px) {
  .topbar-actions .primary-button { font-size: 0; width: var(--control-size); padding: 0; }
  .topbar-actions .plus-mark { font-size: 20px; margin: 0; }
  .brand-wordmark small { display: none; }
  .sync-top-button { width: auto; min-width: 64px; padding: 0 6px; gap: 4px; }
  .sync-top-label { display: inline; font-size: var(--hint-size); }
  .book-cover { height: 91px; }
  .book-card { padding: 8px; }
  .theme-choice { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
/* 설정에서 직접 켠 책장 넘김 효과는 OS 애니메이션 줄이기와 무관하게 유지합니다. */
@media (prefers-reduced-motion: reduce) {
  .page-turn-sheet.is-next { animation: pageTurnNext var(--page-turn-duration, .8s) cubic-bezier(.32, .06, .44, 1) forwards !important; }
  .page-turn-sheet.is-prev { animation: pageTurnPrev var(--page-turn-duration, .8s) cubic-bezier(.32, .06, .44, 1) forwards !important; }
}

/* TTS settings feature card */
.tts-section-label { align-items: center; }
.tts-section-label > div { display: grid; gap: 3px; }
.settings-badge { padding: 4px 7px; border: 1px solid #d7e7d8; border-radius: 999px; background: #f1f8f1; color: #5c8064; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.tts-engine-featured { margin-top: 12px; padding: 15px; border: 1px solid #d9e8da; border-radius: 16px; background: linear-gradient(135deg, #f8fcf7, #f2f8f1); box-shadow: 0 8px 24px rgba(73, 103, 78, .07); }
.tts-engine-featured .tts-engine-picker { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tts-engine-picker > span { display: grid; gap: 4px; min-width: 0; }
.tts-engine-picker > span strong { color: #3f6148; font-size: 12px; }
.tts-engine-picker > span small { color: #819084; font-size: 9px; line-height: 1.45; }
.tts-engine-featured .tts-engine-picker select { width: min(52%, 220px); flex: 0 0 auto; height: var(--control-size); border-color: #cddfce; background: rgba(255,255,255,.82); font-weight: 600; }
.tts-engine-featured .tts-pack-card { margin-top: 13px; border-color: #d5e5d6; background: rgba(255,255,255,.7); }
.tts-model-lock { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 10px 11px; border: 1px solid #dce9dd; border-radius: 11px; background: rgba(255,255,255,.62); }
.tts-model-lock-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: #e8f2e8; color: #5e8566; font-size: 14px; }
.tts-model-lock > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.tts-model-lock strong { color: #46674d; font-size: var(--hint-size); }
.tts-model-lock small { color: #87988b; font-size: 8px; line-height: 1.4; }
.tts-model-lock em { margin-left: auto; padding: 4px 7px; border-radius: 999px; color: #5d8064; background: #eaf4e9; font-size: 8px; font-style: normal; font-weight: 700; white-space: nowrap; }
.tts-settings-card { margin: 13px 0 0; padding: 13px 14px 14px; border: 1px solid #e7ece5; border-radius: 15px; background: #fcfdfb; }
.tts-subsection-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tts-subsection-heading > div { display: grid; gap: 3px; }
.tts-subsection-heading strong { color: #506858; font-size: var(--hint-size); }
.tts-subsection-heading small { color: #9aa59c; font-size: 8px; }
.tts-subsection-heading > span { color: #9ab19d; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.tts-engine-panel { margin-top: 13px; padding: 12px; border: 1px solid #e5ece4; border-radius: 13px; background: rgba(255,255,255,.56); }
.tts-engine-panel[hidden] { display: none; }
.tts-engine-options { margin-top: 13px; padding: 12px; border: 1px solid #e5ece4; border-radius: 13px; background: rgba(255,255,255,.56); }
.tts-engine-options .tts-subsection-heading { margin-bottom: 2px; }
.tts-engine-options .settings-group { padding-top: 13px; }
.tts-inline-actions { display: flex; flex-wrap: wrap; gap: var(--control-gap); margin-top: 9px; }
.tts-novel-option { margin-top: 12px; padding-top: 12px; border-top: 1px solid #edf1eb; }
.tts-cpu-option { margin-top: 11px; padding-top: 11px; border-top: 1px solid #edf1eb; }
.tts-settings-card .tts-pack-card { border-color: #e0e9df; background: #fff; }
.tts-control-group { border-top-color: #edf1eb; }
.tts-toggle-group { padding-bottom: 10px; }
.tts-pack-copy { display: grid; gap: 3px; min-width: 0; }
.tts-pack-copy .tts-pack-kicker { color: #7a9a7f; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.tts-pack-copy strong { color: #3f6849; font-size: 13px; }
.tts-pack-copy small { color: #819084; font-size: var(--hint-size); line-height: 1.45; }

/* Settings and reader toolbar polish */
.settings-dialog { max-height: 92dvh; }
.settings-dialog .dialog-card { max-height: 88dvh; overflow-y: auto; scrollbar-width: thin; }
.settings-intro { margin: -10px 0 2px; color: #8a958c; font-size: var(--hint-size); line-height: 1.6; }
.settings-section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 21px 0 0; padding: 11px 2px 7px; border-bottom: 1px solid #e6ece5; }
.settings-section-label strong { color: #49634f; font-size: 12px; letter-spacing: -.02em; }
.settings-section-label small { color: #a0aaa1; font-size: var(--hint-size); }
.settings-section-label + .settings-group { border-top: 0; padding-top: 13px; }
.settings-dialog .settings-group { padding-bottom: 14px; }
.settings-tabs { display: flex; gap: 0; margin: 0 0 24px; border-bottom: 1px solid #e6ece5; overflow-x: auto; }
.settings-tabs .settings-tab { flex: 0 0 auto; padding: 14px 16px; border: 0; background: transparent; color: #8a988d; font-size: var(--hint-size); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .2s ease; }
.settings-tabs .settings-tab.is-active { color: #425b49; border-bottom-color: #425b49; }
.settings-tabs .settings-tab:hover:not(.is-active) { color: #66716a; }
.settings-tabpanel.hidden { display: none; }
.settings-tabpanel:not(.hidden) { display: block !important; }
.settings-section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 0; padding: 11px 2px 7px; border-bottom: 1px solid #e6ece5; }
.settings-section-label strong { color: #49634f; font-size: 12px; letter-spacing: -.02em; }
.settings-section-label small { color: #a0aaa1; font-size: var(--hint-size); }
.settings-section-label + .settings-group { border-top: 0; padding-top: 13px; }
.settings-dialog .settings-group { padding-bottom: 14px; }
.settings-dialog .settings-group:last-of-type { padding-bottom: 0; }
.reader-toolbar { grid-template-columns: auto minmax(120px, 1fr) auto; }
.reader-tools { max-width: 100%; min-width: 0; gap: var(--control-gap); padding: 4px 5px; border: 1px solid #e7ebe5; border-radius: 13px; background: rgba(249,251,247,.88); overflow-x: visible; white-space: nowrap; }
.reader-tools::-webkit-scrollbar { display: none; }
.reader-tool-cluster { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.reader-tool-divider { width: 1px; height: 20px; flex: 0 0 1px; background: #dce4db; }
.reader-tool-button { min-width: var(--control-size); min-height: var(--control-size); padding: 4px 7px; border-radius: 9px; color: #637469; }
.reader-tool-button:hover { color: #3f6249; background: #eaf2e9; }
.reader-tool-button .reader-tool-icon { display: inline-flex; align-items: center; justify-content: center; margin: 0; font-size: var(--control-icon-size); line-height: 1; }
.reader-tool-button > span:not(.reader-tool-icon) { margin-left: 4px; font-size: var(--hint-size); }
.reader-tool-reading .reader-tool-button:first-child { color: #4f7658; background: #edf5ec; }
.reader-tool-reading .reader-tool-button:first-child:hover { background: #e2eee1; }
.reader-tts-timer { display: inline-flex; align-items: center; gap: 3px; min-height: 30px; padding: 0 5px; border: 1px solid #dce7dc; border-radius: 8px; background: #f7fbf6; color: #68816d; }
.reader-tts-timer > span { font-size: 13px; line-height: 1; }
.reader-tts-timer select { max-width: 86px; height: 27px; border: 0; outline: 0; background: transparent; color: #5c7261; font-size: 9px; }
.reader-aa { min-width: 40px; border-color: #dce6dc; background: #fff; }
.auto-scroll-menu { position: absolute; top: 77px; right: clamp(14px, 4vw, 54px); z-index: 5; width: min(310px, calc(100vw - 28px)); padding: 14px; border: 1px solid #dce7dc; border-radius: 15px; background: rgb(255 255 255 / calc(.98 * var(--popup-alpha, 1))); box-shadow: 0 16px 35px rgba(67,83,69,.18); }
.auto-scroll-menu.hidden { display: none; }
.auto-scroll-menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.auto-scroll-menu-heading strong { color: #49634f; font-size: 12px; }
.auto-scroll-menu-heading small { color: #66776b; font-size: var(--hint-size); text-align: right; }
.auto-scroll-menu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.auto-scroll-menu-actions button { min-height: var(--control-size); border: 1px solid #dce7dc; border-radius: 9px; background: #f7fbf6; color: #5d7562; font-size: var(--hint-size); cursor: pointer; }
.auto-scroll-menu-actions button:hover { border-color: #86a58a; background: #eaf4e9; color: #3f6249; }
.tts-seed-menu { position: absolute; top: 77px; right: clamp(14px, 4vw, 54px); z-index: 5; width: min(310px, calc(100vw - 28px)); padding: 14px; border: 1px solid #dce7dc; border-radius: 15px; background: rgb(255 255 255 / calc(.98 * var(--popup-alpha, 1))); box-shadow: 0 16px 35px rgba(67,83,69,.18); }
.tts-seed-menu.hidden { display: none; }
.tts-seed-menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tts-seed-menu-heading strong { color: #49634f; font-size: 12px; }
.tts-seed-menu-heading small { color: #66776b; font-size: var(--hint-size); text-align: right; }
.tts-control-actions { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid #e7eee6; }
.tts-control-actions .reader-tool-button { flex: 1; min-height: var(--control-size); border: 1px solid #dce7dc; background: #f7fbf6; color: #5d7562; cursor: pointer; }
.tts-control-actions .reader-tool-button:hover { background: #eaf4e9; color: #3f6249; }
.tts-control-actions .reader-tts-timer { flex: 0 0 auto; min-height: 34px; }
.tts-seed-controls { margin-top: 10px; }
.tts-seed-menu-subheading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 10px; margin-bottom: 7px; }
.tts-seed-menu-subheading strong { color: #66806b; font-size: var(--hint-size); }
.tts-seed-menu-subheading small { color: #66776b; font-size: var(--hint-size); }

@media (max-width: 720px) {
  .settings-dialog { width: min(96vw, 520px); max-height: 94dvh; }
  .settings-dialog .dialog-card { max-height: 90dvh; padding: 20px 16px 16px; }
  .settings-section-label { margin-top: 17px; }
  .settings-section-label small { max-width: 52%; text-align: right; }
  .reader-toolbar { grid-template-columns: 52px 1fr auto; gap: 4px; padding-left: 10px; padding-right: 10px; }
  .reader-tools { max-width: 100%; gap: 3px; padding: 3px; border-radius: 11px; overflow-x: visible; white-space: nowrap; }
  .reader-tool-divider { height: 18px; }
  .reader-tool-button { min-width: var(--control-size); width: var(--control-size); min-height: var(--control-size); padding: 3px; }
  .reader-tool-button > span:not(.reader-tool-icon) { display: none; }
  .reader-tool-button .reader-tool-icon { display: inline-flex; font-size: var(--control-icon-size); }
  .reader-tools { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .reader-tools::-webkit-scrollbar { display: none; }
  .reader-aa { min-width: 31px; }
  .reader-tts-timer { min-width: 31px; width: 31px; justify-content: center; padding: 0; }
  .reader-tts-timer select { position: absolute; width: 31px; height: 31px; opacity: 0; }
  .reader-tts-timer > span { font-size: 14px; }
  .tts-engine-featured { padding: 13px; }
  .tts-engine-featured .tts-engine-picker { align-items: stretch; flex-direction: column; gap: 8px; }
  .tts-engine-featured .tts-engine-picker select { width: 100%; }
  .tts-model-lock { align-items: flex-start; }
  .tts-model-lock em { margin-top: 2px; }
  .tts-settings-card { padding: 12px; }
  .tts-pack-card { gap: 10px; }
  .tts-pack-actions { flex-wrap: wrap; }
  .tts-pack-actions select { min-width: 0; }
}

/* Control size steps. Touch targets reach the recommended 44px on devices that
   need it, narrow phones stay at 40px so the toolbar still fits one line, and
   large screens grow slightly. */
@media (min-width: 720px) { :root { --control-size: 42px; --control-gap: 6px; } }
@media (min-width: 1100px) { :root { --control-size: 44px; --control-icon-size: 19px; } }
@media (hover: none) and (min-width: 420px) { :root { --control-size: 44px; --control-icon-size: 19px; } }
@media (hover: none) and (min-width: 1400px) { :root { --control-size: 46px; } }

.bookmark-svg { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; }

/* ---------------------------------------------------------------------------
   Reader popups (읽기 · 자동 스크롤 · 화면 설정) and the settings dialog tabs.
   The popups share one card alignment; rows inside them share one grid.
   --------------------------------------------------------------------------- */
.settings-group-first { border-top: 0; padding-top: 4px; }
.tts-control-menu { width: min(340px, calc(100vw - 28px)); }
.auto-scroll-menu { width: min(340px, calc(100vw - 28px)); }
.reader-controls-panel { position: absolute; top: 77px; right: clamp(14px, 4vw, 54px); z-index: 5; width: min(360px, calc(100vw - 28px)); max-height: min(72vh, 620px); overflow-y: auto; padding: 14px; border: 1px solid #dce7dc; border-radius: 15px; background: rgb(255 255 255 / calc(.98 * var(--popup-alpha, 1))); box-shadow: 0 16px 35px rgba(67,83,69,.18); }
.reader-controls-panel.hidden { display: none; }
.reader-controls-section { display: grid; gap: 10px; padding-top: 10px; }
.reader-controls-section ~ .reader-controls-section { margin-top: 2px; padding-top: 12px; border-top: 1px solid #e7eee6; }
.reader-controls-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.reader-controls-heading strong { color: #49634f; font-size: 12px; }
.reader-controls-heading small { color: #8a988d; font-size: var(--hint-size); }
.reader-controls-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.reader-controls-row > label, .reader-controls-inline { display: grid; gap: 4px; align-content: start; min-width: 0; }
.reader-controls-inline > small { color: #93a095; font-size: var(--hint-size); }
.reader-controls-panel select, .tts-seed-controls select, .auto-scroll-menu select { width: 100%; height: 32px; padding: 0 8px; border: 1px solid #e8eae3; border-radius: 8px; background: #fbfcf9; color: #5f6e62; font-size: 11px; }
.reader-controls-panel input[type="range"] { width: 100%; margin: 3px 0; accent-color: #5e836a; }
.reader-controls-panel .setting-label, .reader-controls-inline .setting-label { margin-bottom: 0; }
.reader-controls-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.reader-controls-actions .theme-choice { min-width: 0; justify-content: center; padding: 7px 4px; font-size: var(--hint-size); }
.reader-controls-check { display: flex; align-items: center; gap: 7px; color: #5f6e62; font-size: var(--hint-size); }
.reader-controls-footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #e7eee6; }
.tts-control-actions .reader-tool-button { flex: 0 0 auto; min-height: 34px; padding: 0 11px; }
.tts-control-actions .reader-tts-timer { margin-left: auto; }

/* --- Reader toolbar: SVG search icon matches the other vector icons --- */
.reader-tool-svg { width: 1.05em; height: 1.05em; display: block; }

/* --- 책장: 카드 ↔ 리스트 보기 --- */
.library-view-tools { display: flex; align-items: center; gap: 8px; }
.view-toggle { display: inline-flex; border: 1px solid #e4e9e1; border-radius: 9px; overflow: hidden; background: #fff; }
.view-toggle-button { width: 34px; height: 32px; border: 0; background: transparent; color: #8a988d; cursor: pointer; font-size: 14px; line-height: 1; }
.view-toggle-button + .view-toggle-button { border-left: 1px solid #eef0ea; }
.view-toggle-button.is-active { background: #edf3ec; color: #3f6849; }
.view-toggle-button:hover:not(.is-active) { background: #f6f8f4; color: #5f7a66; }
.is-list { grid-template-columns: 1fr; gap: 8px; }
.is-list .book-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.is-list .book-card:hover { transform: none; box-shadow: 0 6px 18px rgba(42,55,46,.07); }
.is-list .book-card-open { flex: 1; min-width: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.is-list .book-cover { grid-row: 1 / 3; width: 40px; height: 52px; margin: 0; border-radius: 7px; }
.is-list .book-cover::before { width: 24px; height: 30px; left: calc(50% - 12px); top: 8px; }
.is-list .book-cover::after { top: 22px; left: calc(50% - 8px); width: 16px; }
.is-list .book-cover .book-file-type { display: none; }
.is-list .book-card-title { grid-column: 2; grid-row: 1; }
.is-list .book-card-subtitle { display: none; }
.is-list .book-card-progress { grid-column: 2; grid-row: 2; margin-top: 6px; max-width: 320px; }
.is-list .book-card-bottom { margin: 0; flex-direction: row; align-items: center; gap: 10px; flex: 0 0 auto; }
.is-list .book-card-status { white-space: nowrap; }
.is-list .book-card-actions { justify-content: flex-end; }
@media (max-width: 640px) {
  .is-list .book-card { flex-wrap: wrap; }
  .is-list .book-card-bottom { flex: 1 1 100%; justify-content: space-between; padding-left: 50px; }
}

/* --- 기기 기록: 날짜별 그룹 (접기/펼치기) --- */
.history-day-group { display: grid; gap: 6px; }
.history-day-group + .history-day-group { margin-top: 5px; }
.history-day-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 4px 7px; border: 0; border-bottom: 1px solid #eef0ea; background: transparent; color: #5b7a63; font-size: var(--hint-size); font-weight: 700; text-align: left; cursor: pointer; }
.history-day-toggle:hover { color: #3f6249; background: #f7faf6; }
.history-day-label { flex: 1; }
.history-day-meta { color: #9aa39b; font-weight: 600; }
.history-day-arrow { color: #9aa39b; font-size: 10px; transition: transform .15s ease; }
.history-day-group.is-collapsed .history-day-arrow { transform: rotate(-90deg); }
.history-day-rows { display: grid; gap: 7px; }

/* --- 사용 방식 선택 (웹 · Windows · 모바일) --- */
.entry-options { display: grid; gap: 8px; margin-top: 2px; }
.entry-option { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 11px; align-items: center; padding: 12px 13px; border: 1px solid #e5ece4; border-radius: 13px; background: #fbfcf9; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.entry-option:hover { border-color: #b8cdbb; background: #f4f8f3; }
.entry-option .entry-icon { grid-row: 1 / 3; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; background: #edf3ec; font-size: 21px; }
.entry-option strong { color: #3f6849; font-size: 13px; }
.entry-option small { color: #819084; font-size: var(--hint-size); line-height: 1.45; }

/* --- 본문 글꼴 (시스템 + 자체 호스팅 웹폰트) --- */
@font-face { font-family: 'Gowun Batang'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/gowun-batang.woff2') format('woff2'); }
@font-face { font-family: 'Gowun Dodum'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/gowun-dodum.woff2') format('woff2'); }
@font-face { font-family: 'Nanum Myeongjo'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/nanum-myeongjo.woff2') format('woff2'); }
@font-face { font-family: 'Song Myung'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/song-myung.woff2') format('woff2'); }
.reader-content { font-family: var(--reader-font-family, inherit); }

/* --- 전자책(EPUB) 본문 --- */
.epub-page { white-space: normal; }
.epub-page p { margin: 0 0 .9em; }
.epub-page h1, .epub-page h2, .epub-page h3, .epub-page h4 { line-height: 1.35; margin: 1.1em 0 .55em; }
.epub-page img { max-width: 100%; height: auto; display: block; margin: 18px auto; border-radius: 8px; }
.epub-page figure { margin: 18px 0; text-align: center; }
.epub-page figcaption { margin-top: 8px; font-size: .85em; opacity: .72; }
.epub-page blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid rgba(100,120,105,.35); }
.epub-page hr { border: 0; height: 1px; background: rgba(100,120,105,.25); margin: 1.4em 0; }
.epub-page table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95em; }
.epub-page td, .epub-page th { border: 1px solid rgba(100,120,105,.22); padding: 6px 8px; }
.epub-page ruby rt { font-size: .55em; opacity: .8; }
.epub-page pre { white-space: pre-wrap; }

/* --- 이미지북(만화형) 페이지 ---
   각 페이지 = '프레임 + 원본 이미지'. 프레임이 트리밍·중심선(seam)·반쪽 크롭 창을 만들고
   원본 이미지는 프레임 기준으로 배치됩니다(재인코딩 없음). 크기는 applyImageViewSize 가 인라인 지정. */
.image-page { display: flex; justify-content: center; }
.image-page-frame { position: relative; overflow: hidden; flex: 0 0 auto; }
.image-page-frame img { position: absolute; left: 0; top: 0; display: block; max-width: none; max-height: none; }

/* --- 이미지북 보기 도구 (확대 · 가로폭/세로폭 맞추기, 반투명) ---
   위치(본문 상단)는 positionImageViewControls 가 스크롤 영역 기준으로 지정합니다. */
.image-view-controls { position: absolute; top: 74px; left: 12px; z-index: 7; display: flex; align-items: center; gap: 3px; padding: 4px 6px; border-radius: 11px; background: rgba(255, 255, 255, .38); backdrop-filter: blur(5px); box-shadow: 0 2px 10px rgba(30, 40, 34, .12); opacity: .5; transition: opacity .2s ease; }
.image-view-controls:hover, .image-view-controls:focus-within { opacity: 1; }
.image-view-controls button { width: 27px; height: 27px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .55); color: #42584a; font-size: 15px; line-height: 1; cursor: pointer; }
.image-view-controls button:hover { background: rgba(255, 255, 255, .9); }
.image-view-controls button.is-active { background: #557b62; color: #fff; }
.image-view-zoom { min-width: 40px; text-align: center; font-size: 11px; font-weight: 700; color: #4c6353; }
input.image-view-zoom { width: 56px; border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 700; color: #4c6353; outline: none; padding: 2px 0; border-radius: 6px; }
input.image-view-zoom:focus { background: rgba(255, 255, 255, .9); }

/* --- 이미지북 '선명하게 보기' (AI 초해상도) --- */
#imageSharpenButton.is-active { background: #557b62; color: #fff; }
#imageSharpenButton.is-working { animation: sharpenPulse 1s ease-in-out infinite; }
@keyframes sharpenPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.image-page-upscale { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* 이미지북: 페이지가 화면(툴바·풋터 사이)을 최대한 사용하도록 위·아래 여백을 줄입니다. */
.reader-content.is-image-book { padding-top: 10px; padding-bottom: 10px; }
.superres-license { display: block; margin-top: 6px; opacity: .65; }

/* --- 이미지북 글자 인식 (OCR) --- */
.operation-progress-actions { margin-top: 8px; text-align: right; }
.ocr-text-body { max-height: 46vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: rgba(31, 43, 36, .05); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.75; margin: 4px 0 12px; font-family: inherit; }
/* 확대 중(100% 초과): 왼쪽 끝부터 볼 수 있게 정렬하고, 터치로 가로 이동(스크롤)이 가능하게 합니다. */
.reader-view[data-image-zoomed="true"] .image-page { justify-content: flex-start; }
.reader-view[data-image-zoomed="true"] .reader-surface { touch-action: pan-x pan-y; }

/* --- 책장 넘김 효과 (페이지 모드 · 설정에서 끌 수 있음) ---
   현재 페이지를 '종이'로 복제해 책등(축)을 중심으로 회전시킵니다. */
.page-turn-sheet { position: absolute; overflow: hidden; z-index: 6; pointer-events: none; background: var(--reader-bg); will-change: transform; backface-visibility: hidden; transform-style: preserve-3d; box-shadow: 0 8px 26px rgba(30, 38, 32, .3); }
.page-turn-sheet .page-turn-inner { position: absolute; left: 0; right: 0; top: 0; }
.page-turn-sheet::after { content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.page-turn-sheet.is-next { transform-origin: left center; animation: pageTurnNext var(--page-turn-duration, .8s) cubic-bezier(.32, .06, .44, 1) forwards; }
.page-turn-sheet.is-next::after { background: linear-gradient(90deg, rgba(0,0,0,.3), rgba(0,0,0,0) 62%); animation: pageTurnShade var(--page-turn-duration, .8s) ease-out forwards; }
.page-turn-sheet.is-prev { transform-origin: right center; animation: pageTurnPrev var(--page-turn-duration, .8s) cubic-bezier(.32, .06, .44, 1) forwards; }
.page-turn-sheet.is-prev::after { background: linear-gradient(270deg, rgba(0,0,0,.3), rgba(0,0,0,0) 62%); animation: pageTurnShade var(--page-turn-duration, .8s) ease-out forwards; }
@keyframes pageTurnNext { 0% { transform: perspective(1900px) rotateY(0deg); } 100% { transform: perspective(1900px) rotateY(-117deg); } }
@keyframes pageTurnPrev { 0% { transform: perspective(1900px) rotateY(0deg); } 100% { transform: perspective(1900px) rotateY(117deg); } }
@keyframes pageTurnShade { 0% { opacity: 0; } 60% { opacity: 1; } 100% { opacity: .85; } }

/* --- 시리즈 묶기 --- */
.series-volumes { grid-column: 1 / -1; display: grid; gap: 8px; padding: 2px 0 6px; }
.series-volumes .book-card { background: #fbfdfa; }
.series-badge { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, .86); color: #4f6b56; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.is-list .series-badge { display: none; }
.series-toggle-button { font-size: 13px; }
.series-card.is-expanded { border-color: #cfe0d0; box-shadow: 0 8px 22px rgba(42, 55, 46, .07); }

/* --- 본문 검색: 후보 목록 --- */
.find-results { display: grid; gap: 4px; max-height: 34vh; overflow-y: auto; margin-top: 9px; }
.find-results:empty { display: none; }
.find-result-row { width: 100%; text-align: left; padding: 8px 10px; border: 1px solid #eceee8; border-radius: 9px; background: #fcfdfb; color: #4d5a50; font-size: var(--hint-size); line-height: 1.55; cursor: pointer; }
.find-result-row:hover { border-color: #b8cdbb; background: #f4f8f3; }
.find-result-row.is-current { border-color: #8aa891; background: #f2f8f1; }
.find-result-row mark { padding: 0 1px; border-radius: 3px; background: #ffe9a8; color: inherit; }

/* --- 기기 기록: 모바일에선 시간이 아래 줄로 내려와 가로 스크롤이 없어짐 --- */
@media (max-width: 560px) {
  .history-row { flex-wrap: wrap; }
  .history-row time { flex: 0 0 100%; margin-top: 3px; padding-left: 38px; white-space: normal; }
}

/* --- Settings dialog: display tab grid and shared select look --- */
.settings-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: center; }
.settings-dialog .tts-pack-card { display: grid; gap: 9px; }
.settings-dialog .tts-pack-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.settings-dialog .tts-pack-actions select { width: 100%; }
.settings-dialog .tts-engine-options .settings-group { border-top: 0; padding: 10px 0 0; }
.tts-control-group { gap: 10px 16px; }
.settings-dialog select { height: 34px; padding: 0 9px; border: 1px solid #e8eae3; border-radius: 8px; background: #fbfcf9; color: #5f6e62; font-size: 11px; }
.settings-dialog .two-settings select { width: 100%; }
.tts-subsection-heading strong { font-size: 12px; }
