/*
  Spuckee Loom · JAM Tech
  Identidad tomada de jamtech.cloud: verde #6FC043 como único acento, tinta #0B0F14,
  Bricolage Grotesque para títulos, Inter para texto y Space Mono para tiempos.
  El rojo solo indica el estado "grabando".
  Formas: controles 10px, superficies 14px, diálogos 24px, chips y pastillas redondas.
*/

:root {
  color-scheme: light dark;
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --surface-3: #e3e6ea;
  --line: #e1e5ea;
  --line-strong: #cbd1d8;
  --ink: #0b0f14;
  --ink-2: #2a313a;
  --muted: #5b6470;

  --accent: #6fc043;
  --accent-hover: #63b238;
  --accent-soft: #e8f5df;
  --accent-text: #3b7a1d;
  --on-accent: #0b0f14;
  --blue: #1b6ca8;
  --cyan: #4bbfd0;
  --rec: #e5484d;
  --rec-soft: #fde8e8;

  --shadow-sm: 0 1px 2px rgb(11 15 20 / 0.06);
  --shadow-md: 0 1px 2px rgb(11 15 20 / 0.05), 0 14px 36px -14px rgb(11 15 20 / 0.22);
  --shadow-lg: 0 24px 64px -20px rgb(11 15 20 / 0.35);

  --r-control: 10px;
  --r-surface: 14px;
  --r-dialog: 24px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 68px;
  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --surface: #141a21;
    --surface-2: #1b222b;
    --surface-3: #252e38;
    --line: rgb(255 255 255 / 0.1);
    --line-strong: rgb(255 255 255 / 0.18);
    --ink: #f2f4f7;
    --ink-2: #d3d8de;
    --muted: #97a1ad;
    --accent-soft: rgb(111 192 67 / 0.14);
    --accent-text: #8fd468;
    --rec-soft: rgb(229 72 77 / 0.16);
    --shadow-md: 0 1px 2px rgb(0 0 0 / 0.4), 0 18px 40px -16px rgb(0 0 0 / 0.7);
    --shadow-lg: 0 28px 72px -20px rgb(0 0 0 / 0.8);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.brand img {
  width: 26px;
  height: 30px;
  flex: none;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions,
.topbar > .btn {
  flex: none;
}

@media (max-width: 340px) {
  .topbar .brand-name {
    display: none;
  }
}

.brand-by {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
}

.brand-by strong {
  font-weight: 600;
  color: var(--ink-2);
}

.label-short {
  display: none;
}

@media (max-width: 560px) {
  .brand-by {
    display: none;
  }
}

@media (max-width: 420px) {
  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.12s var(--ease);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn i {
  font-size: 17px;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--rec);
}

.btn-danger:hover:not(:disabled) {
  background: var(--rec-soft);
}

.btn-rec {
  background: var(--rec);
  color: #fff;
}

.btn-rec:hover:not(:disabled) {
  background: #d43d42;
}

.btn-lg {
  height: 48px;
  padding: 0 22px;
  font-size: 15px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-2);
  font-size: 19px;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn.is-danger:hover {
  background: var(--rec-soft);
  color: var(--rec);
}

/* ---------- Página ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px var(--gutter) 64px;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.library-head h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
}

.library-head p {
  margin: 6px 0 0;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(320px, 100%);
}

.search i {
  position: absolute;
  left: 12px;
  font-size: 17px;
  color: var(--muted);
  pointer-events: none;
}

.input,
.search input,
.field select,
.field input,
.field textarea,
.password-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.search input {
  padding-left: 38px;
}

.input::placeholder,
.search input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.input:focus,
.search input:focus,
.field select:focus,
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Biblioteca ---------- */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px 22px;
}

.card {
  position: relative;
  min-width: 0;
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.card-link {
  display: block;
  text-decoration: none;
  border-radius: var(--r-surface);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-surface);
  background: linear-gradient(135deg, var(--blue), var(--cyan) 55%, var(--accent));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.thumb-fallback img {
  width: 38px;
  height: auto;
  opacity: 0.9;
  filter: brightness(0) invert(1);
}

.card-link:hover .thumb {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-link:hover .thumb img {
  transform: scale(1.03);
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgb(11 15 20 / 0.78);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
}

.card-body {
  padding: 12px 2px 0;
}

.card-body h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-body p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.card:hover .card-actions,
.card:focus-within .card-actions {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .card-actions {
    opacity: 1;
    transform: none;
  }
}

.card-actions .icon-btn {
  width: 34px;
  height: 34px;
  font-size: 17px;
  background: rgb(255 255 255 / 0.92);
  color: #0b0f14;
  box-shadow: var(--shadow-sm);
}

.card-actions .icon-btn:hover {
  background: #fff;
}

.card-actions .icon-btn.is-danger:hover {
  color: var(--rec);
}

/* Esqueletos de carga */
.skeleton .thumb,
.skeleton-line {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
}

.skeleton-line {
  height: 12px;
  border-radius: var(--r-pill);
  margin-top: 14px;
  width: 80%;
}

.skeleton-line.short {
  width: 45%;
  margin-top: 8px;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton .thumb,
  .skeleton-line {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
  }
}

/* Estado vacío y de error */
.empty {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 520px;
  padding: 48px 0;
}

.empty-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--r-surface);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 28px;
}

.empty h2 {
  font-size: 26px;
}

.empty p {
  margin: 0;
  color: var(--muted);
  max-width: 46ch;
}

/* ---------- Pie ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-text);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-brand img {
  width: 16px;
  height: auto;
}

/* ---------- Diálogo de grabación ---------- */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}

dialog::backdrop {
  background: rgb(11 15 20 / 0.55);
  backdrop-filter: blur(4px);
}

.recorder-dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}

.recorder-dialog[open] {
  animation: pop 0.32s var(--ease);
}

.rec-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: var(--r-dialog);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.rec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rec-head h2 {
  font-size: 22px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-surface);
  background: var(--surface-2);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: var(--r-control);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.segmented span i {
  font-size: 22px;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.rec-preview {
  position: relative;
  justify-self: center;
  width: 168px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow:
    0 0 0 4px var(--surface),
    0 0 0 6px var(--accent);
}

.rec-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.rec-preview-off {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.rec-preview-off i {
  font-size: 26px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.meter {
  height: 4px;
  border-radius: var(--r-pill);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: inherit;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.08s linear;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  transition: background-color 0.2s var(--ease);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.hint i {
  flex: none;
  font-size: 17px;
  margin-top: 1px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--rec-soft);
  color: var(--rec);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Grabación en curso (en la página) ---------- */

.hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 24px;
  background: rgb(11 15 20 / 0.82);
  backdrop-filter: blur(6px);
  color: #f2f4f7;
}

.hud-stage {
  width: min(720px, 100%);
  aspect-ratio: 16 / 9;
  border-radius: var(--r-dialog);
  overflow: hidden;
  background: #141a21;
  box-shadow: var(--shadow-lg);
}

.hud-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.hud-message {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 420px;
  text-align: center;
}

.hud-message h2 {
  font-size: 26px;
}

.hud-message p {
  margin: 0;
  color: #b8c0ca;
}

.hud-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-radius: var(--r-pill);
  background: #141a21;
  border: 1px solid rgb(255 255 255 / 0.1);
  box-shadow: var(--shadow-lg);
}

.hud-bar .icon-btn {
  color: #d3d8de;
  border-radius: 50%;
}

.hud-bar .icon-btn:hover {
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.hud-bar .btn {
  border-radius: var(--r-pill);
}

.hud-time {
  min-width: 56px;
  font-size: 15px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rec);
}

.is-paused .rec-dot {
  background: #f5a524;
  animation: none;
}

@media (prefers-reduced-motion: no-preference) {
  .rec-dot {
    animation: pulse 1.4s ease-in-out infinite;
  }
}

.confirming {
  background: var(--rec) !important;
  color: #fff !important;
  width: auto !important;
  padding: 0 12px !important;
  font-size: 13px !important;
  font-weight: 600;
  border-radius: var(--r-pill) !important;
}

/* Cuenta regresiva */
.countdown {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgb(11 15 20 / 0.6);
  pointer-events: none;
}

.countdown span {
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
}

.countdown span.tick {
  animation: pop 0.5s var(--ease);
}

/* Subida */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(11 15 20 / 0.55);
  backdrop-filter: blur(4px);
}

.upload-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  border-radius: var(--r-dialog);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.upload-card h2 {
  font-size: 21px;
}

.upload-card p {
  margin: 0;
  color: var(--muted);
}

.progress {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--accent));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.2s linear;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Avisos ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: #0b0f14;
  color: #f2f4f7;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: rise 0.3s var(--ease);
}

.toast i {
  font-size: 18px;
  color: var(--accent);
}

.toast.is-error i {
  color: var(--rec);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: #f2f4f7;
    color: #0b0f14;
  }

  .toast i {
    color: #3b7a1d;
  }
}

/* ---------- Página del video ---------- */

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1000px) {
  .watch {
    grid-template-columns: 1fr;
  }
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--r-surface);
  background: var(--accent-soft);
  color: var(--ink);
  animation: rise 0.4s var(--ease);
}

.banner i.lead {
  font-size: 22px;
  color: var(--accent-text);
}

.banner p {
  flex: 1;
  margin: 0;
  min-width: 200px;
  font-weight: 500;
}

.player-wrap {
  position: relative;
  border-radius: var(--r-surface);
  overflow: hidden;
  background: #0b0f14;
  box-shadow: var(--shadow-md);
}

.player-wrap video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0f14;
}

.floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floater {
  position: absolute;
  bottom: 70px;
  font-size: 34px;
  animation: float-up 1.8s var(--ease) forwards;
}

/* Dos carriles: reacciones arriba, comentarios abajo, para que no se tapen. */
.timeline {
  position: relative;
  height: 46px;
  margin-top: 10px;
  border-radius: var(--r-surface);
  background: var(--surface-2);
}

.timeline-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: var(--accent-soft);
  transform-origin: left;
  transform: scaleX(0);
}

.marker {
  position: absolute;
  top: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 15px;
  transform: translateY(-50%);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.marker:hover {
  transform: translateY(-50%) scale(1.25);
}

.marker.is-comment {
  top: 33px;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  background: var(--surface);
  border: 2px solid var(--blue);
  color: var(--blue);
  font-size: 11px;
}

.timeline-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
}

.watch-title {
  margin-top: 22px;
}

.title-input {
  display: block;
  width: calc(100% + 16px);
  margin: 0 -8px;
  resize: none;
  overflow: hidden;
  field-sizing: content;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition:
    border-color 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

.title-input:hover {
  border-color: var(--line);
}

.title-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.watch-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.watch-meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.watch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.watch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 17px;
  cursor: pointer;
  transition:
    transform 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.reaction-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.reaction-btn:active {
  transform: scale(0.94);
}

.reaction-btn span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.speed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.speed select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Comentarios */
.side {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: var(--r-surface);
  background: var(--surface);
  border: 1px solid var(--line);
}

@media (min-width: 1001px) {
  .side {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100dvh - var(--header-h) - 40px);
    overflow: auto;
  }
}

.side h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
}

.count-pill {
  padding: 1px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.comment-form textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.comment-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  animation: rise 0.3s var(--ease);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.avatar.is-brand {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.comment-head strong {
  font-size: 14px;
}

.comment-head .muted {
  font-size: 12.5px;
}

.time-chip {
  padding: 1px 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.time-chip:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.comment-text {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-2);
}

.comment-delete {
  position: absolute;
  top: 8px;
  right: -6px;
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.comment.is-mine .comment-head {
  padding-right: 26px;
}

.comments-empty {
  margin: 0;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.side-cta {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-surface);
  background: #0b0f14;
  color: #f2f4f7;
}

.side-cta p {
  margin: 0;
  font-size: 14px;
  color: #b8c0ca;
}

.side-cta strong {
  font-family: var(--font-display);
  font-size: 17px;
  color: #fff;
}

/* Esqueleto de la página del video */
.watch-skeleton .player-wrap {
  aspect-ratio: 16 / 9;
}

/* ---------- Sesión y Google Drive ---------- */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drive-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 10px 0 0 !important;
  font-size: 13.5px;
  color: var(--ink-2);
}

.drive-status i {
  font-size: 17px;
  color: var(--accent-text);
}

.drive-status a,
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.drive-status a:hover,
.link-btn:hover {
  text-decoration: underline;
}

.link-btn {
  color: var(--muted);
}

.drive-callout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 18px 20px;
  border-radius: var(--r-surface);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  animation: rise 0.4s var(--ease);
}

.drive-callout-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-control);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 24px;
}

.drive-callout.is-warning .drive-callout-icon {
  background: var(--rec-soft);
  color: var(--rec);
}

.drive-callout h2 {
  font-size: 18px;
}

.drive-callout p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 70ch;
}

@media (max-width: 720px) {
  .drive-callout {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

.storage-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px !important;
  color: var(--accent-text) !important;
  font-weight: 500;
}

.storage-note.is-warning {
  color: var(--rec) !important;
}

@media (prefers-reduced-motion: no-preference) {
  .storage-note:not(.is-warning) i {
    animation: pulse 1.6s ease-in-out infinite;
  }
}

.is-refresh .card {
  animation: none;
}

.title-input.is-readonly {
  cursor: default;
}

.title-input.is-readonly:hover,
.title-input.is-readonly:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.player-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  background: rgb(11 15 20 / 0.88);
  color: #f2f4f7;
  text-align: center;
}

.player-error i {
  font-size: 34px;
  color: var(--rec);
}

.player-error p {
  margin: 0;
  max-width: 44ch;
  color: #b8c0ca;
}

/* Página de acceso */
.login-body {
  justify-content: center;
}

.login {
  display: grid;
  justify-items: center;
  gap: 24px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 16px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 28px;
  border-radius: var(--r-dialog);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  animation: pop 0.35s var(--ease);
}

.login-card h1 {
  font-size: 26px;
}

.login-card p {
  margin: 0;
  font-size: 14px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 46px;
}

.password-wrap .icon-btn {
  position: absolute;
  top: 1px;
  right: 1px;
}

.login-foot {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.login-foot a {
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Animaciones ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translateY(0) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-180px) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
