/* Tema terang ala portal novel (wuxiaworld-style) */
:root {
  --bg: #eef1f5;
  --bg2: #ffffff;
  --card: #ffffff;
  --line: #e2e8f0;
  --txt: #1c2330;
  --muted: #6b7686;
  --accent: #1f7ae0;
  --accent-dark: #1663b8;
  --gold: #b8860b;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --gold-bg: #fef3c7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: clip; /* cegah geser kanan-kiri di HP */
}
img { max-width: 100%; height: auto; }
/* Pecah kata/URL panjang agar tidak melebar melebihi layar */
.syn, .synopsis-full, .reader-para, .diff-orig, .diff-sugg,
td, th, .novel-info h3, .chapter-row .title, .para {
  overflow-wrap: anywhere;
}
/* Proteksi salin: konten bacaan tidak bisa diseleksi / disalin.
   Kolom isian (input, textarea) tetap bisa dipakai seperti biasa. */
.reader .content, .reader-para, .synopsis-full, .syn,
.chapter-row .title, .diff-orig, .diff-sugg, .para,
.novel-info h3, td, th {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; /* iOS: matikan menu long-press */
}
.cover img { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
#navbar {
  display: flex; align-items: center; gap: 1.4rem;
  padding: 0.7rem 1.4rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 4px rgba(20, 40, 80, 0.06);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.1rem; }
.nav-links a { color: var(--muted); font-weight: 600; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; color: var(--muted); font-size: 0.9rem; }

/* Layout */
#view { max-width: 1020px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { font-size: 1.45rem; margin-bottom: 1rem; }
h2.section-title {
  font-size: 1.15rem; margin: 1.6rem 0 0.9rem;
  padding-left: 0.7rem; border-left: 4px solid var(--accent);
}
p.muted, .muted { color: var(--muted); }

/* Card & grid */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(20, 40, 80, 0.05);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1rem; }

/* Kartu novel ala portal */
.novel-card {
  display: flex; gap: 1rem; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.novel-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31, 122, 224, 0.15); }
.cover {
  width: 92px; height: 124px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden;
  background: linear-gradient(135deg, #1f7ae0, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.2rem; font-weight: 800;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.lg { width: 150px; height: 200px; font-size: 3.4rem; }
.novel-info { flex: 1; min-width: 0; }
.novel-info h3 { margin-bottom: 0.35rem; font-size: 1.05rem; }
.syn { color: var(--muted); font-size: 0.88rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }

/* Header detail novel */
.novel-head { display: flex; gap: 1.4rem; }
.novel-head h1 { margin-bottom: 0.5rem; }
.synopsis-full { color: #3c4658; line-height: 1.7; margin: 0.8rem 0; white-space: pre-wrap; }

/* Badge */
.badge { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; }
.b-ongoing { background: var(--green-bg); color: var(--green); }
.b-completed { background: var(--blue-bg); color: var(--blue); }
.b-hiatus { background: var(--gold-bg); color: var(--gold); }
.b-pending { background: var(--gold-bg); color: var(--gold); }
.b-approved { background: var(--green-bg); color: var(--green); }
.b-rejected, .b-suspended { background: var(--red-bg); color: var(--red); }

/* Form */
.form { max-width: 440px; margin: 3rem auto; }
.form.wide { max-width: 760px; margin: 1rem 0; }
label { display: block; margin: 0.8rem 0 0.3rem; color: var(--muted); font-size: 0.9rem; }
input, textarea, select {
  width: 100%; padding: 0.65rem 0.8rem;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  color: var(--txt); font-size: 1rem; font-family: inherit;
}
textarea { min-height: 110px; resize: vertical; }
textarea.tall { min-height: 320px; font-family: Georgia, serif; line-height: 1.7; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,122,224,.15); }

/* Button */
.btn {
  display: inline-block; padding: 0.6rem 1.2rem; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; margin-top: 1rem;
}
.btn:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); margin-top: 0; }
.btn-ghost:hover { color: var(--txt); border-color: #b9c4d4; background: #fff; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #166534; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #b91c1c; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; margin-top: 0; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
td.actions { white-space: nowrap; }
td.actions .btn { margin: 0 0.25rem 0 0; }

/* Chapter list */
.chapter-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--line);
}
.chapter-row:hover { background: #f8fafc; }
.chapter-row .num { color: var(--accent); font-weight: 700; min-width: 3.2rem; }
.chapter-row .title { flex: 1; }
.chapter-row a.title { color: var(--txt); font-weight: 600; }
.chapter-row a.title:hover { color: var(--accent); }

/* Alert */
.alert { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.92rem; border: 1px solid; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #fca5a5; }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: #93c5fd; }
.alert-ok { background: var(--green-bg); color: var(--green); border-color: #86efac; }

/* Reader */
.reader { max-width: 740px; margin: 0 auto; }
.reader h1 { text-align: center; }
.reader .content {
  white-space: pre-wrap; font-family: Georgia, serif;
  font-size: 1.08rem; line-height: 1.9; color: #2a3446;
}
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.toolbar .btn { margin-top: 0; }
.center { text-align: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.row-between h1 { margin-bottom: 0; }

@media (max-width: 640px) {
  .novel-head { flex-direction: column; }
  .cover.lg { width: 120px; height: 160px; }
  /* --- perbaikan tampilan HP: tidak ada geser horizontal --- */
  #navbar { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.7rem 1rem; }
  .nav-links { gap: 0.8rem; }
  .nav-user { margin-left: 0; }
  #view { padding: 1rem 0.8rem 3rem; }
  .card { overflow: hidden; }
  .novel-card { gap: 0.8rem; }
  .cover { width: 76px; height: 104px; font-size: 1.8rem; }
  table { display: block; overflow-x: auto; }
  .verify-row { flex-wrap: wrap; }
}

/* Dashboard & koreksi */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; text-align: center; box-shadow: 0 1px 3px rgba(20,40,80,.05); }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }

.mode-toggle { display: flex; gap: 0.5rem; margin: 1rem 0 0.4rem; }
.mode-toggle .btn { margin-top: 0; }

.para { border: 1px dashed transparent; border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; cursor: pointer; }
.para:hover { border-color: var(--accent); background: #f0f7ff; }
.para-mine { background: #fffbeb; border: 1px solid #fcd34d; }
.para-mine:hover { background: #fef6e0; }
.para-hint { font-size: 0.75rem; color: var(--muted); }
.reader-para { font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.9; color: #2a3446; margin-bottom: 1.1rem; }

.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 0.8rem 0; }
.diff-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 700; }
.diff-orig { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 0.7rem; white-space: pre-wrap; font-size: 0.92rem; line-height: 1.6; }
.diff-sugg { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 0.7rem; white-space: pre-wrap; font-size: 0.92rem; line-height: 1.6; }

.review-item { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  .diff { grid-template-columns: 1fr; }
}

/* Lembar Persetujuan moderator */
.agreement-box { margin: 1.2rem 0 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.agreement-box h3 { margin: 0; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); font-size: 1rem; }
.agreement-text { max-height: 260px; overflow-y: auto; padding: 0.8rem 1rem; font-size: 0.92rem; line-height: 1.7; }
.agreement-text ol { margin: 0.4rem 0 0.8rem 1.2rem; padding: 0; }
.agreement-text li { margin-bottom: 0.3rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; font-size: 0.95rem; line-height: 1.5; }
.check input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; flex-shrink: 0; accent-color: var(--accent); }

/* Kolom komentar chapter */
.comment { border-bottom: 1px solid var(--line); padding: 0.7rem 0; }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-size: 0.85rem; }
.comment-head .btn { margin-top: 0; margin-left: auto; }
.comment-body { margin-top: 0.3rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: break-word; }
.b-admin { background: var(--blue-bg); color: var(--blue); }
.b-moderator { background: var(--green-bg); color: var(--green); }

/* Pilihan peran saat pendaftaran */
.role-toggle { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.role-toggle .btn { flex: 1; }

/* Avatar */
.avatar-xs, .avatar-sm, .avatar-lg, .avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; background: var(--gold-bg); color: var(--gold);
  font-weight: 700; flex: none;
}
img.avatar-xs, img.avatar-sm, img.avatar-lg { background: var(--line); }
.avatar-xs { width: 28px; height: 28px; font-size: 0.8rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.85rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
#nav-profile { display: inline-flex; }
.profile-top { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }

/* Cropper foto profil */
#crop-viewport {
  width: 280px; height: 280px; max-width: 100%;
  overflow: hidden; position: relative; border-radius: 12px;
  border: 2px dashed var(--gold); background: #111; touch-action: none;
  cursor: grab; margin: 0.6rem 0;
}
#crop-viewport:active { cursor: grabbing; }
#crop-img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
#crop-wrap input[type="range"] { accent-color: var(--gold); }

/* Chapter terkunci (Batu Roh) */
.lock-card { padding: 2.5rem 1.5rem; }
.lock-emoji { font-size: 3rem; }
.lock-ico { margin-right: 0.2rem; }

/* Badge peran */
.b-member { background: var(--gold-bg); color: var(--gold); }

/* ---------- Klaim Harian Batu Roh ---------- */
.claim-card {
  position: relative; overflow: hidden; border-radius: 16px; text-align: center;
  padding: 2rem 1.2rem; margin: 1rem 0 1.2rem; color: #fff;
  background: radial-gradient(circle at 50% 0%, #5b3a9e 0%, #2b1b4d 55%, #191233 100%);
  border: 1px solid rgba(255, 215, 0, .4);
  animation: claim-glow 3s ease-in-out infinite;
}
@keyframes claim-glow {
  0%, 100% { box-shadow: 0 10px 30px rgba(43,27,77,.5), 0 0 0 rgba(255,215,0,0); }
  50% { box-shadow: 0 10px 34px rgba(43,27,77,.55), 0 0 28px rgba(255,215,0,.35); }
}
.claim-card.claimed { animation: none; }
.claim-inner { position: relative; z-index: 2; }
.claim-title { font-size: 1.35rem; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.claim-sub { color: #e9e2ff; margin: .5rem 0 1rem; }
.claim-hint { color: #c9bdf0; font-size: .85rem; margin: .8rem 0 0; }

/* batu-batu melayang di latar kartu */
.claim-stones-bg { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.claim-stones-bg span { position: absolute; opacity: .28; animation: stone-drift 7s ease-in-out infinite; }
.claim-stones-bg span:nth-child(1) { left: 8%; top: 12%; font-size: 1.6rem; }
.claim-stones-bg span:nth-child(2) { left: 85%; top: 20%; font-size: 1.1rem; animation-delay: -2s; }
.claim-stones-bg span:nth-child(3) { left: 15%; top: 70%; font-size: 1.2rem; animation-delay: -4s; }
.claim-stones-bg span:nth-child(4) { left: 78%; top: 68%; font-size: 1.8rem; animation-delay: -1s; }
.claim-stones-bg span:nth-child(5) { left: 48%; top: 8%; font-size: 1rem; animation-delay: -5.5s; }
@keyframes stone-drift {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* tombol klaim emas */
.btn-claim {
  position: relative; overflow: hidden; border: none; cursor: pointer;
  font-size: 1.15rem; font-weight: 800; color: #3a2503;
  padding: .9rem 2.2rem; border-radius: 999px;
  background: linear-gradient(180deg, #ffe27a 0%, #f5b81f 55%, #e09c0a 100%);
  transition: transform .12s ease, filter .2s;
  animation: claim-btn-pulse 1.8s ease-in-out infinite;
}
.btn-claim:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); filter: brightness(1.05); }
.btn-claim:active:not(:disabled) { transform: translateY(3px); }
.btn-claim:disabled { cursor: wait; animation: none; filter: saturate(.7); }
@keyframes claim-btn-pulse {
  0%, 100% { box-shadow: 0 6px 0 #9a6b06, 0 10px 24px rgba(245,184,31,.45), 0 0 0 rgba(255,215,0,0); }
  50% { box-shadow: 0 6px 0 #9a6b06, 0 10px 24px rgba(245,184,31,.45), 0 0 32px rgba(255,215,0,.8); }
}
.btn-claim-shine {
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
  transform: skewX(-20deg); animation: shine-sweep 2.6s ease-in-out infinite; pointer-events: none;
}
@keyframes shine-sweep { 0% { left: -70%; } 55%, 100% { left: 140%; } }

/* status sudah diklaim */
.claim-done-badge {
  display: inline-block; font-weight: 800; font-size: 1.05rem; color: #062d16;
  background: linear-gradient(180deg, #bbf7d0, #6ee7a8);
  padding: .55rem 1.4rem; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(110,231,168,.5);
}

/* kilatan sukses + partikel */
.claim-card.claim-success { animation: claim-flash .8s ease 2; }
@keyframes claim-flash { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.7); } }
.claim-float-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.stone-particle {
  position: absolute; bottom: 18%; font-weight: 800; color: #ffe27a;
  text-shadow: 0 2px 6px rgba(0,0,0,.5); animation: float-up 1.8s ease-out forwards;
}
@keyframes float-up {
  0% { transform: translateY(0) scale(.8); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-130px) scale(1.15); opacity: 0; }
}

/* denyut saldo di navbar saat klaim */
.stones-pulse { animation: stones-pulse .6s ease 2; display: inline-block; }
@keyframes stones-pulse { 50% { transform: scale(1.35); } }

/* ---------- Login Google ---------- */
input[readonly] { background: #eef1f5; color: var(--muted); cursor: default; }
