:root {
  --bg: #0a0c10;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f6;
  --text-muted: #98a1b0;
  --text-faint: #6b7484;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --ready: #34d399;
  --progress: #38bdf8;
  --pending: #fbbf24;
  --declined: #fb7185;
  --neutral: #94a3b8;
  --partial: #a3e635;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shell: 1240px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(99, 102, 241, 0.16), transparent 70%),
    radial-gradient(760px 460px at 92% 4%, rgba(56, 189, 248, 0.1), transparent 72%),
    radial-gradient(700px 700px at 50% 110%, rgba(52, 211, 153, 0.06), transparent 70%);
}

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.brand:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.brand-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 550;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ready);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
  animation: pulse 2.4s ease-out infinite;
}

.live.is-stale .live-dot {
  background: var(--declined);
  animation: none;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 11px;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  fill: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-logo {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 13px;
  justify-content: center;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.95);
  transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
}

.btn-logo .tv-logo {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.btn-logo:hover {
  filter: brightness(1.06);
  box-shadow: 0 16px 28px -16px rgba(0, 0, 0, 1);
}

.btn-logo:active {
  transform: translateY(0);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

main {
  padding-block: 2rem 1rem;
}

.section[hidden] {
  display: none;
}

.banner[hidden] {
  display: none;
}

.banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.09);
  color: #fde68a;
  font-size: 0.86rem;
}

.section {
  margin-bottom: 2.75rem;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 1.22rem;
  font-weight: 650;
}

.count {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.filters {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 570;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: var(--surface);
  color: var(--text);
}

.chip[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
}

.chip .chip-count {
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
  margin-left: 0.3rem;
}

.watching-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
  gap: 1rem;
}

.watch-card {
  display: flex;
  gap: 1rem;
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.watch-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.watch-poster {
  flex: none;
  width: 84px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.watch-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0.35rem;
}

.watch-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.watch-title {
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.015em;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.watch-sub {
  color: var(--text-muted);
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.state-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.state-pill.playing {
  color: var(--ready);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

.state-pill.paused {
  color: var(--pending);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
}

.watch-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.79rem;
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 600;
}

.avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), #8b5cf6);
}

.progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.55rem;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 0.9s linear;
}

.progress-bar.preparing {
  background: linear-gradient(90deg, var(--progress), #6366f1);
}

.timecode {
  color: var(--text-faint);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.35rem;
}

.request-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 1.1rem 1rem;
}

.request-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
}

.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-faint);
  font-size: 0.75rem;
  text-align: center;
  padding: 0.75rem;
}

.poster-status {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.75rem 0.6rem 0.6rem;
  background: linear-gradient(to top, rgba(6, 8, 12, 0.94), transparent);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 640;
  background: rgba(10, 12, 16, 0.75);
  border: 1px solid currentColor;
  backdrop-filter: blur(6px);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-detailed {
  align-items: flex-start;
  border-radius: 11px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.badge-detailed::before {
  flex: none;
  margin-top: 0.33rem;
}

.badge-lines {
  display: flex;
  flex-direction: column;
}

.badge.ready { color: var(--ready); }
.badge.partial { color: var(--partial); }
.badge.preparing { color: var(--progress); }
.badge.pending { color: var(--pending); }
.badge.searching,
.badge.queued { color: var(--neutral); }
.badge.declined,
.badge.failed { color: var(--declined); }

.poster-top {
  position: absolute;
  inset: 0.55rem 0.55rem auto 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.poster-top .badge {
  align-self: flex-end;
}

.type-tag {
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(10, 12, 16, 0.7);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.request-title {
  font-size: 0.88rem;
  font-weight: 620;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ratings {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.rating-src {
  padding: 0.05rem 0.28rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.rating-value {
  font-size: 0.73rem;
  font-weight: 640;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.rating.imdb .rating-src {
  background: #f5c518;
  color: #131313;
}

.rating.tmdb .rating-src {
  background: linear-gradient(90deg, #90cea1, #01b4e4);
  color: #042c38;
}

.rt-icon {
  width: 16px;
  height: 16px;
  flex: none;
  object-fit: contain;
}

.request-sub {
  color: var(--text-faint);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  grid-column: 1 / -1;
}

.empty svg {
  width: 34px;
  height: 34px;
  stroke: var(--text-faint);
  stroke-width: 1.5;
  fill: none;
}

.empty strong {
  font-weight: 620;
}

.empty span {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.empty.empty-row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.6rem;
  padding: 0.85rem 1rem;
}

.empty.empty-row svg {
  width: 20px;
  height: 20px;
}

.empty.empty-row span {
  font-size: 0.82rem;
}

.agenda {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.agenda-day {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agenda-date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.agenda-date.is-today {
  color: var(--accent);
}

.agenda-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.agenda-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neutral);
  transform: translateY(-1px);
}

.agenda-dot.tv {
  background: var(--progress);
}

.agenda-dot.movie {
  background: var(--pending);
}

.agenda-dot.have {
  background: var(--ready);
}

.agenda-body {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
}

.agenda-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.agenda-title {
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-code {
  flex: none;
  font-size: 0.76rem;
  font-weight: 640;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.agenda-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.agenda-have {
  color: var(--ready);
  font-weight: 620;
}

.agenda-missing {
  color: var(--declined);
  font-weight: 620;
}

.agenda-day.is-past .agenda-title {
  color: var(--text-muted);
  font-weight: 560;
}

.agenda-day.is-past .agenda-dot {
  opacity: 0.75;
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 30%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.skeleton.watch {
  height: 132px;
}

.skeleton.poster {
  aspect-ratio: 2 / 3;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.5rem 2.5rem;
  color: var(--text-faint);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 1.75rem, var(--shell));
  }
  .live-text {
    display: none;
  }
  .btn {
    padding: 0.5rem 0.7rem;
  }
  .btn-logo {
    width: 42px;
    height: 42px;
    padding: 0;
  }
  .watching-grid {
    grid-template-columns: 1fr;
  }
  .request-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.9rem 0.75rem;
  }
  .section-head h2 {
    font-size: 1.1rem;
  }
  .filters {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
