:root {
  color-scheme: dark;
  --bg-primary: #1a1b22;
  --bg-secondary: rgba(30, 30, 40, 0.92);
  --bg-card: rgba(38, 38, 48, 0.94);
  --accent: #ff3b30;
  --accent-strong: #ff5c52;
  --accent-soft: rgba(255, 59, 48, 0.22);
  --danger: #ff5b5b;
  --danger-strong: #ff3b3b;
  --danger-soft: rgba(255, 91, 91, 0.24);
  --text-primary: #fbfbfd;
  --text-muted: #d3d6de;
  --border: rgba(255, 255, 255, 0.22);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 20px;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
}

.background-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255, 59, 48, 0.25), transparent 55%),
    radial-gradient(80% 80% at 90% 10%, rgba(255, 102, 95, 0.24), transparent 60%),
    radial-gradient(60% 60% at 50% 100%, rgba(255, 255, 255, 0.12), transparent 65%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 120px
    );
  pointer-events: none;
  z-index: 0;
}

.layout {
  position: relative;
  z-index: 1;
  padding: 3rem min(6vw, 4rem) 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(230, 43, 30, 0.18);
  color: #ffd4d1;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-family: "Bebas Neue", "Space Grotesk", sans-serif;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  margin: 1.1rem 0 0.6rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--text-muted);
  line-height: 1.6;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 45%) border-box;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 75%;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.7;
  pointer-events: none;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-family: "Bebas Neue", "Space Grotesk", sans-serif;
  letter-spacing: 0.03em;
}

.credentials {
  padding: 1.4rem 1.75rem;
}

.credentials__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0;
}

.credentials__summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
  transition: transform var(--transition);
}

.credentials[open] .credentials__summary::after {
  transform: rotate(180deg);
}

.credentials__summary::-webkit-details-marker {
  display: none;
}

.credentials__summary-text h2 {
  margin: 0;
}

.credentials__summary.card__header {
  margin-bottom: 0;
}

.credentials__summary-text p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.credentials__body {
  margin-top: 1rem;
}

.credentials[open] .credentials__summary {
  margin-bottom: 0.75rem;
}

.card__subtitle {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.credentials__form {
  margin-top: 1.5rem;
}

.credentials__notice {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(230, 43, 30, 0.1);
  border: 1px solid rgba(230, 43, 30, 0.35);
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.credentials__form.is-locked input,
.credentials__form input[readonly] {
  cursor: not-allowed;
  opacity: 0.85;
}

.form-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.field span {
  font-weight: 600;
}

.field input {
  background: rgba(34, 34, 44, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: border var(--transition), box-shadow var(--transition);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 43, 30, 0.2);
}

.cards-grid {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card__header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.card__header .icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.card__controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.generation-progress {
  margin: 0.8rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transition: transform var(--transition), background var(--transition), opacity var(--transition), border var(--transition);
  position: relative;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn.loading::after {
  content: "";
  position: absolute;
  inset: 50% auto auto calc(100% + 0.75rem);
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #0a0a0a;
  border-color: transparent;
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff4a40 0%, #ff665e 100%);
}

.btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.25);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fee2e2;
}

.btn--danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--tiny {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

.category-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-panel__top {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.category-panel .search {
  flex: 1;
  background: rgba(34, 34, 44, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  color: var(--text-primary);
}

.category-panel .search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(230, 43, 30, 0.2);
}

.counter {
  font-weight: 600;
  color: #ffb3ad;
  white-space: nowrap;
}

.category-panel__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.category-list {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  padding-right: 0.4rem;
}

.category-list::-webkit-scrollbar {
  width: 6px;
}

.category-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(34, 34, 44, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border var(--transition), transform var(--transition), background var(--transition);
  cursor: pointer;
}

.category-item:hover {
  border-color: rgba(230, 43, 30, 0.5);
  transform: translateY(-1px);
}

.category-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.category-item__name {
  flex: 1;
  font-size: 0.95rem;
}

.result {
  border: 1px solid rgba(230, 43, 30, 0.35);
}

.result__details {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;
  display: grid;
  gap: 0.6rem;
}

.result__details li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(34, 34, 44, 0.78);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
}

.result__details strong {
  color: var(--text-primary);
}

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

.playlist-preview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.playlist-preview__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.playlist-preview__content {
  min-height: 260px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(30, 30, 40, 0.92);
  color: var(--text-primary);
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  padding: 1rem;
  resize: vertical;
  line-height: 1.5;
}

.playlist-preview__warning {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.library {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.library__header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.library__intro {
  flex: 1;
}

.library__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.library__filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 320px;
  min-width: 240px;
  margin-right: auto;
}

.library__search-input {
  flex: 1 1 220px;
  min-width: 200px;
  background: rgba(34, 34, 44, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  color: var(--text-primary);
}

.library__search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(230, 43, 30, 0.2);
}

.library__filters .btn {
  white-space: nowrap;
}

.library__selection strong {
  color: #ffb3ad;
}

.library__paths {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.library__content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.library-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.media-card {
  background: rgba(34, 34, 44, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  transition: border var(--transition), box-shadow var(--transition), transform var(--transition);
}

.media-card:hover {
  transform: translateY(-2px);
}

.media-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 18px 38px rgba(230, 43, 30, 0.18);
}

.media-card__thumb {
  width: 96px;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.media-card__placeholder {
  font-size: 2rem;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.6);
}

.media-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.media-card__info h3 {
  margin: 0;
  font-size: 1.05rem;
}

.media-card__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.media-card__path {
  margin: 0;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.75);
  word-break: break-all;
}

.media-card__control {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.media-card__control input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.media-card.is-selected .media-card__control span {
  color: var(--accent);
}

.library-series {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.series-card {
  background: rgba(34, 34, 44, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  overflow: hidden;
}

.series-card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  cursor: pointer;
}

.series-card > summary::-webkit-details-marker {
  display: none;
}

.series-card__thumb {
  width: 70px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.series-card__info h3 {
  margin: 0;
  font-size: 1.1rem;
}

.series-card__info p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.series-card__body {
  padding: 0 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.series-season {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 1rem;
}

.series-season:first-of-type {
  border-top: none;
  padding-top: 0;
}

.series-season__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.series-season__header h4 {
  margin: 0;
  font-size: 1rem;
}

.series-season__toggle {
  white-space: nowrap;
}

.season-episodes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.episode-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: border var(--transition), background var(--transition);
}

.episode-item input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.episode-item__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.episode-item__path {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: "Fira Code", monospace;
  word-break: break-all;
}

.episode-item.is-selected {
  border-color: var(--accent);
  background: rgba(230, 43, 30, 0.12);
}

.library-empty {
  text-align: center;
  padding: 1.5rem;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  color: var(--text-muted);
}

.downloads {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.downloads__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.downloads__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(34, 34, 44, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

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

.downloads__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 220px;
}

.downloads__empty {
  margin: 0;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(34, 34, 44, 0.86);
  border: 1px dashed rgba(255, 255, 255, 0.28);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.downloads__section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.downloads__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.download-item {
  background: rgba(34, 34, 44, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.download-item--completed {
  border-color: rgba(230, 43, 30, 0.35);
}

.download-item--error {
  border-color: rgba(248, 113, 113, 0.45);
}

.download-item--queued {
  border-style: dashed;
}

.download-item--paused {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.06);
}

.download-item--pausing {
  border-color: rgba(251, 191, 36, 0.35);
}

.download-item__header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.download-item__header h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.download-item__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.download-item__path {
  margin: 0;
  font-family: "Fira Code", monospace;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.75);
  word-break: break-all;
}

.download-item__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.download-item__edit {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(32, 32, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.download-item__edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.download-item__edit-field input {
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(32, 32, 42, 0.95);
  color: var(--text-primary);
}

.download-item__edit-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(230, 43, 30, 0.2);
}

.download-item__edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.download-item__edit-hint {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.7);
}

.download-item__progress {
  background: rgba(32, 32, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.download-item__bar-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.download-item__bar {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.download-item__bar--indeterminate {
  width: 35%;
  animation: progress-indeterminate 1.3s ease-in-out infinite;
}

.download-item__progress-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.download-item__error {
  margin: 0;
  color: #f87171;
  font-size: 0.9rem;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  50% {
    transform: translateX(20%);
  }
  100% {
    transform: translateX(120%);
  }
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.4rem;
  border-radius: 12px;
  background: rgba(34, 34, 44, 0.95);
  border: 1px solid rgba(230, 43, 30, 0.4);
  color: #ffd4d1;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 50;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.btn:focus-visible,
.field input:focus-visible,
.category-panel .search:focus-visible,
.library__search-input:focus-visible,
.download-item__edit-field input:focus-visible {
  outline: 2px solid rgba(230, 43, 30, 0.6);
  outline-offset: 2px;
}

@media (min-width: 1200px) {
  .content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
}

@media (max-width: 720px) {
  .layout {
    padding: 2.5rem 1.25rem 3rem;
  }

  .card {
    padding: 1.4rem;
  }

  .card__header {
    align-items: center;
  }

  .hero {
    text-align: left;
  }

  .library__actions {
    justify-content: flex-start;
  }

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

  .media-card {
    grid-template-columns: 1fr;
  }

  .media-card__thumb {
    width: 100%;
    height: 180px;
  }

  .series-card > summary {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


.scroll-nav {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 30;
}

.scroll-nav__btn {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(25, 27, 34, 0.92);
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  transition: transform var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
  opacity: 0.92;
}

.scroll-nav__btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 59, 48, 0.18);
  border-color: rgba(255, 59, 48, 0.45);
}

.scroll-nav__btn:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .scroll-nav {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .scroll-nav__btn {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
}
