/* ============================================================
   ASGARD — Design Tokens
   Brand: deep navy + sky blue, on an off-white / true-black base
   Display: Fraunces (saga/myth weight) · Body: Inter · Meta: IBM Plex Mono
   Signature element: the "Bifrost" rule — a slow, quiet gradient
   line under the hero, referencing the bridge between worlds.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --text: #14171c;
  --text-muted: #5b6270;
  --border: #14171c;
  --border-soft: rgba(20, 23, 28, 0.14);

  --navy: #16234a;
  --navy-hover: #223367;
  --sky: #3f6fd8;
  --sky-soft: rgba(63, 111, 216, 0.12);

  --radius: 2px;
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --header-h: 64px;
  --transition: 160ms ease;
}

[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #121620;
  --text: #f2f1ec;
  --text-muted: #9aa1b0;
  --border: #f2f1ec;
  --border-soft: rgba(242, 241, 236, 0.16);

  --navy: #21315e;
  --navy-hover: #2c4180;
  --sky: #6d9bff;
  --sky-soft: rgba(109, 155, 255, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand img { height: 28px; width: auto; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.main-nav {
  display: flex;
  gap: 24px;
  flex: 1;
}

.main-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
  border-color: var(--sky);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}

.icon-btn:hover { border-color: var(--sky); background: var(--sky-soft); }
.icon-btn svg { width: 18px; height: 18px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 36px;
  width: 220px;
  transition: border-color var(--transition), width var(--transition);
}

.search-box:focus-within { border-color: var(--sky); width: 260px; }
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 12px;
  font-family: var(--font-mono);
}

.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 10px;
  transition: background var(--transition), color var(--transition);
}

.lang-toggle button.active { background: var(--navy); color: #fff; }

.mobile-menu-btn { display: none; }

/* ---------------- Hero ---------------- */

.hero {
  padding: 72px 0 48px;
  position: relative;
}

.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sky);
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.02;
  font-weight: 600;
  margin: 0 0 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--sky);
}

.hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 0 28px;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.btn-primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn-ghost:hover { border-color: var(--sky); color: var(--sky); }

/* Bifrost rule — signature element */
.bifrost {
  height: 2px;
  margin-top: 44px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--sky) 25%, var(--navy) 50%, var(--sky) 75%, transparent);
  background-size: 200% 100%;
  animation: bifrost-shift 9s linear infinite;
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .bifrost { animation: none; }
}

@keyframes bifrost-shift {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.featured-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--surface);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.featured-card .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sky);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.featured-card h3 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 8px;
}

.featured-card .meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ---------------- Category cards ---------------- */

.section { padding: 40px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.view-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--sky);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.category-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  transition: transform var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 160px;
}

.category-card:hover { border-color: var(--sky); transform: translateY(-2px); }

.category-card .label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.category-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.9;
}

.category-card .arrow {
  align-self: flex-end;
  margin-top: 14px;
  color: var(--sky);
}

/* ---------------- Continue reading ---------------- */

.continue-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.continue-card {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.continue-card .cover {
  width: 56px;
  height: 78px;
  background: var(--border-soft);
  border-radius: 2px;
  flex-shrink: 0;
}

.continue-card .info { flex: 1; min-width: 0; }
.continue-card h4 {
  font-size: 13.5px;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-card .chapter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-track {
  height: 4px;
  background: var(--border-soft);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill { height: 100%; background: var(--sky); }

.empty-state {
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ---------------- Trending ---------------- */

.trending-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.trend-card {
  display: block;
  flex: 0 0 160px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.trend-card .rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sky);
  padding: 8px 10px 0;
}

.trend-card .cover {
  height: 200px;
  background: var(--border-soft);
  margin: 8px 10px;
  border-radius: 2px;
}

.trend-card .info { padding: 0 10px 12px; }
.trend-card h4 { font-size: 13px; margin: 0 0 4px; }
.trend-card .rating {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------- Latest updates table ---------------- */

.update-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.pill {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
}

.pill.active { border-color: var(--navy); color: var(--text); background: var(--sky-soft); }

.update-list {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.update-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px 90px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-soft);
}

.update-row:last-child { border-bottom: none; }

.type-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--sky);
  text-transform: uppercase;
}

.update-row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-row .chapter { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.update-row .time { color: var(--text-muted); font-size: 12px; text-align: right; }

/* ---------------- Genres ---------------- */

.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.genre-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.genre-chip:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------- Footer ---------------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 48px 0 28px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand .brand-word { display: block; margin-bottom: 8px; }
.footer-brand p { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 0; }

.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { font-size: 13.5px; color: var(--text); }
.footer-col a:hover { color: var(--sky); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---------------- Auth modal ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  padding: 28px;
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
}

.modal .sub { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field textarea:focus { outline: none; border-color: var(--sky); }

/* Chrome/mobile browsers sometimes paint a hard white background on
   inputs/textareas they think are autofillable (bio, name, etc),
   ignoring our dark theme entirely. Force our colors back. */
.field input:-webkit-autofill,
.field textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.modal .btn { width: 100%; justify-content: center; margin-top: 4px; }

.modal-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.modal-switch button {
  background: none;
  border: none;
  color: var(--sky);
  font-weight: 600;
  font-size: 13px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
}

.modal { position: relative; }

.form-msg {
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: none;
}

.form-msg.error { display: block; background: rgba(200, 60, 60, 0.1); color: #c83c3c; }
.form-msg.success { display: block; background: var(--sky-soft); color: var(--sky); }

/* ---------------- Catalog layout (novels/books/comics) ---------------- */

.catalog-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 28px 0 60px;
}

.catalog-sidebar { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }

.catalog-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius);
  margin-bottom: 2px;
}

.catalog-sidebar nav a svg { width: 16px; height: 16px; }
.catalog-sidebar nav a:hover { background: var(--sky-soft); color: var(--text); }
.catalog-sidebar nav a.active { background: var(--navy); color: #fff; }

.catalog-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 4px;
}

.catalog-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 20px; }

.catalog-search {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.catalog-search input {
  flex: 1;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.catalog-search input:focus { outline: none; border-color: var(--sky); }

.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.type-tile {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.type-tile.active,
.type-tile:hover { border-color: var(--sky); background: var(--sky-soft); }

.catalog-body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
}

.filter-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  height: fit-content;
}

.filter-group { margin-bottom: 18px; }
.filter-group:last-child { margin-bottom: 0; }

.filter-group h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  cursor: pointer;
}

.filter-option input { accent-color: var(--sky); }

.grid-covers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.cover-card { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cover-card .cover { aspect-ratio: 2/3; background: var(--border-soft); background-size: cover; background-position: center; }
.cover-card .info { padding: 10px; }
.cover-card h4 { font-size: 12.5px; margin: 0 0 4px; line-height: 1.3; }
.cover-card .rating { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

.popular-list { list-style: none; padding: 0; margin: 0; }
.popular-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.popular-list li:last-child { border-bottom: none; }
.popular-list .rank { font-family: var(--font-mono); font-size: 12px; color: var(--sky); width: 20px; }
.popular-list .rating { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.announce-bar {
  position: sticky;
  bottom: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 0;
  font-size: 13px;
}

.announce-bar .container { display: flex; justify-content: space-between; align-items: center; }
.announce-bar a { font-weight: 600; text-decoration: underline; }

@media (max-width: 900px) {
  .catalog-shell { grid-template-columns: 1fr; }
  .catalog-sidebar { display: none; }
  .catalog-body { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Detail page ---------------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 20px 0;
}
.back-link:hover { color: var(--sky); }

.detail-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding-bottom: 48px;
}

.detail-cover {
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--border-soft);
  background-size: cover;
  background-position: center;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 10px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  align-items: center;
}

.detail-meta .rating { color: var(--sky); font-weight: 600; }
.detail-meta .dot::before { content: "·"; margin-right: 16px; color: var(--border-soft); }

.detail-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.detail-genres span {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.detail-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  max-width: 68ch;
  margin-bottom: 24px;
  white-space: pre-line;
}

.detail-actions { display: flex; gap: 10px; margin-bottom: 32px; flex-wrap: wrap; }
.detail-actions .btn-outline { background: transparent; }

.chapter-preview {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.chapter-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.chapter-preview-row:last-child { border-bottom: none; }
.chapter-preview-row .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--sky);
  border: 1px solid var(--sky);
  border-radius: 2px;
  padding: 1px 6px;
  margin-left: 8px;
}

@media (max-width: 720px) {
  .detail-shell { grid-template-columns: 1fr; }
  .detail-cover { max-width: 180px; }
}

/* ---------------- Chapter list page ---------------- */

.chlist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.chlist-title h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 4px; }
.chlist-title p { color: var(--text-muted); font-size: 13px; margin: 0; }

.chlist-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.chlist-toolbar input {
  flex: 1;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}

.chlist-toolbar select {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.chapter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.chapter-row:last-child { border-bottom: none; }
.chapter-row:hover { background: var(--sky-soft); }

.chapter-row .num { font-family: var(--font-mono); font-size: 12px; color: var(--sky); margin-bottom: 3px; }
.chapter-row .ctitle { font-size: 14px; }
.chapter-row .cdate { font-size: 12px; color: var(--text-muted); text-align: right; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 24px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.pagination button {
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
}
.pagination button.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------------- Reader ---------------- */

.reader-body { background: #000; min-height: 100vh; }
[data-theme="light"] .reader-body { background: #f0efe9; }

.reader-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(11,14,20,0.92);
  color: #fff;
  z-index: 50;
  transition: transform 200ms ease;
  font-size: 13px;
}
.reader-topbar.hidden { transform: translateY(-100%); }
.reader-topbar a, .reader-topbar span { color: #fff; }

.reader-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 20px 100px;
}

.reader-content.comic { max-width: 720px; padding: 56px 0 90px; }
.reader-content.comic img { width: 100%; display: block; }

.novel-text {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.9;
  color: #f0efe9;
  white-space: pre-line;
}
[data-theme="light"] .novel-text { color: #14171c; }

.novel-chapter-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: #fff;
  margin-bottom: 24px;
}
[data-theme="light"] .novel-chapter-title { color: #14171c; }

.reader-bottombar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 10px 16px;
  background: rgba(11,14,20,0.92);
  z-index: 50;
  transition: transform 200ms ease;
}
.reader-bottombar.hidden { transform: translateY(100%); }

.reader-bottombar button {
  border: none;
  background: transparent;
  color: #fff;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.reader-bottombar button:hover { background: rgba(255,255,255,0.1); }
.reader-bottombar svg { width: 20px; height: 20px; }

.resume-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  z-index: 60;
  max-width: 300px;
  text-align: center;
}
.resume-toast p { font-size: 13px; margin: 0 0 12px; }
.resume-toast .row { display: flex; gap: 8px; }
.resume-toast .row .btn { flex: 1; padding: 8px; font-size: 12.5px; justify-content: center; }

/* ---------------- Info pages (about/terms/privacy/faq/support) ---------------- */

.info-shell { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 32px 0 60px; }

.info-nav a {
  display: block;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-radius: var(--radius);
  margin-bottom: 2px;
}
.info-nav a:hover { background: var(--sky-soft); color: var(--text); }
.info-nav a.active { background: var(--navy); color: #fff; }

.info-content { max-width: 68ch; }
.info-content h1 { font-family: var(--font-display); font-size: 30px; margin: 0 0 6px; }
.info-content .updated { color: var(--text-muted); font-size: 12.5px; font-family: var(--font-mono); margin-bottom: 28px; }
.info-content h2 { font-family: var(--font-display); font-size: 18px; margin: 32px 0 12px; }
.info-content p { font-size: 14.5px; line-height: 1.8; color: var(--text); margin: 0 0 14px; }
.info-content ul { padding-left: 20px; margin: 0 0 14px; }
.info-content li { font-size: 14.5px; line-height: 1.9; color: var(--text); }
.info-content hr { border: none; border-top: 1px solid var(--border-soft); margin: 28px 0; }

.faq-search { margin-bottom: 24px; }
.faq-search input {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-a { display: none; padding: 0 0 16px; font-size: 13.5px; color: var(--text-muted); line-height: 1.7; }
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-q .chev { transition: transform 150ms ease; }

.log-entry { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border-soft); }
.log-entry .v { font-family: var(--font-mono); font-size: 13px; color: var(--sky); margin-bottom: 2px; }
.log-entry .d { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.log-entry .section-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 10px 0 4px; }

.support-options { display: flex; gap: 12px; margin: 20px 0; flex-wrap: wrap; }

@media (max-width: 780px) {
  .info-shell { grid-template-columns: 1fr; }
  .info-nav { display: flex; overflow-x: auto; gap: 4px; margin-bottom: 12px; }
  .info-nav a { white-space: nowrap; }
}

/* ---------------- Forms (contact / request / bug / feedback) ---------------- */

.form-shell { max-width: 620px; margin: 0 auto; padding: 32px 0 60px; }

.form-choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0 8px; }
.form-choice-grid button {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px 12px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.form-choice-grid button:hover { border-color: var(--sky); background: var(--sky-soft); }

.form-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 26px;
  background: var(--surface);
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.step-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.step-row span { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); width: 16px; }
.step-row input { flex: 1; }

.severity-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.severity-grid label {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.severity-grid input { display: none; }
.severity-grid input:checked + span { color: var(--sky); }
.severity-grid label:has(input:checked) { border-color: var(--sky); background: var(--sky-soft); }

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.result-card .check { width: 40px; height: 40px; margin: 0 auto 16px; color: var(--sky); }
.result-card h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 20px; }
.result-card .id-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border-soft); font-size: 13.5px; }
.result-card .id-row:last-of-type { border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; }

.my-request-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.my-request-row .id { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

@media (max-width: 600px) {
  .form-choice-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .severity-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Community ---------------- */

.community-tabs { display: flex; gap: 6px; margin-bottom: 24px; border-bottom: 1px solid var(--border-soft); }
.community-tabs button {
  border: none;
  background: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.community-tabs button.active { color: var(--text); border-color: var(--sky); }

.composer {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  background: var(--surface);
}
.composer textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  min-height: 70px;
  resize: vertical;
  margin-bottom: 10px;
}

.comment-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
}
.comment-card .head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.comment-card .head strong { font-size: 13px; }
.comment-card .head time { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.comment-card p { font-size: 13.5px; line-height: 1.6; margin: 0; white-space: pre-line; }
.comment-card .target { display: inline-block; font-family: var(--font-mono); font-size: 11px; color: var(--sky); margin-bottom: 6px; }

.rec-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  background: var(--surface);
}
.rec-card h4 { margin: 0 0 6px; font-size: 14px; }
.rec-card p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; white-space: pre-line; }
.rec-card .head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-family: var(--font-mono); }

/* ---------------- Profile page ---------------- */

.profile-banner {
  height: 180px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--navy), var(--sky));
  background-size: cover;
  background-position: center;
  margin-top: 24px;
}

.profile-head { text-align: center; margin-top: -48px; padding: 0 0 24px; }

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--border-soft);
  background-size: cover;
  background-position: center;
  margin: 0 auto 12px;
}

.profile-head h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 2px; }
.profile-head .handle { color: var(--text-muted); font-size: 13px; font-family: var(--font-mono); margin-bottom: 10px; }
.profile-head .location { color: var(--text-muted); font-size: 12.5px; margin-bottom: 12px; }

.badge-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.badge-pill {
  border: 1px solid var(--sky);
  color: var(--sky);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.profile-quote { font-family: var(--font-display); font-style: italic; color: var(--text-muted); font-size: 15px; margin: 0 0 16px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 20px 0;
  margin-bottom: 24px;
}
.profile-stats div { text-align: center; }
.profile-stats .num { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.profile-stats .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }

.profile-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border-soft); margin-bottom: 24px; }
.profile-tabs button {
  border: none; background: none; padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.profile-tabs button.active { color: var(--text); border-color: var(--sky); }

.currently-reading { display: flex; gap: 16px; border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 28px; align-items: center; }
.currently-reading .cover { width: 72px; height: 100px; border-radius: 2px; background: var(--border-soft); background-size: cover; background-position: center; flex-shrink: 0; }
.currently-reading .info { flex: 1; }
.currently-reading h4 { margin: 0 0 4px; font-size: 15px; }
.currently-reading .chapter { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.recent-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 28px; }
.recent-item { flex: 0 0 110px; text-align: center; }
.recent-item .cover { width: 110px; height: 150px; border-radius: 2px; background: var(--border-soft); background-size: cover; background-position: center; margin-bottom: 6px; }
.recent-item .type { font-family: var(--font-mono); font-size: 10px; color: var(--sky); text-transform: uppercase; }
.recent-item .ch { font-size: 11px; color: var(--text-muted); }

.library-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.activity-chart { display: flex; align-items: flex-end; gap: 10px; height: 100px; margin-bottom: 28px; padding: 0 4px; }
.activity-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.activity-bar { width: 100%; background: var(--sky); border-radius: 2px 2px 0 0; min-height: 3px; }
.activity-bar-wrap .day { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

.review-item { border-bottom: 1px solid var(--border-soft); padding: 14px 0; }
.review-item:last-child { border-bottom: none; }
.review-item .stars { color: var(--sky); font-size: 13px; margin-bottom: 4px; }
.review-item p { font-size: 13.5px; margin: 0 0 4px; font-style: italic; white-space: pre-line; }
.review-item .target { font-size: 12px; color: var(--text-muted); }

/* ---------------- Settings page ---------------- */

.settings-shell { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 28px 0 60px; max-width: 900px; margin: 0 auto; }
.settings-nav a { display: block; padding: 9px 12px; font-size: 13.5px; color: var(--text-muted); border-radius: var(--radius); margin-bottom: 2px; }
.settings-nav a.active, .settings-nav a:hover { background: var(--sky-soft); color: var(--text); }

.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 4px; }
.settings-section .sub { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }

.avatar-picker { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar-picker .preview { width: 72px; height: 72px; border-radius: 50%; background: var(--border-soft); background-size: cover; background-position: center; }
.banner-picker .preview { width: 100%; height: 100px; border-radius: var(--radius); background: var(--border-soft); background-size: cover; background-position: center; margin-bottom: 10px; }

@media (max-width: 780px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .settings-shell { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; gap: 4px; }
  .settings-nav a { white-space: nowrap; }
}

/* ---------------- Search results ---------------- */

.search-header { padding: 28px 0 8px; }
.search-header h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 4px; }
.search-header .sub { color: var(--text-muted); font-size: 13.5px; }

.search-group { margin-bottom: 32px; }
.search-group h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sky);
  margin: 0 0 14px;
}

/* ---------------- Rating, Like, Comments (detail & reader) ---------------- */

.engage-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.star-rate {
  display: flex;
  gap: 4px;
}

.star-rate button {
  background: none;
  border: none;
  padding: 0;
  color: var(--border-soft);
  cursor: pointer;
}

.star-rate button svg { width: 22px; height: 22px; }
.star-rate button.filled { color: var(--sky); }
.star-rate:hover button { color: var(--sky); }

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
}

.like-btn svg { width: 16px; height: 16px; }
.like-btn.active { border-color: var(--sky); color: var(--sky); background: var(--sky-soft); }
.like-btn.active svg { fill: var(--sky); }

.engage-meta { font-size: 12.5px; color: var(--text-muted); font-family: var(--font-mono); }

.comments-section { margin-top: 32px; }

.comment-composer { margin-bottom: 20px; }
.comment-composer textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  line-height: 1.6;
}

.comment-composer textarea:focus { outline: none; border-color: var(--sky); }
.comment-composer textarea::placeholder { color: var(--text-muted); }
.comment-composer textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.comment-item {
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 0;
}
.comment-item:last-child { border-bottom: none; }

.comment-item .head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
}

.comment-item .head strong { font-size: 13px; }
.comment-item .head time { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.comment-item p { font-size: 13.5px; line-height: 1.6; margin: 0 0 8px; white-space: pre-line; }

.upvote-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}
.upvote-btn svg { width: 14px; height: 14px; }
.upvote-btn.active { color: var(--sky); }

/* ---------------- Reader comments panel ---------------- */

.reader-comments-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 70;
  display: none;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}
.reader-comments-panel.open { display: flex; }

.reader-comments-panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.reader-comments-panel .panel-head h3 { font-family: var(--font-display); font-size: 18px; margin: 0; }

/* ---------------- Responsive ---------------- */

@media (max-width: 960px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .hero .container { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .search-box { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .category-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 32px; }
  .update-row { grid-template-columns: 70px 1fr 70px; }
  .update-row .time { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 6px; align-items: flex-start; }
  .site-header .container { gap: 12px; }
}
