@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #080a12;
  --bg-soft: #0d1020;
  --panel: rgba(19, 23, 42, 0.82);
  --panel-strong: #151a2d;
  --panel-light: #1c2340;
  --line: rgba(154, 163, 255, 0.16);
  --text: #f6f7ff;
  --muted: #9ca4c4;
  --primary: #8b5cf6;
  --primary-light: #b69cff;
  --cyan: #38d9e8;
  --success: #57e39a;
  --danger: #ff7e9d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(139, 92, 246, 0.2), transparent 30rem),
    radial-gradient(circle at 100% 16%, rgba(56, 217, 232, 0.1), transparent 26rem),
    var(--bg);
  font-family: "DM Sans", system-ui, sans-serif;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  pointer-events: none;
}

header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 14px clamp(18px, 4vw, 64px);
  background: rgba(8, 10, 18, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.brand::before {
  width: 11px;
  height: 11px;
  background: linear-gradient(135deg, var(--cyan), var(--primary));
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(56, 217, 232, 0.65);
  content: "";
}

.brand span {
  color: var(--primary-light);
}

nav {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

nav::-webkit-scrollbar {
  display: none;
}

button {
  min-height: 42px;
  padding: 10px 16px;
  color: var(--text);
  background: var(--panel-light);
  border: 1px solid transparent;
  border-radius: 11px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover {
  background: #2a3357;
  border-color: rgba(182, 156, 255, 0.3);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(56, 217, 232, 0.36);
  outline-offset: 2px;
}

nav button {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

nav button:hover,
nav button[aria-selected="true"] {
  color: var(--text);
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(182, 156, 255, 0.18);
}

.tab {
  display: none;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(26px, 5vw, 58px) 0 72px;
}

.tab.active {
  display: block;
  animation: tab-in 300ms ease both;
}

@keyframes tab-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  position: relative;
  max-width: 850px;
  margin: 0 auto 38px;
  padding: clamp(28px, 7vw, 76px) 20px 34px;
  text-align: center;
}

.hero::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--primary), transparent);
  transform: translateX(-50%);
  content: "";
}

.hero h1 {
  max-width: 720px;
  margin: 0 auto 14px;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.2rem, 7vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.075em;
}

.hero h1::first-letter {
  color: var(--primary-light);
}

.hero p,
.muted {
  max-width: 610px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.searchbox,
.row {
  display: flex;
  gap: 10px;
}

.searchbox {
  max-width: 780px;
  margin: 28px auto 0;
  padding: 7px;
  background: rgba(21, 26, 45, 0.8);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.searchbox button {
  flex: 0 0 auto;
  padding-inline: 24px;
  background: linear-gradient(135deg, var(--primary), #6d5ce7);
}

.searchbox button:hover {
  background: linear-gradient(135deg, #9d75ff, #7566f5);
}

input,
.filter {
  min-width: 0;
  color: var(--text);
  background: rgba(7, 10, 20, 0.76);
  border: 1px solid var(--line);
  border-radius: 11px;
  font: inherit;
}

.searchbox input,
.row input,
.filter {
  flex: 1;
  min-height: 48px;
  padding: 12px 15px;
}

input::placeholder {
  color: #6f7899;
}

.provider-grid,
.site-grid,
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.provider,
.site,
.channel,
.player-card,
.result,
.toggle {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(25, 31, 56, 0.92), rgba(15, 19, 35, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13);
}

.provider,
.site,
.channel,
.result,
.toggle {
  padding: 18px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.provider::before,
.site::before,
.channel::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 68%);
  content: "";
  pointer-events: none;
}

.provider:hover,
.site:hover,
.channel:hover,
.result:hover {
  border-color: rgba(182, 156, 255, 0.44);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  transform: translateY(-3px);
}

.provider h3,
.result h3 {
  margin: 0 0 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.provider a,
.site a {
  color: var(--primary-light);
  text-decoration: none;
  word-break: break-word;
}

.provider a:hover,
.site a:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.result-actions button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.84rem;
}

.player-card {
  padding: clamp(14px, 3vw, 24px);
}

.player-card video,
#iptvVideo {
  display: block;
  width: 100%;
  max-height: 65vh;
  background: #03040a;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.player-card #playerStatus {
  padding: 14px 2px 2px;
  color: var(--muted);
}

.player-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 4px;
}

.player-actions button {
  color: #061016;
  background: var(--cyan);
}

.player-card video:fullscreen {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: #000;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(7, 10, 20, 0.62);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.file-item button {
  min-height: 34px;
  padding: 7px 11px;
  color: #061016;
  background: var(--cyan);
  font-size: 0.82rem;
}

.filter {
  display: block;
  width: 100%;
  margin: 16px 0;
}

.channel-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
}

.playlist-settings {
  margin: 18px 0;
  padding: 16px;
  background: rgba(21, 26, 45, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.playlist-settings summary {
  color: var(--primary-light);
  font-weight: 700;
  cursor: pointer;
}

.playlist-settings .row {
  margin-top: 16px;
}

.playlist-settings .muted {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.channel-tools .filter {
  margin: 0;
}

.channel-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.channel-categories button {
  min-height: 36px;
  padding: 7px 13px;
  color: var(--muted);
  background: rgba(21, 26, 45, 0.72);
  border-color: var(--line);
  font-size: 0.86rem;
}

.channel-categories button.active {
  color: var(--text);
  background: linear-gradient(135deg, var(--primary), #6254d8);
  border-color: rgba(182, 156, 255, 0.48);
}

.favorite-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.favorite-filter input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.iptv-player-card {
  margin: 22px 0 18px;
  padding: clamp(14px, 3vw, 24px);
  background: linear-gradient(145deg, rgba(25, 31, 56, 0.92), rgba(15, 19, 35, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.iptv-player-card #iptvVideo {
  min-height: clamp(190px, 42vw, 520px);
  object-fit: contain;
}

.iptv-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.iptv-controls select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(7, 10, 20, 0.76);
  border: 1px solid var(--line);
  border-radius: 11px;
  font: inherit;
}

.iptv-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.channel {
  cursor: pointer;
}

.channel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.favorite-channel {
  flex: 0 0 auto;
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
  color: #ffd76a;
  background: rgba(255, 215, 106, 0.08);
  border-color: rgba(255, 215, 106, 0.18);
  font-size: 1.15rem;
  line-height: 1;
}

.favorite-channel:hover {
  color: #ffe59b;
  background: rgba(255, 215, 106, 0.18);
}

.channel-empty {
  grid-column: 1 / -1;
  padding: 24px 0;
}

.channel small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.site-grid {
  margin-top: 18px;
}

.toggle {
  display: block;
  padding: 18px;
}

.toggle input {
  width: 17px;
  height: 17px;
  margin: 0 9px 0 0;
  accent-color: var(--primary);
  vertical-align: -3px;
}

@media (max-width: 700px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-block: 13px;
  }

  nav {
    width: 100%;
  }

  nav button {
    flex: 1 0 auto;
  }

  .hero {
    margin-bottom: 20px;
    padding-top: 42px;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem);
  }

  .searchbox,
  .row {
    flex-direction: column;
  }

  .searchbox button {
    width: 100%;
  }

  .searchbox input,
  .row input {
    width: 100%;
  }

  .channel-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .iptv-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .iptv-controls select {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

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