:root {
  --bg: #050306;
  --bg-soft: #12080f;
  --card: rgba(40, 16, 30, 0.6);
  --card-2: rgba(21, 10, 18, 0.7);
  --text: #f5ecf1;
  --muted: #c0a8b8;
  --accent: #8f294f;
  --accent-2: #5f1734;
  --line: rgba(201, 129, 160, 0.25);
  --shadow: 0 14px 45px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background-color: #050306;
  overscroll-behavior: none;
}

body {
  color: var(--text);
  font-family: Inter, "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% 0%, rgba(143, 41, 79, 0.2), transparent 60%),
    radial-gradient(1200px 700px at 10% 10%, rgba(79, 15, 43, 0.25), transparent 60%),
    linear-gradient(160deg, #060307, #0e050a 50%, #15070d);
  overflow-x: hidden;
}

body.discord-activity {
  min-height: 100dvh;
  overscroll-behavior: none;
}

.access-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.access-card {
  width: min(520px, 94vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(33, 12, 22, 0.92), rgba(18, 7, 12, 0.95));
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: center;
}

.access-card h2 {
  margin: 0 0 8px;
}

.access-card p {
  margin: 0;
  color: var(--muted);
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
}

.bg-orb-1 {
  width: 380px;
  height: 380px;
  background: rgba(131, 27, 68, 0.35);
  top: -120px;
  left: -120px;
}

.bg-orb-2 {
  width: 360px;
  height: 360px;
  background: rgba(95, 23, 52, 0.28);
  bottom: -140px;
  right: -120px;
}

.snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-repeat: repeat;
  animation: snowfall linear infinite;
  opacity: 0.34;
  will-change: background-position;
  contain: strict;
}

.snow-1 {
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 245, 248, 0.85), transparent 60%),
    radial-gradient(2px 2px at 100px 80px, rgba(255, 245, 248, 0.7), transparent 60%),
    radial-gradient(2px 2px at 170px 140px, rgba(255, 245, 248, 0.82), transparent 60%),
    radial-gradient(2px 2px at 240px 35px, rgba(255, 245, 248, 0.78), transparent 60%);
  background-size: 260px 220px;
  background-position: 0 -260px;
  animation-duration: 24s;
}

.snow-2 {
  background-image:
    radial-gradient(1.5px 1.5px at 40px 50px, rgba(255, 240, 246, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 130px 20px, rgba(255, 240, 246, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 210px 120px, rgba(255, 240, 246, 0.76), transparent 60%);
  background-size: 240px 200px;
  background-position: 0 -240px;
  animation-duration: 34s;
  opacity: 0.2;
}

.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 12px 44px;
  display: grid;
  gap: 14px;
}

.glass {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--card-2));
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.top-header {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.home-header {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 50;
}

.brand-logo {
  display: block;
  width: min(120px, 30vw);
  margin: 4px auto 14px;
  object-fit: contain;
  filter: drop-shadow(0 6px 24px rgba(236, 168, 193, 0.28));
  animation: floatLogo 4.5s ease-in-out infinite;
}

.brand-logo.small {
  width: 56px;
  margin: 0;
}

.top-header h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.8vw, 1.7rem);
}

.top-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-wrap {
  width: min(620px, 96%);
  margin: 0 auto;
  position: relative;
  animation: fadeSlideUp 500ms ease both;
  z-index: 60;
}

.search-box {
  display: flex;
  justify-content: center;
}

input,
button {
  border-radius: 12px;
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(16, 8, 14, 0.78);
  color: var(--text);
  padding: 11px 13px;
  text-align: center;
}

input:focus {
  outline: none;
  border-color: #b84a76;
  box-shadow: 0 0 0 3px rgba(143, 41, 79, 0.24);
}

button {
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 11px 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(44, 17, 33, 0.7);
}

.accent {
  background: linear-gradient(135deg, #ad2e61, #721c3f);
}

.search-dropdown {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  z-index: 1000;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.search-item {
  background: rgba(21, 9, 17, 0.85);
  border: 1px solid var(--line);
  text-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.search-item img {
  width: 44px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
}

.search-title {
  font-weight: 700;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-sub {
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.79rem;
}

.section {
  padding: 14px;
  position: relative;
  z-index: 1;
}

.section h2 {
  margin: 0;
  font-size: 1rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  min-height: 8px;
}

.section-head span {
  color: var(--muted);
  font-size: 0.85rem;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.poster-card {
  border: 1px solid rgba(230, 139, 178, 0.2);
  background: linear-gradient(180deg, rgba(30, 10, 20, 0.92), rgba(14, 6, 11, 0.96));
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  text-align: start;
  position: relative;
  isolation: isolate;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.poster-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 26%),
    linear-gradient(180deg, transparent 50%, rgba(8, 3, 6, 0.86) 84%, rgba(8, 3, 6, 0.96) 100%);
  pointer-events: none;
}

.poster-card::before {
  content: "";
  position: absolute;
  inset: auto -32% -52% -32%;
  height: 55%;
  background: radial-gradient(circle, rgba(160, 51, 95, 0.32), transparent 65%);
  z-index: 1;
  pointer-events: none;
}

.poster-card:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: rgba(236, 144, 184, 0.62);
  box-shadow:
    0 24px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(236, 144, 184, 0.18);
}

.reveal-item {
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  animation: cardReveal 480ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.poster-card img {
  width: 100%;
  aspect-ratio: 0.74;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform 0.35s ease;
}

.poster-card:hover img {
  transform: scale(1.08);
}

.poster-meta {
  padding: 12px 11px 11px;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(34, 12, 23, 0.22) 0%, rgba(20, 7, 14, 0.92) 45%, rgba(14, 5, 10, 0.98) 100%);
  border-top: 1px solid rgba(234, 152, 188, 0.16);
}

.poster-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  min-height: 2.45em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.1px;
}

.poster-sub {
  margin-top: 6px;
  color: #e5b8cd;
  font-size: 0.72rem;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.poster-sub::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cf5f8d;
  box-shadow: 0 0 10px rgba(207, 95, 141, 0.8);
}

.details-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr 1fr;
}

.details-page {
  padding-top: 10px;
  animation: fadeSlideUp 520ms ease both;
}

.details-content {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.details-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.series-card {
  display: grid;
  grid-template-columns: 175px 1fr;
  gap: 12px;
}

.series-poster {
  width: 100%;
  aspect-ratio: 0.7;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.series-info h3 {
  margin: 0 0 6px;
}

.series-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.series-stats span {
  font-size: 0.74rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 8px;
  color: var(--muted);
}

.series-info p {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0;
}

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

.genre {
  font-size: 0.74rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(111, 31, 60, 0.18);
}

.chapter-tools {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chapter-tools input {
  min-width: 180px;
  flex: 1;
}

.chapters-list {
  max-height: 620px;
  overflow: auto;
  display: grid;
  gap: 7px;
}

.feed-loader {
  text-align: center;
  color: var(--muted);
  padding: 10px 6px 4px;
  font-size: 0.85rem;
}

.chapter-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  text-align: start;
  border: 1px solid var(--line);
  background: rgba(20, 9, 16, 0.8);
  border-radius: 10px;
  padding: 9px 10px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.chapter-item:hover {
  transform: translateY(-1px);
  border-color: rgba(225, 126, 170, 0.5);
  background: rgba(34, 12, 23, 0.9);
}

.chapter-item span:first-child {
  color: #e9bad0;
  font-weight: 700;
}

.chapter-item span:last-child {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-item.is-active {
  border-color: #c75585;
  box-shadow: 0 0 0 2px rgba(199, 85, 133, 0.25);
}

.preview-strip {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.preview-strip img {
  width: 100%;
  aspect-ratio: 0.72;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.error {
  color: #ffd6e5;
  border: 1px solid rgba(255, 128, 170, 0.36);
  background: rgba(105, 25, 52, 0.44);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.87rem;
}

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 3, 5, 0.985);
  display: flex;
  flex-direction: column;
}

.reader-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: none;
  background: transparent;
  backdrop-filter: none;
  position: relative;
  z-index: 3;
}

.reader-top strong {
  display: block;
}

.reader-top span {
  font-size: 0.82rem;
  color: var(--muted);
}

.reader-body {
  max-width: 950px;
  width: 100%;
  margin: 0 auto;
  padding: 12px;
  overflow-y: auto;
  position: relative;
  z-index: 3;
}

.reader-body img {
  width: 100%;
  display: block;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d060a;
}

.reader-loader {
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.reader-snow {
  z-index: 2;
  opacity: 0.24;
}

@keyframes floatLogo {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
}

@keyframes snowfall {
  from {
    background-position-y: -280px;
  }
  to {
    background-position-y: 1200px;
  }
}

@media (max-width: 960px) {
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .details-content {
    grid-template-columns: 1fr;
  }

  .series-card {
    grid-template-columns: 120px 1fr;
  }
}
