:root {
  --bg: #07070b;
  --surface: #101018;
  --surface-2: #16161f;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f4f4f8;
  --muted: #8d8da0;
  --accent: #ff2d55;
  --accent-2: #ff7a45;
  --ok: #3ddc97;
  --err: #ff5470;
  --radius: 18px;
  --display: "Sora", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.glow {
  position: fixed; inset: -20vh -10vw auto; height: 70vh; pointer-events: none; z-index: -1;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(255, 45, 85, .16), transparent 70%),
    radial-gradient(35% 45% at 70% 30%, rgba(255, 122, 69, .10), transparent 70%);
  filter: blur(20px);
}

/* ---------- Barra superior ---------- */
.topbar {
  max-width: 1180px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 22px var(--display); letter-spacing: -.5px; }
.brand b { color: var(--accent); }
.wave { display: flex; align-items: center; gap: 3px; height: 22px; }
.wave i { width: 3px; border-radius: 3px; background: linear-gradient(var(--accent-2), var(--accent)); animation: eq 1.2s ease-in-out infinite; }
.wave i:nth-child(1) { height: 8px;  animation-delay: -.2s; }
.wave i:nth-child(2) { height: 16px; animation-delay: -.5s; }
.wave i:nth-child(3) { height: 22px; animation-delay: -.1s; }
.wave i:nth-child(4) { height: 13px; animation-delay: -.7s; }
.wave i:nth-child(5) { height: 7px;  animation-delay: -.3s; }
@keyframes eq { 50% { transform: scaleY(.45); } }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.02);
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61,220,151,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(61,220,151,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,151,0); } }

main { max-width: 1180px; margin: 0 auto; padding: 0 24px 60px; }

/* ---------- Entrada ---------- */
.intro { text-align: center; padding: 48px 0 34px; }
.intro h1 {
  margin: 0; font: 800 clamp(34px, 6vw, 62px)/1.05 var(--display); letter-spacing: -2px;
}
.intro h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.intro p { color: var(--muted); margin: 16px auto 30px; max-width: 520px; font-size: 16px; }

.search {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 7px 7px 18px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.8);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: rgba(255,45,85,.55); box-shadow: 0 0 0 4px rgba(255,45,85,.12), 0 20px 60px -20px rgba(0,0,0,.8); }
.search-icon { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input {
  flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; font-size: 16px;
}
.search input::placeholder { color: #5b5b6c; }

.primary {
  border: 0; border-radius: 12px; height: 46px; padding: 0 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700; white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(255,45,85,.7);
  transition: transform .15s, filter .15s, opacity .15s;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: progress; }
.ghost {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-weight: 600;
}
.ghost:hover { color: var(--text); background: var(--surface-2); }

.form-error {
  max-width: 760px; margin: 14px auto 0; padding: 11px 16px; border-radius: 12px;
  background: rgba(255,84,112,.08); border: 1px solid rgba(255,84,112,.3); color: #ffb3c0; font-size: 14px;
}

/* ---------- Resultado ---------- */
.result {
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 22px;
  padding: 20px; margin-bottom: 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.player {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: #000 center / cover no-repeat;
}
.player video, .embed, .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.player video { object-fit: contain; }
.loader {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.65));
  font-size: 14px; color: #ddd; pointer-events: none;
}
.loader small { color: #aaa; font-size: 12.5px; max-width: 320px; text-align: center; }
.p-error {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  padding: 24px; text-align: center; background: rgba(7,7,11,.88); backdrop-filter: blur(6px);
}
.p-error b { font: 700 18px var(--display); }
.p-error p { margin: 0; color: var(--muted); max-width: 440px; font-size: 14px; }
.p-error code { max-width: 90%; color: #ff9db0; background: rgba(255,84,112,.08); padding: 6px 10px; border-radius: 8px; font-size: 12px; overflow-wrap: anywhere; }
.p-error code:empty { display: none; }
.p-error-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.p-error .primary, .p-error .ghost { height: 40px; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px 0; font-size: 13px; }
.src-label { color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--accent-2); font-weight: 600; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.meta { padding: 14px 2px 2px; }
.meta h2 { margin: 0 0 8px; font: 700 20px/1.3 var(--display); letter-spacing: -.3px; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.chip { padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 12.5px; font-weight: 600; }
.skeleton { color: transparent !important; background: linear-gradient(90deg, var(--surface-2), #20202b, var(--surface-2)); background-size: 200% 100%; border-radius: 8px; animation: shimmer 1.2s infinite; width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.download-col {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line);
  align-self: start;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); }
.tab { border: 0; background: transparent; color: var(--muted); height: 40px; border-radius: 9px; font-weight: 700; font-size: 14px; transition: .15s; }
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.fine { margin: 10px 0 0; font-size: 12.5px; color: #6c6c7d; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.opt {
  display: grid; justify-items: center; gap: 1px; padding: 12px 4px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.opt b { font: 700 15px var(--display); }
.opt small { color: var(--muted); font-size: 11.5px; }
.opt:hover { border-color: rgba(255,255,255,.3); }
.opt.selected { border-color: var(--accent); background: rgba(255,45,85,.1); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.selected small { color: #ff9db0; }

.big { height: 54px; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.big.loading .dl-text::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%; display: inline-block; vertical-align: -3px; margin-right: 10px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite;
}
.dl-status { font-size: 13.5px; padding: 11px 13px; border-radius: 11px; background: rgba(61,220,151,.08); border: 1px solid rgba(61,220,151,.25); color: #a7f0cf; }
.dl-status.info { background: rgba(255,255,255,.04); border-color: var(--line); color: var(--muted); }
.dl-status.error { background: rgba(255,84,112,.08); border-color: rgba(255,84,112,.3); color: #ffb3c0; }

/* ---------- Biblioteca ---------- */
.library { padding-top: 10px; }
.lib-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.lib-head h2 { margin: 0; font: 700 24px var(--display); letter-spacing: -.5px; }
.lib-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); }
.filters { display: flex; gap: 6px; align-items: center; }
.filter { height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.icon-btn { width: 34px; height: 34px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

.mini { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.mini #miniMedia { flex: 1; min-width: 0; }
.mini audio { width: 100%; display: block; }
.mini video { width: 100%; max-height: 60vh; border-radius: 10px; display: block; background: #000; }

.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s;
}
.item:hover { border-color: var(--line-2); }
.item-art {
  width: 42px; height: 42px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 11px; letter-spacing: .5px;
  background: rgba(255,45,85,.12); color: #ff8aa1;
}
.item-art.mp4 { background: rgba(255,122,69,.12); color: #ffb08f; }
.item-info { flex: 1; min-width: 0; }
.item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
.item-size { color: var(--muted); font-size: 12.5px; }
.item a, .item button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--text); }
.item a:hover, .item button:hover { border-color: var(--accent); color: var(--accent); }
.empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; border: 1px dashed var(--line-2); border-radius: 16px; color: var(--muted); }

footer { text-align: center; color: #55556a; font-size: 13px; padding: 30px 24px 40px; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .result { grid-template-columns: 1fr; padding: 14px; }
}
@media (max-width: 600px) {
  .topbar { padding: 16px; }
  
  main { padding: 0 16px 40px; }
  .intro { padding-top: 22px; }
  .search { flex-wrap: wrap; padding: 8px; }
  .search-icon { display: none; }
  .search input { flex-basis: 100%; padding: 0 8px; }
  #paste { flex: 1; background: var(--surface-2); }
  #go { flex: 2; }
  .chips { grid-template-columns: repeat(2, 1fr); }
  .list { grid-template-columns: 1fr; }
}

/* ---------- Web: usuario, login ---------- */
.user-box { display: flex; align-items: center; gap: 6px; }
.ghost.small { height: 34px; padding: 0 12px; font-size: 13.5px; }
.item-exp { color: #6c6c7d; }
.item .del:hover { border-color: var(--err); color: var(--err); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; padding: 30px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.9); animation: rise .35s ease;
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg); outline: 0; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: rgba(255,45,85,.55); box-shadow: 0 0 0 4px rgba(255,45,85,.12); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin: 4px 0 18px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.login-card .primary { width: 100%; }
.login-error { margin-top: 14px; font-size: 13.5px; color: #ffb3c0; text-align: center; min-height: 20px; }
@media (max-width: 600px) { .user-box .badge { display: inline-flex; } }
.item-size { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
