:root {
  --paper: #f5efe4;
  --paper-2: #ece4d5;
  --card: #fbf8f2;
  --ink: #2a241f;
  --ink-2: #6b6158;
  --ink-3: #9b9086;
  --line: #ddd2c1;
  --accent: #a8472a;
  --accent-ink: #fff8f2;
  --accent-soft: #f3dfd3;
  --gold: #b88a2e;
  --silver: #8d8a85;
  --bronze: #a3683f;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --serif: 'Gowun Batang', 'Noto Serif KR', serif;
  --sans: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1915; --paper-2: #26221c; --card: #231f1a;
    --ink: #ece4d6; --ink-2: #b0a594; --ink-3: #7f7568; --line: #3a342c;
    --accent: #e0805f; --accent-ink: #1c1915; --accent-soft: #3a2a22;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1c1915; --paper-2: #26221c; --card: #231f1a;
  --ink: #ece4d6; --ink-2: #b0a594; --ink-3: #7f7568; --line: #3a342c;
  --accent: #e0805f; --accent-ink: #1c1915; --accent-soft: #3a2a22;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ── 상단바 · 하단 탭 ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top, 0px);
  height: calc(56px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-mark {
  width: 22px; height: 26px; border-radius: 2px 5px 5px 2px; background: var(--accent);
  box-shadow: inset 4px 0 0 rgba(0,0,0,.18), inset -2px 0 0 rgba(255,255,255,.15);
  position: relative;
}
.brand-mark::after { content: ''; position: absolute; left: 8px; right: 4px; top: 7px; height: 2px; background: var(--accent-ink); opacity: .8; border-radius: 1px; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; text-decoration: none; font-size: 13px;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active svg { stroke-width: 2.1; }

.view {
  max-width: 600px; margin: 0 auto; outline: none;
  padding: 20px 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
  min-height: 100vh;
}

/* ── 공통 요소 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; text-decoration: none; transition: transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger { color: #c0392b; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.textarea { min-height: 50vh; resize: vertical; font-family: var(--serif); line-height: 1.85; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 0 20px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.social { display: grid; gap: 10px; }
.btn-naver { background: #03c75a; border-color: #03c75a; color: #fff; }
.btn-google { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.s-logo { width: 22px; text-align: center; font-size: 17px; font-weight: 900; font-family: Arial, sans-serif; }
.btn-google .s-logo { color: #4285f4; }
.or { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--ink-3); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-error { color: #c0392b; font-size: 14px; min-height: 20px; margin: -4px 0 12px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { font-size: 19px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); font-size: 14px; color: var(--ink-2);
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }

.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--paper-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.segment button { border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 500; color: var(--ink-2); }
.segment button.on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }
/* 빈 랭킹: 바로 할 수 있는 일 두 가지 (서가로 · 책 쓰기) */
.empty-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }

/* ── 홈 ── */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 28px; line-height: 1.35; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 10px 0 0; color: var(--ink-2); }
.search { position: relative; margin: 20px 0 14px; }
.search .input { padding-left: 42px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; }

/* 책 목록 */
.book-list { display: grid; gap: 12px; }
.book-row {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center;
  padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; transition: transform .12s;
}
.book-row:active { transform: scale(.99); }
.more-btn { margin-top: 14px; color: var(--ink-2); }
.book-row h3 { font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-row .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.book-row .sum { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.cover {
  --c1: #a8472a; --c2: #7a2f1a;
  position: relative; aspect-ratio: 3 / 4.2; border-radius: 3px 8px 8px 3px; overflow: hidden;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: inset 5px 0 0 rgba(0,0,0,.18), inset 6px 0 0 rgba(255,255,255,.08), 0 3px 8px rgba(40,25,10,.18);
  color: #fffaf3; display: flex; flex-direction: column; justify-content: space-between; padding: 10% 10% 10% 16%;
}
.cover .c-title { font-family: var(--serif); font-weight: 700; font-size: 10px; line-height: 1.3; word-break: keep-all; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.cover .c-rule { height: 1px; background: rgba(255,250,243,.55); margin-top: 6%; }
.cover .c-author { font-size: 8px; opacity: .85; }
.cover.lg { width: 150px; margin: 0 auto; padding: 18px 14px 16px 22px; }
.cover.lg .c-title { font-size: 19px; -webkit-line-clamp: 5; }
.cover.lg .c-author { font-size: 12px; }
.cover.lg .c-rule { margin-top: 12px; }

/* ── 책 소개 ── */
.book-detail { text-align: center; padding-top: 12px; }
.book-detail h1 { font-size: 24px; margin-top: 20px; line-height: 1.35; word-break: keep-all; }
.book-detail .by { color: var(--ink-2); margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.stats div { padding: 12px 4px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-size: 18px; font-family: var(--serif); }
.stats span { font-size: 12px; color: var(--ink-3); }
.book-detail .summary { text-align: left; background: var(--paper-2); padding: 14px 16px; border-radius: 12px; color: var(--ink-2); margin-bottom: 20px; font-family: var(--serif); }
.note { font-size: 13px; color: var(--ink-3); margin-top: 12px; }
.share-btn { margin-top: 10px; color: var(--ink-2); }
.share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.end-page .end-share { width: 100%; max-width: 280px; margin-top: 4px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ── 랭킹 ── */
.rank-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rank-list li { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; }
.rank-list li + li { border-top: 1px solid var(--line); }
.rank-list a { text-decoration: none; }
.rank-no { font-family: var(--serif); font-weight: 700; font-size: 18px; text-align: center; color: var(--ink-3); }
.rank-list li:nth-child(1) .rank-no { color: var(--gold); font-size: 22px; }
.rank-list li:nth-child(2) .rank-no { color: var(--silver); font-size: 21px; }
.rank-list li:nth-child(3) .rank-no { color: var(--bronze); font-size: 20px; }
.rank-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { font-size: 12.5px; color: var(--ink-3); }
.rank-val { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── 내 서재 ── */
.profile {
  background: var(--ink); color: var(--paper); border-radius: 18px; padding: 22px 20px;
  display: grid; gap: 14px;
}
.profile h2 { font-size: 22px; }
.profile .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.profile .row div { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; }
.profile .row b { display: block; font-family: var(--serif); font-size: 20px; }
.profile .row span { font-size: 12px; opacity: .7; }
.profile .row .stat-link { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.profile .row .stat-link span::after { content: ' ›'; }
#my-reads { scroll-margin-top: 72px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.log li b { color: var(--accent); white-space: nowrap; }
.linkrow { display: grid; gap: 8px; margin-top: 24px; }

/* ── 쓰기 ── */
.counter { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin: -8px 0 16px; }

/* ── 약관 ── */
.doc h1 { font-size: 24px; margin-bottom: 16px; }
.doc h2 { font-size: 17px; margin: 22px 0 8px; }
.doc p, .doc li { color: var(--ink-2); font-size: 14.5px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.doc td, .doc th { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }

.footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); line-height: 1.8; }
.footer a { color: var(--ink-2); }

/* ── 토스트 ── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.reading .toast { bottom: calc(var(--safe-b) + 70px); }

/* ── 읽기 화면: 위로 밀어 올리며 읽기 ── */
body.reading .topbar, body.reading .tabbar { display: none; }
body.reading { overflow: hidden; overscroll-behavior: none; }
body.reading .view { max-width: none; padding: 0; min-height: 0; }

.reader {
  --fs: 18px;
  position: fixed; inset: 0; background: var(--paper); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: var(--safe-b);
  touch-action: pan-y;
}
.reader-bar {
  height: 52px; display: flex; align-items: center; gap: 4px; padding: 0 8px;
  border-bottom: 1px solid transparent; transition: opacity .2s; flex: none;
}
.reader-bar .t { flex: 1; min-width: 0; font-family: var(--serif); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reader.immersive .reader-bar, .reader.immersive .reader-foot { opacity: 0; pointer-events: none; }

.page-viewport {
  flex: 1; position: relative; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.page-flow {
  max-width: 560px; margin: 0 auto; padding: 8px 24px 32px;
  font-family: var(--serif); font-size: var(--fs); line-height: 1.9; word-break: keep-all; overflow-wrap: anywhere;
}
.page-flow p { margin: 0 0 1em; text-indent: .6em; }
.page-flow p.first { text-indent: 0; }
.page-flow h3 { font-size: 1.12em; margin: 1.6em 0 1em; text-indent: 0; }
/* 시: 들여쓰기 없이 연 사이를 넉넉하게, 시 제목 앞은 크게 띄움 */
.page-flow.poem p { text-indent: 0; margin-bottom: 1.5em; line-height: 1.95; }
.page-flow.poem h3 { margin: 3.2em 0 1.4em; font-size: 1.08em; color: var(--accent); }
.page-flow.poem h3:first-of-type { margin-top: 1.6em; }
/* 웹툰: 컷을 화면 폭에 꽉 차게, 세로로 이어서 */
.page-flow.webtoon { max-width: 720px; padding: 0 0 32px; }
.page-flow.webtoon .title-page, .page-flow.webtoon .end-page { padding: 0 24px; }
.page-flow .cut { margin: 0 0 18px; line-height: 0; }
.page-flow .cut img { display: block; width: 100%; height: auto; background: #efe3cf; aspect-ratio: auto; }
.page-flow.webtoon .cut:last-of-type { margin-bottom: 0; }
.cover.img { padding: 0; background: #efe3cf; }
.cover.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-flow .title-page { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; text-align: center; margin-bottom: 2em; }
.page-flow .title-page h2 { font-size: 1.6em; line-height: 1.35; margin-bottom: .6em; }
.page-flow .title-page .by { color: var(--ink-2); font-size: .85em; }
.page-flow .title-page .orn { color: var(--accent); margin: 1.2em 0; letter-spacing: .6em; font-size: .8em; }
.page-flow .end-page {
  min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; font-family: var(--sans); font-size: 15px; gap: 12px; margin-top: 3em;
}
.end-page .fin { font-family: var(--serif); font-size: 34px; color: var(--accent); }
.end-page .award { background: var(--accent-soft); color: var(--accent); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.end-page .btns { display: grid; gap: 8px; width: 100%; max-width: 280px; margin-top: 8px; }
.end-page .next-books { width: 100%; max-width: 340px; margin-top: 10px; padding-top: 16px; border-top: 1px dashed var(--line); }
.next-books h4 { font-family: var(--serif); font-size: 16px; margin: 0 0 12px; color: var(--ink); }
.next-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.next-card { text-decoration: none; color: var(--ink); text-align: left; min-width: 0; }
.next-card .cover { width: 100%; }
.next-card .cover .c-title { font-size: 11px; }
.next-t { font-size: 13px; font-weight: 700; line-height: 1.35; margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; }
.next-m { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.reader-foot { height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 24px; flex: none; transition: opacity .2s; }
.progress { flex: 1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.page-no { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.reader-menu {
  position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: 8px; z-index: 5;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px; display: grid; gap: 10px; min-width: 210px;
}
.reader-toc {
  position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; z-index: 5; max-width: 420px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 10px 6px; max-height: 70vh; overflow-y: auto; overscroll-behavior: contain;
}
.reader-toc .rt-h { font-size: 13px; font-weight: 700; color: var(--ink-3); padding: 2px 10px 6px; }
.reader-toc ol { list-style: none; margin: 0; padding: 0; }
.reader-toc button { display: block; width: 100%; min-height: 44px; padding: 8px 10px; text-align: left; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink); font-family: var(--serif); font-size: 15px; line-height: 1.4; word-break: keep-all; }
.reader-toc button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.book-toc { text-align: left; margin: -8px 0 20px; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.book-toc summary { cursor: pointer; padding: 12px 0; font-weight: 700; min-height: 44px; box-sizing: border-box; }
.book-toc ol { margin: 0 0 12px; padding-left: 0; list-style: none; }
.book-toc li a { display: block; padding: 9px 0; color: var(--ink-2); text-decoration: none; font-family: var(--serif); border-top: 1px dashed var(--line); word-break: keep-all; }
.reader-menu .r { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.reader-menu .r > div { display: flex; gap: 4px; }
.reader-menu button { min-width: 40px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  .toast, .book-row, .btn { transition: none; }
}

.cover .c-genre { align-self: flex-start; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px;
  background: rgba(255, 248, 234, .92); color: #3a2a22; }
.cover.lg .c-genre { font-size: 13px; padding: 2px 8px; }
.genre-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.kakao-share { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: #fee500; cursor: pointer; flex: none; }
.kakao-share svg { width: 17px; height: 17px; fill: #191919; }
.kakao-share:active { transform: translateY(1px); }
.staff-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }

/* 읽던 책: 옆으로 밀어 보는 작은 책장 */
.continue .section-title { margin: 22px 0 10px; }
.link-btn { border: 0; background: transparent; padding: 10px 4px; margin: -10px -4px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.cont-list { display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 8px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.cont-list::-webkit-scrollbar { display: none; }
.cont-card { flex: none; width: 96px; text-decoration: none; scroll-snap-align: start; }
.cont-card .cover { width: 96px; }
.cont-card .cover .c-title { font-size: 12px; }
.cont-t { font-size: 13px; font-weight: 700; line-height: 1.35; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; }
.cont-bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.cont-bar i { display: block; height: 100%; background: var(--accent); }
.cont-p { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

/* 목록의 추천 수 */
.meta .up-tag { color: var(--accent); font-weight: 700; }
/* 내가 끝까지 읽은 책 표시 (서가 카드·책 소개) */
.meta .done-tag { color: var(--ink-2); font-weight: 700; }
.series-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: -4px 0 16px; font-size: 14px; }
.series-nav .series-now { color: var(--ink-2); font-weight: 700; }
.series-nav .series-link { color: var(--accent); font-weight: 700; text-decoration: none; padding: 10px 4px; min-height: 44px; display: flex; align-items: center; }
.series-nav .series-link:first-child { justify-content: flex-start; }
.series-nav .series-link:last-child { justify-content: flex-end; }
.end-page .series-next { width: 100%; max-width: 280px; }
.book-detail .done-note { color: var(--ink-2); font-weight: 700; font-size: 14px; margin: -6px 0 16px; }

/* 다 읽은 뒤 추천·비추 */
.vote-box { margin: 18px auto 4px; text-align: center; }
.vote-box .vq { font-weight: 700; margin-bottom: 10px; }
.vote-box .vbtns { display: flex; gap: 10px; justify-content: center; }
.vbtn { font: inherit; font-size: 15px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: inherit; cursor: pointer; min-width: 112px; }
.vbtn b { margin-left: 4px; }
.vbtn.up.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vbtn.down.on { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.vote-box .vmsg { min-height: 1.4em; margin-top: 8px; font-size: 13px; }

/* 자체 광고(북놀자 소식) */
.house-ad { position: relative; display: flex; align-items: center; gap: 10px; margin: 22px auto 0; max-width: 420px; padding: 12px 14px 12px 12px;
  border-radius: 14px; background: var(--accent-soft); text-align: left; font-size: 13.5px; line-height: 1.45; text-indent: 0; }
.house-ad .ha-label { position: absolute; top: -9px; left: 12px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--paper); color: var(--ink-3); border: 1px solid var(--line); }
.house-ad .ha-icon { font-size: 22px; flex: none; }
.house-ad .ha-text { flex: 1; }
.house-ad .ha-cta { flex: none; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); border: 0; text-decoration: none; cursor: pointer; white-space: nowrap; }

/* 홈 화면 아이콘 만들기(우상단, 카톡 아이콘과 같은 크기) */
.app-install { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); cursor: pointer; flex: none; }
.app-install svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-install:active { transform: translateY(1px); }

/* 상금 */
.prize-link { display: inline-block; margin-top: 10px; font-size: 13.5px; font-weight: 700; color: var(--accent); text-decoration: none; }
.prize-card { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.prize-card b { color: var(--accent); }
.prize-card span { font-size: 13.5px; }
.doc.prize h1 em { color: var(--accent); font-style: normal; }
.doc.prize .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; text-align: center; }
.doc.prize .stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 4px; }
.doc.prize .stats b { display: block; font-size: 20px; }
.doc.prize .stats span { font-size: 12px; color: var(--ink-2); }
.ext-ad { justify-content: center; min-height: 100px; width: 100%; box-sizing: border-box; }
.house-ad .ha-label { white-space: nowrap; }
.admin .settle { display: grid; gap: 10px; margin: 12px 0; }
.admin-table { font-size: 13px; display: block; overflow-x: auto; }
.admin-table td, .admin-table th { white-space: nowrap; }
.btn-sm { padding: 4px 10px; font-size: 12px; margin: 2px; }

/* 그림 표지: 장르별 그림 위에 제목 (글자가 잘 보이게 위쪽을 살짝 어둡게) */
.cover.art .c-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover.art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,0) 45%, rgba(0,0,0,.18)); pointer-events: none; }
.cover.art > .c-top, .cover.art > .c-author, .cover.art > .c-genre { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.cover.art > .c-genre { text-shadow: none; }

/* 건의함 · 언어 단추 (카톡 단추와 같은 크기) */
.fb-btn, .lang-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); cursor: pointer; flex: none; }
.fb-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.lang-btn { font-size: 11.5px; font-weight: 700; letter-spacing: -.02em; }
.fb-btn:active, .lang-btn:active { transform: translateY(1px); }
.topbar-right { gap: 6px; }
/* 위쪽 동그란 단추: 모양(30px)은 그대로, 손가락으로 누르는 자리만 위아래로 넓게(약 38×44px). 옆 단추와 겹치지 않게 간격의 절반만 */
.topbar-right { gap: 8px; }
.app-install, .kakao-share, .fb-btn, .lang-btn { position: relative; }
.app-install::after, .kakao-share::after, .fb-btn::after, .lang-btn::after { content: ''; position: absolute; inset: -7px -4px; border-radius: 12px; }
@media (max-width: 360px) { .topbar-right { gap: 4px; } .topbar .brand-name { font-size: 18px; }
  .app-install::after, .kakao-share::after, .fb-btn::after, .lang-btn::after { inset: -7px -2px; } }

/* 아래에서 올라오는 창 */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20,14,8,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; width: 100%; max-width: 520px; background: var(--paper); color: var(--ink); border-radius: 18px 18px 0 0;
  padding: 22px 16px calc(20px + var(--safe-b)); box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto; }
.sheet-t { font-size: 20px; margin-bottom: 6px; }
.sheet-x { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: transparent; font-size: 24px; color: var(--ink-2); }
.sheet .textarea { min-height: 120px; margin: 10px 0 6px; }
.ios-install { padding: 8px 0 4px; }
.ios-steps { display: flex; align-items: center; justify-content: center; gap: 14px; font-weight: 700; }
.ios-steps > div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; }
.ios-ic { width: 52px; height: 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: #1a73e8; }
.ios-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ios-arrow { font-size: 22px; color: var(--ink-3); }

/* 읽어주기 */
.tts-btn { margin-top: 10px; }
.tts-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tts-btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.tts-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin-top: 8px; }
.tts-rate select { font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 2px 4px; }
.stats { grid-template-columns: repeat(4, 1fr); }
/* 책 소개 숫자 칸: 쪽·완독·추천·펼침 네 칸을 한 줄에 (개발팀 제안 #8) */
.book-detail .stats div { min-width: 0; }
.book-detail .stats b { white-space: nowrap; }

/* 발행 심사 */
.review-box { text-align: left; margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); font-size: 14px; }
.review-box p { margin: 4px 0 0; color: var(--ink-2); }
.review-box.rejected { border-color: var(--accent); }
.review-box.rejected > b { color: var(--accent); }
.review-box .reason { color: var(--ink); }
.st-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); }
.st-badge.rejected { color: var(--accent); border-color: var(--accent); }

/* 5쪽마다 광고 한 줄 */
.page-flow .ad-line { margin: 26px 0; text-indent: 0; }
.page-flow .ad-line .house-ad { margin-top: 0; }

/* 운영 화면 */
.admin-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.admin-links .btn { flex: 1 1 140px; }
.rv-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--card); }
.rv-card h3 { font-size: 17px; }
.rv-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.meta .ko-tag { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.check.en-only { margin: 8px 0 0; font-size: 14px; }
.footer .link-btn { margin: 0; padding: 0; font-size: inherit; }

/* 운영: SNS 홍보물 */
.sns-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--card); }
.sns-card.posted { opacity: .75; }
.sns-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.sns-img { display: block; width: 100%; max-width: 360px; border-radius: 10px; border: 1px solid var(--line); margin: 0 auto 8px; }
.sns-text { white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.6; margin: 0 0 6px; padding: 10px 12px; background: var(--paper-2); border-radius: 8px; }

/* 파일로 책 쓰기 */
.upload-box { margin: 4px 0 14px; }
.upload-btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-style: dashed; cursor: pointer; }
.upload-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.upload-box .small { margin: 6px 2px 0; }
.counter .over { color: var(--accent); font-weight: 700; }
.draft-note { font-size: 12.5px; color: var(--ink-3); margin: -10px 0 14px; min-height: 1em; }
.draft-note:empty { display: none; }
.draft-note.warn { color: var(--accent); font-weight: 700; }

/* 운영: 광고 설정 */
.ad-setup { border: 1px solid var(--line, #ddd); border-radius: 12px; padding: 12px 14px; margin: 0 0 18px; }
.ad-setup h2 { margin-top: 0; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ad-setup textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; margin: 6px 0 8px; }
.badge { font-size: .78rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.badge.ok { background: #e3f4ea; color: #1d6b3f; }
.badge.warn { background: #fdeee0; color: #9a4a0c; }
@media (prefers-color-scheme: dark) { .badge.ok { background: #1d3a2a; color: #9be0b6; } .badge.warn { background: #3d2a17; color: #f3c08f; } }

/* 딸깍그룹 다른 사업 바로가기 (재개발 지도 · 마음쉼터) — 다른 동그란 단추와 같은 크기 */
.biz-link { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; flex: none; text-decoration: none; }
.biz-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.biz-buge { background: #e3eefb; color: #2f6db5; }
.biz-mind { background: #e6f3ea; color: #3b8a57; }
.biz-games { background: #fdf0d0; color: #a8770a; }
.biz-sales { background: #e8e9fb; color: #3d43b8; }
.biz-more { background: var(--paper-2, #efe9dc); color: var(--ink-2, #555); border: 0; padding: 0; cursor: pointer; }
.biz-inline { display: inline-flex; align-items: center; gap: inherit; }
.biz-wrap { position: relative; display: none; }
.biz-menu { position: fixed; top: 64px; right: 10px; max-width: calc(100vw - 20px); z-index: 60; display: grid; gap: 2px; min-width: 176px; padding: 6px; border-radius: 14px; background: var(--paper, #fff); border: 1px solid var(--line, #ddd); box-shadow: 0 8px 28px rgba(40, 30, 10, .16); }
.biz-menu[hidden] { display: none; }
.biz-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; font-size: 14px; color: var(--ink, #222); cursor: pointer; white-space: nowrap; }
.biz-item:hover { background: var(--paper-2, #f3eee3); }
@media (max-width: 559px) { .biz-inline { display: none; } .biz-wrap { display: inline-flex; } }
.biz-link:active { transform: translateY(1px); }
.biz-link::after { content: ''; position: absolute; inset: -7px -4px; border-radius: 12px; }
@media (max-width: 360px) { .biz-link::after { inset: -7px -2px; } }
@media (max-width: 340px) { .topbar-right { gap: 3px; } .topbar { padding-left: 12px; padding-right: 12px; } }

/* 유튜브 올리기 화면 */
.yt-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line, #ddd); border-radius: 12px; display: grid; gap: 8px; }
.yt-form h3 { margin: 0; font-size: 16px; }
.yt-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.yt-form label.check { display: flex; font-weight: 400; }
.yt-form input, .yt-form textarea, .yt-form select { font: inherit; padding: 8px 10px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--bg, #fff); color: inherit; width: 100%; box-sizing: border-box; }
.yt-form .warn { color: #a8472a; font-weight: 600; }

/* 2026년 가입 회원 '애독자' 배지 (2026-11-13) */
.beta-banner { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; margin: 0 0 12px; border: 1px dashed var(--accent); border-radius: 12px; font-size: .88rem; }
.beta-banner .btn { flex: none; }
.first-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #e8f3e6; color: #2f6b34; border: 1px solid #b9d8b4; vertical-align: middle; white-space: nowrap; }

