:root {
  --bg: #0a0d14;
  --bg2: #10141d;
  --card: #141926;
  --card2: #1a2030;
  --line: #242b3b;
  --text: #eef1f7;
  --sub: #9aa3b5;
  --dim: #6b7486;
  --blue: #3d7bff;
  --blue2: #5b93ff;
  --green: #4ade80;
  --purple: #a974ff;
  --gold: #f5c451;
  --red: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #05070b; color: var(--text); font-family: Pretendard, -apple-system, 'Malgun Gothic', sans-serif; }
/* 한글은 기본이 글자 단위 줄바꿈이라 단어 중간에서 끊긴다. 단어 단위로, 칸보다 긴 단어만 쪼갠다 */
body { word-break: keep-all; overflow-wrap: anywhere; }
body { overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 72px; }
#app.reading { padding-bottom: 0; }

/* 상단 */
#top { position: sticky; top: 0; z-index: 20; background: rgba(10, 13, 20, .96); backdrop-filter: blur(10px); }
.topbar { height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; padding: 0 10px; }
.topbar .left, .topbar .right { min-width: 0; }
.topbar .left, .topbar .right { display: flex; gap: 8px; align-items: center; }
.topbar .right { justify-content: flex-end; }
.iconbtn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; position: relative; }
.iconbtn:active { background: var(--card); }
.dot { position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--blue); color: var(--blue2); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill svg { width: 16px; height: 16px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--bg2); }
.tabs a { flex: 1; text-align: center; padding: 11px 0 10px; color: var(--sub); font-size: 15px; position: relative; }
.tabs a.on { color: var(--blue2); font-weight: 700; }
.tabs a.on::after { content: ''; position: absolute; left: 25%; right: 25%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--blue); }

/* 하단 탭 */
#tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: 64px; display: flex; background: rgba(12, 15, 23, .98); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--sub); font-size: 11px; }
#tabbar a.on { color: var(--blue2); }
#tabbar a.on svg { fill: var(--blue); stroke: var(--blue); }
.reading #tabbar { display: none; }

/* 섹션 */
.section { --gutter: 16px; padding: 20px var(--gutter) 8px; }
.section + .section { border-top: 6px solid #07090e; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 21px; font-weight: 800; min-width: 0; word-break: keep-all; }
.sec-head h2 em { font-style: normal; color: var(--blue2); }
.sec-head .more { color: var(--sub); font-size: 13px; white-space: nowrap; flex: none; }
.sec-sub { color: var(--sub); font-size: 13px; margin: -8px 0 12px; }

.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(210px, 13em)), 1fr)); gap: 14px 12px; }
.rank-item { display: flex; gap: 10px; align-items: center; }
.cover { position: relative; flex: none; border-radius: 10px; overflow: hidden; background: linear-gradient(160deg, #1d2a4d, #0f1422 60%, #2a1740); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; font-weight: 800; font-size: 12px; line-height: 1.3; color: #c9d4ff; }
.cover .num { position: absolute; top: 4px; left: 4px; min-width: 22px; height: 24px; border-radius: 5px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--blue); }
.cover .num.gray { background: #56607a; }
.rank-item .cover { width: 70px; height: 74px; }
.meta { min-width: 0; }
.meta .t { font-weight: 700; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .g { color: var(--sub); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nums { display: flex; gap: 10px; font-size: 12px; margin-top: 4px; color: var(--sub); white-space: nowrap; }
.nums b { font-weight: 500; }
.nums .play::before { content: '▶ '; color: var(--blue); font-size: 10px; }
.nums .route { color: var(--green); }
.nums .route::before { content: '🌿'; font-size: 10px; margin-right: 2px; }

/* 가로로 넘겨 보는 줄: 스크롤바 없이 손가락으로 넘기고 카드 단위로 멈춘다. 페이지 자체는 가로로 흔들리지 않는다 */
.hscroll { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-left: var(--gutter); margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: none; scroll-snap-align: start; }
.poster { width: 124px; }
.poster .cover { width: 100%; aspect-ratio: 3 / 4; }
.poster .cover .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 8px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .88) 45%); }
.poster .cap .t { font-size: 14px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster .nums { color: #dfe4ee; margin-top: 4px; }
.hscroll > .branch-card { width: min(280px, 78vw); flex-wrap: nowrap; }
.hscroll > .branch-card .meta { flex: 1; }
.vlist { display: grid; gap: 10px; }

.branch-card { min-width: 0; display: flex; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px; }
.branch-card .cover { width: 84px; height: 100px; }
.branch-card .big { color: var(--green); font-weight: 800; font-size: 17px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--blue); color: var(--blue2); margin-top: 6px; }

.list-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-item .cover { width: 64px; height: 84px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--sub); font-size: 13px; }
.chip.on { background: var(--blue); color: #fff; font-weight: 700; }
.empty { color: var(--dim); text-align: center; padding: 40px 16px; font-size: 14px; line-height: 1.6; }
.cta-new { margin: 16px; display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius); background: linear-gradient(120deg, #17306b, #241a4b); border: 1px solid #2f4b93; }
.cta-new .plus { width: 42px; height: 42px; border-radius: 12px; background: var(--blue); display: grid; place-items: center; font-size: 26px; font-weight: 300; flex: none; }
.cta-new b { display: block; font-size: 16px; }
.cta-new span { color: #b9c5e6; font-size: 13px; }

/* 작품 상세 */
.detail-top { display: flex; gap: 14px; padding: 16px; }
.detail-top .cover { width: 150px; height: 210px; border-radius: 12px; }
.detail-top .badge { position: absolute; top: 8px; left: 8px; font-size: 11px; background: rgba(20, 30, 60, .9); border: 1px solid var(--blue); color: var(--blue2); padding: 2px 8px; border-radius: 6px; }
.detail-top h1 { font-size: 22px; line-height: 1.3; margin: 2px 0 6px; }
.detail-top .author { color: var(--sub); font-size: 14px; }
.stat-row { display: flex; gap: 0; margin-top: 12px; }
.stat-row > div { flex: 1; border-left: 1px solid var(--line); padding-left: 10px; }
.stat-row > div:first-child { border: 0; padding: 0; }
.stat-row b { display: block; font-size: 17px; }
.stat-row span { color: var(--sub); font-size: 11px; }
.graph-row { display: flex; gap: 14px; margin-top: 10px; color: var(--blue2); font-weight: 700; font-size: 16px; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.obtn { flex: 1; border: 1px solid var(--blue); color: var(--blue2); border-radius: 10px; padding: 8px 0; font-weight: 700; font-size: 14px; display: flex; gap: 4px; justify-content: center; align-items: center; }
.obtn.on { background: var(--blue); color: #fff; }
.obtn.gold { border-color: var(--gold); color: var(--gold); }
.obtn svg { width: 17px; height: 17px; }
.intro { margin: 0 16px; background: var(--card); border-radius: var(--radius); padding: 16px; }
.intro q { display: block; color: var(--blue2); font-size: 18px; font-weight: 700; margin-bottom: 10px; line-height: 1.4; }
.intro p { margin: 0; color: #cfd5e2; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.intro .tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.intro .tags span { font-size: 12px; color: var(--sub); }
.box { margin: 14px 16px 0; background: var(--card); border-radius: var(--radius); padding: 14px; }
.box h3 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.route-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(92px, 6.5em)), 1fr)); gap: 10px 8px; }
.route-strip .step { min-width: 0; }
.route-strip .img { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: linear-gradient(140deg, #1d2a4d, #2a1740); }
.route-strip .img img { width: 100%; height: 100%; object-fit: cover; }
.route-strip .n { font-size: 12px; margin-top: 5px; color: var(--sub); }
.route-strip .tt { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-strip .n::before { content: '→ '; color: var(--blue); }
.route-strip .step:first-child .n::before { content: ''; }
.two-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 16px 0; }
.two-box .box { margin: 0; }
.mini-route { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mini-route:last-child { border: 0; }
.mini-route b { display: block; font-size: 14px; margin-bottom: 2px; }
.mini-route span { color: var(--sub); font-size: 12px; }
.badge-new { font-size: 10px; background: var(--blue); color: #fff; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 2px; }
.badge-rare { font-size: 10px; background: #3a2461; color: #d6b8ff; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 2px; }
.ep { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ep .no { width: 28px; height: 28px; border-radius: 6px; background: var(--card2); display: grid; place-items: center; font-size: 13px; color: var(--sub); flex: none; }
.ep .thumb { width: 92px; height: 52px; border-radius: 6px; overflow: hidden; flex: none; background: linear-gradient(140deg, #1d2a4d, #2a1740); }
.ep .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep .tt { font-weight: 700; font-size: 14px; }
.ep .pv { color: var(--sub); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep .v { margin-left: auto; color: var(--sub); font-size: 12px; white-space: nowrap; }
.bottom-cta { position: sticky; bottom: 64px; display: flex; gap: 8px; padding: 10px 16px; background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }
.bottom-cta > * { min-width: 0; }
.bottom-cta .ghost { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; border: 1px solid var(--blue); border-radius: 12px; padding: 8px; color: var(--blue2); text-align: center; line-height: 1.25; }
.bottom-cta .ghost small { display: block; color: var(--sub); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.primary { flex: 1.2; background: var(--blue); color: #fff; border-radius: 12px; padding: 12px 10px; font-weight: 800; font-size: 16px; text-align: center; display: flex; justify-content: center; align-items: center; gap: 6px; }
.primary:disabled { opacity: .5; }
.link-danger { color: var(--dim); font-size: 12px; text-decoration: underline; display: block; text-align: center; margin: 20px 0 8px; }

/* 리더 */
.reader-head { padding: 18px 22px 0; }
.reader-head h1 { font-size: 22px; margin: 0; font-weight: 800; line-height: 1.35; word-break: keep-all; }
.reader-head .pos { color: var(--sub); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
#top { transition: transform .2s; }
#top.hide { transform: translateY(-100%); }
#top .progress { height: 3px; background: var(--card2); overflow: hidden; }
#top .progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.body { padding: 14px 22px 30px; font-family: var(--ff, inherit); font-size: var(--fs, 17px); line-height: var(--lh, 1.85); color: #e3e7ef; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.body p { margin: 0 0 1em; }
.illust { margin: 0 16px 8px; border-radius: var(--radius); overflow: hidden; background: var(--card); position: relative; min-height: 180px; }
.illust img { width: 100%; display: block; }
.illust.locked img { filter: blur(18px) brightness(.6); transform: scale(1.1); }
.illust .lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; }
.illust .lock p { margin: 0; color: #d6dcea; font-size: 14px; }
.illust .spent { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .65); border-radius: 999px; font-size: 12px; padding: 4px 10px; color: #cdd8ff; }
.shimmer { height: 220px; display: grid; place-items: center; color: var(--sub); font-size: 13px; background: linear-gradient(100deg, var(--card) 30%, var(--card2) 50%, var(--card) 70%); background-size: 300% 100%; animation: sh 1.6s infinite linear; }
@keyframes sh { from { background-position: 100% 0 } to { background-position: 0 0 } }
.choose { padding: 18px 16px 30px; border-top: 1px solid var(--line); }
.choose h2 { margin: 0; font-size: 24px; font-weight: 800; word-break: keep-all; }
.choose h2 em { font-style: normal; color: var(--blue2); }
.choose .sub { color: var(--sub); font-size: 13px; margin: 4px 0 14px; }
.choose .head { display: flex; justify-content: space-between; align-items: flex-start; }
.choice { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 12px 14px; margin-bottom: 10px; align-items: center; }
.choice:active { border-color: var(--blue); }
.choice.mine { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.choice .c { flex: 1; min-width: 0; }
.choice .ct { font-weight: 700; font-size: 16px; line-height: 1.35; }
.choice .ch { color: var(--sub); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.choice .bar { height: 5px; background: var(--card2); border-radius: 5px; margin-top: 9px; overflow: hidden; }
.choice .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue2)); border-radius: 5px; }
.choice .cnt { color: var(--sub); font-size: 12px; margin-top: 5px; }
.choice .stat { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.choice .stat .bar { flex: 1; margin: 0; }
.choice .pct { font-size: 20px; font-weight: 800; color: var(--blue2); white-space: nowrap; flex: none; }
.choice .pct small { font-size: 14px; }
.bdg { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin: 0 4px 0 0; vertical-align: 2px; }
.bdg.popular { border: 1px solid var(--blue); color: var(--blue2); }
.bdg.rising { border: 1px solid #6b8cff; color: #9fb3ff; }
.bdg.rare { border: 1px solid var(--purple); color: #cfb0ff; }
.bdg.new { background: var(--blue); color: #fff; }
.bdg.unexplored { border: 1px solid #2f7a4d; color: var(--green); }
.free-btn { width: 100%; border: 1px solid var(--blue); border-radius: 14px; padding: 16px; color: var(--blue2); display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.free-btn svg { width: 20px; height: 20px; }
.reader-foot { color: var(--dim); font-size: 12px; text-align: center; margin-top: 14px; }

/* 전환 */
#overlay { position: fixed; inset: 0; z-index: 60; display: none; background: rgba(5, 7, 12, .94); align-items: safe center; justify-content: center; overflow-y: auto; }
#overlay.on { display: flex; animation: fade .25s; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.trans { width: 100%; max-width: 420px; padding: 24px; text-align: center; }
.trans .picked { border: 1px solid var(--blue); box-shadow: 0 0 24px rgba(61, 123, 255, .35); border-radius: 16px; padding: 16px; font-size: 19px; font-weight: 800; margin-bottom: 22px; position: relative; }
.trans .picked small { position: absolute; top: -10px; left: 16px; background: var(--blue); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.trans .big { font-size: 40px; font-weight: 900; color: var(--blue2); }
.trans .desc { color: #c9d1e0; font-size: 15px; line-height: 1.6; }
.trans .rank { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: var(--card); color: var(--gold); font-size: 13px; font-weight: 700; }
.trans .discover { margin-top: 10px; font-size: 22px; font-weight: 800; }
.trans .discover + .desc { margin-top: 6px; }
.trans .founder { margin-top: 14px; background: var(--card); border-radius: 12px; padding: 10px; font-size: 13px; color: var(--sub); }
.trans .founder b { color: var(--blue2); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--card2); border-top-color: var(--blue); border-radius: 50%; margin: 22px auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.trans .writing { color: var(--sub); font-size: 14px; }
.steps { text-align: left; display: inline-block; margin-top: 16px; color: var(--sub); font-size: 14px; line-height: 2; }
.steps .done { color: var(--green); }

/* 바텀시트 */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 70; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 480px; background: #111624; border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5 } to { transform: none; opacity: 1 } }
.sheet .grip { width: 40px; height: 4px; border-radius: 4px; background: #39415a; margin: 0 auto 10px; }
.sheet h3 { text-align: center; font-size: 21px; margin: 10px 0 6px; }
.sheet h3 em { font-style: normal; color: var(--blue2); }
.sheet .desc { text-align: center; color: #c9d1e0; font-size: 14px; line-height: 1.6; }
.sheet .desc b { color: var(--blue2); }
.pkg { display: flex; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px; margin-top: 10px; text-align: left; }
.pkg.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.pkg .ic { font-size: 26px; }
.pkg b { font-size: 16px; }
.pkg small { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }
.pkg .price { margin-left: auto; font-weight: 800; font-size: 17px; }
.sheet .row2 { display: flex; gap: 8px; margin-top: 10px; }
.sheet .row2 button { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px; line-height: 1.3; }
.sheet .row2 small { display: block; color: var(--sub); font-size: 11px; }
.sheet .mock { color: var(--dim); font-size: 11px; text-align: center; margin-top: 10px; }
.sheet textarea, .field textarea, .field input, .field select { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; resize: none; outline: none; }
.sheet textarea:focus, .field textarea:focus, .field input:focus { border-color: var(--blue); }
.preview-card { display: flex; gap: 10px; background: var(--card); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.preview-card img { width: 55%; object-fit: cover; filter: blur(8px) brightness(.7); }
.preview-card div { padding: 12px 12px 12px 0; font-size: 13px; color: #cfd5e2; line-height: 1.5; }

/* 새 작품 */
.new-wrap { padding: 20px 16px 30px; }
.new-wrap h1 { font-size: 24px; margin: 0 0 4px; }
.new-wrap .lead { color: var(--sub); margin: 0 0 16px; font-size: 14px; }
.field { margin-top: 14px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.attach { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--blue2); font-size: 14px; }
.attach .file { color: var(--text); background: var(--card); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
details.more-set { margin-top: 12px; background: var(--card); border-radius: 12px; padding: 12px 14px; }
details.more-set summary { cursor: pointer; color: var(--sub); font-size: 14px; }
.radio-row { display: flex; gap: 16px; margin-top: 8px; font-size: 15px; }
.radio-row label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 15px; margin: 0; }
.notice { margin-top: 12px; background: #1b1830; border: 1px solid #3a2d63; border-radius: 12px; padding: 12px; color: #cdbef5; font-size: 13px; line-height: 1.6; }
.notice label { display: flex; gap: 8px; align-items: flex-start; color: #e6ddff; margin-top: 8px; font-size: 13px; }

/* MY */
.my-card { margin: 16px; background: var(--card); border-radius: var(--radius); padding: 16px; }
.my-card .nick { font-size: 20px; font-weight: 800; }
.coupon-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--card2); }
.coupon-row b { color: var(--blue2); font-size: 20px; }
.switch { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.switch input { width: 44px; height: 24px; accent-color: var(--blue); }
.switch small { display: block; color: var(--sub); font-size: 12px; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #242c40; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; text-align: center; }
#toast.on { opacity: 1; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; }
.radio-row input, .notice input { width: auto; }

/* 좁은 폰: 쿠폰 알약은 숫자만, 랭킹은 한 줄 */
.pill .lbl { display: inline; }
@media (max-width: 400px) {
  .pill .lbl { display: none; }
  .section { --gutter: 14px; }
}
@media (max-width: 359px) {
  .detail-top { flex-direction: column; }
  .detail-top .cover { width: 100%; height: 240px; }
  .two-box { grid-template-columns: minmax(0, 1fr); }
}
.meta .g { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nums { flex-wrap: wrap; row-gap: 0; }

/* 상단바: 로고 칸이 좁으면 로고 이미지가 줄어든다 */
.topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
.topbar .mid { min-width: 0; display: flex; justify-content: center; }
.logo { display: block; min-width: 0; max-width: 100%; }
.logo img { display: block; height: 30px; width: auto; max-width: 100%; object-fit: contain; }
.topbar .left, .topbar .right { flex: none; }
.topbar .left { min-width: 34px; }

/* 가로 모드처럼 화면 높이가 낮으면 하단 버튼을 고정하지 않는다 */
@media (max-height: 500px) {
  .bottom-cta { position: static; }
}

/* 줄 안의 글자 칸이 너무 좁아지면(큰 글꼴) 다음 줄로 내려간다 */
.ep { flex-wrap: wrap; }
.ep .epm { flex: 1 1 9em; min-width: 0; }
.list-item, .branch-card { flex-wrap: wrap; }
.list-item .meta, .branch-card .meta { flex: 1 1 8em; min-width: 0; }
.rank-item .meta { flex: 1; min-width: 0; }

.field select { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; color: var(--text); }
.intro q { quotes: none; }

/* 본문 사이에 들어간 삽화: 본문 여백만큼 바깥으로 넓혀 화면 폭에 맞춘다 */
.body > #ill { white-space: normal; margin: 1.4em -6px; }
.body > #ill .illust { margin: 0; min-height: 0; }
.illust img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 어떤 요소가 넘쳐도 페이지가 가로로 흔들리지 않게 */
#app { overflow-x: clip; }

/* 아이콘·알약 버튼 글자(Aa, 쿠폰 수)는 쪼개지 않는다 */
.iconbtn, .pill { white-space: nowrap; overflow-wrap: normal; }

.cover .r19 { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: #e5484d; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.agree { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 13px; color: var(--sub); }
.agree input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; accent-color: var(--blue); }
.agree a { color: var(--blue2); text-decoration: underline; }

/* 작품 상세 탭: 작품소개 | 회차 | 내 경로 | 삽화 */
.dtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); margin-top: 4px; position: sticky; top: 56px; z-index: 6; background: var(--bg); }
.dtabs button { padding: 12px 2px 11px; color: var(--sub); font-size: 15px; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dtabs button.on { color: var(--text); font-weight: 800; }
.dtabs button.on::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--blue); }
#dpane { padding-bottom: 8px; }
#dpane > .intro { margin-top: 14px; }
.eps-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.eps-head h3 { margin: 0; }
.fk { color: var(--green); font-size: 13px; font-weight: 700; white-space: nowrap; }
.route-bar { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--card2); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; text-align: left; font-size: 14px; }
.route-bar b { flex: none; }
.route-bar span { flex: 1; min-width: 0; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-bar i { font-style: normal; color: var(--sub); flex: none; }
.ep .epa { display: flex; gap: 10px; align-items: center; flex: 1 1 14em; min-width: 0; flex-wrap: wrap; }
.ep .no { width: auto; min-width: 34px; padding: 0 4px; background: none; font-size: 13px; }
.ep.fork { background: rgba(61, 123, 255, .08); margin: 0 -14px; padding: 8px 14px; }
.ep.fork .no { color: var(--blue2); font-weight: 800; }
.ep .picked-by { color: var(--blue2); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep .mk { margin-left: auto; color: var(--sub); font-size: 14px; flex: none; padding: 0 4px; }
.ep .mk.now { color: var(--blue2); }
.ep .fbtn { margin-left: auto; flex: none; color: var(--green); font-weight: 800; font-size: 14px; border: 1px solid #2f7a4d; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ropt { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.ropt .rd { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--dim); flex: none; }
.ropt.on { border-color: var(--blue); background: rgba(61, 123, 255, .1); }
.ropt.on .rd { border-color: var(--blue); background: radial-gradient(var(--blue) 45%, transparent 50%); }
.ropt div { min-width: 0; }
.ropt small { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }
.rsep { color: var(--sub); font-size: 12px; margin: 16px 0 0; }

/* 내 경로: 가지 모양(들여쓰기와 왼쪽 선, 가로로 넓어지지 않는다) */
.tree { font-size: 14px; }
.tnode { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.tnode::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--card2); border: 2px solid var(--blue); flex: none; }
.tnode.root::before { border-color: var(--dim); }
.tnode.root + .tnode, .tnode.root + .tleaf { margin-top: 0; }
.tkids { margin-left: 5px; padding-left: 14px; border-left: 2px solid var(--line); display: grid; gap: 8px; padding-top: 4px; }
.tkid { min-width: 0; }
.tvia { color: var(--blue2); font-size: 12px; font-weight: 700; padding: 2px 0; }
.tleaf { background: var(--card2); border-radius: 10px; padding: 10px 12px; }
.tleaf.cur { border: 1px solid var(--blue); background: rgba(61, 123, 255, .12); }
.tleaf b { display: block; }
.tleaf small { color: var(--sub); font-size: 12px; }
.rcard { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rcard:last-child { border: 0; }
.rcard .thumb { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex: none; background: linear-gradient(140deg, #1d2a4d, #2a1740); }
.rcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcard .rm { flex: 1 1 9em; min-width: 0; }
.rcard .rt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rcard small { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }
.rcard .ra { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* 삽화 탭 */
.art-head { margin: 14px 16px 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; background: linear-gradient(120deg, #17306b, #1a2030); border-radius: var(--radius); padding: 16px; flex-wrap: wrap; }
.art-head small { display: block; color: #b9c5e6; font-size: 12px; }
.art-head b { font-size: 30px; font-weight: 900; }
.art-head b span { font-size: 15px; margin-left: 2px; }
.art-head .r { text-align: right; }
.art-head .r b { color: var(--blue2); font-size: 22px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(30%, 140px), 1fr)); gap: 4px; margin: 12px 16px 0; }
.atile { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--card2); position: relative; display: block; }
.atile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.atile.lk img { filter: blur(10px) brightness(.5); transform: scale(1.15); }
.atile.lk span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }

/* 리더: 본문 끝 이동(이전 화 · 목록 · 내가 이어 읽은 다음 화) */
.ep-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 16px 18px; }
.ep-nav > * { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 6px; text-align: center; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-nav .off { color: var(--dim); background: none; }

/* 내가 연(무료·구매) 삽화가 아니면 회차 썸네일도 흐리게 */
.thumb.lk img { filter: blur(6px) brightness(.55); transform: scale(1.15); }

/* 리더: 이 화 다시 쓰기(접힘) */
.rewrite { margin: 0 16px 12px; background: var(--card); border-radius: 12px; padding: 0 14px; }
.rewrite summary { cursor: pointer; padding: 12px 0; color: var(--sub); font-size: 14px; list-style: none; }
.rewrite summary::-webkit-details-marker { display: none; }
.rewrite summary::after { content: ' ▾'; }
.rewrite[open] summary::after { content: ' ▴'; }
.rewrite[open] { padding-bottom: 12px; }
.rewrite textarea { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; resize: none; outline: none; }
.rw-vers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rw-note { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
