:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #151f32;
  --line: rgba(148, 163, 184, 0.22);
  --text: #eef2ff;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.13), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

.sidebar,
.stage {
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  height: calc(100vh - 36px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
}

.brand {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.brand__eyebrow,
.label {
  display: block;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.search-box,
.custom-panel,
.tabs,
.list-header {
  padding: 14px 16px 0;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.86);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

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

.tab,
.ghost-button,
.icon-button,
.favorite-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.78);
  min-height: 40px;
  font-weight: 800;
}

.tab.is-active,
.primary-button {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(14, 165, 233, 0.9));
  color: #03131a;
}

.custom-panel {
  display: grid;
  gap: 8px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
  padding-bottom: 10px;
}

.icon-button {
  width: 40px;
  min-height: 36px;
}

.channel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px 14px;
  scrollbar-color: rgba(56, 189, 248, 0.62) rgba(15, 23, 42, 0.78);
  scrollbar-width: thin;
}

.channel-list::-webkit-scrollbar {
  width: 10px;
}

.channel-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.78);
  border-radius: 999px;
}

.channel-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.85), rgba(34, 197, 94, 0.75));
  border: 2px solid rgba(15, 23, 42, 0.78);
  border-radius: 999px;
}

.channel-item {
  width: 100%;
  display: grid;
  grid-template-columns: 58px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
  color: var(--text);
  text-align: left;
}

.channel-number {
  display: block;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.channel-item:hover,
.channel-item.is-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(21, 31, 50, 0.95);
}

.channel-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e2e8f0;
  overflow: hidden;
}

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

.channel-logo span {
  color: #0f172a;
  font-weight: 900;
}

.channel-name {
  font-weight: 900;
  line-height: 1.2;
}

.channel-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.star {
  color: #facc15;
  font-size: 1.1rem;
}

.stage {
  min-height: calc(100vh - 36px);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto auto;
  overflow: hidden;
}

.stage__topbar,
.channel-details {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 8px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.ghost-button,
.favorite-button {
  padding: 0 14px;
}

.ghost-button:disabled,
.favorite-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.player-frame {
  position: relative;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.45)),
    #020617;
}

video,
iframe {
  width: min(100%, 1180px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 230px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020617;
}

iframe,
video.is-hidden,
.empty-state.is-hidden {
  display: none;
}

iframe.is-visible {
  display: block;
}

.empty-state {
  width: min(100%, 560px);
  border: 1px dashed rgba(148, 163, 184, 0.38);
  border-radius: 8px;
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

.empty-state__title {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.channel-details {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.channel-details h2 {
  margin-top: 4px;
  font-size: 1.35rem;
}

.favorite-button.is-active {
  color: #111827;
  background: #facc15;
  border-color: #facc15;
}

.player-message {
  color: var(--muted);
  padding: 0 20px 18px;
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding: 10px;
    overflow: visible;
  }

  .sidebar,
  .stage {
    height: auto;
    min-height: auto;
  }

  .channel-list {
    max-height: 360px;
  }

  .stage {
    grid-template-rows: auto auto auto auto;
  }

  .stage__topbar,
  .channel-details {
    align-items: stretch;
    flex-direction: column;
  }

  video,
  iframe {
    max-height: none;
  }
}
