/* 번역서가 — 글자만으로 만든 책장. 색은 먹색·종이색·강조색 한 가지만 쓴다. */
:root {
  --bg: #faf8f4;
  --paper: #ffffff;
  --ink: #1c1b19;
  --sub: #55524c;
  --line: #d8d3c8;
  --gray: #ebe7df;
  --accent: #9a3412;
  --accent-soft: #f1dfd6;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 12px 16px; z-index: 20;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------- 머리 ---------- */
.top { border-bottom: 2px solid var(--ink); background: var(--bg); }
.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-height: 56px; flex-wrap: wrap;
}
.brand {
  font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
}
.brand-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.brand-mark i { display: block; width: 5px; background: var(--ink); }
.brand-mark i:nth-child(1) { height: 16px; }
.brand-mark i:nth-child(2) { height: 22px; background: var(--accent); }
.brand-mark i:nth-child(3) { height: 19px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a {
  color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 600;
  padding: 0 10px; min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 26px; line-height: 1.3; margin: 0 0 10px; letter-spacing: -0.01em; }
.hero .lead { margin: 0 0 12px; color: var(--ink); }
.proof {
  margin: 0 0 6px; padding: 10px 12px;
  border-left: 6px solid var(--accent); background: var(--paper);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.proof strong { color: var(--accent); font-size: 19px; }
.proof .asof { display: block; color: var(--sub); font-size: 16px; margin-top: 2px; }

h2 { font-size: 22px; line-height: 1.35; margin: 36px 0 12px; }
h3 { font-size: 18px; line-height: 1.4; margin: 24px 0 8px; }
.sec-note { color: var(--sub); font-size: 16px; margin: 0 0 10px; }

/* ---------- 세워 꽂은 책등 ---------- */
.shelf-label { margin: 18px 0 8px; font-size: 16px; font-weight: 700; }
.shelf-label span { font-weight: 400; color: var(--sub); }
.shelf {
  display: flex; align-items: flex-end; gap: 3px;
  overflow-x: auto; padding: 4px 2px 0;
  border-bottom: 7px solid var(--ink);
  scrollbar-width: thin;
}
.spine {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: 6px; padding: 8px 4px 6px;
  border: 1.5px solid var(--ink); border-bottom: 0;
  background: var(--paper); color: var(--ink);
  font: inherit; cursor: pointer; text-align: center;
}
.spine:hover { border-color: var(--accent); }
.spine-rank { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.spine-title {
  writing-mode: vertical-rl; text-orientation: mixed;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
  font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: 0.02em;
}
.spine-n { font-size: 15px; font-variant-numeric: tabular-nums; }
.spine:focus-visible { outline-offset: -4px; }
.spine.t1 { background: var(--accent); color: #fff; }
.spine.t2 { background: var(--accent-soft); }
.spine.t3 { background: var(--paper); }
.spine.t4 { background: var(--gray); }

/* ---------- 찾기 도구 ---------- */
.tools { margin: 18px 0 8px; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 12px;
  font: inherit; font-size: 17px; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 6px;
  -webkit-appearance: none; appearance: none;
}
.search-row input::placeholder { color: #6b675f; }

.chips {
  display: flex; flex-wrap: nowrap; gap: 6px; margin: 10px 0 0; padding: 0 0 6px; list-style: none;
  overflow-x: auto; scrollbar-width: thin;
}
.chips li { flex: 0 0 auto; }
.chip { white-space: nowrap; }
.chips-hint { margin: 2px 0 0; font-size: 16px; color: var(--sub); }
.chip, .btn {
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2;
  min-height: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 6px;
  cursor: pointer; text-decoration: none; text-align: center;
}
.chip[aria-pressed="true"], .btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip:hover, .btn:hover { border-color: var(--accent); }
.chip small { font-size: 15px; font-weight: 400; opacity: 0.9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #7c2a0e; border-color: #7c2a0e; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.row2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.row2 label { font-size: 16px; font-weight: 600; }
.row2 select {
  font: inherit; font-size: 16px; min-height: 44px; padding: 0 8px;
  border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink);
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.status { margin: 14px 0 8px; font-size: 16px; color: var(--sub); }
.status strong { color: var(--ink); }

.notice {
  margin: 10px 0; padding: 10px 12px; background: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 6px; font-size: 16px;
}
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin-bottom: 0; }
.disclosure { font-size: 16px; font-weight: 600; margin: 0 0 10px; }

/* ---------- 눕혀 쌓은 책등(목록) ---------- */
.stack { list-style: none; margin: 0; padding: 0; }
.book {
  display: grid; grid-template-columns: 46px 1fr;
  background: var(--paper);
  border: 1.5px solid var(--ink); border-bottom-width: 0;
  scroll-margin-top: 12px;
}
.book:last-child { border-bottom-width: 1.5px; }
.book-rank {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12px; font-weight: 800; font-size: 17px;
  font-variant-numeric: tabular-nums;
  border-right: 1.5px solid var(--ink);
}
.book.t1 .book-rank { background: var(--accent); color: #fff; }
.book.t2 .book-rank { background: var(--accent-soft); }
.book.t3 .book-rank { background: var(--paper); }
.book.t4 .book-rank { background: var(--gray); }
.book-main { padding: 10px 12px 12px; min-width: 0; }
.book-ko { margin: 0; font-size: 19px; line-height: 1.35; font-weight: 800; }
.book-en { margin: 2px 0 0; font-size: 16px; color: var(--sub); line-height: 1.4; }
.book-meta { margin: 4px 0 0; font-size: 16px; line-height: 1.45; }
.book-n { margin: 4px 0 0; font-size: 16px; }
.book-n strong { font-variant-numeric: tabular-nums; }
.book-n .fz { color: var(--sub); font-size: 16px; }
.book-actions { display: grid; grid-template-columns: 1.25fr 0.85fr 0.9fr; gap: 6px; margin-top: 10px; }
.book-actions .btn-primary { grid-column: 1 / -1; }
.book-actions .btn { padding: 0 4px; }
.book-more code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; background: var(--gray); padding: 1px 4px; overflow-wrap: anywhere; }
.book-more { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--sub); font-size: 16px; }
.book-more p { margin: 0 0 6px; }
.book-more dl { margin: 0; }
.book-more dt { font-weight: 700; margin-top: 6px; }
.book-more dd { margin: 0; }
.book.flash { outline: 3px solid var(--accent); outline-offset: -3px; }
.sale-note { color: var(--sub); font-size: 16px; }

.more-row { margin: 12px 0 0; }

.empty {
  border: 1.5px solid var(--ink); background: var(--paper); padding: 14px; border-radius: 6px;
}
.empty p { margin: 0 0 8px; }
.empty ul { margin: 0 0 8px; padding-left: 20px; }

/* ---------- 내 서가 ---------- */
.mine { border: 1.5px solid var(--ink); background: var(--paper); padding: 14px; border-radius: 6px; }
.mine p { margin: 0 0 8px; }
.meter { height: 14px; background: var(--gray); border: 1px solid var(--ink); margin: 6px 0 10px; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); }
.mine-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help { font-size: 16px; color: var(--sub); margin: 8px 0 0; }

/* ---------- 안내 글 목록, 쓰는 법, 질문 ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cards a {
  display: block; padding: 12px 14px; background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 6px; text-decoration: none;
}
.cards a:hover { border-color: var(--accent); }
.cards b { display: block; font-size: 18px; line-height: 1.4; }
.cards span { display: block; color: var(--sub); font-size: 16px; margin-top: 2px; }

.steps { padding-left: 22px; margin: 0; }
.steps li { margin-bottom: 8px; }

details.qa { border-top: 1.5px solid var(--ink); }
details.qa:last-of-type { border-bottom: 1.5px solid var(--ink); }
details.qa summary {
  cursor: pointer; font-weight: 700; min-height: 48px; padding: 10px 0;
  display: flex; align-items: center; list-style: none; gap: 8px;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before { content: "+"; font-weight: 800; color: var(--accent); width: 16px; flex: 0 0 16px; }
details.qa[open] summary::before { content: "−"; }
details.qa .a { padding: 0 0 12px 24px; }
details.qa .a p { margin: 0 0 8px; }

/* ---------- 함께 쓰면 좋은 것 ---------- */
.money { margin-top: 36px; border: 1.5px solid var(--ink); background: var(--paper); padding: 14px; border-radius: 6px; }
.money h2 { margin: 0 0 8px; }
.money ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.money li { border-top: 1px solid var(--line); padding-top: 8px; }
.money li b { display: block; }
.money li span { display: block; color: var(--sub); font-size: 16px; margin-bottom: 6px; }

/* ---------- 글(안내 쪽) ---------- */
.doc { padding: 20px 0 0; }
.doc h1 { font-size: 26px; line-height: 1.35; margin: 0 0 8px; letter-spacing: -0.01em; }
.doc .byline { color: var(--sub); font-size: 16px; margin: 0 0 16px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 14px; }
.doc li { margin-bottom: 6px; }
.doc .key {
  border-left: 6px solid var(--accent); background: var(--paper);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 10px 12px; margin: 0 0 16px;
}
.doc .key p:last-child, .doc .key ul:last-child { margin-bottom: 0; }
.tablewrap { overflow-x: auto; margin: 0 0 14px; border: 1.5px solid var(--ink); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--gray); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.tablewrap.wide table { min-width: 620px; }
.swipe { font-size: 16px; color: var(--sub); margin: 0 0 6px; }
.src { font-size: 16px; color: var(--sub); }
.src li { margin-bottom: 4px; }
.cta { margin: 20px 0; }
.crumbs { font-size: 16px; margin: 14px 0 0; }

/* ---------- 바닥 ---------- */
.foot { margin-top: 44px; border-top: 2px solid var(--ink); padding: 16px 0 40px; font-size: 16px; color: var(--sub); }
.foot p { margin: 0 0 6px; }
.foot a { color: var(--ink); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.foot-nav a { min-height: 44px; display: inline-flex; align-items: center; font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: calc(100% - 32px); width: max-content;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 6px;
  font-size: 16px; z-index: 30;
}
.toast[hidden] { display: none; }

[hidden] { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 620px) {
  .hero h1, .doc h1 { font-size: 32px; }
  .chips { flex-wrap: wrap; overflow-x: visible; }
  .chips-hint { display: none; }
  .swipe { display: none; }
  .book { grid-template-columns: 56px 1fr; }
  .book-actions { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .book-actions .btn-primary { grid-column: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .mine-actions { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .top, .tools, .shelf, .shelf-label, .book-actions, .money, .toast, .more-row { display: none !important; }
}
