/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d1117;
    --surface:   #161b22;
    --surface2:  #1e242d;
    --border:    #30363d;
    --text:      #e6edf3;
    --text-muted:#8b949e;
    --accent:    #ff0055;
    --accent2:   #ff6600;
    --radius:    10px;
    --search-h:  56px;
}

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

/* ── Layout principal: dos columnas (como el YGO viejo) ───────────────── */
.app {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: row;
    padding: 20px;
    gap: 20px;
}

/* Columna izquierda: el video (tarjeta 16/9) arriba y, en modo web, los
   controles de reproducción justo debajo. */
.player-col {
    flex: 0 0 60%;
    width: 60%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

/* ── Controles de reproducción ─────────────────────────────────────────── */
/* Web: fila centrada debajo del video. El tirador (handle) solo existe en móvil. */
.player-controls { width: 100%; }
.pc-handle { display: none; }
.pc-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 0 4px;
}
.pc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    opacity: .78;
    transition: opacity .15s, transform .1s, background .15s;
}
.pc-btn:hover  { opacity: 1; background: rgba(255,255,255,.07); }
.pc-btn:active { transform: scale(.9); }
.pc-btn svg    { width: 26px; height: 26px; }
/* Play/pausa al centro, más grande */
.pc-play       { width: 58px; height: 58px; opacity: 1; }
.pc-play svg   { width: 38px; height: 38px; }

/* Contenedor del video = tarjeta 16/9 con esquinas redondeadas y sombra
   (equivale a .video-container del YGO viejo). */
.player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Dos capas wrapper superpuestas para el crossfade. El iframe de YouTube
   vive DENTRO de cada wrapper; así las clases CSS nunca se pierden cuando
   YT.Player reemplaza el div interno por un iframe. */
/* La capa inactiva va con display:none (igual que #live-video-b del YGO viejo).
   Dos iframes de YouTube visibles a la vez hacen que el navegador bloquee el
   autoplay. Durante el crossfade el JS la muestra temporalmente. */
.yt-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    z-index: 0;
    display: none;
    /* transition se inyecta por JS solo durante crossfade */
}
.yt-layer.active,
.yt-layer.fading {
    display: block;
}
.yt-layer.active {
    opacity: 1;
    z-index: 1;
}
.yt-layer > div,
.yt-layer iframe {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
    display: block;
    border: none;
}

.player-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
}

/* Ocultar placeholder cuando hay video */
.player-empty.hidden { display: none; }

/* Columna derecha: sidebar */
.sidebar-col {
    flex: 1 1 40%;
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
}

/* ── Barra de búsqueda ────────────────────────────────── */
.search-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    height: var(--search-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;   /* el dropdown de sugerencias queda sobre el panel */
}
.queue-list { display: flex; flex-direction: column; gap: 4px; }

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 36px 8px 38px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}

.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-input-wrap input:focus        { border-color: var(--accent); }

/* Sugerencias de búsquedas recientes (dropdown bajo la barra) */
.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    overflow: hidden;
    max-height: 330px;
    overflow-y: auto;
}
.ss-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.ss-clear-all { background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; }
.ss-clear-all:hover { color: var(--accent); }
.ss-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
}
.ss-item:hover { background: rgba(255, 255, 255, .06); }
.ss-item .ss-ico { color: var(--text-muted); display: flex; flex-shrink: 0; }
.ss-item .ss-ico svg { width: 16px; height: 16px; }
.ss-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}
.ss-remove:hover { color: var(--text); background: rgba(255,255,255,.08); }
.ss-remove svg { width: 13px; height: 13px; }

/* Lupa DENTRO del input, sin color de acento */
.search-icon-btn {
    position: absolute;
    left: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.search-icon-btn:hover { color: var(--text); background: var(--border); }

.btn-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
}
.btn-clear:hover { color: var(--text); }

/* Botones de la barra (carpetas / settings) */
.btn-folders,
.btn-settings {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-folders:hover,
.btn-settings:hover {
    color: var(--text);
    border-color: var(--text-muted);
}
.btn-folders.active,
.btn-settings.active {
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Paneles ──────────────────────────────────────────── */
.panel {
    display: none !important;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.panel.active {
    display: flex !important;
}

/* ── Info resultados + spinner ────────────────────────── */
.results-info {
    flex-shrink: 0;
    padding: 8px 12px 4px;
    color: var(--text-muted);
    font-size: 12px;
}
/* Botón para forzar una búsqueda nueva cuando se muestran resultados guardados */
.refresh-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}
.refresh-btn:hover { filter: brightness(1.15); }
.refreshing { opacity: .75; font-style: italic; }

.loading {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* ── Grid de videos ───────────────────────────────────── */
/* Columnas configurables desde Settings (JS fija --cols según el dispositivo). */
.video-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
    gap: 8px;
    padding: 8px 12px 12px;
}

.video-card {
    background: var(--surface2);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color .15s, transform .1s;
}

.video-card:hover         { border-color: var(--border); transform: translateY(-1px); }
.video-card.playing       { border-color: var(--accent); }
.video-card.unavailable   { opacity: .4; }
.video-card.unavailable::after { content: '⚠ No disponible'; display: block; font-size: 10px; color: var(--accent); padding: 2px 8px 6px; }

.thumb-wrap { position: relative; }

.video-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: #000;
}

/* ── Iconos de esquina sobre la miniatura (feed de búsqueda) ──────────── */
.vicon {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(13, 17, 23, .78);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.vicon:hover   { background: var(--accent); transform: scale(1.08); }
.vicon:active  { transform: scale(.94); }
.vicon svg     { width: 14px; height: 14px; }

.vicon-tl { top: 5px;    left: 5px; }
.vicon-tr { top: 5px;    right: 5px; }
.vicon-bl { bottom: 5px; left: 5px; }
.vicon-br { bottom: 5px; right: 5px; }

/* Feedback breve al poner en cola / guardar */
.vicon.flash { background: #2ea043; }

/* ── Botón eliminar (tabs Recientes / Guardados) ──────────────────────── */
.vicon-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(13, 17, 23, .78);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.vicon-delete:hover { background: var(--accent); transform: scale(1.08); }
.vicon-delete svg   { width: 14px; height: 14px; }

.video-info   { padding: 6px 8px 8px; }

.video-title {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 3px;
}

.video-channel {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-badge {
    display: inline-block;
    background: red;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-bottom: 3px;
    letter-spacing: .5px;
}

/* ── Placeholders de paneles ──────────────────────────── */
.panel-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px;
    text-align: center;
}

/* ── Settings: lista de opciones ──────────────────────── */
.settings-list {
    padding: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
}

.settings-row-text { flex: 1; min-width: 0; }

.settings-row-title {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
}

.settings-row-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Toggle switch */
.switch {
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 24px;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform .2s, background .2s;
}

.switch input:checked + .switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* Selector de columnas del feed */
.cols-options {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 60%;
}

.cols-btn {
    width: 32px;
    height: 32px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.cols-btn:hover  { color: var(--text); border-color: var(--text-muted); }
.cols-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Botón Google Sign-In (solo visual, sin lógica aún) ── */
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow .15s, background .15s;
}
.google-signin-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* ── Sub-tabs (panel Mis Videos: Recientes / Guardados) ───────────────── */
.subtabs {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    padding: 10px 12px 0;
}

.subtab {
    flex: 1;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 12.5px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.subtab:hover  { color: var(--text); }
.subtab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.subtab-content { display: none; }
.subtab-content.active { display: grid; }
/* El panel de Playlists no es un grid de videos: apila lista + crear, o la
   vista de una playlist (header + grid interno de videos). */
.subtab-content.pl-panel.active { display: block; padding: 8px 12px 12px; }

/* ── Iconos de borrar en tarjetas (reusa .vicon, hover rojo) ──────────── */
.vicon.danger:hover { background: var(--accent); border-color: var(--accent); }

/* ── Panel de Playlists: lista ────────────────────────────────────────── */
.pl-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pl-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px;
    background: var(--surface2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s;
}
.pl-row:hover { border-color: var(--border); }
.pl-row-thumb {
    width: 72px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}
.pl-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-row-info { min-width: 0; }
.pl-row-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row-count { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Vista de una playlist: cabecera con volver + nombre + eliminar */
.pl-view-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.pl-view-name { flex: 1; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-back, .pl-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.pl-back svg { width: 20px; height: 20px; }
.pl-delete svg { width: 16px; height: 16px; }
.pl-delete:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Crear nueva playlist (input inline) — en el panel y en el modal de guardar */
.sp-create { display: flex; gap: 8px; }
.sp-create input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.sp-create input:focus { border-color: var(--accent); }
.sp-create-btn {
    padding: 9px 16px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Modal: Guardar en playlist ──────────────────────── */
.sp-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.sp-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: var(--surface2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
}
.sp-item:hover { border-color: var(--border); }
.sp-item.last { border-color: var(--accent); }
.sp-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-meta { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px 16px;
}

/* ── Modal: Cola de reproducción ───────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(480px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }

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

.modal-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
}
.modal-clear-btn:hover { color: var(--accent); }

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    padding: 4px;
}
.modal-close-btn:hover { color: var(--text); }

.modal-body {
    overflow-y: auto;
    padding: 8px;
}

.queue-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px 16px;
}

/* ── Pantalla de inicio (solo si el navegador bloquea el audio) ────────── */
.start-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 11, 15, .72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.start-overlay.active { display: flex; }
.start-box {
    text-align: center;
    max-width: 340px;
}
.start-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    animation: startPulse 1.9s ease-in-out infinite;
}
.start-icon svg { width: 40px; height: 40px; margin-left: 4px; }
@keyframes startPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}
.start-box h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.start-box p  { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; }
.start-btn {
    padding: 12px 26px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s, filter .15s;
}
.start-btn:hover  { filter: brightness(1.08); }
.start-btn:active { transform: scale(.96); }

/* Enlace secundario + instrucciones para permitirlo siempre */
.start-link {
    display: block;
    margin: 12px auto 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}
.start-link:hover { color: var(--text); }
.howto {
    display: none;
    margin-top: 18px;
    padding: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
}
.howto.open { display: block; }
.howto-step { font-size: 12.5px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.6; }
.howto-step b { color: var(--text); }
/* Icono dentro del texto (candado, compartir) */
.howto-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0 2px;
    vertical-align: -6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}
.howto-inline svg { width: 13px; height: 13px; }
.howto-foot {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.howto-foot b { color: var(--text); }
/* Botones de acción */
.howto-actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.howto-open, .howto-copy {
    padding: 9px 15px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
}
.howto-open { background: var(--accent); color: #fff; border-color: var(--accent); }
.howto-open:hover { filter: brightness(1.08); }
.howto-copy { background: var(--surface); color: var(--text); }
.howto-copy:hover { border-color: var(--text-muted); }

/* La dirección solo se muestra si hace falta pegarla a mano */
.howto-note { display: none; font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }
.howto-note.show { display: block; }
.howto-url { display: none; margin-bottom: 12px; }
.howto-url.show { display: block; }
.howto-url code {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 11.5px;
    color: var(--text);
}

/* Recreación de la fila que el usuario verá en los ajustes del navegador */
.howto-demo {
    background: #1b1f24;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}
.demo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
}
.demo-ico { color: #c7ccd4; display: flex; flex-shrink: 0; }
.demo-ico svg { width: 17px; height: 17px; }
.demo-label { flex: 1; font-size: 13px; color: #e6e9ee; }
.demo-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid #5b6472;
    border-radius: 6px;
    font-size: 12px;
    color: #c7ccd4;
    white-space: nowrap;
}
.demo-select i { display: flex; }
.demo-select i svg { width: 13px; height: 13px; }
.demo-select.ok {
    border-color: var(--accent);
    color: #fff;
    background: rgba(255, 0, 85, .12);
    font-weight: 600;
}
.demo-arrow {
    display: flex;
    justify-content: center;
    color: var(--accent);
    opacity: .85;
}
.demo-arrow svg { width: 20px; height: 20px; }

/* ── Migración de datos ────────────────────────────────── */
.danger-btn {
    padding: 9px 16px;
    border-radius: var(--radius);
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.danger-btn:hover { background: var(--accent); color: #fff; }

.mig-intro { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 12px; }
.mig-intro b { color: var(--text); }
.mig-groups { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mig-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}
.mig-check input { accent-color: var(--accent); cursor: pointer; }
.mig-check:has(input:checked) { border-color: var(--accent); }
.mig-main { width: 100%; }
.mig-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.mig-sep::before, .mig-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.mig-msg { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; min-height: 18px; }
.mig-msg.err { color: var(--accent); }
.mig-msg.ok  { color: #3fb950; }
.mig-token {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: .08em;
    text-align: center;
    color: var(--text);
    background: var(--surface2);
    border: 1px dashed var(--accent);
    border-radius: var(--radius);
    padding: 16px 10px;
    margin-bottom: 12px;
    user-select: all;
    overflow-x: auto;
    white-space: nowrap;
}
.mig-count { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.mig-count.err { color: var(--accent); }
.mig-foot { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; margin: 14px 0 0; text-align: center; }

/* ── Modal de confirmación ─────────────────────────────── */
.confirm-box { width: min(360px, 90vw); padding: 22px; }
.confirm-msg { font-size: 15px; color: var(--text); line-height: 1.5; margin-bottom: 18px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-cancel, .confirm-ok {
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
}
.confirm-cancel { background: var(--surface2); color: var(--text); }
.confirm-cancel:hover { border-color: var(--text-muted); }
.confirm-ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.confirm-ok:hover { filter: brightness(1.08); }

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    transition: background .15s;
}
.queue-item:hover { background: var(--surface2); }

/* Controles por item (play, poner primero, subir, bajar, quitar) */
.queue-ctls { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.q-ctl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s, background .15s;
}
.q-ctl svg { width: 18px; height: 18px; }
.q-ctl:hover { color: var(--text); background: rgba(255,255,255,.08); }
.q-ctl.q-remove:hover { color: var(--accent); }
.q-ctl:disabled { opacity: .2; cursor: default; pointer-events: none; }

.queue-item img {
    width: 72px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #000;
}

.queue-item-title {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.queue-item-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    padding: 4px;
}
.queue-item-remove:hover { color: var(--accent); }

/* ── Modal: Detalle de video ──────────────────────────── */
.detail-modal {
    position: relative;
    width: min(420px, 92vw);
    max-height: 90vh;
    padding: 0;
}
.detail-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(13,17,23,.7);
    border-radius: 50%;
    width: 32px;
    height: 32px;
}
.detail-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
    background: #000;
}
.detail-body {
    padding: 14px 16px 8px;
}
.detail-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 4px;
}
.detail-channel {
    font-size: 13px;
    color: var(--text-muted);
}
.detail-actions {
    display: flex;
    gap: 6px;
    padding: 8px 16px 16px;
}
.detail-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 4px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.detail-btn svg { width: 20px; height: 20px; }
.detail-btn:hover { color: var(--text); border-color: var(--text-muted); }
.detail-btn:active { transform: scale(.95); }
.detail-btn.accent { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ── EQ indicator (card en reproducción) — grande y al centro ──────────── */
.eq-bars {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    gap: 6px;
    align-items: center;
    height: 50%;
    z-index: 2;
    pointer-events: none;
    padding: 12px 14px;
    background: rgba(13, 17, 23, .45);
    border-radius: 14px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.video-card.playing .eq-bars { display: flex; }
.eq-bars span {
    display: block;
    width: 7px;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transform-origin: center;
}
/* scaleY en vez de animar height: corre en GPU y no fuerza reflow. */
.eq-bars span:nth-child(1) { animation: eq .55s ease-in-out infinite alternate; }
.eq-bars span:nth-child(2) { animation: eq .55s ease-in-out .18s infinite alternate; }
.eq-bars span:nth-child(3) { animation: eq .55s ease-in-out .36s infinite alternate; }
.eq-bars span:nth-child(4) { animation: eq .55s ease-in-out .12s infinite alternate; }
@keyframes eq {
    0%   { transform: scaleY(.25); }
    100% { transform: scaleY(1); }
}

/* ── FAB "Ir al video actual" ────────────────────────── */
.fab-now-playing {
    display: none;
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 60;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    transition: transform .15s;
}
.fab-now-playing:active { transform: scale(.9); }
.fab-now-playing svg { width: 22px; height: 22px; }

/* ── Scrollbar ────────────────────────────────────────── */
.panel::-webkit-scrollbar,
.modal-body::-webkit-scrollbar        { width: 4px; }
.panel::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track  { background: transparent; }
.panel::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 2px; }

/* ── Responsive móvil ─────────────────────────────────── */
@media (max-width: 768px) {
    .app { flex-direction: column; padding: 4px; gap: 4px; }

    /* Player arriba; la tarjeta 16/9 va en .player-wrap (no se encoge). */
    .player-col {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
    }
    .player-wrap { border-radius: 12px; }

    /* Sidebar ocupa el resto. min-height:0 es CLAVE: sin eso un hijo flex no
       puede ser más chico que su contenido y el panel nunca llega a scrollear
       (el .app es position:fixed y el body tiene overflow:hidden). */
    .sidebar-col {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: hidden;
        border-radius: 12px;
    }

    /* El panel es el que scrollea (igual que en escritorio). */
    .panel {
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Controles: barra desplegable fija al fondo de la pantalla. */
    .player-controls {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 55;
        width: auto;
        background: var(--surface);
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -6px 22px rgba(0, 0, 0, .4);
        transition: transform .25s ease;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .pc-handle {
        display: block;
        width: 46px;
        height: 5px;
        margin: 9px auto 3px;
        padding: 0;
        border: none;
        border-radius: 3px;
        background: var(--text-muted);
        opacity: .55;
        cursor: pointer;
    }
    /* Colapsada: baja la barra dejando asomar solo el tirador. */
    .player-controls.collapsed { transform: translateY(calc(100% - 24px)); }
    .pc-row { padding: 4px 0 12px; gap: 14px; }

    /* Que el final del panel no quede bajo la barra colapsada. */
    .panel { padding-bottom: 30px; }
}
