:root {
    --primary: #6d6ff8;
    --primary-hover: #5759e0;
    --primary-inverse: #ffffff;
  
    /* Colores de tema oscuro */
    --bg-dark: #0e0e0e;
    --card-dark: #1b1b1b;
    --border-dark: #2a2a2a;
    --text-light: #f5f5f5;
    --muted-text: #aaa;
  }
  
  /* ---------- GENERAL ---------- */
  
  html, body {
    min-height: 100%;
  }
  
  body {
    font-family: system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    width: 100%;
  }
  
  /* ---------- BARRA SUPERIOR ---------- */
  
  #topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #111;
    border-bottom: 1px solid #222;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  /* Título a la izquierda */
  #topbar h1 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.35rem;        /* 🔹 más grande */
    font-weight: 600;          /* más presencia */
    color: var(--primary);
    margin: 0;
    white-space: nowrap;
  }
  
  #topbar h1 .icon {
    width: 1.4em;              /* tamaño relativo al texto */
    height: 1.4em;
    stroke: var(--primary);    /* color igual al texto */
    flex-shrink: 0;
  }

  /* Buscador centrado y flexible */
/* ---------- BUSCADOR (estilo minimal + alineado) ---------- */

#searchbar {
    flex: 1;
    display: flex;
    align-items: center;   /* ✅ alinea verticalmente con el título y el contador */
    justify-content: center;
  }
  
  #searchbar input[type="search"] {
    width: 100%;
    max-width: 420px;
    font-size: 0.95rem;
    padding: 0.45rem 0.9rem;    /* menos alto */
    border-radius: 0.4rem;      /* esquinas suaves, no redondas */
    border: 1px solid var(--border-dark);
    background: #151515;        /* tono más plano */
    color: var(--text-light);
    line-height: 1;             /* corrige la alineación visual */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
  }
  
  #searchbar input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(109,111,248,0.25);
  }
  
  #searchbar input[type="search"]::placeholder {
    color: var(--muted-text);
    opacity: 0.8;
  }
  
  
  /* Contador a la derecha */
  #count {
    font-size: 0.85rem;
    color: var(--muted-text);
    white-space: nowrap;
  }
  
/* Responsive: reorganiza el header en móviles */
@media (max-width: 600px) {
    #topbar {
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 0.6rem;
      padding: 1rem 0.5rem;
    }
  
    #topbar h1 {
      font-size: 1.2rem;
      margin-bottom: 0.2rem;
    }
  
    #searchbar {
      order: 2;
      width: 100%;
      display: flex;
      justify-content: center;
    }
  
    #searchbar input[type="search"] {
      width: 90%;
      max-width: none;
    }
  
    #count {
      order: 3;
      margin-top: 0.3rem;
      text-align: center;
    }
  }
  
  /* ---------- GRID DE VIDEOS ---------- */
  
  #grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.25rem;
    width: 100%;
    margin: 0;
    padding: 0.25rem;
  }
  
  .card {
    border: none;
    border-radius: .4rem;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .2s ease, box-shadow .2s ease;
  }
  
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
  }
  
  /* Video full-width dentro del card */
  .video-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    cursor: pointer;
    display: block;
    margin: 0;
    padding: 0;
  }
  
  .video-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
    margin: 0;
    padding: 0;
  }
  
  /* Icono play */
  .video-wrapper::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.8rem;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }
  
  /* Duración del video */
  .video-wrapper .duration {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
  }
  
  /* Título debajo del video */
  h3 {
    font-size: 0.82rem;
    font-weight: 400;
    text-align: left;
    margin: 0.25rem 0.3rem 0.6rem;
    color: var(--muted-text);
    line-height: 1.35;
  }

  .folder {
    font-size: 0.7rem;         /* 🔹 más pequeño que el h3 */
    color: var(--muted-text);  /* gris suave */
    margin: -0.3rem 0 0.7rem 0.3rem;
    opacity: 0.75;             /* un poco más apagado */
    text-align: left;
    letter-spacing: 0.2px;
    display: block;
  }
  
  /* ---------- OVERLAY ---------- */
  
  #overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    z-index: 999;
  }
  
  #overlay.active {
    display: flex;
  }
  
  #overlay iframe {
    width: 95vw;
    height: 53.4vw; /* 16:9 ratio */
    max-width: 1280px;
    max-height: 720px;
    border: 0;
    border-radius: .75rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
  }
  
  @media (max-width: 600px) {
    #overlay iframe {
      width: 100vw;
      height: 56.25vw;
      border-radius: 0;
      box-shadow: none;
    }
  }
  
  #overlay .close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
    background: none;
    border: none;
  }
  