/* ─────────────────────────────────────────────────────────────
   REEL — estilos
   ───────────────────────────────────────────────────────────── */
:root {
  --bg:       #07090d;
  --bg-2:     #0c0f15;
  --card:     #11151d;
  --card-2:   #161b25;
  --border:   #1d2330;
  --border-2: #2a3242;
  --accent:   #e8ff47;
  --accent-d: #c4d93a;
  --accent-a: rgba(232,255,71,.12);
  --hot:      #ff6b35;
  --danger:   #ff4d5e;
  --text:     #e3e7f1;
  --text-2:   #a3abbe;
  --muted:    #5c667d;
  --radius:   12px;
  --ease:     cubic-bezier(.2,.8,.2,1);
  --mono:     'DM Mono', ui-monospace, monospace;
  --display:  'Bebas Neue', Impact, sans-serif;
  --top-h:    68px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {          /* grano de película */
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 180px;
}
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
kbd {
  font-family: var(--mono); font-size: .68rem;
  background: var(--card-2); border: 1px solid var(--border-2); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; color: var(--text); margin: 0 1px;
}
code { font-family: var(--mono); color: var(--accent); }
.muted { color: var(--muted); }
::selection { background: var(--accent); color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* Brillo de ambiente de la página: toma el color del vídeo que suena */
.ambient-page {
  position: fixed; inset: -20% -10% auto; height: 80vh; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 60% at 40% 30%, var(--amb, transparent), transparent 70%);
  opacity: .35; transition: background 1.2s linear, opacity .8s;
}

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--border);
  font-size: .85rem; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, color .15s;
}
.btn:hover { background: #1c2230; border-color: var(--border-2); }
.btn:active { transform: scale(.97); }
.btn.accent { background: var(--accent); color: #0a0c10; border-color: var(--accent); font-weight: 700; }
.btn.accent:hover { background: #f1ff7a; }
.btn.ghost { background: transparent; }
.btn.danger:hover { color: var(--danger); border-color: rgba(255,77,94,.4); background: rgba(255,77,94,.08); }
.btn.on { color: var(--accent); border-color: rgba(232,255,71,.35); background: var(--accent-a); }
.btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--card-2); color: var(--text); }

/* ── Cabecera ── */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--top-h);
  display: flex; align-items: center; gap: 24px; padding: 0 32px;
  background: rgba(7,9,13,.78); backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-family: var(--display); font-size: 2rem; letter-spacing: .12em; line-height: 1;
  color: var(--accent); text-decoration: none; white-space: nowrap;
}
.logo span { color: var(--text); opacity: .3; margin-left: 8px; font-size: 1.1rem; letter-spacing: .14em; }
.search {
  flex: 1; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: rgba(232,255,71,.5); box-shadow: 0 0 0 4px rgba(232,255,71,.08); }
.search svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: 0; font-size: .9rem; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.4); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.stats { display: flex; gap: 18px; font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-right: 8px; white-space: nowrap; }
.stats b { color: var(--text); font-weight: 500; }
.forge-pill {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 20px; background: var(--accent-a); color: var(--accent);
  font-family: var(--mono); font-size: .68rem; white-space: nowrap;
}
.forge-spin {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.view { position: relative; z-index: 1; }

/* ═════════════ BIBLIOTECA ═════════════ */
#library { padding: 28px 32px 80px; max-width: 1800px; margin: 0 auto; }

.hero {
  position: relative; overflow: hidden; border-radius: 20px;
  min-height: 340px; display: flex; align-items: flex-end;
  border: 1px solid var(--border); margin-bottom: 28px;
  background: var(--card); isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center;
  animation: kenburns 24s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1.04); } to { transform: scale(1.14) translate(-1.5%, -1%); } }
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(7,9,13,.96) 0%, rgba(7,9,13,.75) 38%, rgba(7,9,13,.1) 75%),
              linear-gradient(0deg, rgba(7,9,13,.85), transparent 55%);
}
.hero-body { padding: 36px 40px; max-width: 640px; min-width: 0; width: 100%; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
}
.hero-kicker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .2; } }
.hero h2 { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 4.2vw, 3.6rem); letter-spacing: .04em; line-height: 1; margin: 12px 0 10px; color: #fff; }
.hero-meta { color: var(--text-2); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.hero-prog { margin: 20px 0 22px; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: .72rem; color: var(--text-2); }
.hero-prog .bar { flex: 1; max-width: 280px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.15); overflow: hidden; }
.hero-prog .bar i { display: block; height: 100%; background: var(--accent); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { height: 44px; padding: 0 20px; font-size: .92rem; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-2); font-size: .82rem;
  transition: all .15s;
}
.chip svg { width: 14px; height: 14px; }
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.on { background: var(--text); color: #0a0c10; border-color: var(--text); font-weight: 500; }
.chip .n { font-family: var(--mono); font-size: .68rem; opacity: .6; }
.toolbar-right { display: flex; gap: 10px; align-items: center; }
.select {
  height: 34px; padding: 0 30px 0 12px; border-radius: 10px; appearance: none; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c667d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center / 18px;
  border: 1px solid var(--border); font-size: .82rem; outline: 0;
}
.select:focus { border-color: var(--border-2); }
.seg { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { width: 30px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--card-2); color: var(--text); }

.group { margin-bottom: 34px; }
.group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.group-head h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; letter-spacing: .08em; }
.group-head span { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.group-head::after { content: ''; flex: 1; height: 1px; background: var(--border); transform: translateY(-6px); }

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

.card { display: block; text-decoration: none; color: inherit; outline: 0; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden;
  background: var(--card-2) linear-gradient(110deg, transparent 30%, rgba(255,255,255,.04) 50%, transparent 70%) 0 0 / 200% 100%;
  border: 1px solid var(--border);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .2s;
}
.thumb.loading { animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.card:hover .thumb, .card:focus-visible .thumb {
  transform: translateY(-3px); border-color: var(--border-2);
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.8), 0 0 0 1px rgba(232,255,71,.15);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .3s; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.thumb .ph svg { width: 32px; height: 32px; opacity: .4; }
.scrub {
  position: absolute; inset: 0; opacity: 0; background-repeat: no-repeat;
  transition: opacity .15s; image-rendering: auto;
}
.card.scrubbing .scrub { opacity: 1; }
.scrub-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; opacity: 0; background: rgba(255,255,255,.2); }
.scrub-bar i { display: block; height: 100%; width: 0; background: #fff; }
.card.scrubbing .scrub-bar { opacity: 1; }
.card.scrubbing .prog { opacity: 0; }
.dur, .badge {
  position: absolute; font-family: var(--mono); font-size: .68rem; font-weight: 500;
  padding: 3px 7px; border-radius: 6px; backdrop-filter: blur(6px);
}
.dur { right: 8px; bottom: 8px; background: rgba(0,0,0,.78); color: #fff; }
.badge { left: 8px; top: 8px; background: var(--accent); color: #0a0c10; letter-spacing: .1em; }
.badge.watched { background: rgba(0,0,0,.7); color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.badge.watched svg { width: 12px; height: 12px; color: var(--accent); }
.fav-btn {
  position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transform: scale(.85); transition: all .2s var(--ease);
}
.fav-btn svg { width: 16px; height: 16px; }
.card:hover .fav-btn, .fav-btn.on { opacity: 1; transform: none; }
.fav-btn.on { color: var(--accent); }
.fav-btn:hover { background: rgba(0,0,0,.8); }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); transition: opacity .15s; }
.prog i { display: block; height: 100%; background: var(--hot); }
.card-body { padding: 12px 2px 0; }
.card-title { font-size: .93rem; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card:hover .card-title { color: #fff; }
.card-meta { margin-top: 5px; font-family: var(--mono); font-size: .68rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card-meta .mk { color: var(--accent-d); display: inline-flex; align-items: center; gap: 3px; }
.card-meta .mk svg { width: 11px; height: 11px; }
mark { background: rgba(232,255,71,.25); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Lista */
#grid.list .cards { grid-template-columns: 1fr; gap: 6px; }
#grid.list .card { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: center; padding: 8px; border-radius: 14px; transition: background .15s; }
#grid.list .card:hover { background: var(--card); }
#grid.list .card:hover .thumb { transform: none; box-shadow: none; }
#grid.list .card-body { padding: 0; }
#grid.list .card-title { font-size: 1rem; }

.empty {
  border: 1.5px dashed var(--border-2); border-radius: 20px; padding: 70px 20px;
  text-align: center; color: var(--text-2);
}
.empty svg { width: 46px; height: 46px; color: var(--accent); margin-bottom: 12px; }
.empty h3 { font-family: var(--display); font-weight: 400; font-size: 2rem; letter-spacing: .06em; color: var(--text); }
.empty p { margin: 6px 0 18px; }

/* ═════════════ REPRODUCTOR ═════════════ */
#watch {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px;
  padding: 18px 32px 60px; max-width: 1900px; margin: 0 auto;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 6px; margin-bottom: 12px;
  border-radius: 8px; color: var(--text-2); font-size: .82rem;
}
.back-link:hover { background: var(--card); color: var(--text); }

.stage { position: relative; }
.ambient {
  position: absolute; inset: 4% 2%; width: 96%; height: 92%; z-index: 0; pointer-events: none;
  filter: blur(60px) saturate(1.8); transform: scale(1.12); opacity: .55; transition: opacity 1s;
}
body.no-ambient .ambient { opacity: 0; }

.player {
  position: relative; z-index: 1; background: #000; border-radius: 16px; overflow: hidden; outline: 0;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.06);
  aspect-ratio: 16 / 9; user-select: none;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player.hide-ui { cursor: none; }
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }

.p-zone { position: absolute; top: 0; bottom: 70px; width: 22%; z-index: 1; }
.p-zone.left { left: 0; } .p-zone.right { right: 0; }

.p-bigplay {
  position: absolute; left: 50%; top: 50%; z-index: 3; width: 86px; height: 86px; border-radius: 50%;
  translate: -50% -50%; display: grid; place-items: center;
  background: rgba(232,255,71,.92); color: #0a0c10; box-shadow: 0 0 0 10px rgba(232,255,71,.15), 0 20px 50px rgba(0,0,0,.6);
  transition: transform .2s var(--ease), opacity .2s;
}
.p-bigplay svg { width: 38px; height: 38px; margin-left: 5px; }
.p-bigplay:hover { transform: scale(1.07); }
.player:not(.fresh) .p-bigplay { opacity: 0; pointer-events: none; transform: scale(.8); }

.p-flash {
  position: absolute; left: 50%; top: 50%; z-index: 3; translate: -50% -50%;
  min-width: 72px; height: 72px; padding: 0 18px; border-radius: 40px; display: grid; place-items: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(8px); color: #fff; pointer-events: none;
  font-family: var(--mono); font-weight: 500; font-size: .95rem; opacity: 0;
}
.p-flash svg { width: 32px; height: 32px; }
.p-flash.go { animation: flash .6s var(--ease); }
.p-flash.left { left: 18%; } .p-flash.right { left: 82%; }
@keyframes flash { 0% { opacity: 0; transform: scale(.7); } 20% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }

.p-spinner {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--accent);
  animation: spin .8s linear infinite; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.player.waiting .p-spinner { opacity: 1; transition-delay: .3s; }

.p-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 50px 14px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.55) 40%, rgba(0,0,0,.9));
  transition: opacity .25s, transform .25s var(--ease);
}
.player.hide-ui .p-controls { opacity: 0; transform: translateY(8px); pointer-events: none; }

.p-timeline { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.p-track { position: relative; width: 100%; height: 4px; background: rgba(255,255,255,.18); border-radius: 4px; transition: height .15s var(--ease); }
.p-timeline:hover .p-track, .p-timeline.drag .p-track { height: 7px; }
.p-buffer, .p-hover, .p-fill, .p-loop { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; pointer-events: none; }
.p-buffer { background: rgba(255,255,255,.22); }
.p-hover { background: rgba(255,255,255,.3); width: 0; opacity: 0; }
.p-timeline:hover .p-hover { opacity: 1; }
.p-fill { background: var(--accent); width: 0; }
.p-loop { background: rgba(255,107,53,.55); outline: 2px solid var(--hot); outline-offset: 1px; }
.p-markers { position: absolute; inset: -3px 0; pointer-events: none; }
.p-markers i {
  position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.7);
}
.p-knob {
  position: absolute; left: 0; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(232,255,71,.25); transform: scale(0); transition: transform .15s var(--ease);
  pointer-events: none;
}
.p-timeline:hover .p-knob, .p-timeline.drag .p-knob { transform: scale(1); }

.p-preview {
  position: absolute; bottom: 26px; left: 0; translate: -50% 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0; transition: opacity .12s; pointer-events: none;
}
.p-timeline:hover .p-preview, .p-timeline.drag .p-preview { opacity: 1; }
.p-preview-img {
  width: 208px; aspect-ratio: 16/9; border-radius: 10px; background: #000 no-repeat;
  border: 2px solid rgba(255,255,255,.9); box-shadow: 0 12px 30px rgba(0,0,0,.7);
}
.p-preview-img:not(.has) { display: none; }
.p-preview span { font-family: var(--mono); font-size: .78rem; background: rgba(0,0,0,.8); padding: 3px 8px; border-radius: 6px; }
.p-preview em { font-style: normal; font-size: .76rem; font-weight: 500; color: #0a0c10; background: var(--accent); padding: 2px 8px; border-radius: 6px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-preview em:empty { display: none; }

.p-row { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.p-btn {
  position: relative; height: 38px; min-width: 38px; padding: 0 8px; border-radius: 9px;
  display: grid; place-items: center; color: rgba(255,255,255,.88); transition: background .15s, color .15s, transform .1s;
}
.p-btn svg { width: 22px; height: 22px; }
.p-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.p-btn:active { transform: scale(.92); }
.p-btn.on { color: var(--accent); }
.p-btn:disabled { opacity: .3; pointer-events: none; }
.p-badge { position: absolute; right: 2px; top: 3px; font-style: normal; font-family: var(--mono); font-size: .58rem; font-weight: 500; color: #0a0c10; background: var(--hot); border-radius: 4px; padding: 0 3px; }
.p-badge:empty { display: none; }
.p-vol { display: flex; align-items: center; }
.p-vol input { width: 0; opacity: 0; transition: width .25s var(--ease), opacity .2s, margin .25s; }
.p-vol:hover input, .p-vol:focus-within input { width: 80px; opacity: 1; margin: 0 8px 0 2px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; outline: 0; cursor: pointer;
  background: linear-gradient(90deg, #fff var(--v, 100%), rgba(255,255,255,.25) var(--v, 100%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.p-time { font-family: var(--mono); font-size: .78rem; color: rgba(255,255,255,.65); margin-left: 6px; white-space: nowrap; }
.p-time b { color: #fff; font-weight: 500; }
.p-chapter { margin-left: 12px; font-size: .8rem; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.p-chapter:not(:empty)::before { content: '•'; margin-right: 10px; color: rgba(255,255,255,.4); }
.p-spacer { flex: 1; }
.p-speed { position: relative; }
.p-speed-btn { font-family: var(--mono); font-size: .8rem; font-weight: 500; min-width: 48px; }
.p-menu {
  position: absolute; bottom: 46px; right: -40px; padding: 6px; border-radius: 12px; min-width: 130px;
  background: rgba(16,19,26,.96); border: 1px solid var(--border-2); backdrop-filter: blur(10px);
  box-shadow: 0 16px 40px rgba(0,0,0,.6);
}
.p-menu button { display: flex; width: 100%; justify-content: space-between; padding: 7px 12px; border-radius: 8px; font-family: var(--mono); font-size: .8rem; }
.p-menu button:hover { background: rgba(255,255,255,.08); }
.p-menu button.on { color: var(--accent); }
.p-menu button.on::after { content: '●'; font-size: .6rem; }

/* Siguiente vídeo */
.p-next {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(5,6,9,.82); backdrop-filter: blur(14px); animation: fade .3s;
}
@keyframes fade { from { opacity: 0; } }
.p-next-label { font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.p-next-label b { color: var(--accent); font-size: 1.1rem; }
.p-next-card { width: min(380px, 70%); }
.p-next-card .thumb { border-radius: 12px; }
.p-next-card h4 { margin-top: 10px; font-weight: 500; text-align: center; }
.p-next-actions { display: flex; gap: 10px; }
.p-next-ring { display: none; }

/* Detalles */
.details { margin-top: 22px; }
.title-row { display: flex; align-items: center; gap: 8px; }
.v-title { font-family: var(--display); font-weight: 400; font-size: clamp(1.8rem, 2.8vw, 2.6rem); letter-spacing: .04em; line-height: 1.05; color: #fff; word-break: break-word; }
.v-title-input {
  flex: 1; font-family: var(--display); font-size: 2.2rem; letter-spacing: .04em; color: #fff;
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 10px; padding: 2px 12px; outline: 0;
}
.v-sub { margin-top: 6px; color: var(--text-2); font-size: .9rem; }
.v-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.v-chips span {
  font-family: var(--mono); font-size: .7rem; color: var(--text-2);
  border: 1px solid var(--border); background: var(--card); border-radius: 6px; padding: 4px 8px;
}
.v-chips span b { color: var(--text); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.45rem; letter-spacing: .08em; }

.markers-panel { margin-top: 22px; }
.markers { list-style: none; display: grid; gap: 4px; counter-reset: mk; }
.markers li {
  display: grid; grid-template-columns: 90px 72px 1fr auto; align-items: center; gap: 12px;
  padding: 6px 8px; border-radius: 10px; transition: background .15s; counter-increment: mk;
}
.markers li:hover { background: var(--card); }
.markers li.now { background: var(--accent-a); }
.mk-img { width: 90px; aspect-ratio: 16/9; border-radius: 6px; background: var(--card-2) no-repeat; cursor: pointer; }
.mk-time { font-family: var(--mono); font-size: .8rem; color: var(--accent); text-align: left; padding: 4px 6px; border-radius: 6px; }
.mk-time:hover { background: var(--accent-a); }
.mk-label { background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; outline: 0; font-size: .9rem; min-width: 0; }
.mk-label:hover { border-color: var(--border); }
.mk-label:focus { border-color: var(--accent); background: var(--bg-2); }
.markers li .icon-btn { opacity: 0; }
.markers li:hover .icon-btn { opacity: 1; }
.markers-empty { color: var(--muted); font-size: .88rem; line-height: 1.7; max-width: 560px; }

/* A continuación */
.upnext { padding-top: 42px; }
.upnext .panel-head { position: sticky; top: calc(var(--top-h) + 0px); z-index: 2; background: var(--bg); padding: 10px 0; margin: 0; }
.upnext-list { display: grid; gap: 4px; }
.up-item { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 6px; border-radius: 12px; text-decoration: none; color: inherit; transition: background .15s; }
.up-item:hover { background: var(--card); }
.up-item.current { background: var(--accent-a); box-shadow: inset 3px 0 0 var(--accent); }
.up-item .thumb { border-radius: 9px; }
.up-item .thumb .dur { font-size: .62rem; padding: 2px 5px; right: 5px; bottom: 5px; }
.up-item .card-title { font-size: .86rem; }
.up-item .card-meta { font-size: .64rem; }
.up-now { font-family: var(--mono); font-size: .62rem; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: 4px; display: block; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--text-2); cursor: pointer; }
.switch input { display: none; }
.switch span { width: 34px; height: 20px; border-radius: 20px; background: var(--border-2); position: relative; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); background: #0a0c10; }

/* Modo cine: el vídeo ocupa todo el ancho y la lista baja */
body.theater #watch { grid-template-columns: 1fr; padding-top: 0; max-width: none; }
body.theater .back-link { margin-top: 12px; }
body.theater .player { aspect-ratio: auto; height: calc(100vh - var(--top-h) - 120px); min-height: 360px; border-radius: 0; }
body.theater .stage { margin: 0 -32px; }
body.theater .ambient { display: none; }
body.theater .details, body.theater .upnext { max-width: 1400px; margin-left: auto; margin-right: auto; width: 100%; }
body.theater .upnext { padding-top: 0; }
body.theater .upnext-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* ═════════════ CAPAS ═════════════ */
.drop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(7,9,13,.85); backdrop-filter: blur(8px); animation: fade .2s; }
.drop-box { text-align: center; padding: 60px 90px; border: 2px dashed var(--accent); border-radius: 28px; background: var(--accent-a); }
.drop-box svg { width: 56px; height: 56px; color: var(--accent); animation: bob 1.2s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-8px); } }
.drop-box h2 { font-family: var(--display); font-weight: 400; font-size: 2.6rem; letter-spacing: .08em; margin: 10px 0 4px; }
.drop-box p { color: var(--text-2); }

.uploads {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 360px; padding: 14px 16px;
  background: rgba(17,21,29,.96); border: 1px solid var(--border-2); border-radius: 16px; backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: rise .3s var(--ease);
}
.uploads .panel-head { margin-bottom: 8px; }
.uploads .panel-head h2 { font-size: 1.2rem; }
.uploads ul { list-style: none; display: grid; gap: 10px; max-height: 300px; overflow: auto; }
.up-row { font-size: .82rem; }
.up-row .nm { display: flex; justify-content: space-between; gap: 10px; }
.up-row .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row .nm span:last-child { font-family: var(--mono); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.up-row .bar { height: 4px; background: var(--border); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.up-row .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-row.err .bar i { background: var(--danger); }
.up-row.done .bar i { background: #5dd39e; }

.modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); animation: fade .2s; padding: 16px; }
.modal-box { width: min(760px, 100%); background: var(--card); border: 1px solid var(--border-2); border-radius: 20px; padding: 22px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.7); animation: rise .3s var(--ease); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 40px; }
.keys h3 { font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin: 10px 0 8px; font-weight: 500; }
.keys p { font-size: .86rem; color: var(--text-2); padding: 4px 0; }
.keys kbd { margin-right: 4px; }

.toasts { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 120; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 12px; pointer-events: auto;
  background: #f1f3f8; color: #0a0c10; font-size: .88rem; font-weight: 500; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  animation: toastIn .35s var(--ease);
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast button { font-weight: 700; color: #6a5cff; padding: 4px 8px; border-radius: 6px; }
.toast button:hover { background: rgba(0,0,0,.06); }
.toast svg { color: #0a0c10; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }

.shot-flash { position: absolute; inset: 0; z-index: 7; background: #fff; pointer-events: none; animation: shot .45s ease-out forwards; }
@keyframes shot { from { opacity: .85; } to { opacity: 0; } }

/* ═════════════ RESPONSIVE ═════════════ */
@media (max-width: 1280px) {
  #watch { grid-template-columns: minmax(0, 1fr) 320px; }
  .up-item { grid-template-columns: 130px 1fr; }
  .stats .s-size { display: none; }
}
@media (max-width: 1020px) {
  #watch { grid-template-columns: 1fr; }
  .upnext { padding-top: 10px; }
  .upnext-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .stats { display: none; }
}
@media (max-width: 720px) {
  :root { --top-h: 60px; }
  .top { padding: 0 16px; gap: 12px; }
  .logo span { display: none; }
  .btn span { display: none; }
  #uploadBtn { width: 38px; padding: 0; justify-content: center; }
  #helpBtn, .forge-pill, .search kbd { display: none; }
  .top-right { gap: 6px; }
  #library, #watch { padding-left: 16px; padding-right: 16px; }
  .hero { min-height: 280px; }
  .hero-body { padding: 24px; }
  .cards { grid-template-columns: 1fr; }
  #grid.list .card { grid-template-columns: 130px 1fr; gap: 12px; }
  .stage { margin: 0 -16px; }
  .player { border-radius: 0; }
  .p-vol input, #loopBtn, #shotBtn, #theaterBtn, #prevBtn, .p-chapter, [data-skip] { display: none; }
  .actions .btn { width: 42px; padding: 0; justify-content: center; }
  .markers li { grid-template-columns: 64px 1fr auto; }
  .mk-img { display: none; }
  .keys { grid-template-columns: 1fr; }
  .uploads { left: 16px; right: 16px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ═════════════ MINI REPRODUCTOR ═════════════ */
.mini {
  position: fixed; left: 20px; bottom: 20px; z-index: 80; width: 360px; border-radius: 14px; overflow: hidden;
  background: #000; border: 1px solid var(--border-2); box-shadow: 0 24px 60px rgba(0,0,0,.75); animation: rise .35s var(--ease);
}
.mini-video { aspect-ratio: 16/9; }
.mini-video video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.mini-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--card); }
.mini-play { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); }
.mini-play:hover { background: var(--card-2); }
.mini-title { flex: 1; min-width: 0; font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.mini-prog { height: 3px; background: var(--border); }
.mini-prog i { display: block; height: 100%; width: 0; background: var(--accent); }
@media (max-width: 720px) { .mini { left: 16px; right: 16px; width: auto; } }

/* Controles según el ancho real del reproductor (no de la ventana) */
.player { container-type: inline-size; }
@container (max-width: 700px) {
  #prevBtn, #nextBtn, #markBtn, .p-chapter { display: none; }
}
@container (max-width: 540px) {
  [data-skip], #loopBtn, #shotBtn, .p-vol input { display: none; }
  .p-btn { min-width: 34px; padding: 0 5px; }
}
