:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --border: #2d3a4f;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.top {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.top h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

code {
  background: #0d1117;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.panel {
  margin: 1rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 1700px;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  display: block;
  width: 100%;
  max-width: 640px;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0d1117;
  color: var(--text);
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: #334155;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
}

.status.err {
  color: var(--danger);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

pre.photo-debug {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  max-height: 220px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.35;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 640px;
  font-size: 0.85rem;
  color: var(--text);
}

label.check input {
  margin-top: 0.2rem;
}

details.help {
  margin: 0.75rem 0 0;
  max-width: 720px;
  font-size: 0.85rem;
  color: var(--muted);
}

details.help summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

details.help ol {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

details.help p {
  margin: 0.5rem 0 0;
}

.mosaic {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.card.dragging {
  opacity: 0.55;
}

.card.drop-target {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.8) inset;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
}

.card-head:active {
  cursor: grabbing;
}

.card-head strong {
  font-weight: 600;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.online {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.badge.offline {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.badge.unknown {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

/* Preview FTP detrás del <video> (sin poster en el video = sin play central al estar parado). */
.video-wrap .channel-poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  background: #000;
}

.video-wrap .channel-video-el {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  vertical-align: middle;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.video-wrap.video-wrap--playing .channel-video-el {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  pointer-events: auto;
}

/* Con controles nativos: quitar solo el play superpuesto; barra (pantalla completa, etc.) se mantiene. */
.video-wrap.video-wrap--playing .channel-video-el::-webkit-media-controls-overlay-enclosure {
  display: none !important;
}

.video-wrap.video-wrap--playing .channel-video-el::-webkit-media-controls-start-playback-button {
  display: none !important;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  flex-wrap: wrap;
}

.card-actions button {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.channels {
  padding: 0 0.65rem 0.65rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.channel-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
}

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

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

.channel-row .label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.foot {
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}
