:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #101722;
  --panel-2: #151f2d;
  --panel-3: #1d2939;
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --line: rgba(148, 163, 184, 0.18);
  --accent: #2dd4bf;
  --accent-2: #60a5fa;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 8px;
  --nav-width: 104px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  height: 100vh;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.08), transparent 36%),
    radial-gradient(circle at 84% 8%, rgba(96, 165, 250, 0.14), transparent 34%),
    var(--bg);
}

.nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.74);
}

.brand {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 8px;
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: var(--radius);
  background: #0f1720;
  color: var(--accent);
  font-weight: 900;
  font-size: 22px;
}

.nav-button {
  display: grid;
  place-items: center;
  width: 74px;
  min-height: 62px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-button span {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.1;
}

.nav-button svg,
.icon {
  width: 22px;
  height: 22px;
}

.nav-button.active {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.32);
  color: var(--text);
}

.content {
  min-width: 0;
  overflow: auto;
  padding: 28px 34px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 42px;
  line-height: 1;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 17px;
}

.clock {
  color: var(--soft);
  font-size: 18px;
  white-space: nowrap;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(520px, 100%);
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, 0.9);
}

.searchbox input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
}

.searchbox input::placeholder {
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 22px;
  margin-bottom: 30px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, 0.82);
}

.hero-main {
  min-height: 278px;
  padding: 30px;
  background:
    linear-gradient(115deg, rgba(15, 23, 32, 0.95), rgba(15, 23, 32, 0.66)),
    linear-gradient(135deg, rgba(45, 212, 191, 0.3), rgba(96, 165, 250, 0.2));
}

.hero-main p {
  max-width: 680px;
  margin-top: 14px;
  color: var(--soft);
  font-size: 19px;
  line-height: 1.5;
}

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

.button,
.chip,
.category-pill {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  font-weight: 800;
}

.button.primary {
  border-color: rgba(45, 212, 191, 0.38);
  background: var(--accent);
  color: #06110f;
}

.button.danger {
  border-color: rgba(251, 113, 133, 0.4);
  color: var(--danger);
}

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

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-head p {
  color: var(--muted);
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 220px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}

.card {
  position: relative;
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  scroll-snap-align: start;
}

.card.poster {
  aspect-ratio: 2 / 3;
  min-height: 270px;
  padding: 0;
  background: #0f1720;
}

.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #162033, #0f1720);
  color: var(--muted);
  text-align: center;
}

.card-body {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 52px 12px 12px;
  background: linear-gradient(transparent, rgba(3, 7, 18, 0.96));
}

.card h3,
.list-item h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: rgba(251, 191, 36, 0.16);
  color: var(--warn);
}

.badge.off {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(251, 191, 36, 0.26);
  border-radius: var(--radius);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  line-height: 1.35;
}

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

.categories {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 10px;
}

.category-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 12px;
  color: var(--soft);
  text-align: left;
}

.category-pill.active {
  border-color: rgba(45, 212, 191, 0.36);
  background: rgba(45, 212, 191, 0.12);
  color: var(--text);
}

.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

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

.list-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.guide {
  display: grid;
  gap: 8px;
}

.guide-head,
.guide-row {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) repeat(3, minmax(180px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.guide-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.guide-head span {
  min-height: 32px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 11, 16, 0.9);
}

.guide-row {
  width: 100%;
  min-height: 86px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.guide-channel,
.guide-program {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, 0.92);
}

.guide-channel {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.guide-channel-text {
  min-width: 0;
}

.guide-channel strong,
.guide-program strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.guide-channel-text > span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.guide-program {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 12px;
}

.guide-program small {
  color: var(--muted);
  font-size: 12px;
}

.guide-program.muted strong {
  color: var(--muted);
  font-weight: 700;
}

.thumb {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: var(--radius);
  background: var(--panel-3);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.favorite {
  color: var(--warn);
}

.empty,
.loading,
.error {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 34, 0.78);
  color: var(--muted);
}

.error {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.35);
}

.player-overlay,
.details-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(3, 7, 18, 0.96);
}

.player-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
}

video {
  width: 100%;
  height: 100%;
  background: #000;
}

.player-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  background: #090b10;
}

.player-title p {
  margin-top: 5px;
  color: var(--muted);
}

.control-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle-row {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
}

.subtitle-row input {
  flex: 1;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.details-panel {
  width: min(980px, calc(100vw - 96px));
  max-height: calc(100vh - 96px);
  margin: 48px auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.details-hero {
  min-height: 320px;
  padding: 26px;
  background-size: cover;
  background-position: center;
}

.details-hero-inner {
  max-width: 620px;
}

.details-hero p {
  margin-top: 14px;
  color: var(--soft);
  line-height: 1.55;
}

.episode-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.episode {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.settings-list {
  display: grid;
  gap: 14px;
  max-width: 840px;
}

.settings-card {
  padding: 18px;
}

.settings-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

button:focus-visible,
input:focus-visible,
.focusable:focus-visible {
  outline: 4px solid rgba(45, 212, 191, 0.9);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  :root {
    --nav-width: 82px;
  }

  .content {
    padding: 20px;
  }

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

  .categories {
    position: relative;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    max-height: none;
    overflow-x: auto;
  }

  h1 {
    font-size: 32px;
  }

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

  .player-controls {
    grid-template-columns: 1fr;
  }

  .guide {
    min-width: 820px;
  }
}
