/* ===================== Reset & Base ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0e0e14;
  --bg2: #181822;
  --bg3: #2a2a3a;
  --text: #f2f1fa;
  --dim: #9391ab;
  --accent: #ce0b35;
  --accent2: #e5484d;
  --radius: 14px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.container { flex: 1; padding-bottom: 40px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; text-decoration: none; }
.dim { color: var(--dim); }

/* ===================== Header ===================== */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.logo span { color: var(--accent2); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--bg3); }
.nav a.active { color: var(--text); background: var(--bg3); }

.search-box { position: relative; width: 260px; }
.search-box input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--bg3);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-result {
  display: none;
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.search-result.show { display: block; }
.search-result a {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 14px;
}
.search-result a:hover { background: var(--bg3); }
.search-result span { color: var(--dim); font-size: 12px; }
.search-result p { padding: 12px 14px; font-size: 14px; }

/* ===================== Hero ===================== */
.hero {
  background: linear-gradient(135deg, #5c0f22 0%, #181822 55%, #0e0e14 100%);
  padding: 70px 0;
  text-align: center;
}
.hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 14px; }
.hero h1 span { color: var(--accent2); }
.hero p { color: var(--dim); max-width: 560px; margin: 0 auto 26px; font-size: 17px; }

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 15px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
  display: inline-block;
  background: var(--bg3);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid #3a3a4a;
}
.btn-secondary:hover { background: #33334a; }

/* ===================== Sections ===================== */
.section { margin-top: 40px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}
.see-all { color: var(--accent2); font-size: 14px; font-weight: 500; }
.see-all:hover { text-decoration: underline; }

/* ===================== Genre chips ===================== */
.genre-list { display: flex; flex-wrap: wrap; gap: 10px; }
.genre-chip {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  color: var(--dim);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.genre-chip:hover { color: var(--text); border-color: var(--accent); }
.genre-chip.small { padding: 4px 12px; font-size: 12px; }

/* ===================== Comic grid & card ===================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

.comic-card { display: block; }
.comic-card .cover {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3 / 4.2;
  background: var(--bg2);
}
.comic-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.comic-card:hover .cover img { transform: scale(1.05); }
.comic-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.comic-card .info { padding: 10px 4px 0; }
.comic-card .title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comic-card .meta {
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comic-card .sub {
  display: flex;
  gap: 10px;
  font-size: 12px;
  margin-top: 4px;
}
.rating { color: #fbbf24; font-weight: 600; }
.status {
  color: var(--accent2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status.done { color: #4ade80; }

/* ===================== Detail page ===================== */
.detail-wrap { padding-top: 30px; }
.detail-hero {
  display: flex;
  gap: 28px;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 28px;
}
.detail-cover {
  width: 240px;
  height: 336px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { font-size: 30px; font-weight: 800; }
.alt-title { color: var(--dim); font-size: 15px; margin-top: 2px; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 14px 0;
  font-size: 14px;
  color: var(--dim);
}
.badge-rating {
  background: rgba(251,191,36,.15);
  color: #fbbf24;
  padding: 3px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
}
.badge-status {
  background: rgba(206,11,53,.18);
  color: var(--accent2);
  padding: 3px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}
.badge-status.done { background: rgba(74,222,128,.15); color: #4ade80; }
.detail-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.detail-author { font-size: 14px; color: var(--dim); margin-bottom: 12px; }
.detail-synopsis { color: var(--dim); font-size: 15px; }
.detail-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* Chapter list */
.chapter-list {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
}
.ch-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ch-search {
  background: var(--bg3);
  border: 1px solid #3a3a4a;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  width: 200px;
  outline: none;
}
.ch-search:focus { border-color: var(--accent); }
.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--bg3);
  font-size: 14px;
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:hover { background: var(--bg3); }
.ch-read {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 14px;
  align-items: center;
}
.ch-num { font-weight: 700; color: var(--accent2); white-space: nowrap; }
.ch-read:hover .ch-num { color: #ff8a94; }
.ch-title { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pages, .ch-date { color: var(--dim); font-size: 12px; white-space: nowrap; }
.ch-dl {
  color: var(--dim);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 14px;
}
.ch-dl:hover { color: var(--accent2); background: var(--bg); }

/* ===================== Reader ===================== */
.reader-body { background: #0a0a10; }
.reader-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.reader-title {
  flex: 1;
  font-size: 14px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-nav { display: flex; gap: 8px; }
.reader-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ch-select {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  max-width: 180px;
}
.btn-nav {
  background: var(--bg3);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #3a3a4a;
  cursor: pointer;
  font-family: inherit;
}
.btn-nav:hover { background: #33334a; }

/* Book mode: satu halaman per layar, geser horizontal */
body.book-mode .reader-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  max-width: none;
  padding: 0;
  height: calc(100vh - 55px);
  align-items: stretch;
}
body.book-mode .reader-ch-header { display: none; }
body.book-mode .reader-img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  scroll-snap-align: start;
  margin-bottom: 0;
  border-radius: 0;
  background: #000;
}

/* Navigasi melayang */
.reader-fab {
  display: none;
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
body.nav-hidden .reader-bar,
body.nav-hidden .reader-bottom-nav { display: none; }
body.nav-hidden .reader-pages { padding-top: 10px; }

.reader-pages {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 12px 60px;
}
.reader-ch-header { text-align: center; margin-bottom: 24px; }
.reader-ch-header h2 { font-size: 20px; }
.reader-ch-header p { color: var(--dim); font-size: 13px; margin-top: 4px; }
.reader-img {
  width: 100%;
  display: block;
  margin-bottom: 10px;
  border-radius: 6px;
  background: #fff;
}

.reader-bottom-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 50px;
  max-width: 800px;
  margin: 0 auto;
}

/* ===================== Account / Auth ===================== */
.account-box { position: relative; }
.acc-wrap { position: relative; }
.acc-btn {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.acc-btn:hover { background: #33334a; }
.acc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  font-size: 15px;
}
.acc-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  overflow: hidden;
  z-index: 300;
}
.acc-menu.show { display: block; }
.acc-menu a, .acc-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.acc-menu a:hover, .acc-menu button:hover { background: var(--bg3); }
.acc-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.acc-head span { font-size: 12px; }

/* Auth modal */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-card h2 { text-align: center; margin-bottom: 6px; }
.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 18px;
  cursor: pointer;
}
.auth-tabs { display: flex; gap: 8px; }
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--bg3);
  background: var(--bg);
  color: var(--dim);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.auth-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--bg3);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-err { color: #f87171; font-size: 13px; min-height: 18px; }
.auth-submit { width: 100%; text-align: center; cursor: pointer; font-family: inherit; }
.auth-submit:disabled { opacity: .5; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--bg3); }
.auth-google { width: 100%; text-align: center; cursor: pointer; font-family: inherit; }
.auth-note { font-size: 12px; text-align: center; margin: 4px 0 0; }

/* Profile */
.profile-hero { padding-top: 10px; }
.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.verify-box {
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 14px;
  font-size: 14px;
}
.verify-box p { margin-bottom: 10px; }

/* ===================== Footer ===================== */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--bg3);
  padding: 30px 0;
  text-align: center;
  font-size: 14px;
  color: var(--dim);
}
.site-footer strong { color: var(--text); }
.site-footer p { margin: 4px 0; }

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .search-box { width: 100%; order: 2; }
  .hero { padding: 50px 0; }
  .hero h1 { font-size: 28px; }
  .detail-hero { flex-direction: column; align-items: center; text-align: center; }
  .detail-cover { width: 180px; height: 252px; }
  .detail-genres, .detail-actions { justify-content: center; }
  .chapter-item { flex-wrap: wrap; }
  .ch-title { display: none; }
  .ch-search { width: 130px; }
  .reader-nav .btn-nav { padding: 6px 10px; font-size: 12px; }
}
