:root {
  --bg: #14142a;
  --bg-2: #1a1a2e;
  --card: #22223b;
  --card-2: #2a2a47;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4efe6;
  --muted: #a9a6b8;
  --gold: #c8882a;
  --gold-2: #e0a94e;
  --ok: #5fcf9a;
  --bad: #ff8f8f;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2b2440 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; margin: 0; line-height: 1.15; }
h1 { font-size: 34px; font-weight: 900; }
h2 { font-size: 26px; font-weight: 700; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); font-size: 14px; }
.eyebrow { color: var(--gold-2); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1205; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(255, 143, 143, 0.4); }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }

input[type="text"], input[type="password"] {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text); font: inherit;
}
input::placeholder { color: #77748a; }
label { display: block; font-size: 14px; font-weight: 700; margin: 16px 0 6px; }
label .hint { font-weight: 400; color: var(--muted); }

/* Acceso */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 32px 26px; border-radius: 22px;
  background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-logo { display: block; margin: 0 auto 14px; height: auto; }
.login-card h1 { text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 10px; }
.login-card .btn-block { margin-top: 18px; }
.login-card .error { margin-top: 12px; }
.login-card h2 { margin-top: 6px; font-size: 22px; }
.steps { padding-left: 20px; margin: 12px 0; color: var(--muted); font-size: 15px; }
.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: 0.08em;
  text-align: center; padding: 14px; border-radius: 12px; background: rgba(200, 136, 42, 0.12);
  border: 1px dashed var(--gold); color: var(--gold-2); word-break: break-all; user-select: all;
}

/* Cabecera */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: rgba(20, 20, 42, 0.92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.top-logo { height: 37px; width: auto; }
.top-title { display: flex; flex-direction: column; line-height: 1.2; margin-right: auto; min-width: 0; }
.top-title strong { font-family: "Playfair Display", Georgia, serif; font-size: 19px; }
.top-title span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-on { color: var(--ok); background: rgba(95, 207, 154, 0.12); }
.pill-off { color: var(--bad); background: rgba(255, 143, 143, 0.12); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; display: grid; gap: 22px; }
section { background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Ahora en pantalla */
.hero { display: flex; gap: 22px; align-items: center; }
.phone {
  position: relative; flex: 0 0 auto; width: 132px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden;
  background: #0c0c18; border: 2px solid var(--gold); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.phone img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phone-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; color: var(--muted); font-size: 12px; }
.live { position: absolute; left: 8px; top: 8px; padding: 3px 7px; border-radius: 6px; background: #d93a3a; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.hero-text { display: grid; gap: 8px; min-width: 0; }
.hero-text .btn { justify-self: start; margin-top: 6px; }

/* Subida */
.upload { border-style: dashed; border-color: rgba(200, 136, 42, 0.45); }
.upload.drag { border-color: var(--gold-2); background: rgba(200, 136, 42, 0.1); }
.upload-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.upload-row input[type="text"] { flex: 1 1 240px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn { margin: 0; font-size: 16px; }
#up-chosen, #up-status { margin-top: 10px; }
.bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 12px; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.2s ease; }
.jobs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 14px; }
.jobs li { padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.jobs .job-error { color: var(--bad); }
.jobs .job-ok { color: var(--ok); }

/* Lista */
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 14px; }
.list-head h3 { white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
.card { position: relative; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.card.is-off { opacity: 0.55; }
.card.is-playing { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.thumb { position: relative; aspect-ratio: 9 / 16; background: #0c0c18; border: 0; padding: 0; cursor: pointer; display: block; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .num { position: absolute; left: 8px; top: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.65); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 12px; }
.thumb .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 34px; opacity: 0; background: rgba(0, 0, 0, 0.3); transition: opacity 0.15s ease; }
.thumb:hover .play, .thumb:focus-visible .play { opacity: 1; }
.card-body { padding: 10px; display: grid; gap: 8px; }
.card-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row { display: flex; gap: 6px; }
.card-row .btn { flex: 1; min-height: 38px; padding: 0 6px; font-size: 14px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.switch button {
  position: relative; width: 46px; height: 26px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.18); transition: background 0.15s ease; flex: 0 0 auto;
}
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
.switch button[aria-checked="true"] { background: var(--gold); }
.switch button[aria-checked="true"]::after { transform: translateX(20px); }
.confirm { display: grid; gap: 6px; font-size: 13px; }

/* Vista previa */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(8, 8, 18, 0.88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: min(360px, 100%); display: grid; gap: 12px; }
.modal video { width: 100%; max-height: 78vh; border-radius: 14px; background: #000; }

@media (max-width: 560px) {
  h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  .hero { gap: 16px; align-items: flex-start; }
  .phone { width: 104px; }
  .top { gap: 8px; padding: 10px 12px; }
  .top-title span { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  section { padding: 16px; }
  .upload-row .btn { flex: 1 1 auto; }
}
