:root {
  --bg: #0f172a;
  --panel: #111e2f;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --border: #334155;
  --panel-strong: #0c1220;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

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

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--accent);
}

main {
  padding: 2rem 0;
}

.hero {
  padding: 2rem 0 3rem;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.24);
}

.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.hero-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
}

.hero-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.hero-card ul {
  list-style: none;
  display: grid;
  gap: 0.65rem;
  color: var(--muted);
}

.hero-card li::before {
  content: "•";
  color: var(--accent);
  margin-right: 0.5rem;
}

.section {
  padding: 2rem 0 3rem;
}

.section > .container {
  text-align: center;
}

.section-heading {
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  font-size: 1.45rem;
  margin-bottom: 0.3rem;
}

.section-heading p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.manga-grid li {
  margin: 0;
  padding: 0;
}

.manga-link {
  display: block;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.manga-link:hover {
  background: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.16);
  color: var(--accent);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.chapter-grid li {
  margin: 0;
  padding: 0;
}

.chapter-link {
  display: block;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.chapter-link:hover {
  background: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.16);
  color: var(--accent);
}

.nav-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.viewer-nav {
  justify-content: center;
}

.viewer-section {
  text-align: center;
}

.viewer-section > .container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viewer-heading {
  text-align: center;
  width: 100%;
}

.viewer-heading h2 {
  margin: 0 auto;
}

.viewer-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.viewer-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  margin-bottom: 0px;
  margin-top: 0px;
}

.viewer-container img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 0 1rem;
  margin-bottom: 0px;
  margin-top: 0px;
}

.viewer-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.quality-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.quality-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-right: 0.25rem;
}

.quality-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.quality-btn.active {
  background: var(--accent);
  color: white;
}

.btn-primary::selection,
.quality-btn.active::selection {
  background: rgba(255,255,255,0.15);
  color: white;
}
.btn-secondary::selection {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

@media (max-width: 600px) {
  .quality-group { gap: 0.25rem; }
  .quality-btn { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
}

.form-card {
  max-width: 520px;
  margin: 1rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(2,6,23,0.6);
}
.form-card label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}
.form-card input {
  width: 100%;
  display: block;
  padding: 0.8rem 0.9rem;
  margin-top: 0.35rem;
  margin-bottom: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #071323;
  color: var(--text);
  font-size: 0.95rem;
}
.form-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: flex-start;
  margin-top: 0.5rem;
}
.flash { margin: 0.8rem 0; }
.flash-item {
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.4rem;
}

@media (max-width: 420px) {
  .container { width: calc(100% - 1rem); padding: 0 0.5rem; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 0; }
  .site-nav { width: 100%; display: flex; gap: 0.5rem; justify-content: flex-start; }
  .brand { font-size: 1rem; }
  .brand img { width: 32px; height: 32px; }
  .form-card { margin: 0.75rem auto; padding: 1rem; border-radius: 10px; }
  .form-card input { padding: 0.75rem; font-size: 1rem; }
  .form-actions { flex-direction: column; width: 100%; }
  .form-actions .btn { width: 100%; text-align: center; }
  .nav-container { gap: 0.6rem; }
  .btn { padding: 0.75rem 0.9rem; font-size: 1rem; }
  #resume-btn { min-width: auto; width: 100%; }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
}

.card h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
}

footer {
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

@media (max-width: 800px) {
  .hero-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .container {
    width: calc(100% - 2rem);
  }

  h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
  }

  .manga-grid,
  .chapter-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

#resume-btn {
  position: relative;
  isolation: isolate;
  padding: 0.85rem 1.25rem;
  min-width: 180px;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.28);
  animation: resumePulse 2.4s ease-in-out infinite;
}

#resume-btn::before {
  content: "↗";
  display: inline-block;
  margin-right: 0.45rem;
  font-size: 0.95em;
  transition: transform 0.2s ease;
}

#resume-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.36);
}

#resume-btn:hover::before {
  transform: translateY(-1px) translateX(2px);
}

#resume-btn:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.35);
  outline-offset: 3px;
}

@keyframes resumePulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(56, 189, 248, 0.24); }
  50% { box-shadow: 0 10px 30px rgba(56, 189, 248, 0.38); }
}

@media (prefers-reduced-motion: reduce) {
  #resume-btn { animation: none; }
}
