* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0f1115;
  color: #f1f2f4;
  line-height: 1.6;
}

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

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

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.site-header {
  background: #1a2431;
  border-bottom: 1px solid #232f3d;
}

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

.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.6px;
  color: #47c6ff;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 22px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #c3c9d4;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 13px;
  font-weight: 600;
}

.header-nav a:hover {
  color: #ffffff;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: transparent;
  border: 0;
  color: #c3c9d4;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
}

.nav-dropdown-toggle:hover {
  color: #ffffff;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 12px;
  background: #243244;
  border: 1px solid #2c3a4d;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px 24px;
  min-width: 560px;
  z-index: 20;
  box-shadow: 0 18px 40px rgba(4, 8, 16, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  max-height: 320px;
  overflow: auto;
}

.nav-dropdown.is-open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  color: #cfd5df;
}

.nav-dropdown-menu a:hover {
  color: #ffffff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #111924;
  border: 1px solid #243040;
  border-radius: 12px;
  padding: 6px 10px;
}

.header-search input {
  background: transparent;
  border: 0;
  color: #e7e9ee;
  min-width: 200px;
}

.header-search input::placeholder {
  color: #7f8796;
}

.search-btn {
  background: #2f3d51;
  border: 0;
  color: #e7e9ee;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.search-btn:hover {
  background: #3a4b63;
}

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

.header-actions a {
  color: #b6bdc8;
}

.header-actions a:hover {
  color: #ffffff;
}

.theme-toggle {
  background: #2f3d51;
  border: 0;
  color: #e7e9ee;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}

.theme-toggle:hover {
  background: #3a4b63;
}

.nav-logout {
  display: inline;
}

.nav-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: #b6bdc8;
  cursor: pointer;
  font: inherit;
}

.nav-link:hover {
  color: #ffffff;
}

.nav-user {
  color: #7a8292;
  font-size: 14px;
  text-decoration: none;
}

.nav-user:hover {
  color: #ffffff;
}

.page-header {
  padding: 32px 0 12px;
}

.subtitle {
  color: #b6bdc8;
  margin-top: 4px;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.filters {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  padding: 12px 0 24px;
}

.filters .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters label {
  font-size: 13px;
  color: #9aa3b2;
}

.filters input,
.filters select {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 10px;
  padding: 10px 12px;
  color: #f1f2f4;
}

.auth-page {
  padding: 40px 0 60px;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: min(420px, 100%);
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card h1 {
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form input {
  background: #0f1115;
  border: 1px solid #1f2430;
  border-radius: 10px;
  padding: 10px 12px;
  color: #f1f2f4;
}

.auth-form ul.errorlist {
  margin: 0;
  padding-left: 18px;
  color: #ff8a8a;
  font-size: 13px;
}

.profile-page {
  justify-content: stretch;
}

.profile-card {
  width: 100%;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 24px;
  align-items: start;
}

.profile-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avatar-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: #0f1115;
  border: 1px solid #1f2430;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  color: #7a8292;
  font-weight: 600;
}

.profile-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filters input::placeholder {
  color: #6f7786;
}

.card-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  padding-bottom: 40px;
}

.list-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 40px;
}

.list-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  background: #141c26;
  border: 1px solid #1f2a38;
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.list-item:hover {
  border-color: #2f3d51;
  box-shadow: 0 10px 24px rgba(5, 7, 12, 0.35);
  transform: translateY(-1px);
}

.list-poster {
  width: 56px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  background: #0b0d12;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.list-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f1f2f4;
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #8f98a6;
  font-size: 12px;
}

.list-rating {
  color: #f4c56b;
}

.list-stats {
  text-align: right;
  min-width: 64px;
}

.list-count {
  font-size: 18px;
  font-weight: 700;
  color: #7dd3fc;
}

.list-label {
  font-size: 11px;
  color: #7a8292;
}

.card {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #2b3140;
  box-shadow: 0 10px 24px rgba(5, 7, 12, 0.35);
}

.card-media {
  background: #0b0d12;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-media img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.card-title {
  margin: 0;
}

.card-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta {
  color: #9aa3b2;
  font-size: 14px;
}

.description {
  color: #d4d7dd;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: #6b5cff;
  color: #ffffff;
  font-weight: 600;
}

.btn:hover {
  background: #5a4ae6;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #2b3140;
  color: #d4d7dd;
}

.btn-ghost:hover {
  background: #1f2430;
  color: #ffffff;
}

.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.muted {
  color: #7a8292;
}

.poster-fallback {
  color: #7a8292;
  font-size: 14px;
}

.detail {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 320px) 1fr;
  padding: 32px 0 40px;
}

.detail-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 0 40px;
}

.detail-intro {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 320px) 1fr;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.hero-poster {
  background: #0b0d12;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

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

.hero-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: #9aa3b2;
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #1f2430;
  color: #b6bdc8;
  font-size: 12px;
}

.tag-list-sm {
  gap: 6px;
}

.tag-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.badge {
  position: absolute;
  right: 12px;
  top: 12px;
  background: rgba(15, 17, 21, 0.85);
  border: 1px solid #2b3140;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #f4c56b;
  font-weight: 600;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 16px;
  text-align: center;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #1f2430;
  background: #0f1115;
}

.info-grid dt {
  color: #7a8292;
  font-size: 12px;
}

.info-grid dd {
  margin: 4px 0 0;
  font-size: 14px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Light theme overrides */
[data-theme="light"] body {
  background: #f6f8fb;
  color: #1b2330;
}

[data-theme="light"] .site-header {
  background: #f3f6fb;
  border-bottom-color: #e1e6ef;
}

[data-theme="light"] .brand {
  color: #1f6feb;
}

[data-theme="light"] .header-nav,
[data-theme="light"] .header-actions a,
[data-theme="light"] .nav-link,
[data-theme="light"] .nav-user {
  color: #4b5563;
}

[data-theme="light"] .header-nav a:hover,
[data-theme="light"] .header-actions a:hover,
[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-user:hover {
  color: #111827;
}

[data-theme="light"] .nav-dropdown-toggle {
  color: #4b5563;
}

[data-theme="light"] .nav-dropdown-toggle:hover {
  color: #111827;
}

[data-theme="light"] .nav-dropdown-menu {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .nav-dropdown-menu a {
  color: #4b5563;
}

[data-theme="light"] .nav-dropdown-menu a:hover {
  color: #111827;
}

[data-theme="light"] .header-search {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme="light"] .header-search input {
  color: #111827;
}

[data-theme="light"] .search-btn,
[data-theme="light"] .theme-toggle {
  background: #e5e7eb;
  color: #111827;
}

[data-theme="light"] .search-btn:hover,
[data-theme="light"] .theme-toggle:hover {
  background: #d1d5db;
}

[data-theme="light"] .filters input,
[data-theme="light"] .filters select,
[data-theme="light"] .auth-form input,
[data-theme="light"] .comment-form textarea,
[data-theme="light"] .rating-controls select {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}



[data-theme="light"] .card,
[data-theme="light"] .list-item,
[data-theme="light"] .detail-intro,
[data-theme="light"] .hero,
[data-theme="light"] .player-section,
[data-theme="light"] .episodes-section,
[data-theme="light"] .story,
[data-theme="light"] .comments-section,
[data-theme="light"] .rating-section,
[data-theme="light"] .auth-card,
[data-theme="light"] .info-grid,
[data-theme="light"] .comment-item {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme="light"] .list-poster,
[data-theme="light"] .hero-poster,
[data-theme="light"] .player-frame {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

[data-theme="light"] .detail-intro .story,
[data-theme="light"] .rating-section {
  background: #f9fafb;
}

[data-theme="light"] .detail-intro .story,
[data-theme="light"] .detail-intro .rating-section {
  background: transparent;
  border: 0;
  border-radius: 0;
}

[data-theme="light"] .episodes-inline {
  border-top-color: #e5e7eb;
}

[data-theme="light"] .tag {
  background: #eef2f7;
  color: #4b5563;
}

[data-theme="light"] .badge {
  background: rgba(255, 255, 255, 0.9);
  border-color: #e5e7eb;
  color: #b45309;
}

[data-theme="light"] .muted {
  color: #6b7280;
}

[data-theme="light"] .page-link,
[data-theme="light"] .list-meta,
[data-theme="light"] .description,
[data-theme="light"] .list-desc {
  color: #4b5563;
}

[data-theme="light"] .list-count {
  color: #2563eb;
}

[data-theme="light"] .list-rating {
  color: #b45309;
}

[data-theme="light"] .site-footer {
  border-top-color: #e5e7eb;
  color: #6b7280;
}

.episode-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.player-section,
.episodes-section,
.story {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 16px;
  padding: 20px;
}

.comments-section {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rating-section {
  background: #0f1115;
  border: 1px solid #1f2430;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-intro .story {
  background: #0f1115;
  border-radius: 14px;
  padding: 16px;
}

/* Monolith intro block: no inner lines/rounded cards */
.detail-intro .rating-section,
.detail-intro .story {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.rating-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rating-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rating-dots {
  display: inline-flex;
  gap: 6px;
}

.rating-dots input {
  display: none;
}

.rating-dot {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.rating-dot .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2b3140;
  transition: background 0.2s ease, transform 0.2s ease;
}

.rating-dots input:checked + .rating-dot .dot,
.rating-dot:hover .dot {
  background: #f4c56b;
  transform: scale(1.1);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-form textarea {
  background: #0f1115;
  border: 1px solid #1f2430;
  border-radius: 10px;
  padding: 10px 12px;
  color: #f1f2f4;
  resize: vertical;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item {
  background: #0f1115;
  border: 1px solid #1f2430;
  border-radius: 12px;
  padding: 12px;
}

.comment-item p {
  margin: 8px 0 0;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.detail-media {
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.player-frame {
  width: min(820px, 100%);
  aspect-ratio: 16 / 9;
  max-height: 55vh;
  background: #151924;
  border: 1px solid #1f2430;
  border-radius: 14px;
  overflow: hidden;
}

.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-frame video {
  width: 100%;
  height: auto;
  display: block;
  background: #000000;
  object-fit: contain;
  max-height: 55vh;
}

.episode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.episodes-inline {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #1f2430;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-tiles {
  gap: 8px;
}

.episode-tab {
  padding: 8px 12px;
  border-radius: 10px;
  background: #151924;
  border: 1px solid #1f2430;
  color: #b6bdc8;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.episode-tile {
  width: 86px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  border-radius: 8px;
  flex-direction: row;
  gap: 0;
}

.episode-tab.is-active {
  background: #6b5cff;
  border-color: transparent;
  color: #ffffff;
}

.episode-tab:hover {
  color: #ffffff;
}

.episode-status {
  font-size: 11px;
  color: #7a8292;
}

.site-footer {
  border-top: 1px solid #1f2430;
  padding: 20px 0 30px;
  color: #8e96a6;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 40px;
  color: #9aa3b2;
}

.page-link {
  color: #b6bdc8;
}

.page-link:hover {
  color: #ffffff;
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-left {
    justify-content: space-between;
  }

  .header-nav {
    flex-wrap: wrap;
  }

  .header-right {
    flex-direction: column;
    align-items: stretch;
  }

  .header-search {
    width: 100%;
  }

  .header-search input {
    min-width: 0;
    flex: 1;
  }

  .header-actions {
    justify-content: space-between;
  }

  .detail,
  .hero {
    grid-template-columns: 1fr;
  }

  .list-grid {
    grid-template-columns: 1fr;
  }

  .list-item {
    grid-template-columns: 56px 1fr;
    align-items: start;
  }

  .list-stats {
    grid-column: 2;
    text-align: left;
  }

  .pagination {
    flex-direction: column;
    gap: 10px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
