/* ═══════════════════════════════════════════════════════════
   MangaFlow Theme – main.css
   Design tokens → Reset → Layout → Components → Pages
═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────── */
:root {
  --clr-bg:          #0f172a;
  --clr-surface:     #1e293b;
  --clr-surface-2:   #263348;
  --clr-border:      #334155;
  --clr-text:        #e2e8f0;
  --clr-text-muted:  #94a3b8;
  --clr-primary:     #6366f1;
  --clr-primary-h:   #4f52d3;
  --clr-accent:      #f59e0b;
  --clr-success:     #22c55e;
  --clr-danger:      #ef4444;
  --clr-warning:     #f97316;
  --clr-link:        #818cf8;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm: 0 1px 3px rgb(0 0 0/.4);
  --shadow-md: 0 4px 12px rgb(0 0 0/.5);
  --shadow-lg: 0 10px 30px rgb(0 0 0/.6);

  --font-base: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --fz-xs:   .75rem;
  --fz-sm:   .875rem;
  --fz-md:   1rem;
  --fz-lg:   1.125rem;
  --fz-xl:   1.25rem;
  --fz-2xl:  1.5rem;
  --fz-3xl:  1.875rem;

  --transition: .2s ease;
  --max-w: 1280px;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--clr-link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select {
  font-family: inherit;
  font-size: var(--fz-md);
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  width: 100%;
  padding: .6rem .875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgb(99 102 241 / .25);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
textarea { resize: vertical; min-height: 6rem; }

/* ── Layout ───────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }

/* ── Utilities ────────────────────────────────────────── */
.text-muted  { color: var(--clr-text-muted); }
.text-center { text-align: center; }
.required::after { content: ' *'; color: var(--clr-danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ═══════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════ */
.site-header {
  background: #080f1e;
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 62px;
}
.header-brand { flex-shrink: 0; }
.site-title {
  font-size: var(--fz-xl);
  font-weight: 700;
  color: #fff;
  letter-spacing: -.025em;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.site-title:hover { text-decoration: none; }
.custom-logo { height: 40px; width: auto; }

.main-menu { flex: 1; }
.nav-list {
  display: flex;
  gap: .25rem;
}
.nav-list a {
  color: var(--clr-text-muted);
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  font-size: var(--fz-sm);
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-list a:hover,
.nav-list .current-menu-item > a {
  color: #fff;
  background: var(--clr-surface);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.search-toggle {
  color: var(--clr-text-muted);
  padding: .4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
}
.search-toggle:hover { color: #fff; background: var(--clr-surface); }

/* Search bar */
.search-bar {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding: .75rem 0;
}
.search-bar form {
  display: flex;
  gap: .5rem;
  max-width: 600px;
}
.search-bar input[type=search] { flex: 1; }
.search-bar button {
  padding: .6rem 1.25rem;
  background: var(--clr-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition);
}
.search-bar button:hover { background: var(--clr-primary-h); }

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: .4rem;
}
.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--clr-text-muted);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: var(--fz-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--clr-primary); color: #fff; }
.btn-primary:hover  { background: var(--clr-primary-h); }
.btn-outline  { border-color: var(--clr-border); color: var(--clr-text); }
.btn-outline:hover  { border-color: var(--clr-primary); color: var(--clr-primary); }
.btn-ghost    { color: var(--clr-text-muted); }
.btn-ghost:hover    { color: var(--clr-text); background: var(--clr-surface); }
.btn-danger   { background: var(--clr-danger); color: #fff; }
.btn-danger:hover   { opacity: .85; }
.btn-sm  { padding: .35rem .75rem; font-size: var(--fz-xs); }
.btn-lg  { padding: .8rem 1.75rem; font-size: var(--fz-md); }
.btn-block { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════════════
   CARDS / SURFACES
═══════════════════════════════════════════════════════ */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* ═══════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: var(--fz-xs);
  font-weight: 600;
  line-height: 1.4;
}
.badge--publish { background: #14532d; color: #86efac; }
.badge--draft   { background: #1e3a5f; color: #93c5fd; }
.badge--pending { background: #78350f; color: #fcd34d; }

/* ═══════════════════════════════════════════════════════
   STORY GRID
═══════════════════════════════════════════════════════ */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.story-grid--sm {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.story-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.story-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--clr-primary);
}
.story-card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 2/3;
  overflow: hidden;
}
.story-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.story-card:hover .story-card__thumb img { transform: scale(1.05); }
.story-card__no-thumb {
  width: 100%; height: 100%;
  background: var(--clr-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-text-muted);
}
.story-card__latest-badge {
  position: absolute;
  top: .5rem;
  left: .5rem;
  background: var(--clr-primary);
  color: #fff;
  font-size: .625rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.story-card__body { padding: .625rem .75rem .75rem; }
.story-card__title {
  font-size: var(--fz-sm);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: .375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-card__title a { color: var(--clr-text); }
.story-card__title a:hover { color: var(--clr-primary); text-decoration: none; }
.story-card__meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fz-xs);
  color: var(--clr-text-muted);
}
.meta-rating { color: var(--clr-accent); font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   SECTION HEADERS
═══════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-size: var(--fz-xl);
  font-weight: 700;
  position: relative;
  padding-left: .875rem;
}
.section-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: .15em;
  bottom: .15em;
  width: 3px;
  background: var(--clr-primary);
  border-radius: 3px;
}
.see-all {
  font-size: var(--fz-sm);
  color: var(--clr-primary);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   HOMEPAGE
═══════════════════════════════════════════════════════ */
.homepage-hero {
  padding: 2.5rem 0 1.5rem;
}
.homepage-hero .page-title {
  font-size: var(--fz-3xl);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--clr-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-latest,
.section-top-rated,
.section-genres {
  margin-bottom: 3rem;
}

/* Genre Tags */
.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.genre-tag {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  padding: .35rem .875rem;
  border-radius: 99px;
  font-size: var(--fz-sm);
  transition: all var(--transition);
}
.genre-tag:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  text-decoration: none;
}
.genre-tag span { color: var(--clr-text-muted); font-size: var(--fz-xs); }

/* ═══════════════════════════════════════════════════════
   SINGLE STORY
═══════════════════════════════════════════════════════ */
.story-single { padding: 2rem 0; }

.story-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}
.story-cover {
  flex-shrink: 0;
  width: 220px;
}
.story-cover img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.story-cover__placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--clr-surface-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-text-muted);
}
.story-info { flex: 1; min-width: 0; }
.story-title {
  font-size: var(--fz-3xl);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: .5rem;
}
.story-alt-title {
  color: var(--clr-text-muted);
  font-size: var(--fz-sm);
  margin-bottom: 1rem;
  font-style: italic;
}

.story-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .625rem;
  margin-bottom: 1.25rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.meta-item { display: flex; flex-direction: column; gap: .2rem; }
.meta-label { font-size: var(--fz-xs); color: var(--clr-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.meta-value { font-size: var(--fz-sm); font-weight: 500; color: var(--clr-text); }
.meta-value a { color: var(--clr-link); }

/* Rating block */
.story-rating-block {
  margin-bottom: 1.25rem;
}
.avg-rating {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .625rem;
}
.stars { display: flex; gap: 2px; }
.star { font-size: 1.125rem; }
.star.full  { color: var(--clr-accent); }
.star.half  { color: var(--clr-accent); }
.star.empty { color: var(--clr-border); }
.avg-number { font-size: var(--fz-lg); font-weight: 700; color: var(--clr-accent); }
.rating-count { font-size: var(--fz-xs); color: var(--clr-text-muted); }

.user-rating {
  display: flex;
  align-items: center;
  gap: .375rem;
}
.rate-label { font-size: var(--fz-sm); color: var(--clr-text-muted); }
.rate-star {
  font-size: 1.5rem;
  color: var(--clr-border);
  transition: color var(--transition), transform var(--transition);
  background: none;
  border: none;
  padding: 0 2px;
  line-height: 1;
}
.rate-star:hover,
.rate-star.hovered,
.rate-star.active { color: var(--clr-accent); transform: scale(1.15); }
.rating-feedback { font-size: var(--fz-sm); color: var(--clr-text-muted); margin-left: .25rem; }
.rating-login-prompt { font-size: var(--fz-sm); color: var(--clr-text-muted); }

.story-actions { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: 1rem; }

/* Story description & chapter list */
.story-description,
.chapter-list {
  margin-bottom: 1.5rem;
}
.story-description h2,
.chapter-list h2 { font-size: var(--fz-xl); font-weight: 700; margin-bottom: 1rem; }
.entry-content { color: var(--clr-text-muted); line-height: 1.8; }
.entry-content p { margin-bottom: 1em; }

.chapters { display: flex; flex-direction: column; gap: .25rem; max-height: 480px; overflow-y: auto; padding-right: .25rem; }
.chapters::-webkit-scrollbar { width: 4px; }
.chapters::-webkit-scrollbar-track { background: var(--clr-surface-2); }
.chapters::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 4px; }

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
.chapter-item:hover { background: var(--clr-surface-2); border-color: var(--clr-border); }
.chapter-link { color: var(--clr-text); font-size: var(--fz-sm); font-weight: 500; flex: 1; }
.chapter-link:hover { color: var(--clr-primary); text-decoration: none; }
.chapter-date { font-size: var(--fz-xs); color: var(--clr-text-muted); flex-shrink: 0; margin-left: 1rem; }

/* ═══════════════════════════════════════════════════════
   CHAPTER READER
═══════════════════════════════════════════════════════ */
.chapter-reader-page .site-main .container { padding: 0; max-width: 100%; }
.chapter-reader-page .site-main { padding-bottom: 0; }

.chapter-viewer { }

.chapter-topbar {
  background: #080f1e;
  border-bottom: 1px solid var(--clr-border);
  padding: .625rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 62px;
  z-index: 90;
}
.topbar-back {
  color: var(--clr-text-muted);
  font-size: var(--fz-sm);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.topbar-back:hover { color: var(--clr-text); text-decoration: none; }
.chapter-title {
  font-size: var(--fz-sm);
  font-weight: 600;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-select-wrap select {
  width: auto;
  min-width: 160px;
  font-size: var(--fz-xs);
  padding: .35rem 2rem .35rem .625rem;
}
.chapter-nav-btns { display: flex; gap: .375rem; flex-shrink: 0; }
.reader-settings-btn {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  padding: .35rem .625rem;
  border-radius: var(--radius-sm);
  font-size: var(--fz-lg);
  transition: all var(--transition);
}
.reader-settings-btn:hover { color: var(--clr-text); border-color: var(--clr-primary); }

.reader-settings-panel {
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  padding: .75rem 1.25rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.reader-settings-panel label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fz-sm);
  color: var(--clr-text-muted);
  cursor: pointer;
}
.reader-settings-panel input[type=range] { width: 120px; accent-color: var(--clr-primary); }
.reader-settings-panel input[type=checkbox] { width: auto; accent-color: var(--clr-primary); }

.chapter-images {
  background: #1a1a2e;
  min-height: 60vh;
  padding: 1rem 0;
  transition: background var(--transition);
}
.chapter-images.dark-bg { background: #0a0a0a; }

.chapter-img {
  max-width: 80%;
  margin: 0 auto 2px;
  display: block;
}

.chapter-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.25rem;
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
}
.chapter-bottom-nav .container {
  max-width: 100%;
  padding: 1.5rem 1.25rem;
}

/* ═══════════════════════════════════════════════════════
   FORMS (Auth, Add/Edit Story)
═══════════════════════════════════════════════════════ */
.form-page { padding: 3rem 0; }
.auth-page  { padding: 2rem 1rem; display: flex; justify-content: center; }
.auth-card, .form-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 520px;
}
.auth-card { margin: auto; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo a {
  font-size: var(--fz-2xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-card h1, .form-card h1 {
  font-size: var(--fz-2xl);
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.form-card-header h1 { margin-bottom: 0; }
.form-card { max-width: 680px; margin: auto; }

.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: var(--fz-sm);
  font-weight: 500;
  margin-bottom: .4rem;
  color: var(--clr-text);
}
.form-input { }
.form-hint { font-size: var(--fz-xs); color: var(--clr-text-muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--clr-border); }
.input-wrap { position: relative; }
.input-wrap .form-input, .input-wrap input { padding-right: 2.75rem; }
.toggle-pw {
  position: absolute;
  right: .625rem;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 0;
  font-size: var(--fz-md);
  color: var(--clr-text-muted);
  background: none;
}
.toggle-pw:hover { color: var(--clr-text); }
.pw-strength { font-size: var(--fz-xs); font-weight: 600; margin-top: .3rem; min-height: 1em; }

/* Login form override (WP default) */
#loginform, #registerform { background: none !important; }
#loginform input[type=text],
#loginform input[type=password] {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border);
  border-radius: var(--radius-sm);
}
#wp-submit {
  background: var(--clr-primary) !important;
  border-color: var(--clr-primary) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-base) !important;
  cursor: pointer;
}
.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: var(--fz-sm);
  color: var(--clr-text-muted);
  display: flex;
  gap: .5rem;
  justify-content: center;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .375rem;
  max-height: 220px;
  overflow-y: auto;
  padding: .75rem;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--fz-sm);
  cursor: pointer;
  padding: .25rem .375rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.checkbox-label:hover { background: var(--clr-surface); }
.checkbox-label input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--clr-primary); flex-shrink: 0; }

.current-thumb { display: flex; align-items: center; gap: .75rem; margin-bottom: .625rem; }
.current-thumb img { width: 60px; border-radius: 4px; }

/* ═══════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════ */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: var(--fz-sm);
}
.alert ul { padding-left: 1rem; list-style: disc; }
.alert li { margin-bottom: .25rem; }
.alert--error   { background: #450a0a; border: 1px solid #991b1b; color: #fca5a5; }
.alert--success { background: #052e16; border: 1px solid #166534; color: #86efac; }
.alert--info    { background: #1e3a5f; border: 1px solid #1d4ed8; color: #93c5fd; }

/* ═══════════════════════════════════════════════════════
   ARCHIVE / SEARCH
═══════════════════════════════════════════════════════ */
.archive-page, .search-page { padding: 2rem 0; }
.archive-header { margin-bottom: 1.5rem; }
.archive-header h1 { font-size: var(--fz-3xl); font-weight: 800; }
.archive-desc { color: var(--clr-text-muted); margin-top: .5rem; }
.result-count { color: var(--clr-text-muted); font-size: var(--fz-sm); margin-bottom: 1rem; }

.filter-bar {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-group label { font-size: var(--fz-xs); color: var(--clr-text-muted); font-weight: 500; }
.filter-group select { width: auto; min-width: 160px; }

/* Pagination */
.pagination { margin: 2rem 0; display: flex; justify-content: center; }
.pagination .page-numbers {
  display: inline-flex;
  gap: .375rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pagination .page-numbers li { }
.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: var(--fz-sm);
  font-weight: 500;
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  transition: all var(--transition);
}
.pagination a:hover { border-color: var(--clr-primary); color: var(--clr-primary); text-decoration: none; }
.pagination .current { background: var(--clr-primary); border-color: var(--clr-primary); color: #fff; }
.pagination .dots { border: none; background: none; }

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--clr-text-muted);
}
.empty-state p { margin-bottom: 1rem; }
.no-content { color: var(--clr-text-muted); padding: 2rem 0; text-align: center; font-size: var(--fz-sm); }

/* ═══════════════════════════════════════════════════════
   COMMENTS
═══════════════════════════════════════════════════════ */
.comments-section { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--clr-border); }
.comments-title { font-size: var(--fz-xl); font-weight: 700; margin-bottom: 1.5rem; }

.comment-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.comment-item { }
.comment-body {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.comment-author { display: flex; align-items: center; gap: .625rem; margin-bottom: .75rem; }
.comment-author .avatar { border-radius: 50%; flex-shrink: 0; }
.comment-author-info { display: flex; flex-direction: column; gap: .1rem; }
.comment-name { font-size: var(--fz-sm); font-weight: 600; }
.comment-time { font-size: var(--fz-xs); color: var(--clr-text-muted); }
.comment-awaiting { font-size: var(--fz-sm); color: var(--clr-text-muted); font-style: italic; margin-bottom: .5rem; }
.comment-content { font-size: var(--fz-sm); color: var(--clr-text-muted); line-height: 1.7; }
.comment-footer { margin-top: .625rem; display: flex; gap: .75rem; }
.reply-link a, .edit-link a { font-size: var(--fz-xs); color: var(--clr-link); }

/* Comment form */
.comment-respond {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
#reply-title { font-size: var(--fz-lg); font-weight: 700; margin-bottom: 1.25rem; }
.comment-form p { margin-bottom: 1rem; }
#submit {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  padding: .6rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-base);
  font-size: var(--fz-sm);
  cursor: pointer;
  transition: background var(--transition);
}
#submit:hover { background: var(--clr-primary-h); }
.logged-in-as { font-size: var(--fz-sm); color: var(--clr-text-muted); margin-bottom: 1rem; }

/* ═══════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════ */
.site-footer {
  background: #080f1e;
  border-top: 1px solid var(--clr-border);
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-logo {
  font-size: var(--fz-xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-bottom: .5rem;
}
.footer-tagline { font-size: var(--fz-sm); color: var(--clr-text-muted); max-width: 300px; }
.footer-menu { display: flex; flex-direction: column; gap: .5rem; }
.footer-menu a { font-size: var(--fz-sm); color: var(--clr-text-muted); }
.footer-menu a:hover { color: var(--clr-text); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid var(--clr-border);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: var(--fz-xs);
  color: var(--clr-text-muted);
}
.footer-bottom a { color: var(--clr-text-muted); }
.footer-bottom a:hover { color: var(--clr-text); }

/* ═══════════════════════════════════════════════════════
   WIDGET
═══════════════════════════════════════════════════════ */
.widget { margin-bottom: 1.5rem; }
.widget-title {
  font-size: var(--fz-md);
  font-weight: 700;
  margin-bottom: .875rem;
  color: var(--clr-text);
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: .5rem;
}

/* ═══════════════════════════════════════════════════════
   SEARCH FORM (standalone)
═══════════════════════════════════════════════════════ */
.search-form {
  display: flex;
  gap: .5rem;
  margin: 1.5rem 0;
}
.search-form input { flex: 1; }
.search-form button { background: var(--clr-primary); color: #fff; padding: .6rem 1.25rem; border-radius: var(--radius-sm); font-weight: 500; transition: background var(--transition); }
.search-form button:hover { background: var(--clr-primary-h); }

/* ═══════════════════════════════════════════════════════
   DEFAULT PAGE
═══════════════════════════════════════════════════════ */
.default-page { padding: 2rem 0; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: var(--fz-3xl); font-weight: 800; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .story-header { flex-direction: column; }
  .story-cover { width: 180px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --fz-3xl: 1.5rem; --fz-2xl: 1.25rem; }

  .main-menu { display: none; }
  .main-menu.is-open { display: block; position: absolute; top: 62px; left: 0; right: 0; background: #080f1e; border-bottom: 1px solid var(--clr-border); padding: 1rem; }
  .main-menu.is-open .nav-list { flex-direction: column; gap: .25rem; }
  .mobile-menu-toggle { display: flex; }

  .story-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .875rem; }
  .story-header { align-items: center; }
  .story-cover { width: 140px; }
  .story-meta-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .auth-card, .form-card { padding: 1.5rem; }
  .chapter-topbar { gap: .5rem; }
  .chapter-title { display: none; }
  .filter-bar { flex-direction: column; }
}

@media (max-width: 480px) {
  .story-grid { grid-template-columns: repeat(3, 1fr); gap: .625rem; }
  .story-card__body { padding: .5rem; }
  .story-card__title { font-size: .75rem; }
  .story-card__meta { font-size: .625rem; }
  .chapter-img { max-width: 100% !important; }
  .header-actions .btn { display: none; }
}

/* ── Print ───────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .chapter-topbar,
  .story-actions, .user-rating, .reader-settings-btn { display: none !important; }
}
