:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efe9e1;
  --text: #2b2724;
  --muted: #776e66;
  --border: #e2dad0;
  --accent: #b5562f;
  --accent-hover: #9c4723;
  --accent-text: #ffffff;
  --danger: #b33a3a;
  --star: #d99a1e;
  --kyobo: #2f7d5b;
  --school: #3e6fa1;
  --shadow: 0 1px 2px rgba(43, 39, 36, 0.06), 0 4px 12px rgba(43, 39, 36, 0.06);
  --radius: 12px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1917;
    --surface: #25221f;
    --surface-2: #302c28;
    --text: #ece6df;
    --muted: #a59c93;
    --border: #3a3531;
    --accent: #e07a4f;
    --accent-hover: #ea8f68;
    --accent-text: #1b1917;
    --danger: #e07070;
    --star: #f0b84a;
    --kyobo: #5cc095;
    --school: #7aa7dc;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.3; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- 상단 바 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.topbar-actions { display: flex; gap: 4px; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---------- 버튼, 입력 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
a.btn { text-decoration: none; }

/* ---------- 교보문고 · 학교도서관 메뉴 ---------- */

.link-panel { margin-bottom: 24px; }
.link-panel:empty { display: none; }
.toolbar .link-panel { margin-bottom: 0; }
.link-panel-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.link-tile {
  --tone: var(--accent);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px 12px 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.link-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone);
}
.link-tile:hover {
  border-color: var(--tone);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tone) 20%, transparent);
  transform: translateY(-1px);
}
.tone-kyobo { --tone: var(--kyobo); }
.tone-school { --tone: var(--school); }

.icon { display: block; }
.link-tile-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
}
.link-tile-icon .icon { width: 22px; height: 22px; }
.link-tile-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.link-tile-text strong { font-size: 0.98rem; }
.link-tile-text span { font-size: 0.8rem; color: var(--muted); }
.link-tile-arrow { color: var(--muted); transition: transform 0.15s, color 0.15s; }
.link-tile-arrow .icon { width: 18px; height: 18px; }
.link-tile:hover .link-tile-arrow { color: var(--tone); transform: translate(2px, -2px); }

/* 책 추가 창 안의 작은 버전 */
#dialog-links { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: -4px; }
.link-tile.compact { gap: 8px; padding: 8px 10px 8px 14px; }
.link-tile.compact .link-tile-icon { width: 30px; height: 30px; border-radius: 8px; }
.link-tile.compact .link-tile-icon .icon { width: 17px; height: 17px; }
.link-tile.compact .link-tile-text strong { font-size: 0.85rem; }
.link-tile.compact .link-tile-text span { display: none; }

input:not([type="file"]), select, textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; }

.field-row { display: flex; gap: 12px; }
.field-row > label { flex: 1; }
.field-row.inline { align-items: center; flex-wrap: wrap; gap: 8px; }
.field-row.inline select { width: auto; }

/* ---------- 내 서재 ---------- */

.btn.lg { padding: 11px 22px; font-size: 1rem; border-radius: 10px; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 28px;
  margin-bottom: 36px;
  padding: 36px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%),
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--school) 10%, transparent), transparent 50%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
}
.hero-eyebrow { margin: 0 0 10px; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.hero h1 {
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4.2vw, 2.3rem);
  word-break: keep-all;
}
.hero-lead { margin: 0 0 22px; color: var(--muted); word-break: keep-all; }

.hero-quote {
  position: relative;
  margin: 0;
  padding: 26px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.hero-quote::before {
  content: "\201C";
  position: absolute;
  top: -6px;
  left: 16px;
  font-family: var(--serif);
  font-size: 4.2rem;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.hero-quote-label { margin: 0 0 6px; font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.hero-quote blockquote {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.hero-quote figcaption { font-size: 0.85rem; color: var(--muted); }

.hero-shelf {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 170px;
  padding: 0 16px;
  border-bottom: 6px solid color-mix(in srgb, var(--text) 18%, transparent);
}
.spine {
  width: 28px;
  height: var(--h);
  border-radius: 3px 3px 0 0;
  background:
    linear-gradient(transparent 14%, rgba(255, 255, 255, 0.35) 14% 17%, transparent 17% 80%, rgba(255, 255, 255, 0.35) 80% 83%, transparent 83%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 35%),
    var(--c);
}
.spine.tilt { margin-left: 14px; transform: rotate(-10deg); transform-origin: bottom left; }

.stats, .steps { grid-column: 1 / -1; display: grid; gap: 10px; margin: 0; padding: 0; }
.stats { grid-template-columns: repeat(4, 1fr); }
.stat {
  padding: 14px 16px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stat dt { font-size: 0.8rem; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat dd small { margin-left: 3px; font-family: inherit; font-size: 0.85rem; font-weight: 400; color: var(--muted); }

.steps { grid-template-columns: repeat(3, 1fr); list-style: none; }
.steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.step-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
}
.steps strong { display: block; font-size: 0.95rem; }
.steps p { margin: 0; font-size: 0.82rem; color: var(--muted); word-break: keep-all; }

.section { margin-bottom: 36px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { font-family: var(--serif); font-size: 1.3rem; }

.reading-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.reading-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}
.reading-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cover.mini { width: 64px; flex-shrink: 0; padding: 6px; border-radius: 4px; }
.cover.mini span { font-size: 0.7rem; -webkit-line-clamp: 3; }
.reading-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reading-info h3 { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reading-info p { margin: 0; }
.reading-days { color: var(--accent); font-weight: 600; }
.reading-cta { margin-top: auto; padding-top: 6px; font-size: 0.85rem; font-weight: 600; }
.reading-card:hover .reading-cta { color: var(--accent); }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px; }
  .hero-shelf { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}

.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

/* ---------- 검색창 옆 책 정보 ---------- */

.search-area { display: grid; gap: 12px; }
.search-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.book-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.book-info:empty { display: none; }

.holding-card { gap: 10px; }
.holding-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}
.holding-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--school) 14%, transparent);
  color: var(--school);
}
.holding-icon .icon { width: 17px; height: 17px; }
.holding-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font-size: 0.92rem; }
.holding-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.holding-status.owned .holding-badge { background: color-mix(in srgb, #4f8146 18%, transparent); color: #4f8146; }
.holding-status.missing .holding-badge { background: var(--surface-2); color: var(--muted); }
.holding-status.busy .holding-badge { background: color-mix(in srgb, var(--star) 22%, transparent); color: #9a6a10; }

.loan-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.loan-chip {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.loan-chip.ok { background: color-mix(in srgb, #4f8146 16%, transparent); color: #3f6b37; }
.loan-chip.busy { background: color-mix(in srgb, var(--star) 20%, transparent); color: #8a5e0c; }
.loan-chip.etc { background: var(--surface-2); color: var(--muted); }
.loan-chip.pending { color: var(--muted); border-color: var(--border); }
.holding-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.holding-list li {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--school) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--school) 18%, var(--border));
  border-radius: 10px;
}
.holding-call { font-size: 0.85rem; color: var(--muted); }
.holding-call strong { margin-left: 4px; font-size: 1.05rem; color: var(--text); letter-spacing: 0.02em; }
.holding-link { align-self: flex-start; font-size: 0.85rem; color: var(--school); text-decoration: none; }
.holding-link:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  .holding-status.owned .holding-badge { color: #8cc483; }
  .holding-status.busy .holding-badge, .loan-chip.busy { color: #f0c46a; }
  .loan-chip.ok { color: #8cc483; }
}

/* 좁은 화면에서는 책 정보를 검색창 바로 아래, 바깥 사이트 메뉴보다 위에 둔다. */
@media (max-width: 759px) {
  .search-main { display: contents; }
  .search-area #search { order: 0; }
  .search-area .book-info { order: 1; }
  .search-area .link-panel { order: 2; }
}

@media (min-width: 760px) {
  .search-area.has-info { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
  .search-area.has-info .link-grid { grid-template-columns: 1fr; }
}

.info-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.info-message { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 20px 16px; }
.info-main { display: flex; gap: 14px; }
.info-thumb {
  flex-shrink: 0;
  width: 84px;
  aspect-ratio: 120 / 174;
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(160deg, var(--cover), color-mix(in srgb, var(--cover) 70%, #000));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.info-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.info-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.info-body h3 { font-family: var(--serif); font-size: 1.15rem; overflow-wrap: anywhere; }
.info-body p { margin: 0; }
.info-label { margin: 0; font-size: 0.72rem; font-weight: 700; color: var(--kyobo); letter-spacing: 0.02em; }
.info-desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.info-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.info-kyobo { color: var(--kyobo); border-color: color-mix(in srgb, var(--kyobo) 40%, var(--border)); }
.info-kyobo:hover { background: color-mix(in srgb, var(--kyobo) 10%, transparent); }

.info-others { border-top: 1px solid var(--border); padding-top: 10px; }
.info-others ul { list-style: none; margin: 6px 0 0; padding: 0; }
.info-others button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
}
.info-others button:hover { background: var(--surface-2); }
.other-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.info-others .muted { flex-shrink: 0; }
.info-source { margin: 0; font-size: 0.72rem; color: var(--muted); text-align: right; }

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 50%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
.skeleton.thumb { width: 84px; aspect-ratio: 120 / 174; flex-shrink: 0; }
.skeleton.line { height: 12px; width: 100%; }
.skeleton.w40 { width: 40%; } .skeleton.w55 { width: 55%; } .skeleton.w70 { width: 70%; } .skeleton.w85 { width: 85%; }
.info-card.loading .info-body { flex: 1; gap: 10px; padding-top: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}
.chip.active { background: var(--text); color: var(--bg); }
.count { opacity: 0.7; font-size: 0.85em; margin-left: 2px; }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.book-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.book-card:hover { transform: translateY(-2px); }
.book-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.book-card h3 {
  font-size: 1rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.book-card p { margin: 0; }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 6px, rgba(255, 255, 255, 0.08) 6px 8px, transparent 8px),
    linear-gradient(160deg, var(--cover), color-mix(in srgb, var(--cover) 70%, #000));
  color: #fff;
}
.cover span {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-2);
}
.cover.large { width: 140px; flex-shrink: 0; border-radius: 6px; box-shadow: var(--shadow); }

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
}
.badge.reading { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge.done { background: color-mix(in srgb, #4f8146 20%, transparent); color: #4f8146; }
@media (prefers-color-scheme: dark) {
  .badge.done { color: #8cc483; }
}

.stars { color: var(--star); letter-spacing: 1px; }

.empty { text-align: center; padding: 48px 16px; grid-column: 1 / -1; }
.empty p { margin: 0 0 6px; }
.empty .btn { margin-top: 12px; }

/* ---------- 책 상세 ---------- */

.back { display: inline-block; margin-bottom: 16px; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--text); }

.detail-head { display: flex; gap: 20px; margin-bottom: 28px; }
.detail-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail-info h1 { font-family: var(--serif); font-size: 1.6rem; overflow-wrap: anywhere; }
.detail-info p { margin: 0; }
.detail-actions { display: flex; gap: 8px; margin-top: 4px; }

.rating { display: flex; }
.star {
  padding: 2px 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--border);
}
.star.on { color: var(--star); }
.star:hover { transform: scale(1.12); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* 독후감 */
.report { display: flex; flex-direction: column; gap: 10px; }
.report-title {
  font-family: var(--serif);
  font-size: 1.25rem !important;
  font-weight: 700;
}
.report textarea {
  min-height: 55vh;
  padding: 16px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.9;
}
.report-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 구절 */
.quote-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.quote-form .field-row input:not(.page-input) { flex: 1; width: auto; min-width: 140px; }
.page-input { width: 80px !important; }

.quote-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.quote {
  position: relative;
  padding: 16px 44px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.quote blockquote {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.quote p { margin: 0; }
.quote-note { margin-top: 8px !important; padding-top: 8px; border-top: 1px dashed var(--border); white-space: pre-wrap; }
.icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }

/* ---------- 책 추가 창 ---------- */

dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
dialog h2 { font-size: 1.2rem; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
dialog label > * { color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 책 추가 창 안의 검색 결과 */
.dialog-search { display: flex; flex-direction: column; gap: 8px; margin-top: -4px; }
.dialog-search:empty { display: none; }
.dialog-search-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dialog-search-label { margin: 0; font-size: 0.78rem; font-weight: 700; color: var(--kyobo); }
.dialog-search-msg { margin: 0; padding: 10px 12px; font-size: 0.85rem; color: var(--muted); background: var(--surface-2); border-radius: 8px; }
.link-btn { padding: 0; background: none; border: none; color: var(--accent); font-size: 0.8rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.pick:hover { background: var(--surface-2); }
.pick.selected { background: color-mix(in srgb, var(--kyobo) 8%, var(--surface)); border-color: color-mix(in srgb, var(--kyobo) 40%, var(--border)); cursor: default; }
.pick-thumb {
  flex-shrink: 0;
  width: 34px;
  aspect-ratio: 120 / 174;
  overflow: hidden;
  border-radius: 3px;
  background: linear-gradient(160deg, var(--cover), color-mix(in srgb, var(--cover) 70%, #000));
}
.pick-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.pick-text strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text span { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-check { flex-shrink: 0; color: var(--kyobo); font-weight: 700; }
.pick-loading { display: flex; flex-direction: column; gap: 6px; }
.pick-skel { height: 52px; }
.dialog-search .holding-card { padding: 12px; box-shadow: none; }

/* ---------- 좁은 화면 ---------- */

@media (max-width: 520px) {
  main { padding-top: 16px; }
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cover.large { width: 96px; }
  .detail-head { gap: 14px; }
  .detail-info h1 { font-size: 1.3rem; }
  .report textarea { min-height: 50vh; }
}
