/* 서고 — 다크 리더 테마
   팔레트: 배경 #141416 / 패널 #1c1d20 / 선 #2a2b30 / 글자 #f0efe9 / 뮤트 #94938c / 황동 #c9a25c */

:root {
  --bg: #141416;
  --panel: #1c1d20;
  --panel-2: #222327;
  --line: #2a2b30;
  --text: #f0efe9;
  --muted: #94938c;
  --brass: #c9a25c;
  --brass-dim: #8a7040;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-num: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── 공용 바 ──────────────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 20px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--text);
}

.bar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-stat {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--brass-dim); }

/* ── 로그인 ──────────────────────────────────────────────── */
#view-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-wrap {
  width: min(360px, 100%);
  text-align: center;
}

.login-mark {
  font-size: 44px;
  line-height: 1;
  color: var(--brass);
  margin-bottom: 14px;
}

.login-title {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0.3em;
  text-indent: 0.3em; /* 자간 보정 */
  font-weight: 700;
}

.login-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  display: grid;
  gap: 16px;
  text-align: left;
}

.field { display: grid; gap: 6px; }

.field-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

.field input:focus {
  outline: none;
  border-color: var(--brass-dim);
}

.btn-primary {
  background: var(--brass);
  border: none;
  border-radius: 6px;
  color: #141416;
  font: inherit;
  font-weight: 700;
  padding: 11px;
  cursor: pointer;
  transition: filter 0.15s;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { filter: saturate(0.4) brightness(0.7); cursor: wait; }

.login-error {
  margin: 0;
  color: #e08f7a;
  font-size: 13.5px;
  text-align: center;
}

/* ── 목록 ────────────────────────────────────────────────── */
.list-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.list-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.list-filter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  width: min(280px, 100%);
}

.list-filter:focus { outline: none; border-color: var(--brass-dim); }

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.12s;
}

.chapter-item:hover { background: var(--panel); }

.chapter-item.current {
  background: var(--panel);
  box-shadow: inset 2px 0 0 var(--brass);
}

.ch-no {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--brass);
  min-width: 52px;
  text-align: right;
}

.ch-title {
  flex: 1;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-chars {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── 리더 ────────────────────────────────────────────────── */
.reader-bar { position: sticky; }

.reader-pos {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  margin-right: 4px;
}

.reader-tools { display: flex; gap: 6px; }

.progress {
  height: 2px;
  background: var(--line);
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brass);
  transition: width 0.1s linear;
}

.reader-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 20px 90px;
  scroll-behavior: smooth;
}

.chapter-head {
  margin-bottom: 42px;
  text-align: center;
}

.chapter-eyebrow {
  margin: 0 0 10px;
  color: var(--brass);
  font-family: var(--font-num);
  font-size: 13px;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  font-variant-numeric: tabular-nums;
}

.chapter-title {
  margin: 0;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  line-height: 1.4;
}

.chapter-body {
  font-size: var(--reader-size, 17px);
  line-height: 1.95;
  letter-spacing: 0.005em;
  word-break: keep-all;
}

.chapter-body p {
  margin: 0 0 1.15em;
}

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.nav-link {
  text-decoration: none;
  color: var(--brass);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.nav-link:hover { border-color: var(--brass-dim); }

.nav-pos {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ── 반응형 / 접근성 ─────────────────────────────────────── */
@media (max-width: 560px) {
  .bar-inner { padding: 10px 14px; }
  .reader-pos { display: none; }
  .ch-chars { display: none; }
  .list-main { padding: 20px 14px 60px; }
  .reader-main { padding: 32px 16px 70px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
