/* =====================================================================
   Betar Uruguay · Buscar mi cara
   Sistema visual: azul profundo + amarillo Betar, cámara con león, Rubik.
   ===================================================================== */

:root {
  /* Marca */
  --blue-950: #061433;
  --blue-900: #081d47;
  --blue-800: #0b2a5e;
  --blue-700: #12397d;
  --blue-600: #1a4fa8;
  --blue-100: #e3ebf8;
  --blue-50:  #f2f6fc;
  --yellow:      #ffc72c;
  --yellow-600:  #e8ac00;
  --yellow-100:  #fff3cc;

  /* Semánticos (claro) */
  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-2: #f6f8fd;
  --text: #0c1833;
  --muted: #4a5675;
  --line: #d9e1ef;
  --link: #1a4fa8;
  --focus: #1a4fa8;
  --chip: #e3ebf8;
  --chip-ink: #0b2a5e;

  --ok-bg: #e5f5ea;  --ok: #176235;
  --warn-bg: #fff3cc; --warn: #7a4f00;
  --info-bg: #e3ebf8; --info: #0b2a5e;
  --err-bg: #fde8e8; --err: #a31f1f;

  /* Un color, un significado. El amarillo es solo de la marca, la acción principal y la pestaña activa. */
  --accent: #1a4fa8;      /* elegido, foco, lo interactivo que no es la acción principal */
  --accent-ink: #ffffff;  /* texto sobre --accent */
  --fav: #e5243b;         /* favoritas (4,5:1 sobre blanco) */
  --badge: #d70f2d;       /* avisos sin leer (blanco encima: 5,3:1) */
  --nuevo: #1a4fa8;       /* punto de "nuevo" */

  /* Escala de letra: 12 · 14 · 16 · 18 · 22 · título. Nada más chico que 12 px. */
  --t-xs: .75rem; --t-sm: .875rem; --t-base: 1rem; --t-md: 1.125rem; --t-lg: 1.375rem;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(8 29 71 / 6%), 0 4px 16px rgb(8 29 71 / 6%);
  --shadow-lg: 0 12px 40px rgb(8 29 71 / 16%);
  /* Movimiento: lo que entra arranca rápido y frena suave; lo que se va acelera y sale (y dura menos) */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(.45, 0, .55, 1);
  --ease-spring: cubic-bezier(.3, 1.3, .5, 1);
  --tabs-h: 64px;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #050f26;
    --surface: #0b1c42;
    --surface-2: #0e2350;
    --text: #edf2fc;
    --muted: #a8b6d6;
    --line: #1f3768;
    --link: #8ab4ff;
    --focus: #8ab4ff;
    --accent: #8ab4ff;
    --accent-ink: #061433;
    --fav: #ff5a5f;
    --nuevo: #8ab4ff;
    --chip: #15306a;
    --chip-ink: #e3ebf8;
    --ok-bg: #0f2e1d;  --ok: #8fe0ad;
    --warn-bg: #33270a; --warn: #ffd97a;
    --info-bg: #13285a; --info: #c9d8f6;
    --err-bg: #3a1414; --err: #ffaaaa;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }  /* que "hidden" oculte siempre, aunque la clase diga display: flex */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 16px/1.55 "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.25rem); font-weight: 800; }
h2 { font-size: var(--t-md); font-weight: 600; }
p { margin: 0 0 1rem; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.i { pointer-events: none; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--yellow); color: var(--blue-900); padding: .5rem 1rem; border-radius: 8px; font-weight: 700; }
.skip:focus { left: 8px; }

.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.center { text-align: center; }
.lead { color: var(--muted); font-size: var(--t-base); }
.eyebrow { display: inline-block; font-size: var(--t-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-600); margin-bottom: .35rem; }
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--accent); } }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--blue-800); color: #fff;
  border-bottom: 4px solid var(--yellow);
  padding-top: env(safe-area-inset-top);
}
.top-in { max-width: 1160px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.5rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; margin-right: auto; }
.logo { --lg-body: var(--blue-800); --lg-ring: #fff; --lg-lens: var(--blue-800); --lg-btn: var(--yellow);
  --lg-mane: var(--yellow); --lg-face: #fff3cf; --lg-ink: var(--blue-800); flex: none; }
.lg-body { fill: var(--lg-body); } .lg-ring { fill: var(--lg-ring); } .lg-lens { fill: var(--lg-lens); } .lg-btn { fill: var(--lg-btn); }
.lg-mane { fill: var(--lg-mane); } .lg-face { fill: var(--lg-face); } .lg-ink { fill: var(--lg-ink); stroke: var(--lg-ink); }
.lg-ink path[fill="none"] { fill: none; }
.brand .logo { --lg-body: #fff; --lg-ring: var(--yellow); width: 40px; height: 40px; }
.brand-logo { height: 40px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text b { font-size: 1.35rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.brand-text small { font-size: var(--t-xs); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--yellow); margin-top: .2rem; }
.brand-text small [lang=he] { letter-spacing: 0; margin-left: .3rem; font-size: var(--t-sm); }

.top-nav { display: flex; gap: .25rem; }
.top-nav a {
  color: #dbe5f7; text-decoration: none; font-weight: 500; font-size: var(--t-base);
  padding: .55rem .8rem; border-radius: 999px; transition: background .2s var(--ease), color .2s var(--ease);
}
.top-nav a:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.top-nav a[aria-current=page] { background: var(--yellow); color: var(--blue-900); font-weight: 700; }
.top-me { display: flex; align-items: center; gap: .35rem; }
.me-link { display: inline-flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; padding: .25rem .7rem .25rem .25rem; border-radius: 999px; font-weight: 500; }
.me-link:hover, .me-link[aria-current=page] { background: rgb(255 255 255 / 12%); }
.me-link .avatar { box-shadow: 0 0 0 2px rgb(255 255 255 / 70%); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; color: #dbe5f7; }
.icon-btn:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.icon-btn.bell[aria-current=page] { background: rgb(255 255 255 / 14%); color: #fff; }

/* ---------------------------------------------------------------- tabs (móvil) */
.tabs { display: none; }
@media (max-width: 760px) {
  .top-nav, .me-name { display: none; }
  .top-in { gap: .5rem; }
  .has-tabs { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
  .tabs {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 40;
    background: var(--blue-900); border-top: 1px solid rgb(255 255 255 / 8%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--tabs-h); color: #a9bbdf; text-decoration: none; font-size: var(--t-xs); font-weight: 500;
    position: relative; transition: color .2s var(--ease);
  }
  .tabs a .i { width: 22px; height: 22px; position: relative; }
  /* El ícono va sobre una píldora; la de la pestaña activa se desliza de una pestaña a la otra al cambiar */
  .tabs .tab-i { position: relative; display: grid; place-items: center; width: 56px; height: 30px; transition: transform .15s var(--ease); }
  .tabs .pill { position: absolute; inset: 0; border-radius: 999px; background: rgb(255 199 44 / 16%); opacity: 0; }
  .tabs a[aria-current=page] .pill { opacity: 1; view-transition-name: tab-pill; }
  .tabs a[aria-current=page] { color: var(--yellow); font-weight: 600; }
  .tabs a[aria-current=page] .i { fill: currentColor; fill-opacity: .28; stroke-width: 2.2; }
  /* Al tocar: se hunde en el momento, y queda marcada mientras llega la pantalla */
  .tabs a:active .tab-i, .tabs a.yendo .tab-i { transform: scale(.88); }
  .tabs a.yendo { color: #fff; }
}

/* ---------------------------------------------------------------- layout */
main { flex: 1; width: 100%; margin: 0 auto; padding: 1.75rem 1rem 2.5rem; }
main.narrow { max-width: 560px; }
main.wide { max-width: 1160px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .35rem 0 0; }
/* Actualizar: arriba, al lado del título. En el celular es solo el ícono; con fotos nuevas muestra el texto y flota */
.page-head .actualizar { margin-left: auto; }
@media (max-width: 760px) {
  .page-head { flex-wrap: nowrap; align-items: center; }
  .page-head .actualizar:not(.hay) { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .page-head .actualizar:not(.hay) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.page-head .actualizar.hay { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top)); box-shadow: var(--shadow-lg); }
/* Agregar fotos de la galería: un + blanco sobre azul, al lado de Actualizar */
.page-head .subir { margin: 0; flex: none; }
.page-head .actualizar.hay + .subir { margin-left: auto; }  /* Actualizar se fue a flotar arriba */
.agregar { width: 44px; height: 44px; padding: 0; position: relative; }
.agregar .i { width: 22px; height: 22px; stroke-width: 2.6; }
.agregar:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.agregar.subiendo { pointer-events: none; }
.agregar.subiendo .i { animation: latido 1.2s ease-in-out infinite; }
/* Seleccionar varias fotos para guardarlas juntas: en el celular es solo el ícono, como Actualizar */
.seleccionar { flex: none; }
@media (max-width: 760px) {
  .seleccionar { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .seleccionar span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.eligiendo .seleccionar { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Eligiendo: un círculo en cada foto, que se llena con la tilde al marcarla */
.grid a.photo { -webkit-touch-callout: none; }
.eligiendo .grid a.photo { user-select: none; -webkit-user-select: none; }
.eligiendo .grid a.photo::after {
  content: ""; position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 999px;
  border: 2px solid #fff; background: rgb(6 20 51 / 30%); box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
  transition: background-color .15s var(--ease), transform .15s var(--ease);
}
.eligiendo .grid a.photo.elegida::after {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat;
  transform: scale(1.08);
}
.eligiendo .grid a.photo img { transition: scale .15s var(--ease), opacity .15s var(--ease); }
.eligiendo .grid a.photo.elegida { outline-color: var(--accent); transition-duration: .15s; }
.eligiendo .grid a.photo.elegida img { scale: .92; }
.sel-bar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .5rem; width: min(520px, calc(100% - 32px)); padding: .45rem .5rem;
  border-radius: 18px; background: var(--blue-900); color: #fff; box-shadow: 0 8px 30px rgb(0 0 0 / 35%);
}
@media (max-width: 760px) { .sel-bar { bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom)); } }
.sel-bar[hidden] { display: none; }
.sel-bar .sel-x { width: 44px; height: 44px; padding: 0; justify-content: center; border: 0; background: transparent; color: #dbe5f7; }
.sel-bar .sel-x:hover { background: rgb(255 255 255 / 8%); border: 0; }
.sel-bar .sel-n { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sel-bar .primary { min-height: 44px; }
/* "No soy yo": las otras fotos de la misma selfie, todas marcadas para sacar */
.misma-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.misma-head h1 { margin: 0 0 .35rem; }
.misma-head p { margin: 0; max-width: 60ch; }
.misma-selfie { flex: none; width: 72px; height: 72px; border-radius: 999px; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line); }
label.photo.pick { position: relative; display: block; cursor: pointer; -webkit-touch-callout: none; }
label.photo.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
label.photo.pick:has(input:focus-visible) { outline-color: var(--focus); }
label.photo.pick img { transition: scale .15s var(--ease), opacity .15s var(--ease); }
label.photo.pick::after {
  content: ""; position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 999px;
  border: 2px solid #fff; background: rgb(6 20 51 / 30%); box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
}
label.photo.pick:has(input:checked) { outline-color: var(--accent); transition-duration: .15s; }
label.photo.pick:has(input:checked) img { scale: .92; }
label.photo.pick:has(input:checked)::after {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
label.photo.pick:not(:has(input:checked)) img { opacity: .55; }
.misma-bar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; display: flex; justify-content: flex-end; gap: .6rem;
  width: fit-content; margin: 0 0 1rem auto; padding: .45rem; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); }
@media (max-width: 760px) { .misma-bar { bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom)); width: auto; margin-left: 0; }
  .misma-bar > * { flex: 1; justify-content: center; } }
.subir-estado { margin: -.25rem 0 1rem; color: var(--muted); font-size: var(--t-sm); text-align: right; }
@media (max-width: 760px) { .subir-estado { text-align: left; } }

/* Mientras recarga, el ícono gira hasta que llega la pantalla nueva (y no se puede volver a tocar) */
.actualizar.girando { pointer-events: none; }
.actualizar.girando .i { animation: girar .8s linear infinite; }
@keyframes girar { to { rotate: 360deg; } }

.foot {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4rem 1.1rem;
  padding: 1.25rem 1rem 1.5rem; font-size: var(--t-sm); color: var(--muted); border-top: 1px solid var(--line);
}
.foot a { color: var(--muted); }
.tel-jai { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-700); font-size: var(--t-xs); }
@media (prefers-color-scheme: dark) { .tel-jai { color: var(--yellow); } }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem; margin-bottom: 1.25rem;
}
.card > h2:first-child { display: flex; align-items: center; gap: .5rem; }
.card > h2 .i { color: var(--blue-600); }
@media (prefers-color-scheme: dark) { .card > h2 .i { color: var(--accent); } }
.card.danger { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); }
.card.danger > h2 { color: var(--err); }
.card.danger > h2 .i { color: var(--err); }

/* ---------------------------------------------------------------- notices */
.notice {
  display: flex; gap: .7rem; align-items: flex-start;
  border-radius: var(--radius-sm); padding: .85rem 1rem; margin-bottom: 1.25rem; border: 1px solid transparent;
}
.notice .i { margin-top: 2px; }
.notice p { margin: 0; }
.notice p + p { margin-top: .3rem; }
.notice a { color: inherit; font-weight: 600; }
.notice.ok    { background: var(--ok-bg);   color: var(--ok); }
.notice.warn  { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--yellow) 50%, transparent); }
.notice.info  { background: var(--info-bg); color: var(--info); }
.notice.error { background: var(--err-bg);  color: var(--err); }

/* ---------------------------------------------------------------- forms */
label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: var(--t-base); }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: .4rem; min-height: 48px; padding: .7rem .9rem;
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; min-height: 84px; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--blue-600) 40%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-600) 20%, transparent); }
@media (prefers-color-scheme: dark) {
  input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
}
input[type=file] { display: block; margin-top: .45rem; font: inherit; font-weight: 400; max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: .75rem; padding: .55rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text);
}
fieldset { border: 0; margin: 1.5rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--line); min-width: 0; }
fieldset[hidden] { display: none; }
legend { font-weight: 600; padding: 0; margin-bottom: .6rem; font-size: var(--t-base); }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: .45rem; border-radius: 999px; background: var(--blue-800); color: var(--yellow); font-size: var(--t-sm); font-weight: 800; vertical-align: 2px; }

.choice { display: flex; gap: .6rem; flex-wrap: wrap; }
.field-label { font-weight: 600; font-size: var(--t-base); margin: 0 0 .4rem; }
.field-label + .choice { margin-bottom: 1rem; }
.choice.choice-3 label { min-width: 0; padding-inline: .7rem; }
.hijo-card { padding: 1rem 1rem .1rem; margin-bottom: .75rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.hijo-head { display: flex; align-items: center; justify-content: space-between; margin: -.35rem 0 .5rem; }
.hijo-head button[hidden] { display: none; }
.choice label {
  flex: 1; min-width: 120px; margin: 0; display: flex; align-items: center; gap: .6rem; cursor: pointer; min-height: 48px;
  padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-weight: 500;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice label:has(input:checked) { border-color: var(--blue-600); background: var(--info-bg); }
@media (prefers-color-scheme: dark) { .choice label:has(input:checked) { border-color: var(--accent); } }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--blue-700); cursor: pointer; }
@media (prefers-color-scheme: dark) { input[type=radio], input[type=checkbox] { accent-color: var(--accent); } }

label.check {
  display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; cursor: pointer;
  padding: .85rem .95rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .65rem;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
label.check input { margin-top: 2px; }
label.check:has(input:checked) { border-color: var(--blue-600); background: var(--info-bg); }
@media (prefers-color-scheme: dark) { label.check:has(input:checked) { border-color: var(--accent); } }
label.check em { color: var(--muted); font-style: normal; font-size: var(--t-sm); }
label.check.optional { border-style: dashed; }
.req, .opt { font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-left: .3rem; white-space: nowrap; }
.req { color: var(--err); }
.opt { color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.15rem; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: var(--t-base); line-height: 1.2; text-decoration: none;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease),
              scale .12s var(--ease);
}
button:hover, .button:hover { border-color: var(--blue-600); }
/* Al apretar se hunde apenas: en el celular es la única señal de que se tocó. Con `scale` y no `transform`, para no
   pisar los botones que se ubican con transform (flechas del visor, volver arriba). */
button:not(:disabled):active, .button:active { box-shadow: inset 0 2px 0 rgb(0 0 0 / 8%); scale: .97; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary, .button.primary { background: var(--yellow); border-color: var(--yellow); color: var(--blue-900); font-weight: 700; }
button.primary:hover, .button.primary:hover { background: var(--yellow-600); border-color: var(--yellow-600); }
button.block, .button.block { width: 100%; min-height: 52px; font-size: var(--t-base); }
button.navy, .button.navy { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
button.navy:hover, .button.navy:hover { background: var(--blue-700); border-color: var(--blue-700); }
@media (prefers-color-scheme: dark) { button.navy, .button.navy { background: var(--blue-600); border-color: var(--blue-600); } }
button.danger { background: var(--err); border-color: var(--err); color: #fff; }
@media (prefers-color-scheme: dark) { button.danger { color: #3a1414; } }
button.link {
  min-height: 36px; padding: .2rem .4rem; background: none; border: 0; border-radius: 6px;
  font-weight: 500; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
button.link:hover { color: var(--text); }
button.link.danger { color: var(--err); background: none; }
button.sm, .button.sm { min-height: 36px; padding: .35rem .85rem; font-size: var(--t-sm); }

/* ---------------------------------------------------------------- auth (login / registro) */
.auth-hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--blue-800); color: #fff;
  margin: -1.75rem -1rem 0; padding: 2.75rem 1.25rem 5.5rem;
}
.auth-hero::before {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -62px; height: 120px; z-index: -1;
  background: var(--yellow); transform: rotate(-4deg);
}
.auth-hero::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -92px; height: 120px; z-index: -1;
  background: var(--bg); transform: rotate(-4deg);
}
.auth-hero .logo.big { position: absolute; right: -24px; top: 12px; width: 210px; height: 210px; z-index: -1; opacity: .13; --lg-body: #fff; --lg-ring: var(--yellow); }
.auth-hero .eyebrow { color: var(--yellow); }
.auth-hero h1 { color: #fff; font-size: clamp(2rem, 1.4rem + 3vw, 2.9rem); font-weight: 900; max-width: 14ch; }
.auth-hero h1 em { font-style: normal; color: var(--yellow); }
.auth-hero p { color: #cfdcf3; max-width: 38ch; margin: 0; }
.auth-card { position: relative; margin-top: -2.5rem; }
.auth-alt { text-align: center; color: var(--muted); }
.auth-alt a { font-weight: 600; }
.trust { display: flex; gap: .5rem; align-items: flex-start; font-size: var(--t-sm); color: var(--muted); margin: .9rem 0 0; }
.trust .i { width: 18px; height: 18px; color: var(--ok); margin-top: 1px; }
@media (min-width: 761px) {
  .auth-hero { margin: -1.75rem calc(50% - 50vw) 0; padding: 3.5rem max(1.25rem, calc(50vw - 280px + 1.25rem)) 6.5rem; }
}

/* ---------------------------------------------------------------- selfies */
.tips { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; padding: 0; margin: 0 0 1.25rem; list-style: none; }
.tips li { display: flex; gap: .55rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .8rem; font-size: var(--t-sm); }
.tips .i { width: 18px; height: 18px; color: var(--ok); margin-top: 2px; }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  min-height: 170px; margin: 0; border: 2px dashed color-mix(in srgb, var(--blue-600) 45%, var(--line)); border-radius: var(--radius);
  cursor: pointer; text-align: center; color: var(--muted); font-weight: 500; background: var(--surface-2);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.drop .i { width: 34px; height: 34px; color: var(--blue-600); }
@media (prefers-color-scheme: dark) { .drop .i { color: var(--accent); } }
.drop b { color: var(--text); font-size: var(--t-base); }
.drop:hover, .drop:focus-within { border-color: var(--blue-600); background: var(--info-bg); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* Selfies: guía (sí / no) y revisión de cada foto al elegirla */
.guia .tips { margin: .75rem 0; gap: .45rem .9rem; }
.guia .tips li { background: none; border: 0; padding: 0; font-size: var(--t-sm); line-height: 1.35; }
.guia .tips.no { padding-top: .75rem; border-top: 1px solid var(--line); }
.tips.no .i { color: var(--err); }
.revision { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .75rem; margin: 1rem 0 .5rem; }
.revision:empty { display: none; }
.rev { margin: 0; display: grid; gap: .3rem; align-content: start; }
.rev img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--line); }
.rev figcaption { font-size: var(--t-xs); line-height: 1.3; color: var(--muted); }
.rev.revisando img { opacity: .55; animation: latido 1.2s ease-in-out infinite; }
.rev.bien img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok); }
.rev.bien figcaption { color: var(--ok); font-weight: 700; }
.rev.mal img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--err); opacity: .7; }
.rev.mal figcaption { color: var(--err); }
.ok-text { color: var(--ok); font-weight: 600; }
.err-text { color: var(--err); font-weight: 600; }
@keyframes latido { 50% { opacity: .3; } }
.previews { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin: 1rem 0; }
.previews:empty { display: none; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--yellow); }

/* Selfies: las guardadas con X para sacarlas, las nuevas se suman y se recortan */
.sf-ayuda { margin: 0 0 .75rem; }
.sf-ayuda .i { width: 14px; height: 14px; vertical-align: -2px; }
.sf-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .9rem .75rem; margin: 0 0 1rem; }
.sf-grilla .rev { position: relative; }
.sf-sin { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius-sm); background: var(--chip); color: var(--muted); }
.sf-sin .i { width: 34px; height: 34px; }
.sf-x { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 30px; height: 30px; min-height: 0; padding: 0;
  border: 2px solid var(--surface); border-radius: 50%; background: var(--blue-900); color: #fff; box-shadow: var(--shadow); }
.sf-x .i { width: 15px; height: 15px; }
.rev.quitada img, .rev.quitada .sf-sin { opacity: .3; filter: grayscale(1); }
.rev.quitada figcaption { color: var(--err); font-weight: 700; }
.rev.quitada .sf-x { background: var(--ok); }
.sf-foto { position: relative; display: block; width: 100%; padding: 0; min-height: 0; border: 0; background: none; border-radius: var(--radius-sm); }
.sf-foto img { display: block; }
.sf-tijera { position: absolute; left: 4px; bottom: 4px; padding: .1rem .4rem; border-radius: 999px; font-size: var(--t-xs); font-weight: 700;
  background: rgb(5 11 26 / 70%); color: #fff; }
.sf-agregar { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  aspect-ratio: 1; border: 2px dashed color-mix(in srgb, var(--blue-600) 45%, var(--line)); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; font-size: var(--t-sm); }
.sf-agregar[hidden] { display: none; }
.sf-agregar .i { width: 28px; height: 28px; color: var(--blue-600); }
@media (prefers-color-scheme: dark) { .sf-agregar .i { color: var(--accent); } }
.sf-agregar b { color: var(--text); }
.sf-agregar:hover, .sf-agregar:focus-within { border-color: var(--blue-600); background: var(--info-bg); }
.sf-agregar input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sf-agregar:only-child { grid-column: 1 / -1; aspect-ratio: auto; min-height: 170px; border-radius: var(--radius); font-size: var(--t-sm); }
.sf-agregar:only-child b { font-size: var(--t-base); }
dialog.recorte { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
  border: 0; background: #050b1a; color: #fff; }
dialog.recorte[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.rc-titulo { margin: 0; text-align: center; font-weight: 600; max-width: 32rem; }
.rc-area { position: relative; line-height: 0; touch-action: none; user-select: none; }
.rc-area img { max-width: calc(100vw - 2rem); max-height: 68vh; max-height: 68dvh; }
.rc-caja { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(5 11 26 / 62%); cursor: move; touch-action: none; }
.rc-area { overflow: hidden; }
.rc-tirador { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-right: 6px solid #fff; border-bottom: 6px solid #fff; filter: drop-shadow(0 0 2px rgb(0 0 0 / 80%)); cursor: nwse-resize; }
.rc-botones { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

/* ---------------------------------------------------------------- galería */
.count {
  display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .55rem; margin-left: .35rem;
  font-size: var(--t-base); font-weight: 700; border-radius: 999px; background: var(--chip); color: var(--chip-ink); vertical-align: 6px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.5rem; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; } }
.photo {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); outline: 3px solid transparent; outline-offset: 2px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), scale .15s var(--ease), outline-color .8s ease;
  animation: rise .35s var(--ease) both;
}
/* Solo con mouse: en el celular el hover queda pegado después de tocar y la tarjeta quedaba levantada */
@media (hover: hover) { .photo:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); } }
a.photo:active { scale: .97; }
/* La foto que se acaba de ver se marca al toque y se apaga despacio */
.photo.recien-visto { outline-color: var(--accent); transition-duration: .25s, .25s, .15s, .2s; }
.photo > a { display: block; }
.photo img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: var(--chip); }
.photo figcaption { padding: .55rem .7rem .6rem; font-size: var(--t-sm); }
.photo .names { display: block; font-weight: 600; color: var(--text); margin-bottom: .2rem; line-height: 1.3; }
.photo .album { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo .actions { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .2rem; }
.photo .actions a { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; text-decoration: none; min-height: 36px; }
.photo .actions a .i { width: 15px; height: 15px; }
.photo .actions form { display: inline; }
.photo button.link { font-size: var(--t-sm); white-space: nowrap; }
.photo .actions a { white-space: nowrap; }
/* Escalonado corto: con más demora las fotos aparecían bastante después que el resto de la pantalla */
.grid .photo:nth-child(2) { animation-delay: .02s; } .grid .photo:nth-child(3) { animation-delay: .04s; }
.grid .photo:nth-child(4) { animation-delay: .06s; } .grid .photo:nth-child(n+5) { animation-delay: .08s; }
/* Con `translate`: si animara `transform`, al quedar fijo al final anulaba el levantarse del hover */
@keyframes rise { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: none; } }
/* Las fotos aparecen suaves cuando terminan de bajar, en vez de pintarse de golpe (la clase la pone base.html) */
:is(.grid, .album-grid) img { transition: opacity .35s var(--ease); }
.js :is(.grid, .album-grid) img:not(.listo) { opacity: 0; }

.empty {
  text-align: center; color: var(--muted); padding: 2.5rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); margin-bottom: 1.5rem;
}
.empty .logo { display: block; margin: 0 auto .75rem; --lg-body: var(--line); --lg-lens: var(--line); --lg-btn: var(--line); --lg-ring: var(--bg); }
.empty b { display: block; color: var(--text); font-size: var(--t-base); margin-bottom: .25rem; }
.progress { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; margin: .6rem 0 .3rem; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
@media (max-width: 420px) { .stats { gap: .6rem; } .stats b { font-size: 1.6rem !important; } .stats > div { padding: .9rem .9rem .9rem 1.15rem !important; } }
.stats > div {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.1rem 1.4rem; box-shadow: var(--shadow);
}
.stats > div::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--blue-600); }
.stats > div.hl { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
.stats > div.hl::after { background: var(--yellow); }
.stats > div.hl span { color: #cfdcf3; }
.stats b { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: var(--t-sm); }

/* ---------------------------------------------------------------- tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: .7rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: var(--surface-2); }
td.actions { text-align: right; }
td.actions form { display: inline-block; margin: .15rem 0 .15rem .35rem; }
td.who { display: flex; gap: .7rem; align-items: center; }
td.who a { font-weight: 600; color: var(--text); text-decoration: none; }
td.who a:hover { text-decoration: underline; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-weight: 600; letter-spacing: .04em; }
.code-big { display: inline-block; font-size: var(--t-md); padding: .3rem .7rem; border-radius: 8px; background: var(--chip); color: var(--chip-ink); user-select: all; }
.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.row label { margin-bottom: 0; }
.row .grow { flex: 1; min-width: 200px; }
.row input[type=number] { width: 100px; }

.tag { display: inline-block; font-size: var(--t-xs); font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--chip); color: var(--chip-ink); margin: .1rem .2rem .1rem 0; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.gold { background: var(--blue-800); color: #fff; }

table.weeks td { white-space: nowrap; }
table.weeks .bar { display: inline-block; height: 10px; min-width: 3px; border-radius: 999px; background: var(--blue-600); vertical-align: middle; margin-right: .5rem; max-width: calc(100% - 2.75rem); }
table.weeks .bar.new { background: var(--yellow); }
table.weeks .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend { display: flex; gap: 1rem; font-size: var(--t-sm); color: var(--muted); margin-bottom: .5rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; background: var(--blue-600); }
.legend i.new { background: var(--yellow); }

@media (max-width: 640px) {
  table.users thead { display: none; }
  table.users tr { display: block; padding: .75rem 0; border-bottom: 1px solid var(--line); }
  table.users td { display: block; border: 0; padding: .2rem 0; }
  table.users td.who { display: flex; }
  table.users td.actions { text-align: left; }
  table.users td.actions form { margin: .3rem .4rem 0 0; }
}

/* ---------------------------------------------------------------- cuenta */
.data { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.25rem; margin: 0 0 1rem; }
.data dt { color: var(--muted); font-size: var(--t-sm); }
.data dd { margin: 0; font-weight: 500; }
@media (max-width: 480px) { .data { grid-template-columns: 1fr; gap: .1rem; } .data dd { margin-bottom: .55rem; } }

/* ---------------------------------------------------------------- perfil */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; background: var(--chip); }
/* Elegir la foto de perfil entre las fotos donde aparece */
.elegir-perfil { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .4rem; margin: .75rem 0 1rem; }
.elegir-perfil button { display: block; width: 100%; padding: 0; min-height: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--chip); }
.elegir-perfil img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
/* Encuadre de la foto de perfil: la foto se mueve y se agranda debajo de un círculo fijo */
dialog.encuadre { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
  border: 0; background: #050b1a; color: #fff; }
dialog.encuadre[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; }
dialog.encuadre h2 { margin: 0; color: #fff; }
.enc-ayuda { margin: 0; color: #cfdcf3; font-size: var(--t-sm); text-align: center; }
.enc-marco { position: relative; width: min(88vw, 56vh, 420px); width: min(88vw, 56dvh, 420px); aspect-ratio: 1; overflow: hidden;
  touch-action: none; user-select: none; cursor: grab; background: #0d1830; border-radius: 12px; }
.enc-marco:active { cursor: grabbing; }
.enc-marco img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
/* El círculo: todo lo de afuera, oscurecido */
.enc-marco::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgb(5 11 26 / 62%); outline: 2px solid rgb(255 255 255 / 85%); outline-offset: -2px; pointer-events: none; }
.enc-cargando { position: absolute; inset: 0; display: none; place-items: center; color: #cfdcf3; font-size: var(--t-sm); }
.enc-marco.cargando .enc-cargando { display: grid; }
.enc-zoom { display: flex; align-items: center; gap: .6rem; width: min(88vw, 420px); margin: 0; color: #cfdcf3; }
.enc-zoom input { flex: 1; accent-color: var(--yellow); }
.enc-error { margin: 0; color: #ffb4a8; font-weight: 600; text-align: center; }
.enc-botones { display: flex; gap: .6rem; }
.enc-botones button { min-width: 8rem; }
#perfil-form [data-open="sheet-mias"] { margin: -.25rem auto .5rem; }
/* Foto de perfil que se toca para verla grande */
.avatar-btn { display: inline-block; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: none; min-height: 0; cursor: zoom-in; }
.avatar-btn:hover { background: none; }
.avatar-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
dialog.foto-grande { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(5 11 26 / 92%); display: grid; place-items: center; }
dialog.foto-grande:not([open]) { display: none; }
dialog.foto-grande img { width: min(92vw, 92vh, 720px); aspect-ratio: 1; border-radius: 18px; object-fit: cover; background: var(--chip); }
dialog.foto-grande .v-btn { position: absolute; top: calc(.75rem + env(safe-area-inset-top)); right: .75rem; color: #fff; }
dialog.foto-grande { transition: opacity .25s var(--ease), overlay .25s allow-discrete, display .25s allow-discrete; }
dialog.foto-grande img { transition: scale .3s var(--ease), opacity .25s var(--ease); }
dialog.foto-grande:not([open]) { opacity: 0; transition-duration: .18s; }
dialog.foto-grande:not([open]) img { scale: .7; opacity: 0; transition-timing-function: var(--ease-in); }
@starting-style {
  dialog.foto-grande[open] { opacity: 0; }
  dialog.foto-grande[open] img { scale: .6; opacity: 0; }
}
.avatar.ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ph-ink); background: var(--ph-bg); }
.ph.c0 { --ph-bg: #ffd9d6; --ph-ink: #7a1d14; } .ph.c1 { --ph-bg: #ffe6c7; --ph-ink: #7a4100; }
.ph.c2 { --ph-bg: #fff1b8; --ph-ink: #5c4700; } .ph.c3 { --ph-bg: #d6f2dc; --ph-ink: #145c2b; }
.ph.c4 { --ph-bg: #cfeff0; --ph-ink: #0d5457; } .ph.c5 { --ph-bg: #d8e6ff; --ph-ink: #123f8c; }
.ph.c6 { --ph-bg: #e6dcff; --ph-ink: #4a2a8f; } .ph.c7 { --ph-bg: #ffd9ec; --ph-ink: #80174d; }
@media (prefers-color-scheme: dark) {
  .avatar.ph { color: var(--ph-bg); background: var(--ph-ink); }
}
.profile-card { position: relative; overflow: hidden; padding: 0; text-align: center; }
.profile-card .banner { height: 96px; background: var(--blue-800); position: relative; }
.profile-card .banner .logo { position: absolute; right: 14px; top: 10px; width: 76px; height: 76px; opacity: .2; --lg-body: #fff; --lg-ring: var(--yellow); }
.profile-card .who { position: relative; margin-top: -48px; padding: 0 1.25rem 1.35rem; }
.profile-card .avatar { box-shadow: 0 0 0 5px var(--surface); }
.profile-card h1, .profile-card h2 { margin: .7rem 0 .25rem; }
.bio { font-size: var(--t-md); font-weight: 500; color: var(--text); max-width: 36ch; margin: .25rem auto 0; }
.bio::before { content: "“"; color: var(--muted); font-weight: 800; }
.bio::after { content: "”"; color: var(--muted); font-weight: 800; }
.profile-card .song-wrap { margin: 1rem auto 0; max-width: 460px; }
.profile-card .facts { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .6rem; }
.profile-card .facts li { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: var(--t-sm); }
.profile-card .facts b { color: var(--text); }
.profile-card .edit-btn { margin-top: 1.1rem; }
.profile-card .edit-btn[hidden] { display: none; }
iframe.song { display: block; width: 100%; border: 0; border-radius: 12px; margin-bottom: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.who[hidden] { display: none; }
/* Editar perfil en el lugar: la tarjeta es la misma, cada dato se edita donde se muestra */
.editing .avatar-edit { position: relative; display: inline-block; cursor: pointer; margin: 0; border-radius: 50%; }
.editing .avatar-edit:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-600) 35%, transparent); }
.editing .avatar-cam { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--blue-700); color: #fff; box-shadow: 0 0 0 3px var(--surface); }
.editing #foto-nombre { margin: .35rem 0 0; }
.editing label.check.inline { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; margin: .5rem 0 0;
  border-radius: 999px; font-size: var(--t-sm); }
.editing label.check.inline input { margin: 0; width: 16px; height: 16px; }
.editing .bio-edit { position: relative; display: block; max-width: 420px; margin: .4rem auto 0; font-weight: 400; }
.editing .bio-edit textarea { min-height: 0; margin: 0; text-align: center; font-size: var(--t-base); font-weight: 500; resize: none; }
.editing .bio-edit small { position: absolute; right: .6rem; bottom: .35rem; color: var(--muted); font-size: var(--t-xs); }
.facts-edit { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: .9rem 0 .2rem; }
.facts-edit label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .2rem .3rem .2rem .75rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: var(--t-sm); font-weight: 400; }
.facts-edit select { margin: 0; width: auto; min-height: 34px; padding: .2rem 1.8rem .2rem .55rem; border-radius: 999px; font-size: var(--t-sm);
  font-weight: 600; color: var(--text); }
.song-edit { text-align: left; }
.song-edit .search-song { margin: .5rem 0 .25rem; }
.song-edit .search-song button { flex: none; }
.song-edit details.paste { margin-top: .25rem; }
.song-edit details.paste input { margin: .25rem 0 0; }
.edit-actions { display: flex; gap: .6rem; justify-content: center; margin-top: 1.25rem; }
.edit-actions > * { flex: 1; max-width: 200px; }
.track-opt { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; margin: 0; cursor: pointer; font-weight: 400; }
.track-opt input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--blue-700); }
.tracks li:has(input:checked) { background: var(--chip); border-radius: 10px; }
.search-song { display: flex; gap: .5rem; margin: .75rem 0; align-items: center; }
.search-song input { flex: 1; margin: 0; }
.tracks { list-style: none; padding: 0; margin: 0 0 1rem; }
.tracks li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.tracks img, .cover-ph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--chip); }
.t-info { flex: 1; min-width: 0; }
.t-info b, .t-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-info small { color: var(--muted); }
details.paste summary { cursor: pointer; color: var(--muted); font-weight: 500; min-height: 40px; display: flex; align-items: center; }

/* ---------------------------------------------------------------- equipo */
.search-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .9rem; }
.search-head .field { position: relative; flex: 1; margin: 0; }
.search-head .field .i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-head input { margin: 0; padding-left: 2.6rem; }
.people { max-height: 340px; overflow-y: auto; margin-bottom: 1.1rem; padding: 4px; }
.kv-gente { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.kv-grupo + .kv-grupo { margin-top: .9rem; }
.kv-titulo { position: sticky; top: 0; z-index: 1; padding: .2rem .25rem; margin-bottom: .25rem; background: var(--surface); color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.person {
  position: relative; display: flex; align-items: center; gap: .6rem; margin: 0; min-height: 48px; padding: .4rem .8rem .4rem .45rem;
  border: 1.5px solid var(--line); border-radius: 999px; font-weight: 500; cursor: pointer; background: var(--surface);
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.person[hidden] { display: none; }
.person input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.person:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.person:hover { border-color: var(--blue-600); }
.person:has(input:checked) { border-color: var(--blue-800); background: var(--blue-800); color: #fff; }
.person:has(input:checked) small { color: #cfdcf3; }
.person:has(input:checked) .avatar { box-shadow: 0 0 0 2px #fff; }
@media (prefers-color-scheme: dark) { .person:has(input:checked) { background: var(--blue-600); border-color: var(--accent); } }
.person .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Sugeridos de "Pasar": solo la foto de perfil, redonda; elegida, con un aro y la tilde */
.caras-sug { display: flex; gap: .9rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.person.cara, .person.cara:hover, .person.cara:has(input:checked) { padding: 0; min-height: 0; border: 0; border-radius: 999px; background: none; }
.person.cara .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px transparent; transition: box-shadow .15s var(--ease), scale .15s var(--ease); }
.person.cara:hover .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line); }
.person.cara:has(input:checked) .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); scale: .94; }
.person.cara:has(input:checked)::after {
  content: ""; position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--surface);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.buscador .paso:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.buscador .paso legend .muted { font-weight: 400; }
.buscador .people { margin-bottom: 0; }
.buscador .sin-match { margin: .5rem 0; }
.buscador .filtros { gap: 1rem; }
.buscador .filtros .grow { flex: 1 1 220px; }
.buscador .filtros select { margin-bottom: 0; }
.buscar-btn { margin-top: 1.5rem; }
@media (max-width: 600px) { .buscar-btn { width: 100%; justify-content: center; } }
.resultados p { margin: .15rem 0 0; }

/* ---------------------------------------------------------------- legales */
.legal { line-height: 1.65; }
.legal h2 { margin-top: 1.75rem; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .45rem; }

/* ---------------------------------------------------------------- utilidades móviles */
.show-m { display: none; }
@media (max-width: 760px) {
  .hide-m { display: none !important; }
  .show-m { display: block; }
  .top-me .me-link { display: none; }
}
.badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--badge); color: #fff; font-size: var(--t-xs); font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--blue-800);
}
.icon-btn { position: relative; }
.tabs a .badge { top: 6px; right: calc(50% - 22px); box-shadow: 0 0 0 2px var(--blue-900); }
.back { display: inline-flex; align-items: center; gap: .2rem; font-weight: 600; text-decoration: none; margin-bottom: .5rem; min-height: 40px; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.mini-card { max-width: 420px; }

/* ---------------------------------------------------------------- filtros */
.seg {
  display: flex; gap: .25rem; padding: .3rem; margin-bottom: 1rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .4rem .95rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--t-sm); white-space: nowrap;
}
.seg button { background: none; border: 0; box-shadow: none; cursor: pointer; }  /* las del selector de foto de perfil */
.seg a .i, .seg button .i { width: 17px; height: 17px; }
.seg a small { font-weight: 600; opacity: .8; }
.seg a[aria-current=page], .seg button[aria-pressed=true] { background: var(--blue-800); color: #fff; }
@media (prefers-color-scheme: dark) { .seg a[aria-current=page], .seg button[aria-pressed=true] { background: var(--blue-600); } }
@media (max-width: 480px) { .seg { width: 100%; } .seg a, .seg button { flex: 1; justify-content: center; padding: .4rem .5rem; } }
.chips { display: flex; gap: .45rem; overflow-x: auto; padding: 2px 2px .75rem; margin: 0 -1rem 0 0; scrollbar-width: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .3rem .85rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-size: var(--t-sm); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.chip small { color: var(--muted); font-weight: 600; }
.chip.on { background: var(--blue-800); border-color: var(--blue-800); color: #fff; font-weight: 700; }
.chip.on small { color: #cfdcf3; }
@media (prefers-color-scheme: dark) { .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .chip.on small { color: var(--accent-ink); } }

/* ---------------------------------------------------------------- grilla (fotos como links al visor) */
a.photo { position: relative; display: block; text-decoration: none; color: inherit; }
a.photo img { border-radius: 0; }
.fav-dot {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px;
  background: rgb(6 20 51 / 65%); color: var(--fav);
}
.fav-dot .i { width: 17px; height: 17px; fill: currentColor; }
.from-chip, .names-chip {
  position: absolute; left: 8px; bottom: 8px; right: 8px; display: inline-flex; align-items: center; gap: .3rem; width: fit-content; max-width: calc(100% - 16px);
  padding: .25rem .55rem; border-radius: 999px; background: rgb(6 20 51 / 75%); color: #fff; font-size: var(--t-xs); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.from-chip .i { width: 13px; height: 13px; color: #cfdcf3; }
.names-chip { border-radius: 8px; white-space: normal; line-height: 1.3; }

/* ---------------------------------------------------------------- transiciones entre pantallas */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
/* La pantalla vieja se desvanece mientras la nueva entra subiendo apenas: las dos a la vez, sin un instante en
   blanco, y sin apuro (con menos de un tercio de segundo el cambio se sentía de golpe) */
::view-transition-old(root) { animation: vt-salir .3s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-entrar .45s var(--ease) both; }
@keyframes vt-salir { to { opacity: 0; } }
@keyframes vt-entrar { from { opacity: 0; transform: translateY(12px); } }
/* Entre pestañas la pantalla se corre hacia el costado de la que se eligió (o hacia donde se deslizó el dedo) */
html[data-dir=adelante]::view-transition-old(root) { animation: vt-a-izq .34s var(--ease-in-out) both; }
html[data-dir=adelante]::view-transition-new(root) { animation: vt-desde-der .5s var(--ease) both; }
html[data-dir=atras]::view-transition-old(root) { animation: vt-a-der .34s var(--ease-in-out) both; }
html[data-dir=atras]::view-transition-new(root) { animation: vt-desde-izq .5s var(--ease) both; }
@keyframes vt-a-izq { to { opacity: 0; transform: translateX(-24px); } }
@keyframes vt-a-der { to { opacity: 0; transform: translateX(24px); } }
@keyframes vt-desde-der { from { opacity: 0; transform: translateX(32px); } }
@keyframes vt-desde-izq { from { opacity: 0; transform: translateX(-32px); } }
/* El encabezado y el menú de abajo quedan quietos; solo cambia el contenido, y la píldora del menú viaja */
.top { view-transition-name: top; }
.tabs { view-transition-name: tabs; }
::view-transition-group(tabs) { animation-duration: .45s; }
::view-transition-group(tab-pill) { animation-duration: .5s; animation-timing-function: var(--ease-spring); }

/* Barrita de "cargando" arriba: aparece solo si la pantalla nueva tarda (más de 0,15 s) */
.cargando-pagina {
  position: fixed; top: env(safe-area-inset-top, 0); left: 0; right: 0; height: 3px; z-index: 100;
  overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.cargando-pagina::before {
  content: ""; position: absolute; inset: 0; width: 30%; background: var(--yellow); border-radius: 3px;
  animation: espera 1s ease-in-out infinite;
}
body.navegando .cargando-pagina { opacity: 1; transition-delay: .15s; }
body.navegando main { opacity: .55; transition: opacity .25s .15s; }
.v-track > #foto { view-transition-name: foto; }
::view-transition-group(foto) { animation-duration: .42s; animation-timing-function: var(--ease); }
::view-transition-old(foto), ::view-transition-new(foto) { height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- visor */
body.viewer { background: #000; color: #eef2fb; }  /* negro de verdad: la foto manda, como en Fotos */
body.viewer .foot, body.viewer .tabs { display: none; }
body.viewer.has-tabs { padding-bottom: 0; }
main.view-main { max-width: 1100px; padding: 0 0 calc(96px + env(safe-area-inset-bottom)); }
.v-top { display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem; }
.v-btn {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 999px;
  color: inherit; background: transparent; border: 0; padding: 0; min-height: 0;
}
.v-btn:hover { background: rgb(255 255 255 / 10%); border: 0; }
.sheet .v-btn { color: var(--text); }
.sheet .v-btn:hover { background: var(--surface-2); }
.v-btn .i { width: 24px; height: 24px; }
.v-title { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.v-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-title small { color: #a9bbdf; }
/* Doble toque: el corazón aparece donde tocaste, late y se va */
.corazon-pop { position: absolute; left: 50%; top: 50%; z-index: 5; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) scale(0); }
.corazon-pop .i { display: block; width: 104px; height: 104px; color: #ff5a5f; fill: #ff5a5f; stroke: #fff; stroke-width: 1;
  filter: drop-shadow(0 4px 18px rgb(0 0 0 / 45%)); }
.corazon-pop.on { animation: corazon .8s cubic-bezier(.2,.8,.3,1) both; }
@keyframes corazon {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  32%  { transform: translate(-50%, -50%) scale(.95); }
  45%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(.9); }
}
@keyframes corazon-suave { 0%, 100% { opacity: 0; transform: translate(-50%, -50%); } 25%, 70% { opacity: 1; transform: translate(-50%, -50%); } }
.v-act.pop .i { animation: latir .45s ease; }
@keyframes latir { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.v-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 50vh; touch-action: pan-y; overflow: hidden; }
.v-track { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50vh; will-change: transform; }
/* Las fotos de al lado, esperando fuera de la pantalla (a 16px, el GAP del visor) */
.v-lado { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.v-lado.izq { transform: translateX(calc(-100% - 16px)); }
.v-lado.der { transform: translateX(calc(100% + 16px)); }
.v-stage img {
  display: block; max-width: 100%; max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px);
  object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 999px; background: rgb(6 20 51 / 60%); color: #fff;
}
.v-nav.prev { left: 12px; } .v-nav.next { right: 12px; }
.v-nav .i { width: 26px; height: 26px; }
@media (hover: none) { .v-nav { display: none; } }
.v-from { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: .75rem 1rem 0; color: #cfdcf3; font-size: var(--t-sm); }
.v-from .i { width: 16px; height: 16px; color: #cfdcf3; }
.v-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; justify-content: center; gap: .25rem;
  padding: .45rem .5rem calc(.45rem + env(safe-area-inset-bottom));
  background: rgb(0 0 0 / 82%); border-top: 1px solid rgb(255 255 255 / 10%); backdrop-filter: blur(12px);
}
.v-bar form { display: contents; }
.v-act {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 60px; padding: .4rem .25rem;
  border: 0; border-radius: 14px; background: transparent; color: #dbe5f7; font-size: var(--t-xs); font-weight: 600;
}
.v-act:hover { background: rgb(255 255 255 / 8%); border: 0; color: #fff; }
.v-act .i { width: 24px; height: 24px; }
.v-act.on { color: #fff; }
.v-act.on .i { color: #ff5a5f; fill: #ff5a5f; }  /* el rojo de favoritas sobre la barra oscura: 5,4:1 */
.v-hint { text-align: center; color: #cfdcf3; font-size: var(--t-sm); margin: .75rem 1rem 0; }
.v-notme { text-align: center; margin-top: .75rem; }
/* Aviso con "Deshacer", arriba de la barra del visor */
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: .75rem; width: max-content; max-width: calc(100vw - 32px);
  padding: .55rem .6rem .55rem 1rem; border-radius: 14px; background: #2b2f38; color: #fff; box-shadow: 0 8px 30px rgb(0 0 0 / 40%);
  font-size: var(--t-base);
  transition: opacity .2s var(--ease), translate .3s var(--ease), display .3s allow-discrete; }
.toast[hidden] { display: none; opacity: 0; translate: 0 12px; transition-timing-function: var(--ease-in); }
@starting-style { .toast:not([hidden]) { opacity: 0; translate: 0 16px; } }
.toast button { min-height: 44px; padding: 0 .8rem; border: 0; border-radius: 10px; background: transparent; color: #8ab4ff; font-weight: 700; }
.toast button:hover { background: rgb(255 255 255 / 8%); border: 0; }
.v-notme button.link { color: #a9bbdf; }

/* ---------------------------------------------------------------- hojas (dialog) */
dialog.sheet {
  width: min(520px, 100%); max-height: 85vh; max-height: 85dvh; margin: auto auto 0; padding: 0 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
  border: 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow-y: auto;
}
@media (min-width: 761px) { dialog.sheet { margin: auto; border-radius: 22px; padding-bottom: 1.25rem; } }
dialog.sheet::backdrop { background: rgb(5 11 26 / 60%); backdrop-filter: blur(2px); }
/* En el celular la hoja sube desde abajo de todo y al cerrarse baja (no desaparece de golpe); en la compu aparece
   en el centro. `overlay` y `display` la dejan en pantalla mientras se va: donde no se puede, se cierra como antes. */
dialog.sheet, dialog.sheet::backdrop {
  transition: translate .34s var(--ease), scale .34s var(--ease), opacity .25s var(--ease), background-color .3s var(--ease),
              overlay .34s allow-discrete, display .34s allow-discrete;
}
dialog.sheet:not([open]) { translate: 0 100%; transition-duration: .22s; transition-timing-function: var(--ease-in); }
dialog.sheet:not([open])::backdrop { background-color: transparent; transition-duration: .22s; }
@starting-style {
  dialog.sheet[open] { translate: 0 100%; }
  dialog.sheet[open]::backdrop { background-color: transparent; }
}
@media (min-width: 761px) {
  dialog.sheet:not([open]) { translate: 0 16px; scale: .97; opacity: 0; }
  @starting-style { dialog.sheet[open] { translate: 0 16px; scale: .97; opacity: 0; } }
}
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 0 .5rem; background: var(--surface); }
.sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
.sheet-head h2 { margin: 0; }
.sheet-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.sheet-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.sheet-list form { margin: 0; }
.sl-name { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; min-width: 0; }
.sl-name .i { color: var(--blue-600); }
@media (prefers-color-scheme: dark) { .sl-name .i { color: var(--accent); } }
.sheet-new { padding-top: .5rem; }
.sheet .field { position: relative; display: block; margin: 0 0 .75rem; }
.sheet .field .i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.sheet .field input { margin: 0; padding-left: 2.6rem; }
.friends { display: grid; gap: .45rem; max-height: 46vh; overflow-y: auto; margin-bottom: 1rem; padding: 3px; }
.friends .person { border-radius: 14px; }

/* ---------------------------------------------------------------- álbumes */
.new-album { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.new-album label { flex: 1; min-width: 200px; margin: 0; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
@media (max-width: 420px) { .album-grid { grid-template-columns: repeat(2, 1fr); gap: .7rem; } }
.album-card {
  position: relative; display: block; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), scale .15s var(--ease);
}
@media (hover: hover) { .album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); } }
.album-card:active { scale: .97; }
.album-card img, .album-empty { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.album-empty { display: grid; place-items: center; background: var(--blue-800); }
.album-empty .logo { opacity: .35; --lg-body: #fff; --lg-ring: var(--yellow); }
.album-info { display: block; padding: .6rem .75rem .7rem; border-top: 1px solid var(--line); }
.album-info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-info small { color: var(--muted); }

/* ---------------------------------------------------------------- avisos */
.feed { list-style: none; padding: 0; margin: 0 0 1.5rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.feed li { position: relative; }
.feed li + li::before { content: ""; position: absolute; top: 0; right: 0; left: calc(1rem + 42px + .85rem); border-top: 1px solid var(--line); }
.feed a {
  display: flex; align-items: center; gap: .85rem; min-height: 64px; padding: .8rem 1rem; background: var(--surface);
  color: inherit; text-decoration: none;
}
.feed a:hover { background: var(--surface-2); }
.feed a > .i { color: var(--muted); }
.feed li.new a { background: color-mix(in srgb, var(--nuevo) 6%, var(--surface)); }
.feed li.new a::after { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--nuevo); }
.feed li:not(.new) .feed-txt b { font-weight: 500; }
.feed-ic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); }
.feed-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.feed-txt span { color: var(--muted); font-size: var(--t-sm); }
.feed-txt small { color: var(--muted); font-size: var(--t-xs); }
.push-card .notice { margin: .5rem 0 1rem; }
/* Mis fotos: cuánto lleva la búsqueda en las fotos viejas */
.buscando { padding: 1rem 1.15rem; }
.bus-titulo { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin: 0 0 .6rem; }
.bus-pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.buscando .small { margin: .6rem 0 0; }
.progress span { transition: width .6s var(--ease); }
/* Todavía sin números: una franja que va y viene */
.progress.espera span { width: 30% !important; animation: espera 1.4s ease-in-out infinite; }
@keyframes espera { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
/* Ya activadas: nada de tarjeta, una línea al final */
.push-mini { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .25rem .5rem; margin-top: 1.5rem;
  color: var(--muted); font-size: var(--t-sm); }
.push-mini[hidden] { display: none; }
.push-mini .i { width: 16px; height: 16px; }
.push-mini button { min-height: 44px; padding: 0 .4rem; font-size: inherit; color: var(--muted); }
.push-card .notice .i { width: 18px; height: 18px; vertical-align: -3px; }

/* ---------------------------------------------------------------- menú del perfil */
.menu-list { padding: .35rem; }
.menu-list a {
  display: flex; align-items: center; gap: .8rem; min-height: 52px; padding: .5rem .8rem; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.menu-list a { position: relative; }
.menu-list a + a { border-radius: 0; }
.menu-list a + a::before { content: ""; position: absolute; top: 0; right: 0; left: calc(.8rem + 22px + .8rem); border-top: 1px solid var(--line); }
.menu-list a:hover { background: var(--surface-2); }
.menu-list a > .i:first-child { color: var(--blue-600); }
@media (prefers-color-scheme: dark) { .menu-list a > .i:first-child { color: var(--accent); } }
.menu-list a span { flex: 1; }
.menu-list a > .i:last-child { color: var(--muted); }
@media (min-width: 761px) { .menu-list { display: none; } }

/* ---------------------------------------------------------------- tnuá: kvutzot, familias */
.choice-tall label { align-items: flex-start; padding: .85rem .95rem; }
.choice-tall label input { margin-top: 3px; }
.choice-tall label span b { display: block; }
.choice-tall label span small { display: block; color: var(--muted); font-weight: 400; font-size: var(--t-sm); }
.chip.kid { padding-left: .3rem; }
.chip.kid .avatar { width: 24px; height: 24px; font-size: var(--t-xs); }
.members { list-style: none; padding: 0; margin: 0; }
.members > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.members > li:last-child { border-bottom: 0; }
.m-who { display: flex; align-items: center; gap: .7rem; min-width: 0; flex: 1 1 220px; }
.m-who > .i { color: var(--blue-600); }
.m-who span { min-width: 0; }
.m-who b { display: block; }
.m-who small { color: var(--muted); }
.m-fam { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.fam-chip {
  display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .2rem .25rem .2rem .65rem; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); font-size: var(--t-sm); font-weight: 600;
}
.fam-chip .i { width: 15px; height: 15px; }
.fam-chip button.link { min-height: 30px; padding: .1rem .35rem; color: inherit; }
.fam-pick { display: flex; gap: .4rem; align-items: center; margin: 0; }
.fam-pick select { margin: 0; min-height: 38px; padding: .35rem .6rem; font-size: var(--t-sm); max-width: 220px; }
.m-move { flex-basis: 100%; }
.m-move summary { cursor: pointer; color: var(--muted); font-size: var(--t-sm); min-height: 32px; display: inline-flex; align-items: center; }
.m-move select { margin: 0; min-height: 38px; padding: .35rem .6rem; font-size: var(--t-sm); width: auto; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.kv-card { margin: 0; border-top: 4px solid var(--kv); }
/* Color de cada kvutzá: el tono viene de la página (--kv-h); acá se ajusta para claro y oscuro */
[style*="--kv-h"] { --kv: hsl(var(--kv-h) 60% 42%); }
@media (prefers-color-scheme: dark) { [style*="--kv-h"] { --kv: hsl(var(--kv-h) 70% 66%); } }
.kv-dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--kv); margin-right: .4rem; vertical-align: .08em; }
.profile-card .facts li.kv .i { color: var(--kv); }
.kv-card.off { opacity: .6; border-top-color: var(--line); }
.kv-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.kv-head h2 { margin: 0; }
.kv-head h2 a { color: var(--text); text-decoration: none; }
.kv-card .row select { margin-top: .35rem; }
.kids-list { display: grid; gap: .5rem; margin-bottom: 1.5rem; }
.kid-row { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.kid-row b, .kid-row small { display: block; }
.kid-row small { color: var(--muted); }
.kid-row .grow { flex: 1; min-width: 0; }
ul.plain { padding-left: 1.1rem; margin: 0 0 1rem; }

/* ---------------------------------------------------------------- al tocar */
/* Cada cosa tocable responde a su manera (se hunde o se oscurece): el recuadro gris del celular sobra */
html { -webkit-tap-highlight-color: transparent; }
.menu-list a, .feed a, .kid-row, tbody tr { transition: background-color .15s var(--ease); }
.menu-list a:active, .feed a:active { background: var(--surface-2); }
.chip, .seg a, .seg button, .person, .back { transition: background-color .18s var(--ease), border-color .18s var(--ease),
                                                         color .18s var(--ease), scale .12s var(--ease); }
.chip:active, .seg a:active, .seg button:active, .person:active { scale: .96; }
/* El año marcado cambia sin parpadear mientras la grilla pasa por debajo */
.years .chip { transition-duration: .35s, .35s, .35s, .12s; }

/* ---------------------------------------------------------------- movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  /* El corazón del doble toque es la única respuesta: aparece y se va, sin crecer */
  .corazon-pop.on { animation: corazon-suave .7s ease both !important; }
  /* Recargando: sin girar, el ícono late para que se vea que está trabajando */
  .actualizar.girando .i { animation: latido 1.2s ease-in-out infinite !important; }
}

/* ---------------------------------------------------------------- kvutzá: quién aparece en las fotos */
.eq-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.eq-head h2 { margin: 0; }
.eq-sort { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; }
.eq-sort a { padding: .3rem .8rem; border-radius: 999px; font-size: var(--t-sm); font-weight: 600; color: var(--muted); text-decoration: none; }
.eq-sort a.on { background: var(--blue-800); color: #fff; }
.eq-list { list-style: none; margin: 0; padding: 0; }
.eq-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.eq-row:first-child { border-top: 0; }
.eq-main { flex: 1; min-width: 0; }
.eq-top { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.eq-top a { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-top a:hover { text-decoration: underline; }
.eq-n { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.eq-bar { height: 10px; margin: .35rem 0 .3rem; background: var(--bg); border-radius: 4px; overflow: hidden; }
.eq-bar span { display: block; height: 100%; min-width: 2px; background: var(--blue-600); border-radius: 0 4px 4px 0; }
.eq-row small { color: var(--muted); font-size: var(--t-sm); }
.eq-row.off .eq-top a, .eq-row.off .eq-n { color: var(--muted); }
.eq-row .tag .i, .notice .tag .i { width: 12px; height: 12px; vertical-align: -1px; margin-right: .2rem; }
@media (prefers-color-scheme: dark) { .eq-bar span { background: var(--accent); } .eq-sort a.on { background: var(--accent); color: var(--accent-ink); } }

/* Login: "¿Te la olvidaste?" al lado de Contraseña y separador antes de Crear cuenta */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.label-row label { margin: 0; }
.label-row a { font-weight: 600; padding: .6rem 0; }
.pw-field { margin-bottom: 1rem; }
.button.google { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.g-logo { width: 1.15rem; height: 1.15rem; flex: none; }
.or { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0 .75rem; color: var(--muted); font-size: var(--t-sm); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line, #dfe3ea); }
.pedidos { list-style: none; margin: 0; padding: 0; }
.pedido { align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); }
.pedido form { margin: 0; }

/* ---------------------------------------------------------------- admin: para hacer + buscador */
.count.sm { min-width: 1.7rem; height: 1.7rem; font-size: var(--t-sm); vertical-align: 2px; }
.todo { border-left: 4px solid var(--accent); }
.pedidos li:first-child { border-top: 0; }
.user-search { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.user-search .field { flex: 1 1 240px; }
.field { position: relative; display: block; margin: 0; }
.field .i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field input { margin: 0; padding-left: 2.6rem; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
details.fold > summary h2::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .2s var(--ease); }
details.fold[open] > summary h2::after { transform: rotate(90deg); }
details.fold > summary { transition: margin-bottom .3s var(--ease); }
details.fold[open] > summary { margin-bottom: 1rem; }
/* Las secciones plegables se abren y cierran deslizando (Chrome nuevo; en los demás, de golpe como antes) */
@supports (interpolate-size: allow-keywords) {
  details.fold { interpolate-size: allow-keywords; }
  details.fold::details-content {
    block-size: 0; overflow: clip;
    transition: block-size .3s var(--ease), content-visibility .3s allow-discrete;
  }
  details.fold[open]::details-content { block-size: auto; }
}
.center { text-align: center; }

/* ---------------------------------------------------------------- celular: 3 fotos por fila */
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; margin-left: -.75rem; margin-right: -.75rem; }
  .grid .photo { border: 0; border-radius: 0; box-shadow: none; }
  .grid .photo:hover { transform: none; }
  .grid .fav-dot { top: 4px; right: 4px; width: 22px; height: 22px; }
  .grid .fav-dot .i { width: 13px; height: 13px; }
  .grid .from-chip, .grid .names-chip { left: 4px; bottom: 4px; max-width: calc(100% - 8px); padding: .15rem .4rem; font-size: var(--t-xs); }
}

/* ---------------------------------------------------------------- visor a pantalla completa en el celular */
@media (max-width: 760px) {
  body.viewer .top { display: none; }
  body.viewer .v-top { position: sticky; top: 0; z-index: 30; padding-top: calc(.5rem + env(safe-area-inset-top));
    background: linear-gradient(rgb(0 0 0 / 80%), rgb(0 0 0 / 0%)); }
  .v-stage img { max-height: calc(100dvh - 170px); }
}
.v-stage img { touch-action: pan-y; }
/* Con zoom los dedos mueven la foto (no la página) y las flechas se esconden */
.v-stage.zoom, .v-stage.zoom img { touch-action: none; }
.v-stage.zoom .v-nav { opacity: 0; pointer-events: none; }
.v-nav { z-index: 2; }
@media (hover: none) {
  /* En pantallas táctiles las flechas quedan chicas y a los costados: se ve que hay más fotos sin tapar la foto */
  .v-nav { display: grid; width: 36px; height: 36px; background: rgb(6 20 51 / 45%); }
  .v-nav.prev { left: 6px; } .v-nav.next { right: 6px; }
  .v-nav .i { width: 20px; height: 20px; }
}

/* ---------------------------------------------------------------- celular: todo lo tocable de al menos 44px */
@media (pointer: coarse) {
  button.sm, .button.sm, button.link, .chip, .seg a, .back, details.paste summary, .m-move summary { min-height: 44px; }
  .facts-edit select, .fam-pick select, .m-move select { min-height: 44px; }
  .fam-chip button.link { min-width: 44px; min-height: 44px; }
  .photo .actions a { min-height: 44px; }
}
@media (max-width: 760px) { .tabs a { font-size: var(--t-xs); } }
/* Con seis pestañas (madrij admin) los nombres largos no entran: letra más chica y, si igual no alcanza, "…" */
@media (max-width: 760px) {
  .tabs:has(> a:nth-child(6)) a { font-size: 10px; min-width: 0; }
  .tabs:has(> a:nth-child(6)) .tab-i { width: 44px; }
  .tabs a span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------------------------------------------------------------- fechas: saltar a un año y filtrar */
.fecha-bar {
  position: sticky; top: 60px; z-index: 20; display: flex; align-items: center; gap: .45rem;
  margin: 0 -1rem .75rem; padding: .5rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.fecha-bar .years { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.fecha-bar .chip .i { width: 16px; height: 16px; }
.fecha-pick { position: relative; flex: none; }
.fecha-pick summary { list-style: none; cursor: pointer; }
.fecha-pick summary::-webkit-details-marker { display: none; }
.fecha-form {
  position: absolute; top: calc(100% + .4rem); left: 0; z-index: 25; display: flex; gap: .5rem; align-items: center;
  width: max-content; max-width: calc(100vw - 2rem); padding: .6rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.fecha-form select { margin: 0; min-height: 44px; width: auto; max-width: 62vw; }
.fecha-bar .years + .fecha-pick .fecha-form { left: auto; right: 0; }
h2.mes { display: flex; align-items: baseline; gap: .5rem; margin: 1.25rem 0 .6rem; font-size: var(--t-base); scroll-margin-top: 120px; }
h2.mes a { color: var(--text); text-decoration: none; }
h2.mes a:hover { text-decoration: underline; }
h2.mes small { color: var(--muted); font-weight: 500; font-size: var(--t-sm); }
h2.mes + .grid { margin-bottom: .5rem; }
/* El mes que se está viendo, flotando mientras se desliza */
.mes-flotante {
  position: fixed; left: 50%; z-index: 19; padding: .35rem .9rem; border-radius: 999px; overflow: hidden;
  background: var(--blue-900); color: #fff; font-weight: 700; font-size: var(--t-sm); white-space: nowrap;
  box-shadow: 0 6px 18px rgb(6 20 51 / .25); pointer-events: none;
  opacity: 0; transform: translate(-50%, -10px) scale(.96); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.mes-flotante.ver { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; cursor: pointer; }  /* tocarlo sube */

/* Botón para volver arriba en las grillas largas: abajo a la derecha, arriba del menú en el celular */
.arriba {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  display: grid; place-items: center; width: 48px; height: 48px; min-height: 0; padding: 0; border: 0; border-radius: 999px;
  background: var(--blue-900); color: #fff; box-shadow: 0 6px 18px rgb(6 20 51 / .3);
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none;
  transition: opacity .2s var(--ease), transform .25s var(--ease-spring), scale .12s var(--ease);
}
.arriba.ver { opacity: 1; transform: none; pointer-events: auto; }
.arriba:hover { background: var(--blue-800); }
.arriba .i { width: 24px; height: 24px; stroke-width: 2.4; }
@media (max-width: 760px) { .has-tabs .arriba { bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom)); } }
.mes-flotante span { display: block; }
.mes-flotante .desde-abajo { animation: mes-abajo .28s var(--ease); }
.mes-flotante .desde-arriba { animation: mes-arriba .28s var(--ease); }
@keyframes mes-abajo { from { transform: translateY(70%); opacity: 0; } }
@keyframes mes-arriba { from { transform: translateY(-70%); opacity: 0; } }
.cargar-mas { display: flex; justify-content: center; padding: 1.5rem 0 2rem; }
.cargar-mas.cargando .button { opacity: .6; pointer-events: none; }
.cargar-mas.cargando .button::after { content: "…"; }

/* ---------------------------------------------------------------- aviso de inicio (Mis fotos) */
.aviso-inicio .ai-paso { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 0; border-top: 1px solid var(--line); }
.aviso-inicio .ai-paso:first-of-type { border-top: 0; }
.aviso-inicio .ai-paso p { margin: .25rem 0 .6rem; }
.aviso-inicio .ai-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--info-bg); color: var(--info); }
.aviso-inicio .ai-paso > div { flex: 1; min-width: 0; }
.aviso-inicio .ai-cuenta { float: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.aviso-inicio .progress { margin: .5rem 0 .2rem; }
.aviso-inicio .ai-luego { display: block; width: 100%; margin-top: .25rem; min-height: 44px; }
