/* ============================================================
   디자인 시스템 v2 — 국내 웹소설 플랫폼 문법
   (문피아 · 네이버 시리즈 · 카카오페이지 · 리디 레퍼런스)
   화이트 베이스 / 헤어라인 보더 / Pretendard / 칩 배지 / 블랙 CTA
   ============================================================ */

:root {
    --bg: #ffffff;
    --bg-soft: #f5f6f8;            /* 보조 면 (푸터, 입력 배경 등) */
    --line: rgba(23, 24, 28, 0.08);  /* 헤어라인 */
    --line-strong: rgba(23, 24, 28, 0.16);

    --text: #17181c;
    --text-2: #6b6f78;             /* 보조 텍스트 */
    --text-3: #a5a9b1;             /* 힌트/플레이스홀더 */

    --accent: #ff4030;             /* 랭킹 넘버, NEW, 하트, 강조 */
    --gold: #ffb400;               /* 별점 */
    --cta: #17181c;                /* 주요 버튼 (블랙) */

    --font: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', sans-serif;

    --radius-s: 6px;
    --radius: 10px;
    --radius-l: 16px;
    --cover-ratio: 2 / 3;   /* 엔진 썸네일 1024x1536 및 웹소설 표준 표지 비율 */

    --main-max: 1200px;
}

/* 장르 → 타이포 커버 배경 보정용 (data의 cover_color를 그대로 쓰므로 보조적) */
.genre-로맨스, .genre-로판 { --genre-color: #A83350; }
.genre-판타지, .genre-무협 { --genre-color: #2E6F5E; }
.genre-현판 { --genre-color: #1E2340; }

/* ── 베이스 ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1, .h1 { font-size: 26px; line-height: 1.3; }
h2, .h2 { font-size: 20px; line-height: 1.35; }
.caption { font-size: 13px; color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

a { color: inherit; }
img { max-width: 100%; }
button { font-family: inherit; }

main { max-width: var(--main-max); margin: 0 auto; padding: 28px 20px 96px; }

/* ── 헤더 (GNB) ─────────────────────────────────────────────── */
.site-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 100;
}
.site-header nav {
    max-width: var(--main-max); margin: 0 auto;
    display: flex; align-items: center;
    padding: 0 20px;
    height: 56px;
    gap: 2px;
    overflow-x: auto; scrollbar-width: none;
}
.site-header nav::-webkit-scrollbar { display: none; }
.site-header nav a {
    text-decoration: none;
    color: var(--text-2);
    font-size: 15px; font-weight: 500;
    padding: 0 11px;
    height: 56px; line-height: 56px;
    white-space: nowrap;
    position: relative;
}
.site-header nav a:hover { color: var(--text); }
.site-header nav a.active { color: var(--text); font-weight: 700; }
.site-header nav a.active::after {
    content: ''; position: absolute; left: 11px; right: 11px; bottom: 0;
    height: 2px; background: var(--text);
}
.site-header nav .display-title {
    font-size: 20px; font-weight: 800; letter-spacing: -0.03em;
    color: var(--text);
    padding-left: 0; margin-right: 14px;
}
.site-header nav .display-title:hover { color: var(--text); }
.site-header nav .nav-spacer { margin-left: auto; }
.site-header nav .nav-user { font-size: 13px; color: var(--text-3); padding: 0 8px; white-space: nowrap; }
.site-header nav .nav-sub { font-size: 13px; color: var(--text-2); }

/* ── 푸터 ───────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    padding: 32px 20px 48px;
    font-size: 12px; line-height: 1.7;
    color: var(--text-3);
    text-align: center;
}
.site-footer .footer-slogan { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.site-footer p { margin: 0; }

/* ── 플래시 메시지 ──────────────────────────────────────────── */
.flash-messages {
    max-width: var(--main-max); margin: 14px auto 0; padding: 0 20px; list-style: none;
}
.flash-messages li {
    padding: 12px 16px; margin-bottom: 8px;
    border-radius: var(--radius);
    background: var(--text); color: #fff;
    font-size: 14px;
}
.flash-messages li.flash-error { background: var(--accent); }
.flash-messages li.flash-info { background: #3c4048; }

/* ── 버튼 ───────────────────────────────────────────────────── */
.btn-primary, .btn-ghost, .btn-sm {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600;
    padding: 0 22px; height: 46px;
    border-radius: var(--radius);
    text-decoration: none;
    border: none; cursor: pointer;
    transition: opacity 0.12s ease, background 0.12s ease;
}
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover { opacity: 0.85; }
.btn-ghost {
    background: #fff; color: var(--text);
    border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }

/* ── 폼 컨트롤 ──────────────────────────────────────────────── */
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
    font-family: inherit; font-size: 15px;
    padding: 0 14px; height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff; color: var(--text);
}
textarea { padding: 12px 14px; height: auto; line-height: 1.7; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--text);
}
::placeholder { color: var(--text-3); }

.form-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 28px;
    max-width: 720px;
    margin: 0 auto 24px;
}
.form-card label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 8px; }
.form-card > label:first-of-type { margin-top: 0; }
.form-card input[type="text"], .form-card input[type="number"],
.form-card select, .form-card textarea { width: 100%; }
.form-card textarea { min-height: 340px; }
.form-help { font-size: 13px; color: var(--text-3); margin: 8px 0 0; }

/* ── 작품 카드 ──────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 26px 14px;
}
@media (max-width: 1000px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 720px)  { .card-grid { grid-template-columns: repeat(3, 1fr); gap: 20px 10px; } }

.card { display: block; text-decoration: none; color: inherit; min-width: 0; }
.card-cover {
    aspect-ratio: var(--cover-ratio);
    border-radius: var(--radius-s);
    overflow: hidden;
    position: relative;
    background: var(--bg-soft);
    box-shadow: inset 0 0 0 1px rgba(23, 24, 28, 0.06);  /* 헤어라인 — 밝은 표지 경계 보정 */
}
.card-cover img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.25s ease;
}
.card:hover .card-cover img { transform: scale(1.04); }

/* 타이포 커버 (썸네일 없는 작품 — 문피아식) */
.card-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 14px 12px;
    background-image: linear-gradient(155deg, rgba(255,255,255,0.14) 0%, rgba(0,0,0,0.10) 60%, rgba(0,0,0,0.28) 100%);
}
.card-fallback .fallback-title {
    color: rgba(255, 255, 255, 0.97);
    font-size: 14px; font-weight: 700; line-height: 1.4;
    letter-spacing: -0.02em;
    word-break: keep-all;
    text-align: center;
    /* 커버 밖으로 넘치지 않게 최대 5줄, 초과 시 말줄임 */
    display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
/* 가로 스크롤 레일의 작은 카드는 폰트도 축소 */
.card-scroll .card-fallback .fallback-title { font-size: 13px; }
/* 상세 페이지 큰 커버는 제목도 크게 */
.detail-cover.card-fallback .fallback-title { font-size: 20px; -webkit-line-clamp: 6; }

.card-title {
    margin-top: 9px;
    font-size: 14px; font-weight: 600; line-height: 1.4;
    letter-spacing: -0.02em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-author { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* 배지 칩 (커버 좌상단) */
.chip-badge {
    position: absolute; top: 7px; left: 7px;
    padding: 3px 7px;
    font-size: 11px; font-weight: 700; line-height: 1.3;
    color: #fff;
    background: rgba(23, 24, 28, 0.72);
    backdrop-filter: blur(4px);
    border-radius: 5px;
}
.chip-badge.chip-writer { background: rgba(23, 24, 28, 0.72); }
.chip-badge.chip-new { background: var(--accent); }

/* 랭킹 대형 숫자 (커버 좌상단 — 좌하단은 타이포 커버 제목과 겹침) */
.rank-num {
    position: absolute; left: 8px; top: 2px;
    font-size: 46px; font-weight: 900; line-height: 1;
    font-style: italic;
    color: #fff;
    letter-spacing: -0.05em;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.12);
}
/* 랭킹 숫자가 좌상단을 차지하면 작가작 배지는 우상단으로 */
.rank-num + .chip-badge { left: auto; right: 7px; }

/* ── 메인 배너 캐러셀 ───────────────────────────────────────── */
.banner-carousel { position: relative; margin-bottom: 44px; }
.banner-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    border-radius: var(--radius-l);
}
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    aspect-ratio: 3 / 1;
    background: #17181c;
    position: relative; display: block; overflow: hidden;
}
/* 배너 아트워크는 1920×640(3:1)로 제작되고 글씨가 박혀 있어, 모바일에서 2:1로
   강제하면 object-fit:cover가 좌우를 잘라 글씨가 잘린다. 원본 비율 3:1을 유지해
   크롭을 없앤다(박스 비율 = 이미지 비율 → cover가 자르지 않음). */
.banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-slide .banner-caption {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 48px 28px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
    color: #fff;
    font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
}
/* 모바일: 아트워크에 제목이 박혀 있어 하단 캡션이 박힌 글씨와 겹친다 → 우측 상단
   칩으로 이동(하단 그라디언트 제거, 한 줄 말줄임). 카운터는 우측 하단이라 안 겹침. */
@media (max-width: 720px) {
    .banner-slide .banner-caption {
        left: auto; right: 12px; bottom: auto; top: 12px;
        max-width: 60%;
        /* 한글은 라인박스 위쪽에 붙고 아래쪽 디센트 여백이 남아 위로 쏠려 보인다.
           line-height:1 + 상단 패딩을 하단보다 크게(6/4) 줘서 글자를 아래로 내려
           칩 안 시각 중앙에 맞춘다(칩 높이는 5/5와 동일). */
        padding: 6px 10px 4px;
        background: rgba(0, 0, 0, 0.45);
        border-radius: 12px;
        font-size: 12px; font-weight: 600;
        line-height: 1;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
}
/* 페이지 카운터 필 (네이버식 "1 / 5") + 인디케이터 점 */
.banner-count {
    position: absolute; right: 14px; bottom: 14px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px; font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.banner-dots {
    position: absolute; bottom: 16px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 7px;
}
.banner-dots button {
    width: 7px; height: 7px; border-radius: 50%;
    border: none; padding: 0; cursor: pointer;
    background: rgba(255, 255, 255, 0.45);
    transition: width 0.2s ease;
}
.banner-dots button.active { background: #fff; width: 18px; border-radius: 4px; }

/* ── 섹션 레일 ──────────────────────────────────────────────── */
.rail { margin-bottom: 52px; }
.rail-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px;
}
.rail-head h2 { font-size: 20px; }
.rail-head h2 a { text-decoration: none; }
.rail-head .rail-sub { font-size: 13px; color: var(--text-3); }
.rail-head .rail-more {
    margin-left: auto;
    font-size: 13px; color: var(--text-2); text-decoration: none;
    display: inline-flex; align-items: center; gap: 2px;
}
.rail-head .rail-more:hover { color: var(--text); }

/* ── 가로 스크롤 레일 (지금 뜨는 신작 / 완결 정주행) ────────────────────── */
.rail-scroll-wrap { position: relative; }
.card-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.card-scroll::-webkit-scrollbar { display: none; }
.card-scroll > .card {
    flex: 0 0 auto;
    width: 150px;
    scroll-snap-align: start;
}
@media (max-width: 600px) { .card-scroll > .card { width: 130px; } }
/* 섹션별 카드 크기 (2:3 비율 유지, 너비만 3단계 — 홈페이지_섹션_개편안 §5) */
.card-scroll.size-sm > .card { width: 116px; }
.card-scroll.size-lg > .card { width: 260px; }
@media (max-width: 600px) {
    .card-scroll.size-sm > .card { width: 100px; }
    .card-scroll.size-lg > .card { width: 200px; }
}

/* 인기 레일 1~3위 강조 */
.rank-rail .rank-num { font-size: 40px; }

/* ── 가로 리스트 카드 (문피아식 — '이런 이야기 어때요?' 섹션) ──────────── */
.list-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 22px 28px;
}
@media (max-width: 900px) { .list-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 20px; } }
@media (max-width: 560px) { .list-grid { grid-template-columns: 1fr; } }
.list-card { display: flex; gap: 13px; text-decoration: none; color: inherit; min-width: 0; }
.list-card .list-cover {
    width: 84px; flex-shrink: 0; aspect-ratio: 2/3;
    border-radius: 6px; overflow: hidden; position: relative;
    background: var(--bg-soft); box-shadow: inset 0 0 0 1px rgba(23,24,28,0.06);
}
.list-card .list-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-card .list-cover .card-fallback { display: flex; }
.list-card .list-cover .fallback-title { font-size: 11px; -webkit-line-clamp: 4; }
.list-card .list-rank {
    position: absolute; left: 5px; bottom: 2px;
    font-size: 26px; font-weight: 900; font-style: italic; color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5); letter-spacing: -0.04em;
}
.list-card .list-meta { min-width: 0; padding-top: 2px; }
.list-card .list-genre { font-size: 12px; color: var(--text-2); }
.list-card .list-title {
    font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: -0.02em;
    margin: 4px 0 4px;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
    word-break: keep-all;
}
.list-card:hover .list-title { text-decoration: underline; }
.list-card .list-syn {
    font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    word-break: keep-all;
}
.list-card .list-sub { font-size: 12px; color: var(--text-3); }

/* ── 10화 몰입보기 — 가로 배너 peek 캐러셀 (카카오페이지식) ────────────── */
.binge-carousel { position: relative; }
.binge-track {
    display: flex; gap: 16px;
    overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 4px 0 8px;
}
.binge-track::-webkit-scrollbar { display: none; }
.binge-slide {
    position: relative; flex: 0 0 86%; scroll-snap-align: center;
    height: 260px; border-radius: var(--radius-l);
    overflow: hidden; text-decoration: none; color: #fff;
    display: flex; align-items: flex-end;
}
@media (min-width: 900px) { .binge-slide { flex-basis: 720px; } }
@media (max-width: 600px) { .binge-slide { flex-basis: 92%; height: 220px; } }
/* 표지 블러 배경 (풀블리드 분위기) */
.binge-slide .binge-bg {
    position: absolute; inset: 0; z-index: 0;
    background-size: cover; background-position: center;
    filter: blur(22px) brightness(0.5); transform: scale(1.25);
}
.binge-slide .binge-scrim {
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(90deg, rgba(0,0,0,0.15), rgba(0,0,0,0.45));
}
.binge-slide .binge-inner {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: 22px;
    padding: 24px; width: 100%;
}
.binge-slide .binge-cover {
    width: 150px; flex-shrink: 0; aspect-ratio: 2/3;
    border-radius: 8px; object-fit: cover;
    box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}
@media (max-width: 600px) { .binge-slide .binge-cover { width: 110px; } }
.binge-slide .binge-cover.card-fallback { display: flex; }
.binge-slide .binge-text { min-width: 0; }
.binge-slide .binge-badges { display: flex; gap: 6px; margin-bottom: 10px; }
.binge-slide .binge-tag {
    font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px;
    background: rgba(255,255,255,0.18); backdrop-filter: blur(4px);
}
.binge-slide .binge-tag.free { background: var(--accent); }
.binge-slide .binge-title {
    font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 600px) { .binge-slide .binge-title { font-size: 18px; } }
.binge-slide .binge-syn {
    font-size: 13px; line-height: 1.55; margin-top: 8px; color: rgba(255,255,255,0.82);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    word-break: keep-all;
}
.binge-slide .binge-cta {
    display: inline-block; margin-top: 14px;
    font-size: 13px; font-weight: 600;
    padding: 8px 16px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.6);
}
.binge-slide:hover .binge-cta { background: #fff; color: var(--text); border-color: #fff; }
.binge-count {
    position: absolute; right: 14px; bottom: 14px; z-index: 3;
    padding: 3px 11px; border-radius: 20px;
    background: rgba(0,0,0,0.45); color: rgba(255,255,255,0.9);
    font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none;
}
/* 데스크탑 스크롤 화살표 */
.scroll-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--line); background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    cursor: pointer; z-index: 5;
    display: none; align-items: center; justify-content: center;
    font-size: 18px; color: var(--text);
}
.rail-scroll-wrap:hover .scroll-arrow { display: flex; }
.scroll-arrow.left { left: -14px; }
.scroll-arrow.right { right: -14px; }
@media (max-width: 700px) { .scroll-arrow { display: none !important; } }

/* ── 하단 피처 스트립 ───────────────────────────────────────────────────── */
.feature-strip {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin: 56px 0 8px;
    padding: 28px 24px;
    background: var(--bg-soft); border-radius: var(--radius-l);
}
@media (max-width: 700px) { .feature-strip { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
.feature-item { display: flex; align-items: flex-start; gap: 12px; }
.feature-item .feat-icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.feature-item .feat-title { font-size: 14px; font-weight: 700; }
.feature-item .feat-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }

/* ── 목록 페이지 ────────────────────────────────────────────── */
.page-head { margin-bottom: 6px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .caption { margin: 0; }

.sort-bar {
    display: flex; align-items: center; gap: 2px;
    margin: 18px 0 22px;
    border-bottom: 1px solid var(--line);
}
.sort-bar a {
    color: var(--text-3); text-decoration: none;
    font-size: 14px; font-weight: 500;
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.sort-bar a.active { color: var(--text); font-weight: 700; border-bottom-color: var(--text); }
.sort-bar .sort-side { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-bottom: 8px; }

.search-box { display: flex; gap: 8px; max-width: 560px; margin: 18px 0 28px; }
.search-box input { flex: 1; height: 48px; border-radius: 12px; background: var(--bg-soft); border-color: transparent; }
.search-box input:focus { background: #fff; border-color: var(--text); }
.search-box .btn-primary { height: 48px; }

.empty-note { color: var(--text-3); padding: 48px 0; text-align: center; grid-column: 1 / -1; font-size: 14px; }

/* ── 페이지네이션 ───────────────────────────────────────────────────────── */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 4px; margin: 40px 0 8px; flex-wrap: wrap;
}
.pagination .page-link {
    min-width: 38px; height: 38px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; text-decoration: none; color: var(--text);
    background: #fff;
}
.pagination .page-link:hover { background: var(--bg-soft); }
.pagination .page-link.active { background: var(--text); color: #fff; border-color: var(--text); font-weight: 700; }
.pagination .page-link.disabled { color: var(--text-3); pointer-events: none; background: var(--bg-soft); }
.pagination .page-ellipsis { padding: 0 6px; color: var(--text-3); }

/* ── 작품 상세 ──────────────────────────────────────────────── */
.detail-header {
    display: flex; gap: 36px;
    padding: 8px 0 36px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}
@media (max-width: 720px) { .detail-header { flex-direction: column; align-items: center; text-align: center; } }
.detail-cover {
    width: 208px; flex-shrink: 0;
    aspect-ratio: var(--cover-ratio);
    border-radius: var(--radius);
    object-fit: cover;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(23, 24, 28, 0.18), inset 0 0 0 1px rgba(23, 24, 28, 0.06);
}
div.detail-cover { display: flex; }  /* 타이포 커버 fallback일 때 */
.detail-meta { flex: 1; min-width: 0; padding-top: 6px; }
.detail-meta h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .detail-meta h1 { justify-content: center; } }
.detail-meta .meta-line { color: var(--text-2); font-size: 14px; margin: 8px 0 0; }
.detail-stats { font-size: 14px; color: var(--text-2); margin: 14px 0 0; }
.detail-stats strong { color: var(--text); font-weight: 700; }
.detail-stats .star { color: var(--gold); }
.synopsis { margin: 16px 0 0; line-height: 1.7; word-break: keep-all; color: var(--text); max-width: 640px; }
.detail-cta { margin-top: 22px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 720px) { .detail-cta { justify-content: center; } }

.engage-bar { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
@media (max-width: 720px) { .engage-bar { justify-content: center; } }
.engage-bar form { display: flex; gap: 6px; align-items: center; }
.engage-bar select { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }

.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-list li { border-bottom: 1px solid var(--line); }
.chapter-list a {
    display: flex; align-items: center;
    padding: 15px 6px;
    text-decoration: none; font-size: 15px;
}
.chapter-list a::after { content: '›'; margin-left: auto; color: var(--text-3); }
.chapter-list a:hover { background: var(--bg-soft); }
.chapter-list .empty-note { border: none; }

/* 태그/상태 칩 (본문용) */
.tag {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
    background: var(--bg-soft); color: var(--text-2);
}
.tag-accent { background: rgba(23, 24, 28, 0.85); color: #fff; }
.tag-warn { background: rgba(255, 64, 48, 0.10); color: var(--accent); }

/* ── 회차 뷰어 (4테마 리더: dark / gray / sepia / light) ────── */
/* 테마는 .viewer-page의 data-theme 속성으로 전환 — 내부 요소는 전부
   --reader-* 변수만 참조하므로 변수 세트 교체만으로 전체가 바뀐다. */
.viewer-page {
    /* sepia (기본) — JS 적용 전 첫 페인트도 세피아라 플래시가 없다 */
    --reader-bg: #f5ecd9;
    --reader-surface: rgba(79, 69, 54, 0.05);
    --reader-line: rgba(79, 69, 54, 0.15);
    --reader-line-hover: rgba(79, 69, 54, 0.45);
    --reader-text: #4f4536;
    --reader-text-dim: #8d8271;
    --reader-text-faint: rgba(79, 69, 54, 0.38);
    --reader-strong: #2f2a20;
    --reader-topbar: rgba(245, 236, 217, 0.92);
    --reader-cta-bg: #3a332a;
    --reader-cta-text: #ffffff;

    background: var(--reader-bg);
    color: var(--reader-text);
    min-height: 100vh;
    margin: -28px -20px -96px;
    padding-bottom: 64px;
    transition: background 0.2s ease, color 0.2s ease;
}
.viewer-page[data-theme="dark"] {
    --reader-bg: #101218;
    --reader-surface: rgba(255, 255, 255, 0.04);
    --reader-line: rgba(255, 255, 255, 0.10);
    --reader-line-hover: rgba(255, 255, 255, 0.38);
    --reader-text: #c9cdd6;
    --reader-text-dim: #7c8089;
    --reader-text-faint: rgba(255, 255, 255, 0.28);
    --reader-strong: #ffffff;
    --reader-topbar: rgba(16, 18, 24, 0.88);
    --reader-cta-bg: #ffffff;
    --reader-cta-text: #17181c;
}
.viewer-page[data-theme="gray"] {
    --reader-bg: #3a3e46;
    --reader-surface: rgba(255, 255, 255, 0.05);
    --reader-line: rgba(255, 255, 255, 0.13);
    --reader-line-hover: rgba(255, 255, 255, 0.42);
    --reader-text: #d6d8dd;
    --reader-text-dim: #9b9ea6;
    --reader-text-faint: rgba(255, 255, 255, 0.32);
    --reader-strong: #ffffff;
    --reader-topbar: rgba(58, 62, 70, 0.9);
    --reader-cta-bg: #ffffff;
    --reader-cta-text: #17181c;
}
.viewer-page[data-theme="sepia"] {
    --reader-bg: #f5ecd9;
    --reader-surface: rgba(79, 69, 54, 0.05);
    --reader-line: rgba(79, 69, 54, 0.15);
    --reader-line-hover: rgba(79, 69, 54, 0.45);
    --reader-text: #4f4536;
    --reader-text-dim: #8d8271;
    --reader-text-faint: rgba(79, 69, 54, 0.38);
    --reader-strong: #2f2a20;
    --reader-topbar: rgba(245, 236, 217, 0.92);
    --reader-cta-bg: #3a332a;
    --reader-cta-text: #ffffff;
}
.viewer-page[data-theme="light"] {
    --reader-bg: #ffffff;
    --reader-surface: rgba(23, 24, 28, 0.03);
    --reader-line: rgba(23, 24, 28, 0.10);
    --reader-line-hover: rgba(23, 24, 28, 0.45);
    --reader-text: #383c44;
    --reader-text-dim: #9ca0a8;
    --reader-text-faint: rgba(23, 24, 28, 0.30);
    --reader-strong: #17181c;
    --reader-topbar: rgba(255, 255, 255, 0.92);
    --reader-cta-bg: #17181c;
    --reader-cta-text: #ffffff;
}

.viewer-topbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px;
    padding: 0 20px; height: 52px;
    position: sticky; top: 0;
    background: var(--reader-topbar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--reader-line);
    z-index: 10;
}
.viewer-topbar a { color: var(--reader-text-dim); text-decoration: none; font-size: 14px; white-space: nowrap; }
.viewer-topbar a:hover { color: var(--reader-strong); }
.viewer-topbar .viewer-series-title {
    font-size: 14px; font-weight: 600; color: var(--reader-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 0; text-align: center;
}
.viewer-controls { display: flex; gap: 6px; align-items: center; }
.viewer-font-controls { display: flex; gap: 6px; }
.viewer-font-controls button {
    background: transparent; color: var(--reader-text-dim);
    border: 1px solid var(--reader-line); border-radius: 6px;
    padding: 4px 10px; cursor: pointer; font-size: 13px;
}
.viewer-font-controls button:hover { color: var(--reader-strong); border-color: var(--reader-line-hover); }

/* 테마 스와치 (라이트/세피아/그레이/다크) */
.viewer-theme-controls { display: flex; gap: 6px; align-items: center; margin-right: 4px; }
.viewer-theme-controls button {
    width: 20px; height: 20px; border-radius: 50%;
    padding: 0; cursor: pointer;
    border: 1px solid rgba(127, 127, 127, 0.45);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.viewer-theme-controls button.active {
    outline: 2px solid var(--reader-strong); outline-offset: 2px;
}
.theme-swatch-light { background: #ffffff; }
.theme-swatch-sepia { background: #f5ecd9; }
.theme-swatch-gray { background: #3a3e46; }
.theme-swatch-dark { background: #101218; }

.viewer-chapter-heading {
    text-align: center;
    font-size: 18px; font-weight: 700; color: var(--reader-strong);
    margin: 44px 20px 6px;
}

/* 본문 좌우 가장자리 이전화/다음화 꺾쇠 버튼 (네이버·문피아식) */
.viewer-side-nav {
    position: fixed; top: 50%; transform: translateY(-50%);
    z-index: 9;
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; line-height: 1; font-weight: 400;
    color: var(--reader-text);
    background: var(--reader-surface);
    border: 1px solid var(--reader-line);
    text-decoration: none;
    transition: background 0.14s ease, color 0.14s ease, opacity 0.14s ease;
    opacity: 0.55;
}
.viewer-side-nav:hover { opacity: 1; color: var(--reader-strong); border-color: var(--reader-line-hover); }
/* 본문 컬럼(max 640px) 바로 바깥에 배치: 화면 중앙 ± (320 + 여유) */
.viewer-side-nav.prev { left: calc(50% - 360px); }
.viewer-side-nav.next { right: calc(50% - 360px); }
/* 본문 옆 공간이 부족한 화면에서는 화면 가장자리에 붙인다 */
@media (max-width: 760px) {
    .viewer-side-nav { width: 40px; height: 40px; font-size: 24px; }
    .viewer-side-nav.prev { left: 6px; }
    .viewer-side-nav.next { right: 6px; }
}
.viewer-body {
    padding: 28px 20px;
    max-width: 640px; margin: 0 auto;
    line-height: 1.9;
    white-space: pre-wrap;
    font-size: var(--reader-font-size, 17px);
    word-break: keep-all;
}
.paywall-gate {
    text-align: center; padding: 36px 20px;
    max-width: 640px; margin: 0 auto;
    border-top: 1px solid var(--reader-line);
    color: var(--reader-text-dim);
}
.paywall-gate .btn-primary { background: var(--reader-cta-bg); color: var(--reader-cta-text); margin-top: 8px; }

.viewer-bottombar {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 640px; margin: 28px auto 0; padding: 0 20px;
    font-size: 14px;
}
.viewer-bottombar a {
    color: var(--reader-text); text-decoration: none;
    padding: 9px 16px; border: 1px solid var(--reader-line); border-radius: 8px;
}
.viewer-bottombar a:hover { border-color: var(--reader-line-hover); color: var(--reader-strong); }
.viewer-bottombar span { color: var(--reader-text-faint); font-size: 13px; }
.viewer-chapter-nav {
    max-width: 640px; margin: 22px auto 0; padding: 14px 20px 0;
    max-height: 132px; overflow-y: auto;
    border-top: 1px solid var(--reader-line);
    font-size: 13px; line-height: 2.2;
}
.viewer-chapter-nav a { color: var(--reader-text-dim); text-decoration: none; margin-right: 12px; }
.viewer-chapter-nav a.current { color: var(--reader-strong); font-weight: 700; }

/* 뷰어 하단 참여 영역 */
.viewer-engage { max-width: 640px; margin: 36px auto 0; padding: 0 20px; }
.viewer-engage-actions {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    border-top: 1px solid var(--reader-line);
    padding-top: 24px;
    color: var(--reader-text-dim); font-size: 14px;
}
.viewer-engage-actions form { display: flex; gap: 6px; align-items: center; }
.viewer-engage button, .viewer-engage select {
    background: var(--reader-surface); color: var(--reader-text);
    border: 1px solid var(--reader-line); border-radius: 8px;
    padding: 8px 15px; height: auto; font-size: 14px; cursor: pointer;
}
.viewer-engage button:hover { border-color: var(--reader-line-hover); color: var(--reader-strong); }
.viewer-engage button.liked { background: var(--accent); border-color: var(--accent); color: #fff; }
.viewer-engage select option { color: var(--text); }
.viewer-engage h3 { font-size: 16px; font-weight: 700; color: var(--reader-strong); margin: 32px 0 14px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 8px; }
.comment-form input[type="text"] {
    flex: 1; height: 44px;
    background: var(--reader-surface);
    border: 1px solid var(--reader-line);
    color: var(--reader-text);
    border-radius: 10px;
}
.comment-form input[type="text"]:focus { border-color: var(--reader-line-hover); }
.comment-form button {
    background: var(--reader-cta-bg); border: none; color: var(--reader-cta-text);
    border-radius: 10px; padding: 0 20px; font-weight: 600; cursor: pointer;
}
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list li { border-bottom: 1px solid var(--reader-line); padding: 15px 0; }
.comment-list li:last-child { border-bottom: none; }
.comment-list .comment-author { font-weight: 700; font-size: 13px; color: var(--reader-text); }
.comment-list .comment-date { color: var(--reader-text-faint); font-size: 12px; margin-left: 6px; }
.comment-list p { margin: 6px 0 4px; font-size: 14px; line-height: 1.65; }
.comment-list .report-btn {
    background: transparent; border: none; padding: 0;
    color: var(--reader-text-faint); font-size: 12px; cursor: pointer;
}
.comment-list .report-btn:hover { color: var(--accent); }

/* ── 패널/테이블 (내 작품 관리, 마이페이지 등) ──────────────── */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head .panel-title { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.panel-head .push-right { margin-left: auto; }

.table-plain { width: 100%; border-collapse: collapse; margin-top: 14px; }
.table-plain th, .table-plain td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px; text-align: left; font-size: 14px;
}
.table-plain th { color: var(--text-3); font-size: 12px; font-weight: 600; }
.table-plain tr:last-child td { border-bottom: none; }
.table-plain a { text-decoration: none; }
.table-plain a:hover { text-decoration: underline; }
.inline-form { display: inline; }

.writer-notice {
    max-width: 720px; margin: 24px auto;
    padding: 18px 22px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    font-size: 13px; line-height: 1.7; color: var(--text-2);
}
.writer-notice strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 14px; }

.mypage h2 { margin: 44px 0 16px; font-size: 20px; }
.mypage h2:first-of-type { margin-top: 16px; }

/* ── 인증 페이지 (django-allauth 오버라이드) ────────────────── */
.auth-main { max-width: 420px; padding-top: 56px; }
.auth-main h1 { text-align: center; font-size: 22px; margin-bottom: 8px; }
.auth-main > p { text-align: center; color: var(--text-2); font-size: 14px; margin: 6px 0; }
.auth-main > p a, .auth-main section a { color: var(--text); font-weight: 600; }
.auth-main form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 26px;
    margin: 22px 0;
}
.auth-main form p { margin: 0 0 14px; }
.auth-main form label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.auth-main form input[type="text"], .auth-main form input[type="password"],
.auth-main form input[type="email"], .auth-main form input[type="number"] { width: 100%; }
.auth-main form input[type="checkbox"], .auth-main form input[type="radio"] { width: auto; height: auto; margin-right: 6px; }
.auth-main form input[type="checkbox"] + label, .auth-main form input[type="radio"] + label { display: inline; font-weight: 400; }
.auth-main form span { font-size: 12px; color: var(--text-3); }
.auth-main form ul { list-style: none; padding: 0; margin: 8px 0 0; }
.auth-main button[type="submit"], .auth-main form button {
    background: var(--cta); color: #fff;
    border: none; border-radius: var(--radius);
    height: 48px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
}
.auth-main button[type="submit"]:hover { opacity: 0.85; }
.auth-main .errorlist { color: var(--accent); font-size: 13px; list-style: none; padding: 0; margin: 0 0 10px; }
.auth-main section { margin-top: 28px; }
.auth-main section h2 { font-size: 13px; font-weight: 500; text-align: center; color: var(--text-3); margin-bottom: 12px; }
.auth-main section ul { list-style: none; padding: 0; margin: 0; }
.auth-main section ul li { margin-bottom: 8px; }
.auth-main section ul li a {
    display: flex; align-items: center; justify-content: center;
    height: 46px; border-radius: var(--radius);
    border: 1px solid var(--line-strong); background: #fff;
    text-decoration: none; font-size: 14px; font-weight: 600;
}
.auth-main section ul li a:hover { background: var(--bg-soft); }

/* 소셜 로그인 컬러 버튼 (카카오/네이버/구글 브랜드 가이드 색상) */
.social-login-buttons { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 4px; }
.social-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 48px; border-radius: var(--radius);
    font-size: 15px; font-weight: 600;
    text-decoration: none;
    transition: filter 0.12s ease;
}
.social-btn:hover { filter: brightness(0.96); }
.social-kakao { background: #FEE500; color: #191919; }
.social-naver { background: #03C75A; color: #fff; }
.social-google { background: #fff; color: #3c4043; border: 1px solid var(--line-strong); }

.auth-divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-3); font-size: 12px;
    margin: 22px 0 6px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}
.auth-alt { text-align: center; font-size: 14px; color: var(--text-2); margin-top: 18px; }
.auth-alt a { color: var(--text); font-weight: 600; }
