:root {
  --bg: #f4f1f8;
  --reader-bg: #111;
  --card: #ffffff;
  --text: #272331;
  --muted: #81798e;
  --primary: #8b5cf6;
  --border: #e5deec;
}
body.dark {
  --bg: #111;
  --card: #211c2b;
  --text: #f5f2fa;
  --muted: #aaa1b5;
  --border: #393044;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-decoration: none;
}
/* HEADER */
.reader-header {
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.reader-logo {
  color: var(--primary);
  font-size: 21px;
  font-weight: 800;
}
.reader-title {
  margin: auto;
  text-align: center;
}
.reader-title strong {
  display: block;
  font-size: 13px;
}
.reader-title span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.reader-actions {
  display: flex;
  gap: 8px;
}
.reader-actions button,
.reader-actions a {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
/* MAIN */
.reader-main {
  width: min(900px, 100%);
  margin: 0 auto;
  background: var(--reader-bg);
}
/* HEADING */
.chapter-heading {
  padding: 35px 20px 25px;
  text-align: center;
  background: var(--reader-bg);
  color: white;
}
.chapter-heading h1 {
  margin: 0;
  font-size: 22px;
}
.chapter-heading p {
  margin: 7px 0 0;
  color: #aaa;
  font-size: 13px;
}
/* ADS */
.ad-placeholder {
  min-height: 90px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
  color: #888;
  font-size: 11px;
}
/* COMIC */
.comic-pages {
  width: 100%;
  background: #000;
  line-height: 0;
}
.comic-page {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
}
/* DEMO PAGE */
.demo-page {
  min-height: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(
      180deg,
      #222,
      #090909
    );
  color: #777;
  font-size: 20px;
}
/* NAV */
.chapter-navigation {
  padding: 22px 15px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--reader-bg);
}
.nav-button {
  padding: 12px;
  border: 1px solid #3a3a3a;
  border-radius: 9px;
  color: white;
  text-align: center;
  font-size: 12px;
}
.nav-button:hover {
  border-color: var(--primary);
  color: #c4b5fd;
}
/* COMMENTS */
.reader-comments {
  padding: 25px 20px;
  background: var(--card);
  color: var(--text);
}
.reader-comments h2 {
  margin-top: 0;
  font-size: 19px;
}
.comment-form {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
}
.comment-form textarea {
  min-height: 70px;
  flex: 1;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  outline: none;
  resize: vertical;
}
.comment-form button {
  align-self: flex-end;
  padding: 10px 15px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  cursor: pointer;
}
.comment {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.comment strong {
  font-size: 13px;
}
.comment p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
/* FOOTER */
footer {
  width: min(900px, 100%);
  margin: auto;
  padding: 25px 20px;
  display: flex;
  justify-content: space-between;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
}
/* MOBILE */
@media (max-width: 600px) {
  .reader-header {
    padding: 0 10px;
  }
  .reader-logo {
    font-size: 18px;
  }
  .reader-title strong {
    font-size: 11px;
  }
  .chapter-navigation {
    grid-template-columns: 1fr 1fr;
  }
  .chapter-navigation
  .nav-button:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .chapter-heading {
    padding: 25px 15px 20px;
  }
  .chapter-heading h1 {
    font-size: 18px;
  }
  .comment-form {
    flex-direction: column;
  }
  .comment-form button {
    align-self: stretch;
  }
}
/* Common footer */
.site-footer, footer {
  padding: 36px 5% 28px;
  border-top: 1px solid var(--border);
  background: var(--card, var(--surface, #fff));
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.footer-logo {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.footer-slogan {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-social-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.footer-social-link:hover { color: var(--primary); }
.footer-disclaimer {
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  max-width: 700px;
  opacity: 0.9;
}
@media (max-width: 600px) {
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-social { justify-content: center; }
}

/* Header search */
.header-search {
  flex: 1;
  max-width: 280px;
  margin: 0 12px;
  position: relative;
  min-width: 120px;
}
.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface, var(--card, #fff));
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.header-search input:focus {
  border-color: var(--primary);
}
.header-search button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  width: 30px;
  height: 30px;
}
@media (max-width: 680px) {
  .header-search {
    max-width: none;
    flex: 1;
    margin: 0 8px;
    min-width: 0;
  }
  .header-search input {
    height: 36px;
    font-size: 12px;
    padding-left: 10px;
  }
}

@media (max-width: 680px) {
  .site-header, .member-header, .reader-header {
    height: auto !important;
    min-height: 56px;
    padding: 8px 12px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-search {
    flex: 1 1 100%;
    max-width: none !important;
    margin: 0 !important;
    order: 10;
  }
  .main-nav, nav { display: none; }
}



.site-logo {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: inherit;
  flex-shrink: 0;
  visibility: visible !important;
  opacity: 1 !important;
}
.site-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--primary, #8b5cf6);
  color: #fff !important;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  font-family: Georgia, serif;
  flex-shrink: 0;
}
.site-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.site-logo-text strong {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary, #8b5cf6) !important;
}
.site-logo-text small {
  font-size: 11px;
  color: var(--muted, #81798f);
  font-weight: 500;
  margin-top: 1px;
}
@media (max-width: 680px) {
  .site-logo-icon { width: 34px; height: 34px; font-size: 16px; }
  .site-logo-text strong { font-size: 18px; }
  .site-logo-text small { font-size: 10px; }
}


/* ===== LOGO kiểu thiết kế (star + serif) ===== */
.site-logo {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: inherit;
  flex-shrink: 0;
  visibility: visible !important;
  opacity: 1 !important;
}
.site-logo-mark {
  font-size: 26px;
  line-height: 1;
  color: var(--primary, #8b6acb);
  filter: drop-shadow(0 0 6px rgba(139, 106, 203, 0.35));
}
.site-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.site-logo-name {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 26px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.2px;
  color: var(--primary, #8b6acb) !important;
  background: linear-gradient(135deg, #9b7ad8 0%, #7c5cbf 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* fallback if gradient text not supported */
@supports not (-webkit-background-clip: text) {
  .site-logo-name {
    color: var(--primary, #8b6acb) !important;
    -webkit-text-fill-color: unset;
  }
}
.site-logo-slogan {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  font-style: normal;
  color: var(--muted, #81798f) !important;
  -webkit-text-fill-color: var(--muted, #81798f);
  margin-top: 2px;
  letter-spacing: 0.2px;
}
@media (max-width: 680px) {
  .site-logo-mark { font-size: 22px; }
  .site-logo-name { font-size: 20px; }
  .site-logo-slogan { font-size: 10px; }
}
