:root {
  --bg: #08131a;
  --bg-alt: #0e1f29;
  --panel: rgba(10, 27, 36, 0.78);
  --panel-strong: rgba(9, 22, 30, 0.95);
  --line: rgba(157, 214, 222, 0.16);
  --line-strong: rgba(157, 214, 222, 0.3);
  --text: #eef7f9;
  --text-dim: #9cb6bc;
  --accent: #3dd6c6;
  --accent-2: #ffb05c;
  --danger: #ff7b72;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(61, 214, 198, 0.18), transparent 38%),
    radial-gradient(circle at top right, rgba(255, 176, 92, 0.16), transparent 30%),
    linear-gradient(180deg, #071017 0%, #08131a 46%, #091720 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  padding: max(20px, var(--safe-top)) max(16px, var(--safe-right)) max(20px, var(--safe-bottom)) max(16px, var(--safe-left));
}

button,
input,
select,
a {
  font: inherit;
}

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

.hidden {
  display: none !important;
}

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

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(140deg, rgba(10, 30, 40, 0.98), rgba(12, 26, 34, 0.86));
  box-shadow: var(--shadow);
}

.hero__backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(61, 214, 198, 0.14), transparent 44%),
    radial-gradient(circle at 78% 28%, rgba(255, 176, 92, 0.28), transparent 22%),
    radial-gradient(circle at 18% 24%, rgba(61, 214, 198, 0.22), transparent 18%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(61, 214, 198, 0.18), rgba(255, 176, 92, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.brand__mark svg {
  width: 34px;
  color: var(--accent);
}

.eyebrow,
.panel__label,
.player-meta__label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--text-dim);
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

h2 {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
}

.hero__copy {
  width: min(720px, 100%);
  margin: 18px 0 0;
  color: #d4e8eb;
  line-height: 1.7;
}

.hero__actions,
.quick-actions,
.toolbar,
.controls,
.type-switcher {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__actions {
  margin-top: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

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

.button--primary {
  color: #041015;
  background: linear-gradient(135deg, var(--accent), #78f3d4);
  font-weight: 800;
}

.button--ghost,
.button--chip {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.button--chip.is-active {
  border-color: rgba(61, 214, 198, 0.5);
  background: rgba(61, 214, 198, 0.14);
}

.status-banner,
.note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: #dcf1f4;
}

.status-banner--error,
.note--error {
  border-color: rgba(255, 123, 114, 0.4);
  background: rgba(255, 123, 114, 0.1);
  color: #ffe8e5;
}

.status-banner--success {
  border-color: rgba(61, 214, 198, 0.4);
  background: rgba(61, 214, 198, 0.1);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  white-space: nowrap;
}

.player-wrap {
  position: relative;
  margin-top: 18px;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(61, 214, 198, 0.22), transparent 22%),
    linear-gradient(180deg, #081117, #03070a);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.player {
  width: 100%;
  height: 100%;
  background: transparent;
}

.player-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
}

.player-empty__icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: #09151b;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.player-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.player-meta__value {
  margin: 6px 0 0;
  line-height: 1.6;
}

.quick-actions {
  margin-top: 18px;
}

.quick-actions .button,
.quick-actions a.button {
  flex: 1 1 180px;
}

.controls {
  margin-top: 16px;
  align-items: end;
}

.type-switcher {
  margin-bottom: 2px;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1 1 220px;
}

.field span {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.field select,
.field input {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.field select:focus,
.field input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.14);
}

.toolbar {
  margin-top: 16px;
  justify-content: space-between;
  align-items: center;
}

.stats-line {
  color: var(--text-dim);
}

.category-rail {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

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

.channel-grid--groups {
  grid-template-columns: 1fr;
}

.content-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.group-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.group-toggle[aria-expanded="true"] {
  border-bottom-color: var(--line);
  background: rgba(61, 214, 198, 0.08);
}

.group-toggle__title {
  font-weight: 700;
  font-size: 1rem;
}

.group-toggle__meta {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.group-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.channel-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.channel-card:hover {
  transform: translateY(-1px);
  border-color: rgba(61, 214, 198, 0.36);
  background: rgba(61, 214, 198, 0.07);
}

.channel-card.is-playing {
  border-color: rgba(255, 176, 92, 0.5);
  background: rgba(255, 176, 92, 0.08);
}

.channel-logo,
.channel-fallback {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(61, 214, 198, 0.16), rgba(255, 176, 92, 0.18));
}

.channel-fallback {
  display: grid;
  place-items: center;
  color: #08131a;
  font-weight: 800;
  font-family: "Space Grotesk", sans-serif;
}

.channel-name {
  margin: 0;
  font-size: 1rem;
}

.channel-card__tag {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(61, 214, 198, 0.12);
  color: #c7f7f1;
  font-size: 0.77rem;
}

.channel-detail {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.favorite-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
}

.favorite-button.is-favorite {
  color: var(--accent-2);
  border-color: rgba(255, 176, 92, 0.34);
  background: rgba(255, 176, 92, 0.08);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 26px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  color: var(--text-dim);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 11, 0.72);
  backdrop-filter: blur(10px);
}

.modal__card {
  position: relative;
  width: min(920px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: 12px auto;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.modal__close {
  min-height: 42px;
}

.modal__description {
  margin: 14px 0 0;
  color: #d7ebee;
  line-height: 1.7;
}

.modal__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.meta-pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}

.episode-sections {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.season-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
}

.season-title {
  margin: 0 0 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

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

.episode-button {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.episode-button:hover {
  border-color: rgba(61, 214, 198, 0.36);
  background: rgba(61, 214, 198, 0.07);
}

.episode-title {
  font-weight: 700;
}

.episode-subtitle {
  color: var(--text-dim);
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .group-toggle {
    padding: 14px 16px;
  }
}

@media (max-width: 640px) {
  body {
    padding-left: max(10px, var(--safe-left));
    padding-right: max(10px, var(--safe-right));
  }

  .hero__content,
  .panel {
    padding: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand__mark {
    width: 56px;
    height: 56px;
  }

  .channel-card {
    grid-template-columns: 52px minmax(0, 1fr) auto;
  }

  .channel-logo,
  .channel-fallback {
    width: 52px;
    height: 52px;
  }

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

  .modal__card {
    width: min(100% - 12px, 920px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
    padding: 16px;
  }
}
