/* 소설 사이트: 홈페이지 모양(home.css)에 색만 먹색 + 붉은 점으로 바꿈. 책장 · 기본 표지는 여기 */
:root {
  color-scheme: light dark;
  --bg: #F4F2EF; --surface: #ECE9E4; --card: #FBFAF8; --ink: #1C1C1C; --muted: #4F4B47; --faint: #6E6A66;
  --line: #DDD8D1; --line2: #CBC5BC; --accent: #A23B3B; --accent-ink: #8E3030; --accent-soft: #F3E4E1;
  --n-top: rgba(244, 242, 239, .88); --n-hover: #D2B6B0; --n-cover: #2A2725; --n-cover-ink: #EDE8E1;
}
/* 어두운 화면: 위 메뉴 단추로 고른 것(data-theme, novel.js)이 먼저, 안 골랐으면 기기 설정 */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #181616; --surface: #211E1D; --card: #1F1C1B; --ink: #D8D4CF; --muted: #B5B0AA; --faint: #928D88;
    --line: #322E2B; --line2: #443F3B; --accent: #E58B8B; --accent-ink: #EBA0A0; --accent-soft: #3A2423;
    --n-top: rgba(24, 22, 22, .88); --n-hover: #5A3B39; --n-cover: #2B2725; --n-cover-ink: #D8D4CF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #181616; --surface: #211E1D; --card: #1F1C1B; --ink: #D8D4CF; --muted: #B5B0AA; --faint: #928D88;
    --line: #322E2B; --line2: #443F3B; --accent: #E58B8B; --accent-ink: #EBA0A0; --accent-soft: #3A2423;
    --n-top: rgba(24, 22, 22, .88); --n-hover: #5A3B39; --n-cover: #2B2725; --n-cover-ink: #D8D4CF;
  }
}
:root[data-theme="light"] { color-scheme: light; }
html { scrollbar-gutter: stable; }
.prose { color: var(--ink); } /* home.css 는 글자색이 고정값이라 어두운 화면에서 안 보임 */
.top { background: var(--n-top); }
.top nav span { height: 34px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--faint); font-size: 18px; font-weight: 500; opacity: .6; }
.card:hover { border-color: var(--n-hover); }
:root[data-theme="dark"] .btn.primary { color: #1c1c1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #1c1c1c; } }
.ntheme { flex: none; justify-content: center; width: 34px; padding: 0; background: none; font: 16px/1 var(--font); cursor: pointer; }

.list.nrecent li { flex-flow: row nowrap; align-items: baseline; gap: 10px; padding: 12px 18px; }
.nrecent a { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.nrecent a span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nrecent em { flex: none; min-width: 2.6em; color: var(--accent); font-size: 13.5px; font-style: normal; font-weight: 600; }

.tabs { margin: 0 0 18px; }
.pagehead .tabs { margin: 14px 0 0; }
.nbooks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ncover { display: flex; align-items: center; aspect-ratio: 3 / 4; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--n-cover); color: var(--n-cover-ink); }
.ncover img { width: 100%; height: 100%; object-fit: cover; }
.ncoverword { display: block; padding: 14%; font-size: 15px; font-weight: 600; line-height: 1.45; }
.nbook .cardbody { padding: 12px 12px 14px; }
.nbook h3 { margin-top: 8px; font-size: 15.5px; line-height: 1.4; letter-spacing: -.2px; }
.nbook .badge { height: 20px; padding: 0 6px; font-size: 12px; }

/* 자료실: 위키 모양. 왼쪽 분류는 스크롤을 따라옴, 항목은 이름 + 짧은 설명 */
.wiki { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 40px; margin-top: 36px; }
.wikiside { position: sticky; top: 92px; align-self: start; }
.wikiside h1 { margin-bottom: 14px; font-size: 24px; line-height: 1.35; letter-spacing: -.5px; }
.wikiside .crumb { margin-bottom: 4px; font-size: 13.5px; color: var(--faint); }
/* 자료실 첫 화면: 세계관 카드 */
.arcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 8px; }
.arcard { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.arcard:hover { border-color: var(--n-hover); }
.arcard strong { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.arcard span { color: var(--muted); font-size: 15px; line-height: 1.6; }
.arcard small { margin-top: auto; padding-top: 6px; color: var(--faint); font-size: 13.5px; }
.wikiside input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--card); color: var(--ink); font: 15px var(--font); }
.wikiside input:focus { outline: 0; border-color: var(--accent); }
.wikiside nav { display: grid; gap: 2px; margin-top: 12px; }
.wikiside nav a { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: 15px; font-weight: 500; }
.wikiside nav a:hover { background: var(--surface); color: var(--ink); }
.wikiside nav span { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.wikimain { max-width: 760px; }
.wikisec { margin-bottom: 36px; scroll-margin-top: 92px; }
.wikisec h2 { padding-bottom: 8px; border-bottom: 2px solid var(--accent); font-size: 21px; letter-spacing: -.4px; }
.wikiitem { display: block; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.wikiitem strong { display: block; font-size: 16px; font-weight: 600; }
.wikiitem span { display: block; margin-top: 3px; color: var(--muted); font-size: 15px; line-height: 1.65; }
.wikiitem:hover strong { color: var(--accent); }
.wikiworks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.wikiworks button { max-width: 100%; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: 500 13px var(--font); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wikiworks button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nitem { max-width: 720px; margin-top: 36px; }
.nitem h1 { font-size: clamp(24px, 3vw, 30px); line-height: 1.4; letter-spacing: -.5px; }
.nitem .prose { margin-top: 14px; }
.nspoiler { margin-top: 22px; padding: 12px 16px; border: 1px dashed var(--line2); border-radius: 12px; }
.nspoiler summary { color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer; }
/* 메인 대표 작품: 표지를 크게, 긴 제목도 시원하게 */
.nhero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: center; margin-top: 32px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.nhero .ncover { border: 0; border-radius: 10px; }
.nhero h1 { margin-top: 10px; font-size: clamp(23px, 3vw, 32px); line-height: 1.38; letter-spacing: -.6px; }
.nhero h1 a:hover { color: var(--accent); }
@media (max-width: 620px) { .nhero { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; margin-top: 20px; padding: 14px; } .nhero .ncoverword { padding: 10%; font-size: 12px; } .nhero .nsum { display: none; } .nhero h1 { font-size: 18px; } .nhero .btns { margin-top: 12px; } .nhero .btn { height: 36px; padding: 0 12px; font-size: 14px; } }
@media (max-width: 760px) {
  .wiki { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 24px; }
  .wikiside { position: static; }
  .wikiside nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .wikiside nav a { gap: 6px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
}
/* 작품 페이지 */
.nworkhead { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; margin-top: 36px; align-items: start; }
.nworkhead .ncover { border: 1px solid var(--line); border-radius: 10px; }
.nworkhead h1 { margin-top: 10px; font-size: clamp(24px, 3vw, 32px); line-height: 1.35; letter-spacing: -.6px; }
.nsum { margin-top: 12px; color: var(--muted); }
.neps ol, .nside ol { margin: 0; padding: 0; list-style: none; }
.neps details + details, .neps details + ol { margin-top: 10px; }
.neps summary, .nside summary { padding: 6px 2px; font-weight: 600; cursor: pointer; }
.neps li a { display: flex; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.neps li a:hover { color: var(--accent); }
.neps li span { flex: none; min-width: 3.4em; color: var(--accent); font-size: 14px; font-weight: 600; }

/* 소설 뷰어: 본문은 한 줄 35~40자로 좁게 */
:root { --rfs: 18px; }
.nread { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 44px; margin-top: 32px; }
.nread.one { display: block; }
.nside { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 108px); padding-right: 8px; overflow-y: auto; scrollbar-gutter: stable; font-size: 14.5px; }
.nsidehead { display: block; margin-bottom: 8px; font-size: 15.5px; font-weight: 700; line-height: 1.4; }
.nside summary { color: var(--muted); font-size: 14px; }
.nside li a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--muted); line-height: 1.45; }
.nside li span { margin-right: 6px; color: var(--faint); font-size: 13px; }
.nside li a:hover { background: var(--surface); color: var(--ink); }
.nside li a[aria-current] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nside li a[aria-current] span { color: inherit; }
.nbody { width: min(720px, 100%); min-width: 0; margin: 0 auto; }
.nbody header { position: relative; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.nbody h1 { padding-right: 100px; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.4; letter-spacing: -.5px; }
.nbody header p { margin-top: 4px; color: var(--faint); font-size: 15px; }
.ntools { position: absolute; top: 0; right: 0; display: flex; gap: 6px; }
.ntools .gh { height: 32px; padding: 0 9px; background: none; font-family: var(--font); cursor: pointer; }
#toc-btn { display: none; }
.ntext { padding-top: 26px; font-size: var(--rfs); line-height: 1.95; }
.ntext p { margin: 0 0 1.25em; }
.nill { margin: 1.8em 0; }
.nill img { width: 100%; border-radius: 6px; }
.nill figcaption { margin-top: 8px; color: var(--faint); font-size: 14px; text-align: center; }
.npager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; font-weight: 500; }
.npager span { color: var(--faint); opacity: .7; }
.npager a:hover { color: var(--accent); }
.npager .next { padding: 9px 16px; border-radius: 10px; background: var(--accent); color: var(--bg); font-weight: 600; }
.npager .next:hover { color: var(--bg); opacity: .9; }
@media (max-width: 860px) {
  .nread { display: block; margin-top: 20px; }
  #toc-btn { display: inline-flex; }
  .nbody h1 { padding-right: 0; padding-top: 42px; }
  .ntools { left: 0; right: auto; }
  .nside { position: static; display: none; max-height: 60vh; margin-bottom: 20px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .nread.tocopen .nside { display: block; }
}
#pageno { display: none; }
.ntools .ntheme { display: none; }
/* 휴대폰 뷰어: 메뉴를 숨기고 화면을 꽉 채운 페이지 방식. 위는 제목 · 도구, 아래는 이전화 · 쪽 번호 · 다음화 */
html.paged, html.paged body { height: 100dvh; min-height: 0; overflow: hidden; scrollbar-gutter: auto; }
html.paged .top, html.paged .foot { display: none; }
html.paged main.wrap { height: 100%; padding: 0 16px; }
html.paged .nread { height: 100%; margin: 0; }
html.paged .nbody { display: flex; flex-direction: column; width: 100%; height: 100%; }
html.paged .nbody header { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 10px 0 8px; }
html.paged .nbody h1 { padding: 0; font-size: 14.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.paged .nbody header p { grid-row: 2; margin: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.paged .ntools { position: static; grid-column: 2; grid-row: 1 / span 2; gap: 4px; }
html.paged .ntools .gh { height: 30px; padding: 0 7px; font-size: 13px; }
html.paged .ntools .ntheme { display: inline-flex; width: 30px; margin: 0; padding: 0; }
.npagebox { min-width: 0; }
html.paged .npagebox { flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
html.paged .ntext { padding: 16px 0 0; box-sizing: border-box; column-fill: auto; transition: transform .22s ease; -webkit-user-select: none; user-select: none; }
html.paged .ntext p { orphans: 2; widows: 2; }
html.paged .nill { margin: 0 0 1.2em; break-inside: avoid; }
html.paged .nill img { width: auto; max-width: 100%; max-height: calc(100dvh - 210px); margin: 0 auto; }
html.paged #pageno { display: inline; color: var(--faint); font-size: 13.5px; font-variant-numeric: tabular-nums; opacity: 1; }
html.paged .npager { margin: 0; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); font-size: 14px; }
html.paged .npager .plist { display: none; }
html.paged .npager .next { padding: 6px 12px; border-radius: 8px; }
html.paged .nside { position: fixed; z-index: 10; top: 56px; left: 10px; right: 10px; max-height: 70dvh; margin: 0; box-shadow: 0 16px 36px -14px rgba(0, 0, 0, .45); }
@media (max-width: 620px) { .nworkhead { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; margin-top: 24px; } }
@media (max-width: 760px) { .ntheme { margin-left: auto; width: 32px; } .ntheme + .gh { margin-left: 0; } }
@media (min-width: 620px) { .nbooks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 860px) { .nbooks { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; } }
