:root {
  --bg: #fff7fa; --card: #ffffff; --text: #4a2c3a; --muted: #8c6676; --line: #fadbe6;
  --pink: #c8336f; --pink-ink: #ffffff; --soft: #ffe5ee; --soft-ink: #a82a5d; --blush: #f78fb3;
  --warn: #fff1d6; --warn-ink: #7a4e00; --shadow: 0 6px 20px rgba(214, 81, 134, .10);
  --display: "Fredoka", "Nunito", system-ui, sans-serif; --body: "Nunito", system-ui, sans-serif; --serif: "Lora", Georgia, serif;
  --tab-h: 62px; --tab-lift: 0px; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1f151a; --card: #2b1e25; --text: #f6e4eb; --muted: #c3a0af; --line: #47303b;
  --pink: #ff8fb8; --pink-ink: #3b0d20; --soft: #422834; --soft-ink: #ffc2d8; --blush: #d9648c;
  --warn: #443418; --warn-ink: #ffdf9e; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 980px; margin-inline: auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
main { flex: 1; padding-block: 24px 40px; outline: none; }
body { padding-bottom: calc(var(--tab-h) + var(--tab-lift) + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.25; margin: 0 0 .4em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; } a { color: var(--soft-ink); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--blush); outline-offset: 2px; }
.muted { color: var(--muted); font-size: .9rem; }
.sr { position: absolute; width: 1px !important; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--pink); z-index: 20; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.logo { display: flex; align-items: center; gap: 8px; font: 600 1.5rem var(--display); color: var(--pink); text-decoration: none; }
.logo svg { width: 28px; height: 28px; fill: var(--blush); } .logo circle { fill: #fff; }
nav { display: flex; align-items: center; gap: 6px; }
.top nav a { text-decoration: none; padding: 6px 14px; border-radius: 99px; font-weight: 700; color: var(--muted); }
.top nav a.active { background: var(--soft); color: var(--soft-ink); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--soft-ink); font-size: 1.1rem; cursor: pointer; }
.demo-banner { background: var(--warn); color: var(--warn-ink); font-size: .85rem; padding-block: 8px; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding-block: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.support-link { display: inline-block; padding: 6px 16px; border-radius: 99px; background: var(--soft); color: var(--soft-ink); font-weight: 700; text-decoration: none; }
.support-link:hover { filter: brightness(.97); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid transparent; border-radius: 99px; padding: 9px 20px; font: 700 .95rem var(--body); background: var(--pink); color: var(--pink-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn.soft { background: var(--soft); color: var(--soft-ink); }
.btn.ghost { background: transparent; color: var(--soft-ink); border-color: var(--line); }
.btn.danger { background: #b3261e; color: #fff; }
.btn.small { padding: 5px 14px; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 5px 14px; font: 600 .87rem var(--body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }
.chips, .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.section-head { margin: 24px 0 14px; } .section-head h1, .section-head h2, .section-head p { margin: 0; }

input:not([type=checkbox]):not([type=file]), textarea, select { font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 9px 14px; max-width: 100%; }
input:not([type=checkbox]):not(.num), textarea { width: 100%; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--pink); flex: none; }

.hero { text-align: center; background: var(--soft); border-radius: 28px; padding: 32px 20px; margin-bottom: 20px; }
.hero h1 { color: var(--soft-ink); }
.hero input.search { max-width: 520px; border-radius: 99px; padding: 12px 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
.grid .empty { grid-column: 1 / -1; }
.card { text-decoration: none; color: var(--text); min-width: 0; }
.card h3 { margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card p { margin: 0; }
.card .cover { margin-bottom: 8px; transition: transform .2s; }
.card:hover .cover { transform: translateY(-4px); }
.cover { aspect-ratio: 2 / 3; width: 100%; border-radius: 18px; overflow: hidden; background: linear-gradient(160deg, #ffd9e7, #f9a8c6); display: grid; place-items: center; box-shadow: var(--shadow); }
.cover img { width: 100%; height: 100%; object-fit: cover; grid-area: 1 / 1; min-height: 0; }
.cover-title { font: 600 1.1rem var(--display); color: #6d1739; text-align: center; padding: 14px; overflow: hidden; overflow-wrap: anywhere; max-height: 100%; }
.cover.thumb { width: 52px; flex: none; border-radius: 10px; } .cover.thumb .cover-title { display: none; }
.badge { display: inline-block; font: 700 .72rem var(--body); padding: 2px 10px; border-radius: 99px; background: var(--soft); color: var(--soft-ink); }
.badge.completed { background: #dcf3e4; color: #175c37; } .badge.hiatus { background: var(--warn); color: var(--warn-ink); }

.detail { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tags span { border: 1.5px solid var(--line); border-radius: 99px; padding: 1px 12px; font-size: .82rem; }
.synopsis { white-space: pre-line; }
.chapters { list-style: none; margin: 12px 0 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.chapters li + li { border-top: 1px solid var(--line); }
.chapters a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; text-decoration: none; color: var(--text); }
.chapters a span { min-width: 0; overflow-wrap: anywhere; } .chapters small { color: var(--muted); white-space: nowrap; }
.chapters a:hover, .chapters a.current { background: var(--soft); }
.pad { padding: 16px 18px; }

.reader { max-width: 680px; margin-inline: auto; }
.reader h1 { text-align: center; margin-top: 16px; }
.back { font-weight: 700; text-decoration: none; display: inline-block; margin-bottom: 8px; overflow-wrap: anywhere; }
.reader-tools { justify-content: center; margin-bottom: 16px; }
.chapter-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-block: 16px; }
.chapter-nav select { width: 100%; }
.prose { line-height: 1.85; overflow-wrap: anywhere; padding-block: 12px; }
.prose p { margin: 0 0 1.1em; }
.prose.serif { font-family: var(--serif); }
.scene { text-align: center; color: var(--blush); letter-spacing: .3em; margin: 1.6em 0; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.login { max-width: 380px; margin: 32px auto; text-align: center; } .login .field { text-align: left; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; min-width: 0; }
.field > span { font-weight: 700; font-size: .9rem; } .field small { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.novel-form { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.cover-edit { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 16px; }
.item .grow { flex: 1 1 180px; min-width: 0; } .item h3, .item p { margin: 0; }
.status-select { font-size: .85rem !important; padding: 5px 10px !important; }
.import-row { display: grid; grid-template-columns: auto 90px minmax(0, 1fr) 80px; gap: 8px; align-items: center; margin-bottom: 8px; }
.import-row .num { width: 100%; }
.chapter-head { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.toolbar { margin-bottom: 8px; }
.writer { min-height: 52vh; line-height: 1.8; border-radius: 18px !important; padding: 18px !important; }
.savebar { position: sticky; bottom: calc(var(--tab-h) + var(--tab-lift) + env(safe-area-inset-bottom)); background: var(--bg); padding-block: 12px; }
.savebar-top { margin-bottom: 8px; }
.savebar-top .btn[hidden] { display: none; }
.notice { background: var(--warn); color: var(--warn-ink); border-radius: 14px; padding: 10px 16px; margin-bottom: 14px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty-art { font-size: 2rem; color: var(--blush); margin-bottom: 8px; }
.modal { border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--text); max-width: min(420px, calc(100vw - 32px)); padding: 22px; }
.modal::backdrop { background: rgba(60, 20, 38, .45); }
#toasts { position: fixed; bottom: calc(var(--tab-h) + var(--tab-lift) + 16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100vw - 32px); z-index: 30; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); border-radius: 18px; padding: 10px 18px; font-weight: 600; text-align: center; overflow-wrap: anywhere; pointer-events: auto; user-select: text; }
.toast.bad { background: #8f1d18; color: #fff; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail, .novel-form { grid-template-columns: minmax(0, 1fr); }
  .cover.large { max-width: 210px; margin-inline: auto; }
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-nav select { grid-row: 1; grid-column: 1 / -1; }
  .chapter-head { grid-template-columns: 90px minmax(0, 1fr); }
  .import-row { grid-template-columns: auto 80px minmax(0, 1fr); }
  .import-row small { grid-column: 3; }
  .logo { font-size: 1.3rem; } .top nav a { padding: 5px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Akun, login Google, bookmark ---------- */
.account { position: relative; display: inline-flex; align-items: center; }
.account details { position: relative; }
.account summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: var(--soft); color: var(--soft-ink); font: 700 1rem var(--display); border: 1px solid var(--line); }
.account summary::-webkit-details-marker { display: none; }
.account summary img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; right: 0; top: 46px; z-index: 30; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px; box-shadow: 0 10px 28px rgba(60, 20, 38, .18); display: grid; gap: 2px; }
.menu .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu .who b { display: block; }
.menu a, .menu button { text-align: left; background: none; border: 0; font: 700 .93rem var(--body); color: var(--text); padding: 8px 12px; border-radius: 12px; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--soft); }
.btn.google { background: #fff; color: #3c4043; border-color: #dadce0; gap: 10px; }
.btn.google:hover { filter: none; background: #f8f9fa; }
.btn.google svg { width: 18px; height: 18px; flex: none; }
.gate { max-width: 440px; margin: 32px auto; text-align: center; }
.gate .row { justify-content: center; margin-top: 14px; }
.btn.fav { gap: 6px; }
.btn.fav[aria-pressed="true"] { background: var(--pink); color: var(--pink-ink); }
.card { position: relative; }
.card .fav-mark { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #c8336f; font-size: .95rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

/* Anti-salin untuk isi bab. Hanya menghalangi pembaca awam; proteksi sebenarnya ada di RLS. */
.reader .prose { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.reader .prose::selection { background: transparent; }
@media print { .reader .prose, .reader .reader-tools, .chapter-nav { display: none !important; } .reader::after { content: "Isi bab tidak bisa dicetak. Silakan baca di Jiaziee."; display: block; text-align: center; padding: 40px 0; } }
@media (max-width: 640px) { .top nav { gap: 2px; } .top-inner { gap: 6px; } .menu { right: -40px; } }

/* Dukungan & komentar */
.support-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-block: 24px; padding: 16px 20px; background: var(--soft); border-radius: 20px; }
.support-card p { margin: 2px 0 0; }
.comments { margin-top: 32px; }
.comments .section-head { margin-top: 0; }
.composer { display: grid; gap: 8px; }
.composer textarea { min-height: 84px; }
.composer .hint { color: var(--muted); font-size: .8rem; }
.c-list { display: grid; gap: 14px; margin-top: 18px; }
.c-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
.c-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); color: var(--soft-ink); display: inline-flex; align-items: center; justify-content: center; font: 600 1rem var(--display); overflow: hidden; }
.c-avatar img { width: 100%; height: 100%; object-fit: cover; }
.c-main { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; min-width: 0; }
.c-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.c-head b { font-weight: 700; overflow-wrap: anywhere; }
.c-head small { color: var(--muted); }
.c-admin { background: var(--pink); color: var(--pink-ink); border-radius: 99px; padding: 0 8px; font-size: .72rem; font-weight: 700; }
.c-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 4px; }
.c-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.link-btn { border: 0; background: none; padding: 2px 0; font: 700 .82rem var(--body); color: var(--soft-ink); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.c-replies { display: grid; gap: 10px; margin: 10px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.c-form { margin-top: 10px; }
.spoiler { background: var(--text); color: transparent; border-radius: 6px; padding: 0 4px; cursor: pointer; -webkit-user-select: none; user-select: none; transition: background .15s, color .15s; }
.spoiler.open { background: var(--soft); color: inherit; -webkit-user-select: text; user-select: text; }
@media print { .comments, .support-card { display: none !important; } }

/* Profil */
.c-avatar.big { width: 72px; height: 72px; font-size: 1.8rem; }
.modal.profile { width: min(420px, calc(100vw - 32px)); }
.profile-form { display: grid; gap: 14px; }
.profile-pic { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chip-demo { display: inline-block; border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 1px 10px; font: 600 .8rem var(--body); white-space: nowrap; }

/* ---------- Bar navigasi bawah ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); display: block; box-shadow: 0 -6px 20px rgba(214, 81, 134, .08); }
.tabbar-inner { max-width: 520px; margin-inline: auto; height: var(--tab-h); display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font: 700 .72rem var(--body); position: relative; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--pink); }
.tabbar a.active svg { fill: var(--soft); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--pink); }
.tab-icon { position: relative; display: inline-flex; }
.tab-badge { position: absolute; top: -5px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--pink); color: var(--pink-ink); font: 700 .68rem/18px var(--body); text-align: center; border: 2px solid var(--card); box-sizing: content-box; transform: scale(.85); transform-origin: center; }
@media print { .tabbar { display: none !important; } body { padding-bottom: 0; } }

/* ---------- Cari ---------- */
.search-box { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-block: 4px 12px; }
.search-box input { border-radius: 99px; padding: 12px 20px; }
.hint-title { font: 700 .85rem var(--body); color: var(--muted); margin: 18px 0 8px; }
.result-list { display: grid; gap: 10px; margin-top: 12px; }
.result { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px 10px 10px; text-decoration: none; color: var(--text); }
.result:hover { background: var(--soft); }
.result .cover { border-radius: 10px; box-shadow: none; } .result .cover-title { font-size: .6rem; padding: 4px; }
.result h3 { margin: 0; } .result p { margin: 0; }
.result .meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 2px; }

/* ---------- Notifikasi ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--soft); border-radius: 99px; padding: 4px; margin-bottom: 14px; }
.seg button { border: 0; background: transparent; color: var(--soft-ink); font: 700 .88rem var(--body); padding: 8px 6px; border-radius: 99px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg button[aria-selected="true"] { background: var(--card); box-shadow: 0 2px 8px rgba(214, 81, 134, .15); }
.seg .count { background: var(--pink); color: var(--pink-ink); border-radius: 99px; font-size: .7rem; padding: 0 7px; line-height: 18px; }
.n-list { display: grid; gap: 8px; }
.n-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px 10px 10px; text-decoration: none; color: var(--text); }
.n-item:hover { background: var(--soft); }
.n-item.unread { border-color: var(--blush); background: color-mix(in srgb, var(--soft) 55%, var(--card)); }
.n-item .c-avatar { width: 44px; height: 44px; }
.n-item .cover.thumb { width: 44px; border-radius: 8px; box-shadow: none; }
.n-text { min-width: 0; overflow-wrap: anywhere; }
.n-text p { margin: 0; font-size: .93rem; line-height: 1.45; }
.n-text .quote { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.n-text small { color: var(--muted); }
.n-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); }
.n-dot.off { visibility: hidden; }
.n-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }

/* ---------- Profil ---------- */
.me-card { text-align: center; }
.me-card .c-avatar { margin-inline: auto; }
.me-card h1 { margin: 10px 0 0; } .me-card p { margin: 0; }
.me-menu { display: grid; margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.me-menu > * { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; text-decoration: none; color: var(--text); background: none; border: 0; border-top: 1px solid var(--line); font: 700 .95rem var(--body); cursor: pointer; text-align: left; width: 100%; }
.me-menu > *:first-child { border-top: 0; }
.me-menu > *:hover { background: var(--soft); }
.me-menu small { color: var(--muted); font-weight: 600; }
.me-menu .danger-text { color: #b3261e; }
:root[data-theme="dark"] .me-menu .danger-text { color: #ff9a92; }

/* ---------- Lanjutkan membaca, rak, reaksi ---------- */
.resume { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 12px 14px; margin-bottom: 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.resume:hover { background: var(--soft); }
.resume .cover { border-radius: 10px; box-shadow: none; } .resume .cover-title { display: none; }
.resume-text { display: grid; min-width: 0; line-height: 1.35; }
.resume-text small { color: var(--soft-ink); font-weight: 700; }
.resume-text b { font-family: var(--display); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-text .muted { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-select { border-radius: 99px !important; font-weight: 700; background: var(--soft) !important; color: var(--soft-ink) !important; border-color: transparent !important; padding: 9px 16px !important; }
.reaction { text-align: center; margin-block: 24px 8px; }
.reaction h2 { font-size: 1.1rem; margin-bottom: 10px; }
.reaction p { margin: 10px 0 0; font-size: .82rem; }
.reaction.busy { opacity: .7; pointer-events: none; }
.react-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.react-btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 8px 16px; font: 700 .95rem var(--body); cursor: pointer; transition: transform .12s, background .15s; }
.react-btn:hover { background: var(--soft); }
.react-btn:active { transform: scale(.95); }
.react-btn .emoji { font-size: 1.35rem; line-height: 1; }
.react-btn small { font-size: .9rem; min-width: 1ch; color: var(--muted); font-weight: 700; }
.react-btn[aria-pressed="true"] { background: var(--soft); border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink) inset; }
.react-btn[aria-pressed="true"] small { color: var(--soft-ink); }
@media (prefers-reduced-motion: no-preference) { .react-btn[aria-pressed="true"] .emoji { animation: pop .3s ease; } @keyframes pop { 50% { transform: scale(1.35); } } }
@media print { .reaction { display: none !important; } }

/* ---------- Editor bab visual ---------- */
.rich { position: relative; background: var(--card); border: 1.5px solid var(--line); outline: none; overflow-wrap: anywhere; font-size: 17px; }
.rich:focus { border-color: var(--blush); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blush) 35%, transparent); }
.rich p { margin: 0 0 1.1em; }
.rich[data-empty]::before { content: attr(data-placeholder); position: absolute; left: 18px; top: 18px; right: 18px; color: var(--muted); pointer-events: none; }
.rich .scene { user-select: none; -webkit-user-select: none; }
.chip.fmt { min-width: 40px; }
.chip.fmt[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: var(--pink-ink); }

/* ---------- Pengaturan baca ---------- */
.reader { max-width: var(--read-w, 680px); transition: max-width .2s; }
.prose { transition: font-size .15s; }
.prose.justify { text-justify: inter-word; }
.align-bar { gap: 4px; display: inline-flex; padding: 0; }
.align-bar .chip { padding: 5px 9px; display: inline-flex; align-items: center; }
.chip[aria-pressed="true"] svg { color: inherit; }
.read-panel { display: grid; gap: 14px; }
.opt-group { display: grid; gap: 6px; }
.opt-title { font: 700 .85rem var(--body); color: var(--muted); }
.paper { border-radius: 24px; transition: background .2s, color .2s; }
.paper[data-paper] { padding: 6px 22px 20px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.paper[data-paper="cream"] { --bg: #fbf3dc; --card: #fffaea; --text: #3d3425; --muted: #7a6c51; --line: #e8dbb6; --soft: #f1e5c2; --soft-ink: #7a3f12; --pink: #a8305c; --pink-ink: #ffffff; --blush: #c98a5a; color-scheme: light; }
.paper[data-paper="sepia"] { --bg: #ead9b8; --card: #f3e6c9; --text: #43301d; --muted: #6f5a3c; --line: #d6c096; --soft: #dfcaa0; --soft-ink: #5d3410; --pink: #8f3a22; --pink-ink: #ffffff; --blush: #a9743f; color-scheme: light; }
.paper[data-paper] select { background: var(--card); color: var(--text); }
@media (max-width: 640px) { .paper[data-paper] { padding-inline: 14px; border-radius: 20px; } }
@media print { .read-panel, .align-bar { display: none !important; } }

/* ---------- Aplikasi terpasang (PWA) ---------- */
.top { padding-top: env(safe-area-inset-top); }
.install-bar { background: var(--soft); border-bottom: 1px solid var(--line); padding-block: 8px; }
.install-bar .wrap { display: flex; align-items: center; gap: 12px; }
.install-bar img { border-radius: 10px; flex: none; }
.install-bar span { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.install-bar small { color: var(--muted); }
.install-bar .icon-btn { flex: none; font-size: 1.3rem; line-height: 1; }
.install-steps { padding-left: 1.2em; display: grid; gap: 8px; }
@media (display-mode: standalone) { .install-bar { display: none; } body { overscroll-behavior-y: none; } }
@media print { .install-bar { display: none !important; } }

/* Terbitkan banyak bab */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 4px 0 12px; }
.bulk-bar .check { margin-bottom: 0; }
.bulk-bar .btn[disabled] { opacity: .45; cursor: not-allowed; }
.item > input[type="checkbox"], .bulk-bar input[type="checkbox"] { width: 20px; height: 20px; flex: none; accent-color: var(--pink); }

/* Penamaan otomatis */
.modal.autoname { width: min(480px, calc(100vw - 32px)); max-height: 88vh; overflow-y: auto; }
.modal.autoname h2 { margin-top: 0; }
.modal.autoname .check { flex-wrap: wrap; margin-bottom: 12px; }
.modal.autoname input.num { width: 80px; }
.name-preview { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; margin: 8px 0 16px; }
.name-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 8px 12px; font-size: .88rem; border-bottom: 1px solid var(--line); }
.name-row:last-child { border-bottom: 0; }
.name-row .was { color: var(--muted); overflow-wrap: anywhere; }
.name-row .arrow { color: var(--muted); }
.name-row .now { font-weight: 700; overflow-wrap: anywhere; }
.name-row:not(.changed) .now { font-weight: 400; color: var(--muted); }

/* ---------- Genre yang bisa diklik, ❤️ pengganti rating ---------- */
.tags a { border: 1.5px solid var(--line); border-radius: 99px; padding: 1px 12px; font-size: .82rem; color: var(--text); text-decoration: none; transition: background .15s, border-color .15s; }
.tags a:hover, .tags a:focus-visible { background: var(--soft); border-color: var(--blush); color: var(--soft-ink); }
.genre-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--soft); color: var(--soft-ink); border-radius: 16px; padding: 10px 14px; margin-bottom: 14px; }
.loves { display: flex; width: fit-content; align-items: center; gap: 6px; margin: 0 0 12px; padding: 6px 18px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--card); color: var(--text); font: 600 1.05rem var(--body); cursor: pointer; }
.loves[aria-pressed="true"] { background: var(--soft); border-color: var(--blush); color: var(--soft-ink); }
.loves b { font-family: var(--display); }

/* ---------- Beranda ---------- */
.home-hero { padding: 22px 18px; }
.home-hero h1 { margin: 0 0 4px; } .home-hero p { margin: 0; }
.home-section { margin-top: 26px; } .home-section > h2, .home-section .row > h2, .board > h2 { margin: 0 0 12px; }
.streak-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); }
.streak-flame { font-size: 2.4rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(255, 120, 40, .35)); }
.streak-flame.off { filter: grayscale(1); opacity: .5; }
.streak-main { flex: 1 1 140px; min-width: 0; } .streak-main p { margin: 0; }
.streak-num { font: 600 1.6rem var(--display); color: var(--pink); }
.streak-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; text-align: right; }
.streak-clock { font: 600 1.25rem var(--display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.chip-ok { background: #d9f4e3; color: #1d6b3b; border-radius: 99px; padding: 3px 12px; font: 700 .82rem var(--body); }
:root[data-theme="dark"] .chip-ok { background: #1f3b2b; color: #9be3b8; }
.latest-list { display: flex; flex-direction: column; gap: 14px; }
.latest { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 12px; box-shadow: var(--shadow); }
.latest-cover { position: relative; flex: 0 0 96px; display: block; text-decoration: none; }
.latest-cover .cover { width: 96px; }
.genre-pill { position: absolute; top: 6px; left: 6px; background: rgba(255, 255, 255, .88); color: #6b2a45; border-radius: 99px; padding: 1px 9px; font: 700 .7rem var(--body); max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.latest-title { color: var(--text); text-decoration: none; } .latest-title h3 { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.latest-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.latest-body li a { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 12px; border-radius: 99px; background: color-mix(in srgb, var(--soft) 60%, var(--card)); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.latest-body li a:hover, .latest-body li a:active { background: var(--soft); }
.latest-body li a small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.latest-body li a:hover span { color: var(--pink); }
.board { margin-top: 26px; }
.board-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.board-list li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.board-list li + li { border-top: 1px solid var(--line); }
.board-list li.me { background: var(--soft); }
.board-list .rank { width: 28px; text-align: center; font: 600 1.05rem var(--display); }
.board-list .who-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.board-list .score { white-space: nowrap; color: var(--pink); font-family: var(--display); }

/* ---------- Cari & ganti di editor bab ---------- */
.findbar { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin: 8px 0; }
.findbar[hidden] { display: none; }
.findbar .check { margin: 0; font-size: .9rem; }
.find-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.find-fields input { min-width: 0; }
.quote-row { align-items: center; }
::highlight(jz-find) { background: #ffd54f; color: #000; }
@media (max-width: 560px) { .find-fields { grid-template-columns: 1fr; } .latest-cover, .latest-cover .cover { flex-basis: 84px; width: 84px; } }

/* ---------- Footer ---------- */
.foot .copyright { font-size: .78rem; opacity: .85; }

/* ---------- Admin: tab status, aktivitas, cari & ganti massal ---------- */
.status-tabs { margin-top: 12px; }
.admin-feed { display: flex; flex-direction: column; gap: 10px; }
.modal.bulk input[type="text"] { margin-bottom: 6px; }
.bulk-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; font-size: .85rem; overflow-wrap: anywhere; }
.bulk-row + .bulk-row { border-top: 1px solid var(--line); }
.bulk-row .was { color: var(--muted); }
@media (max-width: 420px) { .seg button { font-size: .8rem; padding-inline: 2px; gap: 4px; } }

/* ---------- Pemanis: banner beranda ---------- */
.home-hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; text-align: left; background: linear-gradient(135deg, #ffdbe9, #ffe9df); }
:root[data-theme="dark"] .home-hero { background: linear-gradient(135deg, #4a2938, #46302d); }
.home-hero::before, .home-hero::after { position: absolute; color: var(--blush); opacity: .35; pointer-events: none; }
.home-hero::before { content: "✦"; top: 6px; right: 96px; font-size: 1.3rem; }
.home-hero::after { content: "♡"; bottom: -10px; right: 78px; font-size: 2.6rem; }
.hero-text { flex: 1; min-width: 0; }
.home-hero h1 { font-size: 1.45rem; }
.hero-mascot { flex: none; width: 84px; height: 84px; }

/* ---------- Pemanis: streak ---------- */
.streak-hearts { flex: 1 0 100%; display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 1.5rem; line-height: 1; color: var(--blush); }
.streak-hearts .on { color: var(--pink); }
.streak-card .streak-side { flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin: 0; padding: 8px 10px; background: var(--soft); border-radius: 18px; text-align: left; }
.streak-next { display: inline-flex; align-items: baseline; gap: 6px; margin-left: auto; }
.streak-side .streak-next .muted { color: var(--soft-ink); font-size: .78rem; }
.streak-side .streak-clock { font-size: 1.1rem; }
.streak-side .chip-ok { padding-inline: 9px; font-size: .78rem; }

/* Di HP, Library dan Rak ada di bar bawah. */
@media (max-width: 700px) { .top nav > a[data-nav] { display: none; } }

/* ---------- Anggota di beranda ---------- */
.members { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.members p { flex: 1 1 180px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.members p .link-btn { font: inherit; font-weight: 700; text-decoration: underline; padding: 0; }
.member-faces { display: flex; }
.member-faces .c-avatar { border: 2px solid var(--card); }
.member-faces .c-avatar + .c-avatar { margin-left: -12px; }
.modal.member-modal { width: min(420px, calc(100vw - 32px)); color: var(--text); }
.member-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 55vh; overflow-y: auto; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Daftar bab: 30 dulu, sisanya digulir di dalam kotak ---------- */
.chapters-scroll { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.chapters-more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--soft); color: var(--soft-ink); padding: 13px; font: 700 .95rem var(--body); cursor: pointer; }

/* ---------- Review & rating ---------- */
.rating-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rating-summary > div { display: grid; }
.rating-big { font: 600 2.2rem var(--display); color: var(--pink); }
.stars { white-space: nowrap; letter-spacing: 1px; }
.stars .off, .star-pick button.off { filter: grayscale(1); opacity: .35; }
.star-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 8px; }
.star-pick button { background: none; border: 0; padding: 4px; font-size: 1.8rem; line-height: 1.2; cursor: pointer; border-radius: 10px; }
.star-pick b { margin-left: 8px; color: var(--soft-ink); }
.review-stars { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

/* ---------- Seret urutan bab ---------- */
.drag-handle { flex: none; width: 40px; height: 44px; border: 0; border-radius: 12px; background: var(--soft); color: var(--soft-ink); font: 700 1.5rem/1 var(--body); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.item.dragging { border: 2px solid var(--pink); box-shadow: 0 10px 28px rgba(214, 81, 134, .35); background: var(--soft); }
.item.dragging .drag-handle { cursor: grabbing; }
.list.reordering .item > .btn, .list.reordering .item > input { display: none; }
.order-bar { position: sticky; bottom: calc(var(--tab-h) + var(--tab-lift) + env(safe-area-inset-bottom) + 8px); z-index: 24; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 12px 14px; background: var(--card); border: 2px solid var(--pink); border-radius: 20px; font-weight: 700; }

/* ---------- Koleksi ---------- */
.collection-chip { padding-block: 9px; }
.collection-tools { margin-bottom: 14px; }
.modal.collection-modal { width: min(440px, calc(100vw - 32px)); }
.pick-list { max-height: 45vh; overflow-y: auto; margin-block: 12px; }
.pick-list .check { margin: 0; padding: 9px 2px; }

/* ---------- Pratinjau impor PDF/EPUB ---------- */
.modal.import-modal { width: min(560px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: 90vh; overflow-y: auto; }
.import-modal select { width: 100%; }
.import-cover img { width: 52px; height: 78px; object-fit: cover; border-radius: 8px; flex: none; }
.import-chapters { max-height: 34vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.import-chapter { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 10px 12px; }
.import-chapter + .import-chapter { border-top: 1px solid var(--line); }
.import-chapter .import-no { min-width: 4.2em; font-size: .85rem; }
.import-chapter small { grid-column: 2 / -1; }

/* Tombol sebelumnya / selanjutnya di editor bab */
.savebar-top { flex-wrap: nowrap; gap: 8px; }
.savebar-top info, .savebar-top small { min-width: 0; text-align: center; flex: 1 1 auto; font-size: .8rem; }
.savebar-top .btn { flex: none; white-space: nowrap; }
.savebar-top .btn:disabled { opacity: .4; cursor: not-allowed; }
