@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --brand: #1f4fd8;
  --brand-dark: #1739a8;
  --brand-soft: #eef2ff;
  --accent: #f0364f;
  --ink: #16181d;
  --ink-2: #454a54;
  --ink-3: #767d8a;
  --line: #e5e8ee;
  --line-2: #f1f3f7;
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --ok: #0f9d58;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 25, 40, .06), 0 1px 3px rgba(20, 25, 40, .04);
  --shadow-md: 0 4px 16px rgba(20, 25, 40, .08);
  --shadow-lg: 0 12px 32px rgba(20, 25, 40, .12);
  --max: 1200px;
}

* { box-sizing: border-box; }

/* display 를 지정한 규칙이 hidden 속성을 덮지 않도록 한다. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Segoe UI', 'Malgun Gothic', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------- 헤더 */

.hd {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.hd-top { display: flex; align-items: center; gap: 20px; height: 62px; }

.logo { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #4f7cff); color: #fff; font-size: 15px;
}

.hd-search { flex: 1; max-width: 460px; position: relative; }
.hd-search input {
  width: 100%; height: 40px; padding: 0 40px 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-soft);
  outline: none; transition: .15s;
}
.hd-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.hd-search button {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--ink-3);
}
.hd-search button:hover { background: var(--line-2); color: var(--brand); }

.hd-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.hd-nav a, .hd-nav button {
  padding: 8px 12px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.hd-nav a:hover, .hd-nav button:hover { background: var(--line-2); color: var(--ink); }
.hd-nav a.on { color: var(--brand); background: var(--brand-soft); }
.hd-nav .cta { background: var(--brand); color: #fff; }
.hd-nav .cta:hover { background: var(--brand-dark); color: #fff; }

.hd-cats { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.hd-cats::-webkit-scrollbar { display: none; }
.hd-cats a {
  padding: 9px 13px; font-size: 14px; font-weight: 600; color: var(--ink-2);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.hd-cats a:hover { color: var(--brand); }
.hd-cats a.on { color: var(--brand); border-bottom-color: var(--brand); }

/* ------------------------------------------------------------- 공통 UI */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); }
.btn:disabled {
  cursor: not-allowed; background: var(--line-2);
  border-color: var(--line); color: var(--ink-3);
}
.btn-pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-pri:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-acc:hover:not(:disabled) { filter: brightness(.93); }
.btn-lg { height: 50px; font-size: 16px; padding: 0 26px; }
.btn-sm { height: 34px; font-size: 13px; padding: 0 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: -.2px; line-height: 1.5;
}
.badge-new { background: #e8f0fe; color: var(--brand); }
.badge-best { background: #fff0e6; color: #e8590c; }
.badge-free { background: #e6f7ed; color: var(--ok); }
.badge-sale { background: #ffe9ec; color: var(--accent); }
.badge-own { background: var(--ink); color: #fff; }
.badge-age { background: #ffeaea; color: #d93025; }
.badge-gray { background: var(--line-2); color: var(--ink-3); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.field label .req { color: var(--accent); margin-left: 2px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.field label.check {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-weight: 600; color: var(--ink); margin-bottom: 0; min-height: 42px;
}
.field label.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.input, .field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; outline: none; transition: .15s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.65; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.section-hd { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; }
.section-hd h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.section-hd .sub { font-size: 13.5px; color: var(--ink-3); }
.section-hd .more { margin-left: auto; font-size: 13.5px; font-weight: 700; color: var(--brand); }

.empty { padding: 72px 20px; text-align: center; color: var(--ink-3); }
.empty .ico { font-size: 40px; margin-bottom: 12px; opacity: .55; }
.empty h3 { margin: 0 0 6px; font-size: 17px; color: var(--ink-2); font-weight: 700; }
.empty p { margin: 0 0 18px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 90vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--accent); }

/* ------------------------------------------------------------- 도서 카드 */

.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 30px 20px; }

.bcard { position: relative; }
.bcard .thumb {
  position: relative; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden;
  background: var(--bg-soft); box-shadow: var(--shadow-md); margin-bottom: 11px;
  transition: transform .18s, box-shadow .18s;
}
.bcard:hover .thumb { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.bcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.bcard .thumb .ph {
  width: 100%; height: 100%; display: grid; place-items: center; text-align: center;
  padding: 16px; font-weight: 800; font-size: 14px; line-height: 1.45; color: #fff;
  background: linear-gradient(150deg, #4a5bd4, #2a3a90);
}
.bcard .flags { position: absolute; left: 7px; top: 7px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.bcard h3 {
  margin: 0 0 3px; font-size: 14.5px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bcard .by { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard .price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bcard .price .off { font-size: 14px; font-weight: 800; color: var(--accent); }
.bcard .price .now { font-size: 14.5px; font-weight: 800; }
.bcard .price .was { font-size: 12.5px; color: var(--ink-3); text-decoration: line-through; }
.bcard .rate { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.bcard .rate b { color: #f59f00; }

/* ------------------------------------------------------------- 스토어 */

.hero {
  background: linear-gradient(120deg, #17307d 0%, #1f4fd8 55%, #4472ff 100%);
  color: #fff; padding: 48px 0 52px; margin-bottom: 36px;
}
.hero h1 { margin: 0 0 10px; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.hero p { margin: 0 0 22px; font-size: 15.5px; opacity: .88; max-width: 560px; }
.hero .stats { display: flex; gap: 30px; flex-wrap: wrap; }
.hero .stats div b { display: block; font-size: 24px; font-weight: 800; }
.hero .stats div span { font-size: 13px; opacity: .8; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.toolbar .count { font-size: 14px; color: var(--ink-3); }
.toolbar .count b { color: var(--ink); font-weight: 800; }
.toolbar .spacer { flex: 1; }
.chip {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; color: var(--ink-2);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.toolbar select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; cursor: pointer; }

/* ------------------------------------------------------------- 상세 */

.crumb { font-size: 13px; color: var(--ink-3); padding: 18px 0; }
.crumb a:hover { color: var(--brand); }

.detail { display: grid; grid-template-columns: 300px 1fr; gap: 44px; padding-bottom: 40px; }
.detail-cover { position: sticky; top: 90px; align-self: start; }
.detail-cover .thumb { aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-lg); background: var(--bg-soft); }
.detail-cover .thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover .thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; padding: 22px; text-align: center; color: #fff; font-weight: 800; font-size: 18px; background: linear-gradient(150deg, #4a5bd4, #2a3a90); }

.detail h1 { margin: 6px 0 6px; font-size: 27px; font-weight: 800; letter-spacing: -.8px; line-height: 1.32; }
.detail .subtitle { margin: 0 0 12px; font-size: 16px; color: var(--ink-2); font-weight: 500; }
.detail .by { font-size: 14.5px; color: var(--ink-2); margin-bottom: 14px; }
.detail .by a { font-weight: 700; }
.detail .by a:hover { color: var(--brand); text-decoration: underline; }
.detail .flags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }

.rate-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); margin-bottom: 20px; }
.stars { color: #f59f00; letter-spacing: 1px; font-size: 15px; }

.pricebox { background: var(--bg-soft); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.pricebox .row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.pricebox .off { font-size: 26px; font-weight: 800; color: var(--accent); }
.pricebox .now { font-size: 26px; font-weight: 800; }
.pricebox .was { font-size: 15px; color: var(--ink-3); text-decoration: line-through; }
.pricebox .point { font-size: 13.5px; color: var(--ink-3); }
.pricebox .point b { color: var(--brand); }

.cta-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cta-row .btn { flex: 1; min-width: 130px; }
.cta-row .btn.icon-only { flex: 0 0 50px; min-width: 50px; padding: 0; font-size: 19px; }

.notice {
  display: flex; gap: 9px; padding: 13px 15px; background: var(--brand-soft);
  border-radius: 10px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin-bottom: 30px;
}

.sec { padding: 28px 0; border-top: 1px solid var(--line); }
.sec h2 { margin: 0 0 14px; font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.sec .body { font-size: 14.8px; line-height: 1.85; color: var(--ink-2); white-space: pre-wrap; }
.sec .body.clamp { display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.sec .toggle { margin-top: 10px; font-size: 13.5px; font-weight: 700; color: var(--brand); background: none; border: 0; cursor: pointer; padding: 0; }

.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec th, .spec td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.spec th { width: 116px; color: var(--ink-3); font-weight: 600; background: var(--bg-soft); }

.review { padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.review:last-child { border-bottom: 0; }
.review .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; color: var(--ink-3); }
.review .meta .who { font-weight: 700; color: var(--ink-2); }
.review .txt { font-size: 14.5px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; }
.review-form { background: var(--bg-soft); border-radius: var(--radius); padding: 18px; margin-bottom: 8px; }
.star-pick { display: flex; gap: 2px; margin-bottom: 10px; }
.star-pick button { background: none; border: 0; cursor: pointer; font-size: 25px; color: var(--line); padding: 0 1px; line-height: 1; }
.star-pick button.on { color: #f59f00; }

/* ------------------------------------------------------------- 내 서재 */

.lib-hd { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 30px 0; margin-bottom: 26px; }
.lib-hd h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.7px; }
.lib-hd p { margin: 0; color: var(--ink-3); font-size: 14px; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 30px 20px; }
.lib-item .thumb { position: relative; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-md); background: var(--bg-soft); margin-bottom: 10px; }
.lib-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-item .thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; font-weight: 800; font-size: 14px; background: linear-gradient(150deg, #4a5bd4, #2a3a90); }
.lib-item .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.28); }
.lib-item .bar i { display: block; height: 100%; background: var(--brand); }
.lib-item h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-item .by { font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.lib-item .pct { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.lib-item .acts { display: flex; gap: 6px; }
.lib-item .acts .btn { flex: 1; }

.lib-list .lib-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.lib-list .lib-row .thumb { aspect-ratio: 2/3; border-radius: 5px; overflow: hidden; box-shadow: var(--shadow-sm); }
.lib-list .lib-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-list .lib-row .thumb .ph { width: 100%; height: 100%; background: linear-gradient(150deg, #4a5bd4, #2a3a90); }
.lib-list .lib-row h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.lib-list .lib-row .meta { font-size: 12.5px; color: var(--ink-3); }
.lib-list .lib-row .acts { display: flex; gap: 6px; }

/* ------------------------------------------------------- 읽기 앱 연동 */

.opds {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 26px; background: var(--bg-soft);
}
.opds .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opds .head b { font-size: 14.5px; font-weight: 800; letter-spacing: -.3px; }
.opds .head button {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--brand); padding: 4px 6px; border-radius: 6px;
}
.opds .head button:hover { background: var(--brand-soft); }
.opds p { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-3); line-height: 1.7; }
.opds .url { display: flex; gap: 8px; align-items: center; }
.opds .url code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.opds ol { margin: 12px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.85; }
.opds[hidden] { display: none !important; }

.opds-guide { list-style: none; counter-reset: step; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.opds-guide li {
  counter-increment: step; display: grid; grid-template-columns: 26px 1fr 260px;
  gap: 12px; align-items: center; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.opds-guide li::before {
  content: counter(step); width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
}
.opds-guide .txt b { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.55; }
.opds-guide .txt span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.opds-guide em { font-style: normal; color: var(--brand); font-weight: 800; }

.opds-guide .shot {
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft);
  padding: 8px; font-size: 11.5px; overflow: hidden;
}
.opds-guide .shot-nav .row {
  display: flex; align-items: center; gap: 7px; padding: 5px 8px;
  border-radius: 5px; color: var(--ink-3); font-weight: 600;
}
.opds-guide .shot-nav .row.on { background: var(--brand); color: #fff; }
.opds-guide .shot-nav .ico { opacity: .8; }

.opds-guide .shot-bar { display: flex; align-items: center; gap: 8px; }
.opds-guide .shot-bar .ttl { font-weight: 800; font-size: 13px; }
.opds-guide .btn-mock {
  margin-left: auto; background: var(--brand); color: #fff; border-radius: 5px;
  padding: 4px 8px; font-weight: 700; white-space: nowrap;
}
.opds-guide .btn-mock.ghost { background: #fff; color: var(--ink-3); border: 1px solid var(--line); }

.opds-guide .shot-form { display: grid; grid-template-columns: 46px 1fr; gap: 5px 7px; align-items: center; }
.opds-guide .shot-form label { color: var(--ink-3); font-weight: 600; }
.opds-guide .shot-form .inp {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.opds-guide .shot-form .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; }
.opds-guide .shot-form .acts { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; margin-top: 3px; }
.opds-guide .shot-form .acts .btn-mock { margin-left: 0; }

.opds-note { margin: 14px 0 0 !important; font-size: 13px; }

@media (max-width: 760px) {
  .opds-guide li { grid-template-columns: 26px 1fr; }
  .opds-guide .shot { grid-column: 2; }
}

/* ------------------------------------------------------------- 출판사 */

.pub-hd { background: var(--ink); color: #fff; padding: 28px 0; margin-bottom: 28px; }
.pub-hd h1 { margin: 0 0 5px; font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.pub-hd p { margin: 0; opacity: .68; font-size: 14px; }
.pub-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.pub-tabs button { padding: 11px 16px; border: 0; background: none; font-size: 15px; font-weight: 700; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; }
.pub-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

.drop {
  border: 2px dashed var(--line); border-radius: 14px; padding: 44px 24px;
  text-align: center; cursor: pointer; transition: .18s; background: var(--bg-soft);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .ico { font-size: 38px; margin-bottom: 10px; }
.drop h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 700; }
.drop p { margin: 0; font-size: 13.5px; color: var(--ink-3); }

.parsed {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: #e6f7ed; border: 1px solid #b7e3c8; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 22px; color: #12703f;
}
.parsed b { font-weight: 800; }
.parsed .btn { margin-left: auto; }

.form-grid { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.cover-pick { text-align: center; }
.cover-pick .thumb { aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-md); background: var(--bg-soft); margin-bottom: 10px; }
.cover-pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cover-pick .thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }

.fieldset { border: 0; padding: 0; margin: 0 0 26px; }
.fieldset legend { padding: 0; font-size: 15px; font-weight: 800; margin-bottom: 14px; letter-spacing: -.3px; }

.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th { text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 700; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.ptable td { padding: 13px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.ptable .tt { display: flex; align-items: center; gap: 11px; }
.ptable .tt .mini { width: 34px; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; flex: none; box-shadow: var(--shadow-sm); }
.ptable .tt .mini img { width: 100%; height: 100%; object-fit: cover; }
.ptable .tt .mini .ph { width: 100%; height: 100%; background: linear-gradient(150deg, #4a5bd4, #2a3a90); }
.ptable .tt b { font-weight: 700; }
.ptable .tt span { display: block; font-size: 12.5px; color: var(--ink-3); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi b { display: block; font-size: 22px; font-weight: 800; margin-top: 3px; letter-spacing: -.5px; }

/* ------------------------------------------------------------- 인증 */

.auth-page { min-height: calc(100vh - 63px); display: grid; place-items: center; padding: 40px 20px; background: var(--bg-soft); }
.auth-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 34px 32px; box-shadow: var(--shadow-md); }
.auth-box h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.auth-box .lead { margin: 0 0 24px; font-size: 14px; color: var(--ink-3); }
.auth-tabs { display: flex; background: var(--bg-soft); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button { flex: 1; padding: 9px; border: 0; background: none; border-radius: 7px; font-size: 14px; font-weight: 700; color: var(--ink-3); cursor: pointer; }
.auth-tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.role-pick label { display: block; cursor: pointer; }
.role-pick input { position: absolute; opacity: 0; pointer-events: none; }
.role-pick .box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; transition: .15s; }
.role-pick .box b { display: block; font-size: 14px; font-weight: 700; }
.role-pick .box span { font-size: 12px; color: var(--ink-3); }
.role-pick input:checked + .box { border-color: var(--brand); background: var(--brand-soft); }
.auth-err { background: #ffe9ec; color: #c92a3e; padding: 10px 13px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }

/* ------------------------------------------------------------- 미리보기 뷰어 */

.reader {
  position: fixed; inset: 0; z-index: 300; background: #fff;
  display: flex; flex-direction: column;
}
.reader[hidden] { display: none; }

.reader-bar {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 0 18px; height: 56px; border-bottom: 1px solid var(--line); background: #fff;
}
.reader-bar .who { min-width: 0; }
.reader-bar .who b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bar .who span { font-size: 12.5px; color: var(--ink-3); }
.reader-bar .tag {
  margin-left: auto; flex: none; padding: 5px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 700;
}
.reader-bar .close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: none; cursor: pointer; font-size: 20px; color: var(--ink-3); line-height: 1;
}
.reader-bar .close:hover { background: var(--line-2); color: var(--ink); }

.reader-body { flex: 1; min-height: 0; position: relative; background: var(--bg-soft); }
.reader-body #reader-frame-host { width: 100%; height: 100%; }
.reader-body iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.reader-foot .acts { display: flex; gap: 8px; }
.reader-body .loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-3); font-size: 14px; background: #fff;
}

.reader-foot {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 12px 18px; border-top: 1px solid var(--line); background: #fff;
}
.reader-foot .pos { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.reader-foot .spacer { flex: 1; }

.reader-end {
  padding: 40px 24px; text-align: center; max-width: 520px; margin: 0 auto;
}
.reader-end h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.reader-end p { margin: 0 0 20px; font-size: 14.5px; color: var(--ink-3); line-height: 1.7; }
.reader-end .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 560px) {
  .reader-bar { padding: 0 14px; height: 52px; }
  .reader-bar .tag { display: none; }
  .reader-foot { padding: 10px 14px; }
}

/* ------------------------------------------------------------- 대여 */

.badge-rent { background: #ede7ff; color: #6035d0; }
.badge-pdf { background: #ffece6; color: #c0391b; }
.badge-drm { background: #e3f1ea; color: #1d6b45; }
.badge-expired { background: var(--line-2); color: var(--ink-3); }

.buybox { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.buybox .opt {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px;
  text-align: left; background: #fff; cursor: pointer; transition: .15s;
}
.buybox .opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.buybox .opt:disabled { opacity: .55; cursor: not-allowed; }
.buybox .opt .k { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 3px; }
.buybox .opt .v { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.buybox .opt .n { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.buybox .opt.primary { border-color: var(--accent); }
.buybox .opt.primary .v { color: var(--accent); }

.lib-item .rent-line { font-size: 12px; font-weight: 700; color: #6035d0; margin-bottom: 6px; }
.lib-item .rent-line.warn { color: var(--accent); }
.lib-item .rent-line.dead { color: var(--ink-3); }
.lib-item .thumb.dim img, .lib-item .thumb.dim .ph { opacity: .42; }

@media (max-width: 400px) { .buybox { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- 푸터 */

.ft { border-top: 1px solid var(--line); margin-top: 56px; padding: 30px 0 44px; color: var(--ink-3); font-size: 13px; }
.ft .row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.ft .row a { font-weight: 600; }
.ft .row a:hover { color: var(--brand); }
.ft p { margin: 0; line-height: 1.75; }

/* ------------------------------------------------------------- 반응형 */

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 26px; }
  .detail-cover { position: static; max-width: 220px; margin: 0 auto; }
  .form-grid { grid-template-columns: 1fr; gap: 22px; }
  .cover-pick { max-width: 180px; margin: 0 auto; }
  .hd-search { display: none; }
  .hero { padding: 34px 0 38px; }
  .hero h1 { font-size: 25px; }
}

@media (max-width: 560px) {
  .books, .lib-grid { grid-template-columns: repeat(auto-fill, minmax(134px, 1fr)); gap: 24px 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wrap { padding: 0 16px; }
  .detail h1 { font-size: 22px; }
  .hd-nav a, .hd-nav button { padding: 8px 9px; font-size: 13.5px; }
}
