/* Mi Videoteca · tema oscuro tipo sala de cine, acento ámbar */
:root {
  --bg: #121316;
  --bg2: #191b20;
  --card: #1e2026;
  --line: #2b2e36;
  --text: #ecedef;
  --muted: #9a9ea8;
  --accent: #f2a93b;
  --accent-ink: #1b1306;
  --ok: #4cc38a;
  --warn: #f2a93b;
  --err: #ef6461;
  --info: #8ab4f8;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
code { background: var(--bg2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- barra superior ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(18, 19, 22, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; padding-left: 2px;
}
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); padding: 7px 11px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav a.on { color: var(--text); background: var(--card); }
.nav a:hover { color: var(--text); }
.nav-out { opacity: .75; }

.page { max-width: 1240px; margin: 0 auto; padding: 16px 16px 48px; }
.h1 { font-size: 24px; margin: 6px 0 8px; letter-spacing: -.02em; }
.h2 { font-size: 16px; margin: 0 0 10px; }

/* ---------- controles ---------- */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(242, 169, 59, .45); outline-offset: 0; border-color: var(--accent); }
.lbl { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin: 0 0 12px; }
.lbl input, .lbl select, .lbl textarea { margin-top: 5px; }
.chk { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.chk input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 650;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #3b3f4a; }
.btn-main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-main:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--err); border-color: rgba(239, 100, 97, .4); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
form.inline { display: inline; }

.flash { padding: 11px 14px; border-radius: 11px; margin: 0 0 14px; font-weight: 600; border: 1px solid; }
.flash-ok { background: rgba(76, 195, 138, .1); border-color: rgba(76, 195, 138, .35); color: #9be3c0; }
.flash-info { background: rgba(138, 180, 248, .1); border-color: rgba(138, 180, 248, .35); color: #c3d7fb; }
.flash-err { background: rgba(239, 100, 97, .1); border-color: rgba(239, 100, 97, .35); color: #f6b0ae; }

/* ---------- alta rápida ---------- */
.addbar {
  display: grid; grid-template-columns: 1fr 230px auto auto; gap: 10px; align-items: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.addbar input, .addbar select { background: var(--bg); }

/* ---------- estadísticas ---------- */
.stats { display: flex; gap: 8px; margin: 14px 0; overflow-x: auto; scrollbar-width: none; }
.stats::-webkit-scrollbar { display: none; }
.stats > * {
  flex: 0 0 auto; display: flex; align-items: baseline; gap: 6px;
  padding: 8px 12px; border-radius: 11px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.stats b { color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }
.stats .st-warn b { color: var(--warn); }
.stats .st-err b { color: var(--err); }
.st-disk { margin-left: auto; }

/* ---------- categorías en fichas ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip small { color: var(--muted); font-weight: 600; margin-left: 2px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on small { color: rgba(27, 19, 6, .65); }
.chips-sub .chip { font-size: 13px; padding: 6px 11px; background: transparent; }
.chips-sub .chip.on { background: rgba(242, 169, 59, .16); color: var(--accent); border-color: rgba(242, 169, 59, .5); }
.chips-sub .chip.on small { color: var(--accent); }

.filters { display: grid; grid-template-columns: 1fr 170px 190px auto auto; gap: 8px; margin: 10px 0 6px; }
.found { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }

/* ---------- cuadrícula ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { border-color: #3b3f4a; transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 3 / 4; background: #0b0c0e; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(160deg, #2a2d35, #16171b);
}
.ph span { font-weight: 750; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.ph-instagram { background: linear-gradient(150deg, #833ab4, #c13584 45%, #f77737); }
.ph-facebook { background: linear-gradient(150deg, #1d4f9e, #0e2a57); }
.ph-youtube { background: linear-gradient(150deg, #b3261e, #4a0f0b); }
.ph-instagram span, .ph-facebook span, .ph-youtube span { color: rgba(255, 255, 255, .85); }

.b-plat, .b-dl, .b-dur {
  position: absolute; z-index: 2; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .66); color: #fff; backdrop-filter: blur(4px);
}
.b-plat { top: 8px; left: 8px; }
.b-dur { bottom: 8px; right: 8px; font-variant-numeric: tabular-nums; }
.b-dl { bottom: 8px; left: 8px; display: inline-flex; align-items: center; gap: 5px; }
.dl-fallido.b-dl { background: rgba(239, 100, 97, .9); }
.dl-solo_enlace.b-dl { background: rgba(60, 63, 72, .92); }
.dl-duplicado.b-dl { background: rgba(138, 180, 248, .85); color: #0d1a30; }
.vmeta .b-plat, .info .b-plat { position: static; }

.favbtn {
  position: absolute; z-index: 3; top: 4px; right: 4px; width: 38px; height: 38px; min-height: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: rgba(255, 255, 255, .55); text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.favbtn.on { color: var(--accent); }
.cbody { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 6px; }
.ctitle {
  font-weight: 650; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.dot-new { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.vs { padding: 1px 7px; border-radius: 999px; font-weight: 650; border: 1px solid var(--line); }
.vs-visto { color: var(--ok); }
.vs-practicar { color: var(--info); }
.vs-guardar { color: #c9a7f5; }

.spin {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 22px 0 0; color: var(--muted); }
.footlinks { text-align: center; margin-top: 30px; font-size: 14px; }

/* ---------- ficha del video ---------- */
.backlink { display: inline-block; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.watch { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
.player {
  position: sticky; top: 76px; background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); display: grid; place-items: center; min-height: 240px;
}
.player video { width: 100%; max-height: 78vh; display: block; background: #000; }
.player iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.player-off { aspect-ratio: 9 / 14; }
.player-off img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.player-msg {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, .6); font-weight: 650;
}
.vtitle { font-size: 20px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.01em; word-break: break-word; }
.vmeta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.vactions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.favbtn-lg.on { color: var(--accent); border-color: rgba(242, 169, 59, .5); }
.dlbox { background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 11px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.dlbox b { color: var(--text); }
.dlbox.dl-descargado { border-left-color: var(--ok); }
.dlbox.dl-pendiente, .dlbox.dl-descargando { border-left-color: var(--warn); }
.dlbox.dl-fallido { border-left-color: var(--err); }
.dlbox.dl-duplicado { border-left-color: var(--info); }
.dlerr { color: #f6b0ae; margin-top: 6px; font-size: 13px; word-break: break-word; }
.dlbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.dlbtns:not(:empty) { margin-top: 8px; }
.suggest { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: rgba(242, 169, 59, .08); border: 1px solid rgba(242, 169, 59, .3); border-radius: 11px; padding: 8px 12px; margin: 0 0 14px; font-size: 14px; }
.suggest-auto { color: var(--muted); }
.editform { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.desc { margin: 14px 0; color: var(--muted); font-size: 14px; }
.desc summary { cursor: pointer; font-weight: 650; color: var(--text); }
.desc p { word-break: break-word; }
.danger { margin-top: 18px; text-align: right; }

/* ---------- categorías ---------- */
.catnew, .catgroup, .reclass { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 14px 0; }
.catnew .catrow-main { margin-bottom: 8px; }
.catnew .in-kw { margin-bottom: 10px; }
.catrow { padding: 10px 0; border-top: 1px solid var(--line); }
.catgroup .catrow:first-child { border-top: 0; padding-top: 0; }
.catrow-sub { padding-left: 22px; }
.catrow-main { display: flex; gap: 8px; align-items: center; }
.in-emoji { width: 56px; flex: 0 0 56px; text-align: center; font-size: 18px; padding: 8px 4px; }
.in-name { flex: 1 1 auto; font-weight: 650; }
.in-sort { width: 74px; flex: 0 0 74px; }
.catnew select { flex: 0 1 260px; }
.sub-mark { color: var(--muted); font-size: 20px; width: 20px; text-align: center; }
.catcount { color: var(--muted); font-size: 13px; white-space: nowrap; min-width: 70px; text-align: right; }
.in-kw { margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 38px; padding: 8px 12px; }
.catrow-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ---------- atajo ---------- */
.copybox, .tipbox { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.copyrow { display: flex; gap: 8px; margin: 5px 0 12px; }
.copyrow input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.steps { padding-left: 22px; }
.steps li { margin: 0 0 12px; padding-left: 4px; }
.steps ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.tipbox { font-size: 14px; color: var(--muted); }
.tipbox b { color: var(--text); }

/* ---------- login ---------- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; }
.login-box .brand { margin-bottom: 4px; }
.login-box .btn { width: 100%; margin-top: 14px; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .watch { grid-template-columns: 1fr; gap: 16px; }
  .player { position: static; }
  .player video { max-height: 72vh; }
}
@media (max-width: 720px) {
  .page { padding: 12px 12px 40px; }
  .top { padding-left: 12px; padding-right: 12px; }
  .addbar { grid-template-columns: 1fr auto; }
  .addbar-url { grid-column: 1 / -1; }
  .addbar .btn { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input[type=search] { grid-column: 1 / -1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .catrow-main { flex-wrap: wrap; }
  .in-name { flex-basis: calc(100% - 64px); }
  .catnew select { flex: 1 1 100%; }
  .catcount { text-align: left; min-width: 0; }
  .st-disk { margin-left: 0; }
}
