/* ==========================================================================
   Happymod.diy — Dark Glass Manga & Manhwa Editorial Theme
   Fast, Mobile-First, Zero-Dependency Responsive Layout
   ========================================================================== */

:root {
  --hm-accent: #1e73be;
  --hm-accent-2: #3b82f6;
  --hm-purple: #7c3aed;
  --hm-bg: #0a0a0a;
  --hm-surface: #11131a;
  --hm-surface-2: #181c26;
  --hm-border: #262c3a;
  --hm-text: #f1f5f9;
  --hm-muted: #9ca3af;
  --hm-header: #070707;
  --hm-footer: #0c0c0c;
  --hm-radius: 14px;
  --hm-container: 1240px;
  --hm-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--hm-bg);
  color: var(--hm-text);
  font-family: var(--hm-font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: #93c5fd;
}

h1, h2, h3, h4 {
  margin: 0 0 0.55em;
  line-height: 1.26;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #ffffff;
}

p {
  margin: 0 0 1.1em;
}

.hm-container {
  width: 100%;
  max-width: var(--hm-container);
  margin: 0 auto;
  padding: 0 20px;
}

.hm-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--hm-accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
}
.hm-skip-link:focus {
  left: 8px;
}

/* Buttons */
.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--hm-accent);
  color: #ffffff !important;
  font-weight: 800;
  font-size: 0.92rem;
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hm-btn:hover {
  background: var(--hm-accent-2);
  transform: translateY(-1px);
}

.hm-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--hm-text) !important;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.hm-btn-ghost:hover {
  background: var(--hm-surface-2);
}

.hm-btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

/* Topbar & Sticky Header */
.hm-header {
  background: var(--hm-header);
  border-bottom: 1px solid var(--hm-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.hm-topbar {
  background: #0d1017;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: var(--hm-muted);
}

.hm-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
  gap: 12px;
}

.hm-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
}

.hm-logo, .hm-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.32rem;
  letter-spacing: -0.02em;
}

.hm-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #1e73be, #7c3aed);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 4px 18px rgba(30, 115, 190, 0.4);
  flex-shrink: 0;
}

.hm-logo-text {
  background: linear-gradient(100deg, #38bdf8, #3b82f6, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}

.hm-nav {
  display: flex;
  align-items: center;
}

.hm-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.hm-menu a {
  display: block;
  padding: 9px 12px;
  color: var(--hm-muted);
  font-weight: 600;
  font-size: 0.89rem;
  border-radius: 8px;
}

.hm-menu a:hover, .hm-menu a.active {
  color: #ffffff;
  background: var(--hm-surface-2);
}

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

.hm-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--hm-surface-2);
  border: 1px solid var(--hm-border);
  border-radius: 999px;
  padding: 4px 6px 4px 14px;
}

.hm-search input {
  border: 0;
  background: transparent;
  outline: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--hm-text);
  width: 155px;
}

.hm-search button {
  border: 0;
  background: var(--hm-accent);
  color: #fff;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.85rem;
}

.hm-search-results {
  display: none;
  position: absolute;
  top: 42px;
  right: 0;
  width: 290px;
  background: #12151f;
  border: 1px solid var(--hm-border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  z-index: 200;
}

.hm-search-results.open {
  display: block;
}

.hm-search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.86rem;
  font-weight: 600;
}

.hm-search-results a:hover {
  background: rgba(59, 130, 246, 0.18);
  color: #fff;
}

.hm-menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--hm-surface-2);
  border: 1px solid var(--hm-border);
  color: var(--hm-text);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.hm-mobile-menu {
  display: none;
  border-top: 1px solid var(--hm-border);
  background: var(--hm-surface);
  padding-bottom: 14px;
}

.hm-mobile-menu.is-open {
  display: block;
}

.hm-mobile-nav {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.hm-mobile-nav a {
  display: block;
  padding: 11px 4px;
  color: var(--hm-text);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Hero Slider (Portrait Cover + Blurred Backdrop) */
.hm-hero-slider {
  position: relative;
  border-bottom: 1px solid var(--hm-border);
  overflow: hidden;
}

.hm-hero-slide {
  display: none;
  position: relative;
  background-size: cover;
  background-position: center;
}

.hm-hero-slide.active {
  display: block;
  animation: hmFade 0.45s ease;
}

@keyframes hmFade {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.hm-hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10, 10, 14, 0.96) 0%, rgba(10, 10, 14, 0.88) 52%, rgba(10, 10, 14, 0.55) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hm-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 235px 1fr;
  gap: 36px;
  align-items: center;
  padding: 54px 20px;
}

.hm-hero-cover {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.7);
  background: #141824;
}

.hm-hero-cover img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.hm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.22);
  border: 1px solid rgba(124, 58, 237, 0.45);
  color: #ddd6fe;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hm-hero-content h1, .hm-hero-content h2 {
  font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  margin-bottom: 12px;
  color: #ffffff;
}

.hm-hero-content p {
  color: #cbd5e1;
  font-size: 1.05rem;
  max-width: 640px;
}

.hm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hm-slider-bar {
  position: relative;
  z-index: 5;
  background: #0d1017;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 20px;
}

.hm-slider-bar-inner {
  max-width: var(--hm-container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hm-slider-dots {
  display: flex;
  gap: 8px;
}

.hm-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.24);
  cursor: pointer;
  transition: all 0.25s ease;
}

.hm-dot.active {
  width: 28px;
  background: var(--hm-accent);
}

.hm-slider-arrows {
  display: flex;
  gap: 8px;
}

.hm-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-2);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.hm-arrow-btn:hover {
  background: var(--hm-accent);
  border-color: var(--hm-accent);
}

/* Dark Glass About + Reader Rating Section */
.hm-about-section {
  padding: 44px 0 18px;
}

.hm-about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 36px;
  align-items: start;
}

.hm-glass-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 30px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hm-about-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.hm-about-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 12px rgba(124, 58, 237, 0.45);
}

.hm-share-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hm-share-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #71717a;
}

.hm-share-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hm-share-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.hm-about-text p {
  color: #d4d4d8;
  line-height: 1.72;
  margin-bottom: 14px;
}

.hm-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hm-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: #d8b4fe;
  font-size: 0.76rem;
  font-weight: 700;
}

.hm-tag-hash {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #a1a1aa;
}

.hm-meta-dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
}

.hm-meta-dl dt {
  color: #71717a;
  margin-bottom: 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hm-meta-dl dd {
  margin: 0;
  font-weight: 700;
  color: #ffffff;
}

.hm-meta-status {
  color: #22d3ee !important;
  text-transform: uppercase;
}

.hm-aka {
  margin: 18px 0 0;
  font-size: 0.86rem;
  color: #d4d4d8;
}

.hm-aka span {
  color: #71717a;
}

.hm-about-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hm-rating-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
}

.hm-rating-num {
  font-size: 2.25rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

.hm-rating-max {
  font-size: 0.9rem;
  font-weight: 500;
  color: #71717a;
}

.hm-stars-gold {
  color: #facc15;
  font-size: 1.25rem;
  letter-spacing: 2px;
}

.hm-rating-votes {
  font-size: 0.8rem;
  color: #a1a1aa;
  margin: 0;
}

.hm-related-note {
  padding: 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hm-related-note h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(124, 58, 237, 0.45);
}

.hm-related-note p {
  font-size: 0.88rem;
  color: #a1a1aa;
  margin: 0;
}

/* Editorial Content & Gold/Dark Quick Facts Table */
.hm-article-section {
  padding: 28px 0 46px;
}

.hm-article-wrap {
  max-width: 940px;
  margin: 0 auto;
}

.hm-single-head {
  text-align: center;
  max-width: 860px;
  margin: 0 auto 28px;
}

.hm-single-eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 8px;
}

.hm-single-head h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  margin-bottom: 10px;
}

.hm-single-sub {
  color: #a1a1aa;
  font-size: 0.96rem;
}

.hm-prose p {
  color: #e2e8f0;
  font-size: 1.02rem;
  line-height: 1.8;
  margin-bottom: 18px;
}

.hm-prose h2 {
  font-size: 1.48rem;
  margin: 34px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hm-border);
}

.hm-prose h3 {
  font-size: 1.2rem;
  margin: 26px 0 12px;
}

.hm-prose figure {
  margin: 24px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hm-border);
  background: #11131a;
}

.hm-prose figure img {
  width: 100%;
  height: auto;
}

.hm-prose figcaption {
  padding: 10px 14px;
  font-size: 0.83rem;
  color: var(--hm-muted);
  text-align: center;
  background: #0e1118;
}

/* Signature Quick Facts Table */
.hm-facts-wrap {
  overflow-x: auto;
  margin: 28px 0;
  border-radius: 12px;
  border: 1px solid #3a3220;
}

.hm-facts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  background: #12151e;
}

.hm-facts-table thead th {
  background: linear-gradient(90deg, #facc15, #fbbf24);
  color: #1c1917;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 900;
  text-align: left;
}

.hm-facts-table td {
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  vertical-align: top;
}

.hm-facts-table td.fact-key {
  width: 220px;
  background: #ffe9a8;
  color: #4a3500;
  font-weight: 800;
  border-color: #e6cf94;
}

.hm-facts-table td.fact-val {
  color: #f1f5f9;
}

/* Ad Slots (ads.js) */
.hm-ad-slot {
  margin: 26px auto;
  max-width: 940px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  background: rgba(17, 19, 26, 0.85);
  padding: 14px 18px;
}

.hm-ad-badge {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.hm-ad-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(30, 115, 190, 0.16), rgba(124, 58, 237, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
}

.hm-ad-inner strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
}

.hm-ad-inner span {
  font-size: 0.84rem;
  color: #cbd5e1;
}

/* "You May Like" Compact S3 Cards Grid */
.hm-you-may-like {
  padding: 18px 0 48px;
}

.hm-section-heading {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 18px;
  color: #ffffff;
}

.hm-s3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.hm-card-s3 {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #0f1219;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hm-card-s3:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.hm-s3-thumb {
  width: 92px;
  height: 68px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  background: #181c26;
}

.hm-s3-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hm-s3-body {
  min-width: 0;
  flex: 1;
}

.hm-s3-title {
  font-size: 0.96rem;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.32;
}

.hm-s3-title a {
  color: #ffffff;
}

.hm-s3-title a:hover {
  color: #60a5fa;
}

.hm-s3-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: #9ca3af;
  margin-bottom: 4px;
}

.hm-cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
}

.hm-s3-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
}

.hm-s3-stars {
  color: #facc15;
  letter-spacing: 1px;
}

.hm-s3-date {
  color: #9ca3af;
}

/* Post Footer Tags + Reader Discussion Box */
.hm-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
  padding-top: 20px;
  border-top: 1px solid var(--hm-border);
}

.hm-comment-box {
  margin-top: 32px;
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: 14px;
  padding: 26px;
}

.hm-comment-box h3 {
  font-size: 1.18rem;
  margin-bottom: 8px;
}

.hm-comment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.hm-comment-box input, .hm-comment-box textarea {
  width: 100%;
  background: #0b0d13;
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
}

.hm-comment-box textarea {
  min-height: 110px;
  margin-top: 12px;
}

/* Footer & Back-to-Top */
.hm-footer {
  background: var(--hm-footer);
  border-top: 1px solid var(--hm-border);
  padding: 48px 0 28px;
  margin-top: 32px;
}

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

.hm-footer-about {
  color: var(--hm-muted);
  font-size: 0.9rem;
  margin-top: 12px;
  max-width: 420px;
}

.hm-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
}

.hm-footer-links a {
  color: var(--hm-muted);
}

.hm-footer-links a:hover {
  color: #ffffff;
}

.hm-footer-bottom {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.83rem;
  color: var(--hm-muted);
}

.hm-back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--hm-accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  z-index: 90;
}

/* Lazy Image Transition */
img.lazy-img {
  opacity: 0;
  transition: opacity 0.4s ease;
}
img.lazy-img.loaded {
  opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
  .hm-about-grid {
    grid-template-columns: 1fr;
  }
  .hm-s3-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hm-nav {
    display: none;
  }
  .hm-menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .hm-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 36px 20px;
  }
  .hm-hero-cover {
    max-width: 210px;
    margin: 0 auto;
  }
  .hm-hero-actions {
    justify-content: center;
  }
  .hm-meta-dl {
    grid-template-columns: repeat(2, 1fr);
  }
  .hm-s3-grid, .hm-footer-grid, .hm-comment-grid {
    grid-template-columns: 1fr;
  }
  .hm-search {
    display: none;
  }
  .hm-facts-table td.fact-key {
    width: 135px;
  }
}
