:root {
  --bg: #06090f;
  --bg-soft: #101722;
  --panel: rgba(15, 18, 26, 0.92);
  --panel-alt: rgba(20, 25, 34, 0.9);
  --card: rgba(19, 24, 32, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #edf3ff;
  --muted: #9aa9c2;
  --soft: #d9e2f5;
  --primary: #ff6b35;
  --primary-strong: #ff4b2b;
  --secondary: #ffbf5e;
  --accent: #9b79ff;
  --shadow: 0 15px 40px rgba(0, 0, 0, 0.42);
}

:root[data-theme="light"] {
  --bg: #f2f4fa;
  --bg-soft: #e6e9f2;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-alt: rgba(245, 247, 252, 0.96);
  --card: rgba(255, 255, 255, 0.96);
  --border: rgba(21, 27, 40, 0.12);
  --text: #171a24;
  --muted: #606a7c;
  --soft: #353d4c;
  --shadow: 0 12px 30px rgba(26, 34, 50, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 94, 91, 0.18), transparent 30%),
    linear-gradient(180deg, #0a0d15 0%, #070b12 100%);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 44%, rgba(155, 121, 255, 0.18), transparent 33%),
    linear-gradient(150deg, #090b14, #151123 58%, #090b14);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loading-screen.is-ready {
  opacity: 0;
  visibility: hidden;
}

.loading-screen[hidden] {
  display: none;
}

.loading-logo {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  color: white;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  border-radius: 24px;
  box-shadow: 0 12px 42px rgba(255, 107, 53, 0.28);
  font-size: 2.8rem;
  font-weight: 900;
  animation: loading-pulse 1.1s ease-in-out infinite alternate;
}

.loading-screen > strong {
  font-size: 1.35rem;
  letter-spacing: 0.03em;
}

.loading-caption {
  color: var(--muted);
  font-size: 0.88rem;
}

.loading-track {
  width: min(190px, 50vw);
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.loading-track span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  animation: loading-progress 1.1s ease-in-out infinite;
}

@keyframes loading-pulse {
  to { transform: translateY(-5px) scale(1.04); }
}

@keyframes loading-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(260%); }
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 94, 91, 0.12), transparent 30%),
    linear-gradient(180deg, #f8f9fd 0%, #edf0f6 100%);
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  width: min(1440px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 80px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: linear-gradient(110deg, rgba(20, 17, 34, 0.92), rgba(9, 12, 22, 0.88));
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 170px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 900;
  color: white;
  box-shadow: 0 10px 25px rgba(255, 94, 91, 0.4);
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-mark:hover {
  transform: translateY(-2px) rotate(-3deg);
  box-shadow: 0 12px 30px rgba(255, 107, 53, 0.5);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.brand-tag {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--soft);
  text-decoration: none;
  font-size: 0.92rem;
  opacity: 0.84;
  transition: opacity 0.2s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  opacity: 1;
  color: var(--secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification-wrap {
  position: relative;
}

.notification-wrap .icon-button {
  position: relative;
}

.notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  color: white;
  background: var(--primary-strong);
  border: 2px solid #080c12;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
}

.notification-count[hidden],
.notification-panel[hidden] {
  display: none;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  width: min(350px, calc(100vw - 36px));
  padding: 14px;
  background: #101722;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
}

.notification-panel-head a {
  color: #ffb8b3;
  font-size: 0.8rem;
  text-decoration: none;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 8px;
  color: var(--soft);
  border-radius: 10px;
  text-decoration: none;
}

.notification-item:hover,
.notification-item.unread {
  background: rgba(255, 255, 255, 0.05);
}

.notification-item strong,
.notification-item small {
  display: block;
}

.notification-item small {
  margin-top: 4px;
  color: var(--muted);
}

.notification-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: transparent;
}

.notification-item.unread .notification-dot {
  background: var(--primary);
}

.notification-empty {
  margin: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.mark-read-button {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 28vw);
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.search-box svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.search-box input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: rgba(237, 243, 255, 0.6);
}

.icon-button,
.profile-pill {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.profile-pill {
  width: 42px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(255, 94, 91, 0.2), rgba(255, 176, 98, 0.2));
}

.content {
  padding-top: 28px;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1.8fr 0.7fr;
  align-items: end;
  min-height: 470px;
  padding: 38px 38px 30px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(6, 9, 15, 0.86), rgba(6, 9, 15, 0.28)),
    url("https://images.unsplash.com/photo-1578632767115-351597cf2477?auto=format&fit=crop&w=1200&q=80") center/cover no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  max-width: 590px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: #f7d1d0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 18px 0 14px;
  font-size: clamp(2.4rem, 4vw, 5rem);
  line-height: 0.95;
}

.hero-copy p {
  max-width: 520px;
  color: rgba(237, 243, 255, 0.82);
  line-height: 1.7;
  font-size: 1.02rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-meta span {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 0.82rem;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
}

.primary-btn,
.ghost-btn {
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 700;
  transition: transform 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 15px 30px rgba(255, 81, 81, 0.35);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-btn:hover,
.ghost-btn:hover,
.chip:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-self: end;
  width: min(270px, 100%);
  padding: 26px 18px;
  border-radius: 22px;
  background: rgba(7, 10, 16, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-stat strong {
  font-size: 1.1rem;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
  margin-bottom: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  border-radius: 999px;
  padding: 10px 16px;
  transition: all 0.2s ease;
}

.chip.active {
  background: linear-gradient(135deg, rgba(255, 94, 91, 0.2), rgba(255, 176, 98, 0.14));
  border-color: rgba(255, 94, 91, 0.3);
  color: white;
}

.media-section {
  margin-top: 36px;
  scroll-margin-top: 110px;
}

.horizontal-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 220px;
  grid-template-columns: none;
  overflow-x: auto;
  gap: 18px;
  padding: 2px 2px 14px;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(255, 94, 91, 0.55) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.horizontal-row .poster-card {
  scroll-snap-align: start;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
}

.catalogue-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.section-head a {
  color: #ffb8b3;
  text-decoration: none;
  font-weight: 600;
}

.list-tabs {
  display: flex;
  gap: 8px;
}

.list-tab,
.list-action {
  color: var(--soft);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.list-tab.active,
.list-action[aria-pressed="true"] {
  color: white;
  background: rgba(255, 94, 91, 0.18);
  border-color: rgba(255, 94, 91, 0.4);
}

.list-tab:hover,
.list-action:hover {
  border-color: rgba(255, 94, 91, 0.5);
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.poster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 395px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.poster-card::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, transparent 8%, rgba(7, 10, 16, 0.38) 42%, rgba(7, 10, 16, 0.97) 100%);
  content: "";
  pointer-events: none;
}

.poster-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.48);
}

.poster-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  object-fit: cover;
  z-index: 0;
}

.poster-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(7, 10, 16, 0.8) 100%);
}

.poster-content {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 14px 12px;
  z-index: 1;
}

.poster-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f6d8d5;
}

.badge {
  display: inline-flex;
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(255, 94, 91, 0.22);
  border: 1px solid rgba(255, 94, 91, 0.32);
}

.poster-content h3 {
  margin: 0;
  font-size: 1.12rem;
}

.poster-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: rgba(237, 243, 255, 0.76);
  font-size: 0.82rem;
}

.poster-meta .rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ffd86b;
}

.poster-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.list-action {
  min-width: 0;
  padding: 8px 6px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.resume-button {
  width: 100%;
  white-space: normal;
}

.empty-list {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.watch-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.watch-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.watch-thumb {
  height: 150px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
}

.watch-info {
  min-width: 0;
}

.watch-info .label {
  display: inline-block;
  margin-bottom: 6px;
  color: #ffb8b3;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.watch-info h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.watch-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-dialog {
  width: min(820px, calc(100% - 28px));
  max-height: min(90vh, 900px);
  padding: 24px;
  color: var(--text);
  background: #0e141f;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.detail-dialog {
  width: min(900px, calc(100% - 24px));
  padding: 0;
  overflow: auto;
}

.detail-artwork {
  position: relative;
  min-height: 300px;
  background-color: #151b28;
  background-position: center 28%;
  background-size: cover;
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.detail-body {
  padding: 24px;
}

.detail-body h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.detail-meta {
  color: var(--secondary);
  font-size: 0.92rem;
}

.detail-description {
  max-width: 720px;
  color: var(--soft);
  line-height: 1.7;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 28px;
}

.episode-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0;
}

.episode-heading h3 {
  margin: 0;
}

.season-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.season-picker select,
.setting-row select {
  padding: 9px 12px;
  color: var(--text);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.episode-list {
  display: grid;
  gap: 8px;
}

.episode-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.episode-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: #ffd2b6;
  background: linear-gradient(145deg, rgba(255, 107, 53, 0.18), rgba(155, 121, 255, 0.16));
  border-radius: 12px;
  font-weight: 800;
}

.episode-copy {
  display: grid;
  flex: 1;
  gap: 5px;
}

.episode-copy small {
  color: var(--muted);
}

.episode-play {
  width: 40px;
  height: 40px;
  color: white;
  background: linear-gradient(135deg, var(--primary-strong), var(--accent));
  border: 0;
  border-radius: 12px;
}

.episode-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.episode-pagination button {
  padding: 9px 12px;
}

.episode-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.settings-dialog {
  width: min(660px, calc(100% - 28px));
}

.settings-list {
  display: grid;
  gap: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.setting-row span {
  display: grid;
  gap: 5px;
}

.setting-row small {
  color: var(--muted);
  line-height: 1.4;
}

.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.settings-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.settings-footer .player-status {
  width: 100%;
  margin-bottom: 0;
}

:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.86);
}

:root[data-theme="light"] .hero-panel {
  color: white;
}

:root[data-theme="light"] .hero-copy h1,
:root[data-theme="light"] .hero-meta span {
  color: white;
}

:root[data-theme="light"] .app-dialog {
  color: var(--text);
  background: #fff;
}

:root[data-theme="light"] .detail-artwork {
  background-color: #151b28;
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 12px 0 0;
}

.dialog-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1.5rem;
}

.dialog-help,
.player-status {
  color: var(--muted);
  line-height: 1.6;
}

.player-screen {
  position: relative;
  display: grid;
  min-height: min(58vh, 500px);
  place-items: center;
  overflow: hidden;
  background: #030408;
  border: 1px solid var(--border);
  border-radius: 18px;
}

#animePlayer {
  display: block;
  width: 100%;
  max-height: 58vh;
  background: #030408;
}

.player-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 48%, rgba(155, 121, 255, 0.16), transparent 34%),
    linear-gradient(145deg, #10121d, #171021);
  text-align: center;
}

.player-empty-state[hidden] {
  display: none;
}

.player-play-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  color: white;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  border-radius: 50%;
  box-shadow: 0 12px 35px rgba(255, 107, 53, 0.24);
  font-size: 1.35rem;
}

.file-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.player-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.player-control {
  display: grid;
  width: 38px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--text);
  background: rgba(155, 121, 255, 0.11);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.player-control:hover {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.player-seek {
  min-width: 30px;
  flex: 1;
  accent-color: var(--primary);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-control input {
  width: 62px;
  accent-color: var(--primary);
}

.player-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#playerSpeed {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.admin-dialog {
  width: min(680px, calc(100% - 28px));
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 16px;
}

.admin-tab {
  padding: 10px 14px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-tab.active {
  color: white;
  background: linear-gradient(130deg, rgba(255, 107, 53, 0.22), rgba(155, 121, 255, 0.2));
  border-color: rgba(255, 107, 53, 0.4);
}

.admin-form {
  display: grid;
  gap: 13px;
}

.admin-form[hidden] {
  display: none;
}

.admin-form > label,
.form-two-columns > label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.admin-form input:not([type="checkbox"]),
.admin-form textarea,
.admin-form select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.admin-form textarea {
  resize: vertical;
}

.form-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-form .admin-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.admin-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.file-picker input {
  min-width: min(100%, 240px);
  flex: 1;
  color: var(--muted);
}

.file-picker input::file-selector-button {
  margin-right: 10px;
  padding: 9px 12px;
  color: white;
  background: rgba(255, 94, 91, 0.2);
  border: 1px solid rgba(255, 94, 91, 0.4);
  border-radius: 9px;
  cursor: pointer;
}

#animePlayer {
  display: block;
  width: 100%;
  max-height: 58vh;
  margin-top: 12px;
  background: #000;
  border-radius: 14px;
}

.rating-dialog {
  width: min(460px, calc(100% - 28px));
}

.rating-picker {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.rating-picker button {
  padding: 8px;
  color: rgba(255, 216, 107, 0.4);
  background: transparent;
  border: 0;
  font-size: 2.3rem;
  cursor: pointer;
}

.rating-picker button:hover,
.rating-picker button.selected {
  color: #ffd86b;
}

@media (max-width: 1100px) {
  .poster-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-panel {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-card {
    justify-self: start;
  }
}

@media (max-width: 840px) {
  .topbar {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .horizontal-row {
    grid-auto-columns: 190px;
    grid-template-columns: none;
  }

  .watch-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .page-shell {
    width: min(100% - 18px, 100%);
  }

  .topbar {
    padding: 14px 14px 18px;
    border-radius: 16px;
  }

  .brand-wrap {
    min-width: 0;
  }

  .main-nav {
    gap: 12px 16px;
  }

  .hero-panel {
    padding: 20px 16px;
    min-height: 350px;
    border-radius: 22px;
  }

  .hero-copy h1 {
    font-size: 2.5rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .list-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }

  .horizontal-row {
    grid-auto-columns: 175px;
    grid-template-columns: none;
  }

  .poster-card {
    min-height: 355px;
    border-radius: 15px;
  }

  .poster-content {
    padding: 12px 10px 10px;
  }

  .poster-content h3 {
    font-size: 0.97rem;
  }

  .poster-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
  }

  .poster-actions {
    gap: 6px;
    margin-top: 9px;
  }

  .list-action {
    padding: 7px 4px;
    font-size: 0.68rem;
  }

  .detail-artwork {
    min-height: 220px;
  }

  .detail-body {
    padding: 18px;
  }

  .episode-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .episode-pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .setting-row {
    align-items: flex-start;
  }

  .watch-item {
    grid-template-columns: 1fr;
  }

  .app-dialog {
    padding: 18px;
  }

  .player-toolbar {
    gap: 6px;
    overflow-x: auto;
  }

  .player-control {
    width: 34px;
    height: 34px;
  }

  .volume-control input {
    width: 44px;
  }

  .form-two-columns {
    grid-template-columns: 1fr;
  }

  .loading-logo {
    width: 68px;
    height: 68px;
  }
}
