:root {
  --bg: #8e57e7;
  --surface: #fffdf9;
  --surface-2: #f4ede5;
  --surface-3: #efe5d8;
  --text: #171412;
  --muted: #736961;
  --line: rgba(23, 20, 18, 0.08);
  --yellow: #ffd548;
  --yellow-2: #f5be28;
  --green: #70d629;
  --green-2: #dff4cb;
  --danger: #bf5e4d;
  --danger-bg: #fff0ed;
  --shadow: 0 32px 70px rgba(23, 20, 18, 0.16);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 999px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 18%),
    linear-gradient(180deg, #9a61ee 0%, #7f4bd6 100%);
}

button,
input,
textarea {
  font: inherit;
}

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

.app-shell {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.app-surface {
  min-height: calc(100vh - 46px);
  border-radius: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 213, 72, 0.22), transparent 28%),
    linear-gradient(180deg, #fffdf9 0%, #f7f0e8 100%);
  box-shadow: var(--shadow);
}

.app-topbar {
  padding: 18px 22px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42));
  backdrop-filter: blur(8px);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 700;
}

.status-icons {
  color: var(--muted);
}

.status-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid rgba(214, 117, 92, 0.24);
  border-radius: 999px;
  background: #fff3f1;
  color: var(--danger);
  font-weight: 700;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(960px, 100%);
  padding: 22px;
  border-radius: 32px;
  background:
    radial-gradient(circle at top left, rgba(255, 213, 72, 0.18), transparent 28%),
    linear-gradient(180deg, #fffdf9 0%, #f7f0e8 100%);
  box-shadow: var(--shadow);
}

.auth-panel__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: center;
  margin-top: 18px;
}

.auth-panel__copy h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.auth-panel__copy p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-panel__form {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 20, 18, 0.06);
}

.auth-panel__form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.hero-card {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(135deg, #9158e8 0%, #d57ab0 100%);
  color: white;
}

.hero-copy {
  display: block;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.hero-card h1,
.section-head h2,
.empty-card h3,
.discover-card h3,
.watch-row h3,
.tool-card__title,
.sidebar-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.hero-card h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 4.2vw, 3.8rem);
  line-height: 0.96;
}

.hero-text {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.hero-side {
  display: grid;
  gap: 14px;
  align-content: end;
}

.hero-badge {
  display: none;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
}

.hero-badge span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.hero-preview {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.hero-preview__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-posters {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.hero-poster {
  width: 58px;
  aspect-ratio: 0.72;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.top-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.top-tabs--mobile {
  display: none;
}

.auth-strip {
  margin-top: 12px;
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 20, 18, 0.06);
}

.auth-card__copy h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.08rem;
}

.auth-card__copy p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.auth-form__actions,
.auth-user__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.auth-card--user {
  grid-template-columns: minmax(0, 1fr) auto;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border: 1px solid rgba(145, 88, 232, 0.18);
  border-radius: 16px;
  background: rgba(145, 88, 232, 0.12);
  color: #6f46bc;
  font-weight: 800;
  cursor: pointer;
}

.top-tab.is-active {
  background: linear-gradient(135deg, #9158e8 0%, #b46bd9 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 14px 24px rgba(145, 88, 232, 0.24);
}

.top-tab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  min-width: 1.15rem;
  font-size: 0.95rem;
  line-height: 1;
}

.top-tab__label {
  white-space: nowrap;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.covers-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.covers-toolbar__group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.covers-toolbar__group--sort {
  justify-items: end;
}

.covers-toolbar__label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
}

.chip-row {
  min-width: 0;
}

.filter-tab {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.filter-tab.is-active {
  background: linear-gradient(135deg, #9158e8 0%, #b46bd9 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 14px 24px rgba(145, 88, 232, 0.22);
}

.sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.sort-tab {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.sort-tab.is-active {
  background: white;
  color: var(--text);
  border-color: rgba(23, 20, 18, 0.08);
  box-shadow: 0 12px 22px rgba(23, 20, 18, 0.09);
}

.screen-body {
  padding: 18px 22px 28px;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.section-head h2 {
  font-size: 1.6rem;
  line-height: 1.05;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.content-main,
.content-side {
  min-width: 0;
}

.counter-pill,
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
}

.counter-pill,
.score-pill {
  background: var(--surface-3);
}

.empty-card,
.tool-card,
.discover-card,
.watch-row,
.alias-item,
.episode-card,
.episode-season,
.cover-card,
.sidebar-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 28px rgba(23, 20, 18, 0.06);
}

.empty-card {
  padding: 24px 20px;
  margin-top: 16px;
  text-align: center;
}

.empty-card p {
  margin: 10px auto 0;
  max-width: 30ch;
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-card {
  position: sticky;
  top: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.section-head--sidebar {
  margin-bottom: 14px;
}

.section-head--sidebar h2 {
  font-size: 1.6rem;
  line-height: 1.05;
}

.sidebar-toggle {
  display: none;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-card__body {
  display: block;
}

.sidebar-note {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.sidebar-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sidebar-summary__item {
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  text-align: center;
}

.sidebar-summary__item strong,
.sidebar-summary__item span {
  display: block;
}

.sidebar-summary__item strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.08rem;
}

.sidebar-summary__item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.sidebar-next-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sidebar-next-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  text-align: left;
  cursor: pointer;
}

.sidebar-next-item__copy {
  display: block;
}

.sidebar-next-item strong,
.sidebar-next-item span {
  display: block;
}

.sidebar-next-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar-next-item__progress {
  width: 100%;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(23, 20, 18, 0.08);
  overflow: hidden;
}

.sidebar-next-item__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd35a 0%, #ffe89e 100%);
}

.stack-list,
.discover-grid,
.alias-list,
.episode-seasons {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.covers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 16px;
}

.search-panel input,
.tool-form input,
.tool-form textarea {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  outline: none;
}

.search-panel input:focus,
.tool-form input:focus,
.tool-form textarea:focus {
  border-color: rgba(145, 88, 232, 0.45);
  box-shadow: 0 0 0 5px rgba(145, 88, 232, 0.12);
}

.search-panel button,
.wide-button,
.watch-row__toggle,
.episode-toggle,
.soft-button,
.back-link {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

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

.search-panel button,
.wide-button {
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffd95d 0%, #ffcf3f 100%);
  color: var(--text);
  font-weight: 800;
  box-shadow: 0 14px 22px rgba(255, 213, 72, 0.24);
}

.search-panel button:hover,
.wide-button:hover,
.watch-row__toggle:hover,
.episode-toggle:hover,
.soft-button:hover,
.filter-tab:hover,
.sort-tab:hover,
.back-link:hover,
.cover-card:hover,
.sidebar-next-item:hover,
.hero-poster:hover {
  transform: translateY(-1px);
}

.status-text {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.discover-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
}

.discover-card__poster {
  width: 100%;
  height: 100%;
  min-height: 250px;
  aspect-ratio: 0.72;
  object-fit: cover;
  background: var(--surface-2);
}

.discover-card__body {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.discover-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.discover-card__meta,
.watch-row__episode,
.watch-row__subtitle,
.alias-item__subtitle,
.tool-card__copy {
  margin: 0;
  color: var(--muted);
}

.discover-card__summary {
  margin: 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discover-card__genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.discover-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.discover-card__genres span {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 700;
}

.discover-card .wide-button {
  width: auto;
  min-width: 220px;
  margin-top: 4px;
  justify-self: start;
}

.discover-card__secondary-action {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
}

.watch-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.watch-row.is-updating {
  animation: watch-row-swap 520ms ease;
}

.watch-row__poster {
  width: 72px;
  aspect-ratio: 0.72;
  object-fit: cover;
  border-radius: 16px;
  background: var(--surface-2);
}

.watch-row__copy {
  min-width: 0;
}

.watch-row h3 {
  font-size: 1.05rem;
}

.watch-row__episode {
  margin-top: 6px;
  font-weight: 700;
  color: var(--text);
}

.watch-row__subtitle {
  margin-top: 4px;
  font-size: 0.92rem;
}

.watch-row__toggle {
  min-width: 128px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.watch-row__toggle.is-ready {
  background: var(--yellow);
  border-color: transparent;
}

.watch-row__toggle.is-complete {
  background: var(--green-2);
  color: #2c7a18;
  border-color: transparent;
}

.back-link {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.episode-detail {
  margin-top: 14px;
}

.cover-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.72;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.cover-card__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-2);
  transition: transform 220ms ease;
}

.cover-card__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 48px 14px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.88) 100%);
  color: white;
}

.cover-card__meta {
  display: none;
}

.cover-card__progress {
  margin-top: 0;
}

.cover-card__progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.cover-card__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd35a 0%, #ffe89e 100%);
}

.cover-card__progress-text {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
}

.cover-card:hover {
  box-shadow: 0 18px 34px rgba(23, 20, 18, 0.2);
}

.cover-card:hover .cover-card__poster {
  transform: scale(1.03);
}

.episode-card {
  padding: 18px;
}

.episode-card__head {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 14px;
}

.episode-card__content {
  min-width: 0;
}

.episode-card__content > .section-label {
  display: none;
}

.episode-card__details {
  display: none;
}

.episode-card__details.is-expanded {
  display: block;
}

.episode-card__poster {
  width: 94px;
  aspect-ratio: 0.72;
  object-fit: cover;
  border-radius: 18px;
  background: var(--surface-2);
}

.episode-card__summary {
  margin: 12px 0 0;
  line-height: 1.55;
}

.episode-summary-toggle {
  display: none;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #6f46bc;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.episode-summary-toggle--always {
  display: inline-flex;
}

.episode-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.episode-meta-strip span {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 700;
}

.episode-view-controls {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.episode-manage-controls {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.episode-view-toggle.is-active {
  background: white;
  box-shadow: 0 10px 18px rgba(23, 20, 18, 0.08);
}

.episode-seasons {
  margin-top: 16px;
}

.episode-season {
  padding: 16px;
}

.episode-season__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.episode-season__title,
.episode-season__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.episode-season__button:disabled {
  opacity: 0.55;
  cursor: default;
}

.episode-season__hint {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.episode-season__list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.episode-season__empty {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fcfaf7;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 600;
}

.episode-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: #fcfaf7;
  border: 1px solid var(--line);
}

.episode-row strong,
.episode-row span {
  display: block;
}

.episode-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.episode-toggle {
  min-width: 114px;
  padding: 10px 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  font-weight: 800;
}

.episode-toggle.is-watched {
  background: var(--green);
  color: white;
  border-color: transparent;
}

.tool-card {
  padding: 16px;
  margin-top: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-grid--single {
  grid-template-columns: 1fr;
}

.admin-grid .tool-card {
  margin-top: 0;
}

.admin-collapsible {
  margin-top: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(23, 20, 18, 0.06);
  overflow: hidden;
}

.admin-collapsible__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  list-style: none;
}

.admin-collapsible__summary::-webkit-details-marker {
  display: none;
}

.admin-collapsible__body {
  padding: 0 16px 16px;
}

.tool-card--nested {
  margin-top: 0;
  background: #fff;
}

.tool-card__title {
  font-size: 1.05rem;
}

.tool-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.tool-form--stack textarea {
  min-height: 180px;
  resize: vertical;
}

.tool-actions {
  display: flex;
  gap: 10px;
}

.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
}

.soft-button--later {
  background: #f7f1ff;
  border-color: #e0cffc;
  color: #6f46bc;
}

.soft-button--return {
  background: #edf8f0;
  border-color: #cbe9d5;
  color: #2c8a4d;
}

.soft-button--danger {
  background: #fff3f1;
  border-color: #f6d4ce;
  color: var(--danger);
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.tool-meta {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.tool-meta span {
  color: var(--muted);
  font-size: 0.88rem;
}

.cron-url-input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--text);
  font-size: 0.92rem;
}

.log-output {
  margin-top: 14px;
  padding: 14px;
  min-height: 160px;
  max-height: 300px;
  overflow: auto;
  border-radius: 18px;
  background: #17131f;
  border: 1px solid #2d243b;
  color: #f7f1ff;
  font: 0.85rem/1.55 "Consolas", "SFMono-Regular", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-log-raw {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.admin-log-raw__summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
}

.admin-run-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.admin-run-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
}

.admin-run-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.admin-run-card__head h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.admin-run-card__meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.admin-run-source,
.admin-run-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-run-source {
  background: #f7f1ff;
  color: #6f46bc;
}

.admin-run-card__note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-show-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.admin-show-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fcfaf7;
}

.admin-show-card.is-changed {
  background: linear-gradient(180deg, #fffaf0 0%, #fffdf9 100%);
}

.admin-show-card.has-error {
  background: #fff5f2;
  border-color: rgba(191, 94, 77, 0.18);
}

.admin-show-card__poster {
  width: 86px;
  aspect-ratio: 0.72;
  object-fit: cover;
  border-radius: 16px;
  background: var(--surface-2);
}

.admin-show-card__body {
  min-width: 0;
}

.admin-show-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.admin-show-card__head h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
}

.admin-show-card__head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-show-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #edf8f0;
  color: #2c8a4d;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-show-card:not(.is-changed) .admin-show-state {
  background: var(--surface-2);
  color: var(--muted);
}

.admin-show-card.has-error .admin-show-state {
  background: var(--danger-bg);
  color: var(--danger);
}

.admin-show-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.admin-show-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-show-pill--new {
  background: #fff3c9;
  border-color: rgba(255, 213, 72, 0.24);
}

.admin-show-pill--muted {
  color: var(--muted);
}

.admin-show-block {
  margin-top: 12px;
}

.admin-show-block strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
}

.admin-show-block--debug strong {
  color: #6f46bc;
}

.admin-show-list,
.admin-change-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-show-list li,
.admin-change-list li {
  display: grid;
  grid-template-columns: minmax(0, 110px) minmax(0, 1fr) minmax(0, 140px);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(23, 20, 18, 0.05);
  font-size: 0.88rem;
}

.admin-change-list li {
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr) minmax(0, 1fr);
}

.admin-show-list li span:first-child,
.admin-change-list li span:first-child {
  font-weight: 800;
}

.admin-show-list li span:last-child,
.admin-change-list li span:last-child {
  color: var(--muted);
}

.admin-show-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.admin-debug-grid {
  display: grid;
  gap: 8px;
}

.admin-debug-grid > div {
  display: grid;
  grid-template-columns: minmax(0, 130px) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7f1ff;
  border: 1px solid #e6d8ff;
  font-size: 0.88rem;
}

.admin-debug-grid > div span:first-child {
  font-weight: 800;
  color: #6f46bc;
}

.sync-progress {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #fbf7f2;
  border: 1px solid var(--line);
}

.sync-progress__labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sync-progress__labels span,
.sync-progress__details {
  color: var(--muted);
}

.sync-progress__bar {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #ece4d8;
}

.sync-progress__bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow) 0%, var(--yellow-2) 55%, #9158e8 100%);
  transition: width 280ms ease;
}

.sync-progress__details {
  margin-top: 10px;
}

.alias-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
}

.alias-item--static {
  display: block;
}

.alias-item__title,
.alias-item__subtitle {
  display: block;
}

.alias-item__subtitle {
  margin-top: 6px;
  line-height: 1.5;
}

.alias-item__meta {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.empty-card--compact {
  padding: 18px 20px;
  margin-top: 8px;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(23, 20, 18, 0.92);
  color: white;
  font-weight: 700;
  box-shadow: 0 20px 40px rgba(23, 20, 18, 0.24);
  animation: toast-in 220ms ease;
}

@keyframes watch-row-swap {
  0% {
    transform: scale(1);
    box-shadow: 0 18px 28px rgba(23, 20, 18, 0.06);
  }
  35% {
    transform: scale(0.985);
    box-shadow: 0 10px 18px rgba(23, 20, 18, 0.05);
    opacity: 0.72;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 18px 28px rgba(23, 20, 18, 0.06);
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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

  .content-side {
    order: -1;
  }

  .covers-toolbar {
    grid-template-columns: 1fr;
  }

  .covers-toolbar__group--sort {
    justify-items: stretch;
  }

  .sort-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .app-surface {
    min-height: 100vh;
    border-radius: 0;
    overflow: visible;
    padding-bottom: 96px;
  }

  .app-topbar,
  .screen-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .auth-gate {
    padding: 16px;
  }

  .auth-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .auth-panel__grid {
    grid-template-columns: 1fr;
  }

  .auth-panel__copy h1 {
    font-size: 2rem;
  }

  .hero-card {
    display: none;
  }

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

  .search-panel,
  .watch-row,
  .episode-row,
  .tool-actions,
  .sync-progress__labels,
  .alias-item {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .watch-row__toggle,
  .search-panel button,
  .wide-button,
  .soft-button,
  .episode-toggle {
    width: 100%;
  }

  .watch-row {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .watch-row__poster {
    width: 64px;
    border-radius: 14px;
  }

  .watch-row__copy {
    display: grid;
    gap: 4px;
    align-content: start;
  }

  .watch-row h3 {
    font-size: 1rem;
    line-height: 1.15;
  }

  .watch-row__episode {
    margin-top: 0;
    font-size: 0.98rem;
  }

  .watch-row__subtitle {
    margin-top: 0;
    font-size: 0.9rem;
  }

  .watch-row__toggle {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  .auth-form__actions,
  .auth-user__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .episode-card {
    padding: 14px;
  }

  .episode-card__head {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .episode-card__poster {
    width: 72px;
    border-radius: 16px;
  }

  .episode-card h2 {
    font-size: 1.15rem;
    line-height: 1.1;
  }

  .episode-card__summary {
    margin-top: 8px;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .episode-card__summary.is-expanded {
    display: block;
    overflow: visible;
  }

  .episode-view-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
  }

  .episode-manage-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .episode-view-controls .soft-button,
  .episode-view-controls .episode-summary-toggle,
  .episode-manage-controls .soft-button {
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
  }

  .episode-view-controls .episode-view-action,
  .episode-manage-controls .episode-view-action {
    grid-column: auto;
  }

  .episode-meta-strip {
    gap: 6px;
    margin-top: 10px;
  }

  .episode-meta-strip span {
    padding: 5px 8px;
    font-size: 0.74rem;
  }

  .episode-summary-toggle {
    margin-top: 8px;
    font-size: 0.92rem;
  }

  .top-tabs--desktop {
    display: none;
  }

  .top-tabs--mobile {
    position: fixed;
    inset: auto 16px calc(10px + env(safe-area-inset-bottom, 0px)) 16px;
    top: auto !important;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
    padding: 8px;
    border: 1px solid rgba(145, 88, 232, 0.16);
    border-radius: 24px;
    overflow: hidden;
    background: rgba(22, 15, 46, 0.88);
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 42px rgba(17, 10, 33, 0.28);
  }

  .top-tabs--mobile .top-tab {
    display: grid;
    justify-items: center;
    gap: 5px;
    min-height: 62px;
    padding: 10px 6px 9px;
    border-radius: 18px;
    border-color: transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    box-shadow: none;
  }

  .top-tabs--mobile .top-tab__icon {
    width: auto;
    min-width: 0;
    font-size: 1.05rem;
  }

  .top-tabs--mobile .top-tab__label {
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  .top-tabs--mobile .top-tab.is-active {
    background: linear-gradient(135deg, rgba(145, 88, 232, 0.98) 0%, rgba(180, 107, 217, 0.98) 100%);
    color: white;
    box-shadow: 0 14px 24px rgba(11, 7, 28, 0.3);
  }

  .covers-toolbar {
    gap: 12px;
    margin-top: 14px;
  }

  .covers-toolbar__group {
    gap: 8px;
  }

  .covers-toolbar__label {
    padding: 0 2px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }

  .filter-tabs,
  .sort-tabs {
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .filter-tabs::-webkit-scrollbar,
  .sort-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab,
  .sort-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 14px;
    white-space: nowrap;
  }

  .admin-access {
    justify-content: flex-start;
  }

  .admin-run-card__head,
  .admin-show-card,
  .admin-show-card__head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-run-card__meta {
    justify-items: start;
    text-align: left;
  }

  .admin-show-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .admin-show-card__poster {
    width: 72px;
    border-radius: 14px;
  }

  .admin-show-list li,
  .admin-change-list li {
    grid-template-columns: 1fr;
  }

  .content-side {
    order: 0;
  }

  .section-head--sidebar {
    align-items: center;
    margin-bottom: 0;
  }

  .sidebar-card {
    position: static;
    display: none;
    padding: 16px;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-card__body {
    display: block;
    margin-top: 0;
  }

  .sidebar-card.is-open {
    display: block;
  }

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

  .discover-card__poster {
    min-height: 200px;
    height: auto;
    aspect-ratio: 1.5 / 1;
  }

  .discover-card .wide-button {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .filter-tabs {
    gap: 8px;
  }

  .sort-tabs {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sidebar-summary {
    grid-template-columns: 1fr;
  }

  .app-toast {
    width: calc(100% - 24px);
    text-align: center;
  }
}
