:root {
  color-scheme: dark;
  --bg: #061a3a;
  --panel: #0b2554;
  --panel-2: #12366f;
  --line: rgba(165, 202, 255, 0.18);
  --text: #f5f9ff;
  --muted: #b9c9e4;
  --accent: #2f8cff;
  --accent-2: #7dd3fc;
  --danger: #ff6b6b;
  --shadow: 0 22px 60px rgba(0, 8, 28, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  background:
    linear-gradient(120deg, rgba(47, 140, 255, 0.22), transparent 34%),
    radial-gradient(circle at 82% 12%, rgba(125, 211, 252, 0.18), transparent 28%),
    var(--bg);
}

.rail {
  position: sticky;
  top: 0;
  width: 232px;
  height: 100vh;
  padding: 22px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(5, 19, 45, 0.9);
  backdrop-filter: blur(18px);
}

.brand,
.nav-item,
.tab,
.segment,
.primary,
.ghost,
.icon-button,
.category-button {
  border: 0;
  color: var(--text);
}

.brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: transparent;
  font-weight: 800;
  font-size: 1.08rem;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.category-button.active,
.category-button:hover {
  background: rgba(47, 140, 255, 0.18);
  color: var(--text);
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(125, 211, 252, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.mode-iptv .workspace {
  height: 100vh;
  overflow: hidden;
}

.mode-connect .workspace {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.mode-connect {
  grid-template-columns: 1fr;
}

.mode-connect .workspace {
  grid-column: 1 / -1;
}

.mode-connect .topbar {
  display: none;
}

.mode-connect .rail {
  display: none;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.76rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.04;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  width: min(34vw, 420px);
  min-width: 220px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(214, 231, 255, 0.08);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: rgba(214, 231, 255, 0.1);
  font-size: 1.28rem;
}

.connect-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  width: min(520px, calc(100vw - 56px));
  max-width: 520px;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(8, 30, 72, 0.98), rgba(5, 19, 45, 0.96));
  box-shadow: var(--shadow);
}

.connect-copy {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 6px 0 2px;
  text-align: center;
}

.connect-copy img {
  width: 62px;
  height: 62px;
}

.connect-copy h2 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 13, 34, 0.34);
  align-self: end;
}

.login-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.tab,
.segment {
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.tab.active,
.segment.active {
  background: var(--accent);
  color: #f8fbff;
  font-weight: 800;
}

.source-form {
  display: none;
  grid-template-columns: 1fr;
  gap: 14px;
  align-self: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.source-form.active {
  display: grid;
}

.remote-panel.active {
  display: grid;
  grid-template-columns: 1fr;
}

.remote-code {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(214, 231, 255, 0.08);
}

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

.remote-code strong {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.remote-panel p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.wide {
  grid-column: 1 / -1;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(214, 231, 255, 0.09);
  color: var(--text);
  outline: 0;
}

input[type="file"] {
  padding: 12px;
}

.primary,
.ghost {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #2f8cff, #62b6ff);
  color: #f8fbff;
  box-shadow: 0 14px 30px rgba(47, 140, 255, 0.28);
}

.primary:hover,
.media-card:hover,
.ghost:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary:disabled {
  cursor: progress;
  opacity: 0.76;
}

.ghost {
  background: rgba(214, 231, 255, 0.1);
  color: var(--text);
}

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

.mode-home .content-layout {
  grid-template-columns: 1fr;
}

.mode-iptv .content-layout {
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.mode-home .workspace {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.hub-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 34px;
  width: min(1400px, 100%);
  margin: 0 auto;
  align-content: start;
}

.hero {
  position: relative;
  min-height: 48vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(18, 54, 111, 0.98), rgba(6, 26, 58, 0.95));
  box-shadow: 0 26px 60px rgba(0, 10, 36, 0.36);
}

.hero-media {
  position: absolute;
  inset: 0;
}

.hero-media-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 500ms ease;
}

.hero-media-image.loaded {
  opacity: 0.85;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 12, 31, 0.1) 0%, rgba(3, 12, 31, 0.6) 58%, var(--bg) 100%),
    linear-gradient(100deg, rgba(3, 12, 31, 0.8), transparent 62%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: 48px;
  display: grid;
  gap: 14px;
}

.hero-tag {
  margin: 0;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 800;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  line-height: 1.05;
  font-weight: 900;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.hero-meta {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

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

.hero-play,
.hero-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 10px;
  border: 0;
  font-weight: 800;
  font-size: 1rem;
  transition: transform 160ms ease, background 160ms ease;
}

.hero-play {
  background: linear-gradient(135deg, #2f8cff, #7dd3fc);
  color: #041226;
  box-shadow: 0 14px 30px rgba(47, 140, 255, 0.36);
}

.hero-play svg {
  width: 20px;
  height: 20px;
}

.hero-play:hover,
.hero-play:focus-visible {
  transform: translateY(-1px);
}

.hero-secondary {
  background: rgba(214, 231, 255, 0.14);
  color: var(--text);
  backdrop-filter: blur(6px);
}

.hero-secondary svg {
  width: 18px;
  height: 18px;
  transition: transform 160ms ease;
}

.hero-secondary.active svg {
  transform: rotate(45deg);
}

.hero-secondary:hover,
.hero-secondary:focus-visible {
  background: rgba(214, 231, 255, 0.22);
}

.home-rows {
  display: grid;
  gap: 30px;
}

.home-rows-empty {
  color: var(--muted);
  padding: 24px 0;
}

.category-panel,
.catalog {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 30, 72, 0.74);
}

.category-panel {
  padding: 14px;
  height: 100%;
  overflow: hidden;
}

.panel-header,
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header {
  padding: 4px 4px 12px;
  color: var(--muted);
  font-weight: 800;
}

.category-list {
  display: grid;
  gap: 6px;
  max-height: calc(100% - 38px);
  overflow: auto;
}

.category-button {
  min-height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog {
  padding: 18px;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.catalog-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-bottom: 12px;
  background: rgba(8, 30, 72, 0.96);
}

.back-button {
  width: 48px;
  height: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(214, 231, 255, 0.08);
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
}

.back-button:hover {
  background: var(--accent);
}

.wide-message {
  grid-column: 1 / -1;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 13, 34, 0.3);
}

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

.catalog-sentinel {
  grid-column: 1 / -1;
  height: 1px;
}

.media-row {
  min-width: 0;
}

.media-row h2 {
  margin: 0 0 12px;
  padding-left: 2px;
  font-size: 1.16rem;
}

.media-row-track {
  position: relative;
}

.media-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 202px);
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 14px;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}

.row-nav {
  position: absolute;
  top: 0;
  bottom: 14px;
  z-index: 3;
  width: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(3, 12, 31, 0.88), transparent);
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.row-nav-next {
  right: 0;
  background: linear-gradient(270deg, rgba(3, 12, 31, 0.88), transparent);
}

.row-nav-prev {
  left: 0;
}

.media-row-track:hover .row-nav {
  opacity: 1;
  pointer-events: auto;
}

.media-card {
  min-width: 0;
  min-height: 218px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(21, 62, 128, 0.96), rgba(8, 30, 72, 0.96));
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 26px rgba(0, 10, 36, 0.24);
  scroll-snap-align: start;
  transform-origin: center;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease, z-index 0s;
}

.media-card:hover,
.media-card:focus-visible {
  position: relative;
  z-index: 2;
  transform: translateY(-6px) scale(1.045);
  border-color: rgba(125, 211, 252, 0.78);
  box-shadow: 0 22px 42px rgba(0, 14, 48, 0.48);
}

.media-card:hover .poster-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.poster {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(140deg, rgba(47, 140, 255, 0.42), transparent),
    linear-gradient(320deg, rgba(125, 211, 252, 0.28), transparent),
    #082554;
}

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

.poster-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease;
}

.poster-image.loaded {
  opacity: 1;
}

.poster::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 54%;
  background: linear-gradient(180deg, transparent, rgba(3, 12, 31, 0.62));
  pointer-events: none;
}

.poster-fallback {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(214, 231, 255, 0.13);
  color: var(--accent-2);
}

.poster-fallback svg {
  width: 26px;
  height: 26px;
}

.poster-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(3, 12, 31, 0.62);
  color: var(--text);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.poster-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.poster-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 140, 255, 0.92);
  color: #f8fbff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.media-info {
  padding: 11px;
}

.media-title {
  display: -webkit-box;
  min-height: 42px;
  margin: 0 0 7px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  font-weight: 800;
}

.media-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card {
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.settings-card h2 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.settings-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.settings-card dt {
  color: var(--muted);
}

.settings-card dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 20, 0.72);
  backdrop-filter: blur(6px);
}

.detail-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(82vh, 780px);
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(11, 37, 84, 0.98), rgba(4, 16, 40, 0.98));
  box-shadow: var(--shadow);
}

.detail-close {
  position: absolute;
  right: 14px;
  top: 14px;
}

.detail-header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-right: 40px;
}

.detail-poster {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(125, 211, 252, 0.14);
}

.detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-heading {
  min-width: 0;
}

.detail-heading h2 {
  margin: 2px 0 4px;
  font-size: 1.3rem;
}

.detail-meta {
  margin: 0;
  color: var(--muted);
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(214, 231, 255, 0.08);
  color: var(--muted);
  font-weight: 700;
}

.detail-tab.active {
  background: var(--accent);
  color: #f8fbff;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(214, 231, 255, 0.06);
  color: var(--text);
  text-align: left;
}

.detail-row:hover,
.detail-row:focus-visible {
  background: rgba(47, 140, 255, 0.18);
  border-color: rgba(125, 211, 252, 0.5);
}

.detail-row-num {
  flex: 0 0 auto;
  min-width: 34px;
  color: var(--accent-2);
  font-weight: 800;
  text-align: center;
}

.detail-row-title {
  flex: 1 1 auto;
  font-weight: 600;
}

.detail-empty {
  margin: 0;
  padding: 20px 4px;
  color: var(--muted);
  text-align: center;
}

.player-drawer {
  position: fixed;
  inset: 32px;
  z-index: 70;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
  box-shadow: var(--shadow);
}

.player-drawer.fullscreen-mode {
  inset: 0;
  border-radius: 0;
}

.player-fullscreen .workspace {
  padding: 0;
}

.player-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

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

.player-status {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 8, 22, 0.55);
  color: var(--text);
  text-align: center;
  font-weight: 800;
  pointer-events: none;
}

.player-controls-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, rgba(2, 8, 20, 0.7) 0%, transparent 22%, transparent 68%, rgba(2, 8, 20, 0.86) 100%);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.player-frame.controls-visible .player-controls-layer {
  opacity: 1;
  pointer-events: auto;
}

.player-top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.player-titles {
  min-width: 0;
  flex: 1 1 auto;
}

.player-titles h2 {
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1rem;
}

.player-center-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.overlay-button {
  min-width: 64px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  border-radius: 999px;
  background: rgba(2, 13, 34, 0.5);
  font-size: 1.3rem;
  backdrop-filter: blur(6px);
}

.overlay-label {
  font-size: 0.62rem;
  font-weight: 800;
}

.overlay-play {
  min-width: 84px;
  min-height: 84px;
  font-size: 2rem;
  background: rgba(47, 140, 255, 0.32);
}

.player-bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 12px;
  width: 100%;
  padding: 0 20px 18px;
}

.scrubber {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 28px;
  cursor: pointer;
  touch-action: pan-x;
}

.scrubber-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
  transform: translateY(-50%);
}

.scrubber-buffered {
  position: absolute;
  inset: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.34);
}

.scrubber-progress {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent);
}

.scrubber-input {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.scrubber-input::-webkit-slider-runnable-track {
  background: transparent;
}

.scrubber-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 0 5px rgba(47, 140, 255, 0.35);
}

.scrubber-input::-moz-range-track {
  background: transparent;
}

.scrubber-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
}

.live-badge {
  display: none;
  flex: 0 0 auto;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scrubber.is-live .scrubber-input,
.scrubber.is-live .scrubber-track {
  visibility: hidden;
}

.scrubber.is-live .live-badge {
  display: inline-block;
}

.player-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.player-bottom-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.time-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.control-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(214, 231, 255, 0.14);
  color: var(--text);
  font-weight: 800;
}

.control-button:hover,
.control-button:focus-visible {
  background: var(--accent);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(214, 231, 255, 0.1);
  height: 44px;
}

.volume-control input[type="range"] {
  width: 110px;
  height: 4px;
  accent-color: var(--accent-2);
}

.player-bottom-row {
  width: 100%;
}

.player-bottom-left {
  flex: 1 1 auto;
  min-width: 0;
}

.player-bottom-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.empty-state {
  padding: 54px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(92vw, 560px);
  transform: translateX(-50%);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b2554;
  color: var(--text);
  box-shadow: var(--shadow);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  gap: 14px;
  background: rgba(2, 13, 34, 0.72);
  backdrop-filter: blur(12px);
}

.loading-overlay p {
  margin: 0;
  font-weight: 800;
}

.loader {
  width: 54px;
  height: 54px;
  border: 4px solid rgba(125, 211, 252, 0.22);
  border-top-color: var(--accent-2);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

.focusable:focus-visible,
.focus-ring:focus-within {
  outline: 3px solid rgba(125, 211, 252, 0.74);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    z-index: 60;
  }

  .brand {
    display: none;
  }

  .nav-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 0;
  }

  .nav-item {
    min-height: 52px;
    justify-content: center;
    padding: 0;
  }

  .nav-item span:last-child {
    display: none;
  }

  .workspace {
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .mode-iptv .workspace {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
    min-width: 0;
  }

  .connect-panel,
  .source-form,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .mode-iptv .content-layout {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    height: auto;
    overflow: visible;
  }

  .connect-panel {
    margin-top: 0;
    padding: 16px;
  }

  .connect-copy {
    min-height: 0;
  }

  .tabs,
  .source-form {
    grid-column: auto;
  }

  .category-panel {
    height: auto;
    max-height: none;
    padding: 12px;
    overflow: visible;
  }

  .mode-iptv .category-panel {
    height: auto;
  }

  .mode-iptv .catalog {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .remote-panel.active {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 40vh;
    border-radius: 16px;
  }

  .hero-content {
    padding: 24px;
    max-width: 100%;
  }

  .hero-play,
  .hero-secondary {
    min-height: 46px;
    padding: 0 18px;
    font-size: 0.92rem;
  }

  .category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }

  .category-button {
    min-width: 118px;
    flex: 0 0 auto;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  }

  .media-strip {
    grid-auto-columns: minmax(142px, 164px);
  }

  .media-card {
    min-height: 204px;
  }

  .poster {
    min-height: 132px;
  }

  .player-drawer {
    inset: 0;
    border-radius: 0;
  }

  .player-top-bar {
    padding: 14px;
  }

  .player-center-controls {
    gap: 16px;
  }

  .overlay-button {
    min-width: 52px;
    min-height: 52px;
    font-size: 1.1rem;
  }

  .overlay-play {
    min-width: 68px;
    min-height: 68px;
    font-size: 1.6rem;
  }

  .player-bottom-bar {
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .player-bottom-row {
    gap: 8px;
  }

  .player-bottom-left {
    gap: 6px;
  }

  .time-label {
    order: 1;
    width: 100%;
  }

  .volume-control {
    display: none;
  }

  .detail-panel {
    padding: 0;
  }

  .detail-card {
    width: 100%;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }

  .detail-header {
    padding-right: 34px;
  }
}

@media (min-width: 1800px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .rail {
    width: 280px;
    padding: 26px 18px;
  }

  .workspace {
    padding: 40px;
  }

  .content-layout {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
  }

  .mode-iptv .content-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .category-panel {
    padding: 18px;
  }

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

  .media-card {
    min-height: 246px;
  }

  .poster {
    min-height: 168px;
  }

  .hero {
    min-height: 56vh;
  }

  .player-top-bar {
    padding: 20px 24px;
  }

  .player-bottom-bar {
    padding: 0 24px 24px;
  }
}


@media (min-width: 1600px) {
  .workspace {
    padding: 34px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}
