/* ─── Blaze · diseño (negro + rosa pastel + malva/crema) ──────────────────── */
:root {
  --bg: #0e0d10;
  --bg-2: #15131a;
  --surface: #1b1823;
  --surface-2: #231f2e;
  --line: #2e2838;
  --line-soft: #241f2f;

  --pink: #f7a8c4;      /* rosa pastel principal */
  --pink-soft: #ffc9dd;
  --pink-deep: #e67ba6;
  --mauve: #c7a9f0;     /* malva complementario */
  --peach: #ffd9b8;     /* melocotón crema */
  --cream: #f4ecef;     /* texto claro */

  --text: #f4ecef;
  --muted: #a99fb3;
  --muted-2: #776d85;

  --danger: #ff8095;
  --ok: #9ff0c4;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 45px -22px rgba(0, 0, 0, 0.9);
  --glow: 0 0 0 1px rgba(247, 168, 196, 0.25), 0 12px 40px -16px rgba(247, 168, 196, 0.35);
  --grad: linear-gradient(120deg, var(--pink) 0%, var(--mauve) 100%);
  --grad-warm: linear-gradient(120deg, var(--peach), var(--pink) 60%, var(--pink-deep));
  --font-display: 'Fraunces', Georgia, serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1100px 600px at 85% -10%, rgba(199, 169, 240, 0.12), transparent 55%),
    radial-gradient(900px 520px at 5% 0%, rgba(247, 168, 196, 0.12), transparent 55%), var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }
::selection { background: rgba(247, 168, 196, 0.3); }

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-size: 44px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.08); } }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-soft); }

/* ─── Marca ─────────────────────────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── Botones ───────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--pink-deep); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--grad);
  color: #241320;
  border: none;
  box-shadow: var(--glow);
}
.btn.ghost { background: transparent; }
.btn.block { width: 100%; justify-content: center; padding: 13px; }
.btn.sm { padding: 7px 12px; font-size: 13px; }

/* ─── Layout principal ──────────────────────────────────────────────────── */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .logo { font-size: 26px; display: flex; align-items: center; gap: 9px; }
.topbar .logo .flame { font-size: 22px; filter: drop-shadow(0 0 10px rgba(247, 168, 196, 0.6)); }
.topbar .spacer { flex: 1; }

.nav { display: flex; gap: 4px; background: var(--surface); padding: 5px; border-radius: 999px; border: 1px solid var(--line-soft); }
.nav button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s, background 0.2s;
}
.nav button:hover { color: var(--text); }
.nav button.active { color: #241320; background: var(--grad); }

.me-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.me-chip:hover { border-color: var(--pink-deep); }
.me-chip .name { font-weight: 600; font-size: 14px; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #241320;
  flex: none;
  background: var(--grad);
  font-size: 15px;
}

.content { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(18px, 3vw, 34px) clamp(16px, 4vw, 40px) 90px; }

/* ─── Cabeceras de sección ──────────────────────────────────────────────── */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 6px 0 22px; flex-wrap: wrap; }
.section-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 4vw, 40px); margin: 0; letter-spacing: -0.02em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--pink-deep); }
.chip.active { color: #241320; background: var(--pink); border-color: transparent; }

/* ─── Buscador ──────────────────────────────────────────────────────────── */
.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 420px;
}
.search input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus { border-color: var(--pink-deep); box-shadow: 0 0 0 3px rgba(247, 168, 196, 0.16); }
.search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }

/* ─── Rejilla de pósters ────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: clamp(12px, 2vw, 20px); }

.card { position: relative; }
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s;
}
.poster:hover { transform: translateY(-4px); border-color: var(--pink-deep); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .noimg {
  width: 100%; height: 100%;
  display: grid; place-items: center; text-align: center;
  padding: 14px; color: var(--muted-2); font-size: 13px; gap: 6px; font-weight: 600;
}
.poster .rating {
  position: absolute; top: 8px; left: 8px;
  background: rgba(14, 13, 16, 0.78);
  backdrop-filter: blur(6px);
  color: var(--peach);
  font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  display: flex; align-items: center; gap: 3px;
}
.poster .ownerflag {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--bg);
  font-size: 12px;
}
.poster .watched-veil {
  position: absolute; inset: 0;
  background: rgba(14, 13, 16, 0.55);
  display: grid; place-items: center;
  color: var(--ok); font-weight: 700; font-size: 13px;
  letter-spacing: 0.04em;
}

.card .meta { padding: 8px 2px 0; }
.card .meta .t { font-size: 13.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta .y { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

.card .quick {
  position: absolute; bottom: 60px; right: 8px;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.16s, transform 0.16s;
}
.card:hover .quick { opacity: 1; transform: translateY(0); }
.iconbtn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(27, 24, 35, 0.92);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  font-size: 15px; color: var(--text);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.iconbtn:hover { transform: scale(1.1); border-color: var(--pink); }
.iconbtn.on { background: var(--grad); border-color: transparent; color: #241320; }
.iconbtn.on.heart { background: linear-gradient(120deg, var(--pink-deep), var(--pink)); }
@media (hover: none) { .card .quick { opacity: 1; transform: none; } }

/* ─── Estados vacíos / carga ────────────────────────────────────────────── */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; }
.empty h3 { font-family: var(--font-display); font-weight: 600; color: var(--text); margin: 0 0 6px; font-size: 22px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.skeleton { aspect-ratio: 2/3; border-radius: var(--radius-sm); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.banner { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.banner.warn { border-color: rgba(255, 217, 184, 0.35); background: rgba(255, 217, 184, 0.07); }
.banner code { background: rgba(0,0,0,0.35); padding: 2px 6px; border-radius: 6px; font-size: 13px; color: var(--peach); }

/* ─── Login / registro ──────────────────────────────────────────────────── */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(26px, 5vw, 42px);
  box-shadow: var(--shadow);
}
.auth-card .brand { text-align: center; margin-bottom: 8px; }
.auth-card .brand .flame { font-size: 40px; filter: drop-shadow(0 0 16px rgba(247, 168, 196, 0.55)); }
.auth-card .brand h1 { font-family: var(--font-display); font-size: 40px; margin: 6px 0 0; }
.auth-card .brand p { color: var(--muted); margin: 6px 0 0; font-size: 14.5px; }

.profiles { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 26px 0 8px; }
.profile-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 92px; background: none; border: none; color: var(--text); }
.profile-pick .avatar { width: 68px; height: 68px; font-size: 26px; border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s; }
.profile-pick:hover .avatar { transform: translateY(-3px); border-color: var(--pink); }
.profile-pick .pname { font-size: 13.5px; font-weight: 600; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-pick.add .avatar { background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); }

.field { margin-top: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.field input {
  width: 100%; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font-size: 15px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--pink-deep); box-shadow: 0 0 0 3px rgba(247, 168, 196, 0.16); }
.auth-error { color: var(--danger); font-size: 14px; margin-top: 14px; text-align: center; min-height: 18px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.auth-switch button { background: none; border: none; color: var(--pink); font-weight: 600; }
.back-link { background: none; border: none; color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; }

/* Selector de color + avatar en registro/perfil */
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.avatar-edit .avatar { width: 72px; height: 72px; font-size: 28px; }
.avatar-edit .ae-actions { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--cream); }

/* ─── Modal de detalle ──────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(8, 7, 10, 0.72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 18px; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 760px; max-height: 92dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow); position: relative;
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise { from { transform: translateY(18px) scale(0.98); opacity: 0; } }
.modal .hero { position: relative; aspect-ratio: 16/9; background: var(--surface-2); }
.modal .hero img { width: 100%; height: 100%; object-fit: cover; }
.modal .hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--surface) 98%); }
.modal .close { position: absolute; top: 14px; right: 14px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(14,13,16,0.65); backdrop-filter: blur(6px); color: #fff; font-size: 17px; }
.modal .close:hover { background: var(--pink-deep); }
.modal .body { padding: 0 clamp(20px, 4vw, 34px) 30px; margin-top: -60px; position: relative; z-index: 2; }
.modal .body h2 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 36px); margin: 0 0 4px; letter-spacing: -0.02em; }
.modal .tagline { color: var(--pink-soft); font-style: italic; margin: 0 0 14px; }
.modal .facts { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.modal .facts .dot { color: var(--muted-2); }
.genres { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.genres span { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line-soft); padding: 5px 11px; border-radius: 999px; color: var(--muted); }
.modal .overview { line-height: 1.6; color: #d9d0e0; margin-bottom: 20px; }
.modal .cast { font-size: 14px; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.modal .cast b { color: var(--text); font-weight: 600; }
.modal .actions { display: flex; flex-wrap: wrap; gap: 10px; position: sticky; bottom: 0; }

.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toastIn 0.2s ease; display: flex; gap: 8px; align-items: center; }
.toast.err { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav { order: 4; flex-basis: 100%; overflow-x: auto; justify-content: flex-start; }
  .me-chip .name { display: none; }
  .grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
  .card .quick { bottom: 54px; }
}
