/* ThirdCEDI Time
   Idea: el tercer tiempo es el talón de la entrada. Todo lo que pasa "después del partido" va en un talón azul marino,
   perforado, pegado a la tarjeta de la actividad (en la lista, en el detalle y en el formulario). El resto es sobrio.
   Los números que importan (día, hora, plata, puntos) van en Space Grotesk con cifras tabulares, como un marcador.
   Íconos: Phosphor (MIT), peso regular, en el sprite de index.html (dev/tools/iconos-sprite.js). */
:root {
  --brand: #002F68;
  --brand-hover: #001F48;
  --accent: #00B1EF;
  --accent-hover: #0090C8;
  --text: #001E3D;
  --muted: #4A5C73;
  --bg: #FFFFFF;
  --bg-alt: #F4F8FA;
  --border: #D1E3ED;
  /* derivados */
  --acento-tinta: #0071A0;     /* celeste legible como texto sobre blanco (5,4:1) */
  --tinta-fuerte: var(--brand); /* números grandes y títulos de marca */
  --talon: #002F68;            /* superficie del tercer tiempo */
  --talon-texto: #FFFFFF;
  --talon-suave: #B9CEE6;
  --talon-acento: #00B1EF;
  --ok: #1B7F3B;
  --mal: #B3261E;
  --r-ctrl: 8px;
  --r-tarjeta: 14px;
  --radius: var(--r-ctrl);
  --fuente-titulos: 'Space Grotesk', system-ui, sans-serif;
  --fuente-ui: 'Montserrat', system-ui, sans-serif;
  color-scheme: light;
}
[data-tema="oscuro"] {
  --brand: #4C8BE0;
  --brand-hover: #75A6EA;
  --accent: #00B1EF;
  --accent-hover: #38C6F5;
  --text: #E8F0F8;
  --muted: #9FB2C8;
  --bg: #071A2E;
  --bg-alt: #0C2440;
  --border: #1B3A5C;
  --acento-tinta: #38C6F5;
  --tinta-fuerte: #DCEAF8;
  --talon: #134080;
  --talon-suave: #A9C3E0;
  --talon-acento: #5CD0F7;
  --ok: #6FD08C;
  --mal: #FF8A80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--fuente-ui); font-weight: 400; font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
h1, .titulo-app { font-family: var(--fuente-titulos); font-weight: 700; }
h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .75rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* íconos del sprite: toman el color del texto */
.ico { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; vertical-align: -.25em; }
.titulo-ico { display: flex; align-items: center; gap: .45rem; }
.titulo-ico > .ico { color: var(--acento-tinta); }
.btn-con-ico, .btn-volver { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
/* cifras de marcador */
.hora, .tf-num, .talon-hora, .cuenta, .cu-resumen, .cu-monto-txt, .rk-puntos, .reloj, .puesto {
  font-family: var(--fuente-titulos); font-variant-numeric: tabular-nums;
}

/* ---------- Barra superior y pestañas ---------- */
.barra-sup {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(env(safe-area-inset-top) + .5rem) calc(env(safe-area-inset-right) + 1rem) .5rem calc(env(safe-area-inset-left) + 1rem);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.marca { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.logo { height: 28px; width: auto; display: block; }
.logo-oscuro { display: none; }
[data-tema="oscuro"] .logo-claro { display: none; }
[data-tema="oscuro"] .logo-oscuro { display: block; }
.titulo-app { font-size: 1.05rem; font-weight: 500; color: var(--tinta-fuerte); white-space: nowrap; padding-left: .6rem; border-left: 2px solid var(--accent); }
.btn-icono {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 50%;
  font-size: 1.15rem; cursor: pointer;
}
.btn-icono:hover { border-color: var(--accent); }

#pantallas { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.pantalla { padding: 1.25rem calc(env(safe-area-inset-right) + 1rem) 2rem calc(env(safe-area-inset-left) + 1rem); }
.pantalla[hidden] { display: none; }
.vacio {
  margin: 0; padding: 1.25rem; text-align: center; color: var(--muted);
  background: var(--bg-alt); border: 1px dashed var(--border); border-radius: var(--r-tarjeta);
}
.vacio p { margin: 0 0 .25rem; }
.vacio-act { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.75rem 1.25rem; }
.vacio-act .vacio-ico { width: 2.25rem; height: 2.25rem; color: var(--acento-tinta); }
.vacio-act .btn-sec { margin-top: .25rem; }
.vacio-acciones { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem 1rem; }
.vacio-acciones .btn-link { margin-top: .25rem; }

.pestanas {
  flex: none; display: flex;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg); border-top: 1px solid var(--border);
}
.pestanas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: .55rem 0 .5rem; color: var(--muted); text-decoration: none;
  font-size: .72rem; font-weight: 600; border-top: 3px solid transparent; margin-top: -1px;
}
.pestanas .ico { width: 24px; height: 24px; }
.pestanas a.activa { color: var(--tinta-fuerte); border-top-color: var(--accent); }
.pestanas a:focus-visible { outline-offset: -3px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 76px); max-width: min(90vw, 420px);
  padding: .65rem 1rem; background: var(--brand); color: #fff;
  border-radius: var(--r-ctrl); font-size: .9rem; box-shadow: 0 4px 14px rgba(0, 30, 61, .3); z-index: 100; pointer-events: none;
}
[data-tema="oscuro"] .toast { background: var(--accent); color: #001E3D; }
.toast[hidden] { display: none; }

/* ---------- Acceso, formularios y avatar ---------- */
body.sin-sesion #pantallas, body.sin-sesion .pestanas { display: none; }
.acceso { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 2.5rem calc(env(safe-area-inset-right) + 1.25rem) 1.5rem calc(env(safe-area-inset-left) + 1.25rem); }
.acceso[hidden] { display: none; }
.acceso-caja { max-width: 420px; margin: 0 auto; }
.acceso h1 { font-size: 2rem; }
.paso[hidden] { display: none; }
.paso { display: flex; flex-direction: column; gap: .5rem; }
/* captcha (Turnstile): el widget trae su tema claro u oscuro; con "interaction-only" no ocupa lugar si no hace falta */
.captcha-zona { margin-top: 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.captcha-zona[hidden], .captcha-error[hidden] { display: none; }
.captcha { max-width: 100%; }
.captcha-error { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; width: 100%; }
.ayuda { margin: 0 0 .5rem; color: var(--muted); font-size: .95rem; }
label { font-weight: 600; font-size: .9rem; }
input[type="email"], input[type="text"], select, textarea, input[type="datetime-local"], input[type="number"] {
  width: 100%; padding: .75rem .85rem; font: inherit; font-size: 1rem;
  background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-ctrl);
}
/* iPhone (Safari): el campo de fecha y hora trae un ancho mínimo propio y se salía de la pantalla, y era más alto que
   los demás. Solo en iOS (-webkit-touch-callout lo entiende solo Safari de iOS): en Android queda como siempre. */
@supports (-webkit-touch-callout: none) {
  input[type="datetime-local"] {
    -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
    line-height: 1.4; height: calc(1.4em + 1.5rem + 2px); text-align: left;
  }
  input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
#in-codigo { font-family: var(--fuente-titulos); font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.error { margin: 0; color: var(--mal); font-size: .9rem; font-weight: 600; }
.error[hidden] { display: none; }
.btn-primario {
  margin-top: .5rem; padding: .85rem 1rem; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--brand); color: #fff; border: 0; border-radius: var(--r-ctrl);
}
[data-tema="oscuro"] .btn-primario { background: var(--accent); color: #001E3D; }
.btn-primario:hover { background: var(--brand-hover); }
[data-tema="oscuro"] .btn-primario:hover { background: var(--accent-hover); }
.btn-primario:disabled, .btn-link:disabled { opacity: .55; cursor: default; }
.btn-sec {
  display: inline-block; padding: .55rem .9rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-ctrl);
}
.btn-sec.btn-con-ico { display: inline-flex; }
.btn-sec:hover { border-color: var(--accent); }
.btn-sec:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-link { background: none; border: 0; padding: .5rem 0; font: inherit; font-size: .9rem; font-weight: 600; color: var(--acento-tinta); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link[hidden] { display: none; }
/* "Volver": sin subrayado, con el chevrón; el área de toque es más grande que el texto */
.btn-volver { align-self: flex-start; justify-content: flex-start; text-decoration: none; margin: -.4rem 0 .35rem -.3rem; padding: .45rem .5rem .45rem .3rem; color: var(--muted); }
.btn-volver:hover { color: var(--acento-tinta); }
.fila-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.avatar {
  --tam: 40px; flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: var(--tam); height: var(--tam); border-radius: 50%;
  background: var(--accent); color: #001E3D; font-family: var(--fuente-titulos); font-weight: 700; font-size: calc(var(--tam) * .38);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-editor { display: flex; flex-direction: column; align-items: center; gap: .75rem; margin: .5rem 0 1rem; }
.foto-botones { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem; }
.perfil-datos { text-align: center; margin-bottom: 1rem; }
.perfil-nombre { margin: 0; font-family: var(--fuente-titulos); font-weight: 700; font-size: 1.35rem; letter-spacing: -.01em; }
#pantalla-perfil { max-width: 560px; margin: 0 auto; width: 100%; }
#perfil-contenido { max-width: 420px; margin: 0 auto; }
.perfil-avisos { max-width: 420px; margin: 1.5rem auto 0; padding-top: .5rem; border-top: 1px solid var(--border); }
.perfil-avisos .fila-links { align-items: center; }
.pasos-avisos { padding-left: 1.25rem; margin: .25rem 0 0; }
.pasos-avisos li { margin: .2rem 0; }
.estado-avisos { display: flex; align-items: center; gap: .5rem; }
.estado-avisos.activos { color: var(--text); font-weight: 600; }
.estado-avisos.activos .ico { color: var(--ok); }

/* ---------- Actividades ---------- */
#pantalla-actividades { max-width: 620px; margin: 0 auto; width: 100%; }
.fila-titulo { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.fila-titulo h1 { margin: 0; }
.btn-chico { margin-top: 0; padding: .55rem .9rem; white-space: nowrap; }
.btn-chico.btn-con-ico { padding-left: .7rem; }

/* Filtro por tipo: control segmentado de una fila. En el teléfono, los no elegidos son solo el pictograma y el
   elegido se estira con su nombre; cuando hay lugar (escritorio, tablet) todos llevan nombre. */
.filtro-tipos { container-type: inline-size; margin: 1rem 0 1.1rem; }
.segmentos {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
}
.seg {
  flex: 1 1 0; min-width: 0; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: 0 .5rem; font: inherit; font-size: .82rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  background: transparent; color: var(--muted); border: 0; border-radius: 9px;
  transition: flex-grow .22s ease, background-color .15s ease, color .15s ease;
}
.seg .ico { width: 20px; height: 20px; }
.seg:hover { color: var(--text); }
.seg.activo { background: var(--brand); color: #fff; }
[data-tema="oscuro"] .seg.activo { background: var(--accent); color: #001E3D; }
.seg:focus-visible { outline-offset: -2px; }
.filtro-tipos .seg { flex: 1 1 0; padding: 0; }
.filtro-tipos .seg-txt { display: none; }
.filtro-tipos .seg.activo { flex: 2.2 1 auto; padding: 0 .7rem; }
.filtro-tipos .seg.activo .seg-txt { display: inline; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@container (min-width: 550px) {
  .filtro-tipos .seg, .filtro-tipos .seg.activo { flex: 1 1 auto; padding: 0 .4rem; gap: .28rem; font-size: .8rem; }
  .filtro-tipos .seg .ico { width: 18px; height: 18px; }
  .filtro-tipos .seg.activo .seg-txt { overflow: visible; }
  .filtro-tipos .seg-txt { display: inline; }
}
.cu-partes { margin: .25rem 0 .6rem; }
.cu-partes .seg { flex: 1 1 0; }
.cu-partes[hidden] { display: none; }

.lista-act { display: flex; flex-direction: column; gap: .7rem; }
.lista-act.pasadas { opacity: .7; }
.lista-act.pasadas .tarjeta-act { filter: grayscale(.6); }

/* Tarjeta: la entrada. Fecha como en un fixture, a la izquierda; el tercer tiempo es el talón de abajo. */
.tarjeta-act {
  position: relative; display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden; text-align: left;
  font: inherit; color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-tarjeta); cursor: pointer;
}
.tarjeta-act:hover { border-color: var(--accent); }
.tarjeta-act.cancelada { opacity: .62; }
.tarjeta-act.cancelada .tarjeta-titulo { text-decoration: line-through; text-decoration-thickness: 1px; }
.tarjeta-principal { display: flex; align-items: stretch; }
.tarjeta-fecha {
  flex: none; width: 3.6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: .7rem 0; border-right: 1px solid var(--border); color: var(--muted); font-size: .72rem; font-weight: 600; line-height: 1.1;
}
.tf-num { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--tinta-fuerte); letter-spacing: -.02em; }
.tarjeta-cuerpo { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding: .7rem .85rem .75rem; }
.tarjeta-tipo { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .78rem; font-weight: 600; }
.tarjeta-tipo .ico { width: 1.2rem; height: 1.2rem; }
.tarjeta-titulo { font-family: var(--fuente-titulos); font-weight: 700; font-size: 1.1rem; line-height: 1.25; letter-spacing: -.01em; }
.tarjeta-meta { display: flex; align-items: baseline; gap: .5rem; min-width: 0; color: var(--muted); font-size: .88rem; }
.tarjeta-meta .hora { color: var(--text); font-weight: 500; }
.tm-lugar { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-badges { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .3rem 0 0; }
.cupo { font-size: .8rem; color: var(--muted); }
.badge { padding: .1rem .5rem; font-size: .75rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; }
.badge.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.badge.mal { background: var(--mal); color: #fff; border-color: var(--mal); }
[data-tema="oscuro"] .badge.ok, [data-tema="oscuro"] .badge.mal { color: #001E3D; }
.badge.acento { background: var(--accent); color: #001E3D; border-color: var(--accent); }

/* El talón (tercer tiempo): azul marino, perforado y con dos mordidas en los bordes donde se corta */
.talon-mini, .talon { position: relative; background: var(--talon); color: var(--talon-texto); }
.talon-mini::before, .talon-mini::after, .talon::before, .talon::after {
  content: ""; position: absolute; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); z-index: 1;
}
.talon-mini::before, .talon::before { left: -10px; }
.talon-mini::after, .talon::after { right: -10px; }
.talon-mini {
  display: flex; align-items: center; gap: .45rem; padding: .6rem .9rem .6rem 1rem; font-size: .84rem;
  border-top: 2px dashed var(--bg);
}
.talon-mini .ico { width: 1.25rem; height: 1.25rem; color: var(--talon-acento); }
.tm-titulo { font-weight: 600; white-space: nowrap; }
.talon-mini .hora { color: var(--talon-acento); font-weight: 700; }
.talon-mini .tm-lugar { color: var(--talon-suave); }

/* Detalle */
.det-cab { margin-bottom: .6rem; }
.det-cab h1 { margin: .15rem 0 .35rem; font-size: 1.9rem; }
.det-cab.cancelada h1 { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.det-tipo { margin: 0; font-size: .85rem; }
.datos { margin: .4rem 0 .75rem; display: flex; flex-direction: column; gap: .35rem; }
.dato-fila { display: flex; align-items: flex-start; gap: .55rem; }
.dato-fila .ico { color: var(--muted); margin-top: .1rem; }
.dato-fila dd { margin: 0; }
.datos .hora { font-weight: 700; }
/* el lugar y, abajo, el botón a Google Maps */
.dato-lugar { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; overflow-wrap: anywhere; }
.dato-etq { color: var(--muted); }
.btn-maps { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; font-size: .85rem; font-weight: 600; color: var(--acento-tinta); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.btn-maps .ico { width: 1rem; height: 1rem; color: inherit; margin: 0; }
.btn-maps:hover { border-color: var(--accent); }
.btn-maps-buscar { border-color: transparent; padding-left: 0; color: var(--muted); font-weight: 500; background: transparent; }
.btn-compartir { display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 .25rem; }
.ayuda-link { margin: .1rem 0 0; font-size: .82rem; }
.talon .btn-maps { margin: -.4rem 0 .9rem; color: var(--talon-texto); background: transparent; border-color: rgba(255, 255, 255, .45); }
/* un campo por lugar: abajo, si hay link de Maps, "Link de Maps cargado" y "Quitar" */
.link-estado { display: flex; align-items: center; gap: .35rem; margin: .1rem 0 0; font-size: .85rem; font-weight: 600; color: var(--acento-tinta); }
.link-estado[hidden] { display: none; }
.link-estado .ico { width: 1rem; height: 1rem; }
.link-estado .link-quitar { margin-left: auto; padding: .2rem .4rem; font-size: .85rem; color: var(--muted); }
.talon .link-estado { color: var(--talon-acento); }
.talon .link-estado .link-quitar { color: var(--talon-suave); }
.sub { font-family: var(--fuente-titulos); font-size: 1.15rem; letter-spacing: -.01em; margin: 1.5rem 0 .6rem; }
.sub .cuenta { color: var(--muted); font-weight: 500; }
.dato { margin: .25rem 0; }
.desc { color: var(--muted); margin: 0 0 .75rem; }
.btn-ancho { width: 100%; }
.btn-sec.btn-ancho { text-align: center; justify-content: center; }
.anotados { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.anotados li { display: flex; align-items: center; gap: .6rem; }
.fila-botones { display: flex; flex-wrap: wrap; gap: .5rem; }

/* la entrada del detalle: la actividad arriba y el talón pegado abajo */
.parte-act { margin-top: 1rem; padding: .25rem 1rem 1.1rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-tarjeta); }
.parte-act .sub { margin-top: .9rem; }
.parte-act:has(+ .talon) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
.talon { padding: .35rem 1rem 1.15rem; border-top: 2px dashed var(--bg); border-radius: 0 0 var(--r-tarjeta) var(--r-tarjeta); }
.parte-act + .talon { margin-top: 0; }
.talon .sub { color: var(--talon-texto); margin-top: .9rem; }
.talon .sub .cuenta { color: var(--talon-suave); }
.talon-titulo { display: flex; align-items: center; gap: .45rem; }
.talon-titulo .talon-ico { width: 1.6rem; height: 1.6rem; color: var(--talon-acento); }
.talon-cuando { display: flex; align-items: center; gap: .85rem; margin: .1rem 0 .9rem; }
.talon-hora { font-size: 2.4rem; font-weight: 700; line-height: 1; color: var(--talon-acento); letter-spacing: -.02em; }
.talon-donde { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.talon-lugar { font-weight: 600; overflow-wrap: anywhere; }
.talon-dia { color: var(--talon-suave); font-size: .88rem; }
.talon .btn-primario { background: var(--accent); color: #001E3D; }
.talon .btn-primario:hover { background: var(--accent-hover); }
.talon .btn-sec { background: transparent; color: var(--talon-texto); border-color: rgba(255, 255, 255, .45); }
.talon .btn-sec:hover { border-color: var(--accent); }
.talon .ayuda { color: var(--talon-suave); }
.talon.cancelada { opacity: .75; }

.btn-peligro { padding: .55rem .9rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; background: transparent; color: var(--mal); border: 1px solid var(--mal); border-radius: var(--r-ctrl); }
button:disabled { opacity: .55; cursor: default; }
.form-act { margin-top: .25rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; }
.campo[hidden], .bloque-tercer[hidden] { display: none; }
.f-tipo { display: flex; align-items: center; gap: .5rem; }
.f-tipo-ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-ctrl); background: var(--bg-alt); border: 1px solid var(--border); color: var(--acento-tinta); }
.f-tipo-ico .ico { width: 24px; height: 24px; }
/* en el formulario, el tercer tiempo también es un talón */
.talon-form { margin: .75rem 0 .5rem; padding: .4rem 1rem .6rem; border-top: 0; border-radius: var(--r-tarjeta); }
.talon-form::before, .talon-form::after { top: calc(50% - 9px); }
.talon-form:has(.bloque-tercer:not([hidden]))::before, .talon-form:has(.bloque-tercer:not([hidden]))::after { top: 1.55rem; }
.talon-form .check { font-weight: 600; color: var(--talon-texto); }
.talon-form .check .ico { color: var(--talon-acento); width: 1.4rem; height: 1.4rem; }
.talon-form label { color: var(--talon-texto); }
.talon-form .bloque-tercer { padding-top: .5rem; border-top: 2px dashed rgba(255, 255, 255, .25); }
.talon-form input { background: rgba(255, 255, 255, .08); color: var(--talon-texto); border-color: rgba(255, 255, 255, .3); }
.talon-form input::placeholder { color: var(--talon-suave); }
.talon-form input[type="datetime-local"] { color-scheme: dark; }
.aviso-confirmar { margin: .5rem 0; padding: .85rem; background: var(--bg-alt); border: 1px solid var(--mal); border-radius: var(--r-ctrl); }
.aviso-confirmar p { margin: 0 0 .6rem; }
.aviso-confirmar[hidden] { display: none; }
.check { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }

/* ---------- Chat ---------- */
.chat { margin-top: 1.25rem; }
.chat-cab { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1.5rem 0 .6rem; }
.chat-cab .sub { margin: 0; }
.chat-cab-acc { display: flex; gap: .15rem; }
.chat-cab-b { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: none; color: var(--text); cursor: pointer; padding: 0; }
.chat-cab-b:hover { background: var(--bg-alt); }
.chat-cab-b .ico { width: 22px; height: 22px; }
.chat-fijado { display: flex; align-items: center; gap: .25rem; margin-bottom: .4rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.chat-fijado[hidden] { display: none; }
.chat-fijado-ir { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-fijado-ir > .ico { color: var(--acento-tinta); width: 20px; height: 20px; }
.chat-fijado-tx { min-width: 0; display: flex; flex-direction: column; }
.chat-fijado-tx b { font-size: .72rem; color: var(--acento-tinta); }
.chat-fijado-t { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-fijado-x { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; }
.chat-lista {
  display: flex; flex-direction: column; gap: .5rem; height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain;
  padding: .75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-tarjeta);
  /* la presión larga abre el menú del mensaje: que Chrome no seleccione texto ni abra su búsqueda (para copiar está "Copiar") */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.chat-lista::before { content: ""; flex: 1; }
.chat-lista .vacio { margin: auto; border: 0; background: none; }
.chat-anteriores { align-self: center; }
.chat-msg { display: flex; align-items: flex-end; gap: .4rem; max-width: 86%; }
.chat-msg.mio { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.otro { align-self: flex-start; }
.chat-col { display: flex; flex-direction: column; min-width: 0; gap: .2rem; }
.chat-msg.mio .chat-col { align-items: flex-end; }
.chat-msg.otro .chat-col { align-items: flex-start; }
.chat-autor { font-size: .75rem; font-weight: 600; color: var(--muted); padding-left: .25rem; }
/* el gesto horizontal (deslizar para responder) llega a la página; el desplazamiento vertical y el zoom siguen */
.chat-burbuja { position: relative; padding: .45rem .7rem .3rem; border-radius: 14px; background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); min-width: 4.5rem;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y pinch-zoom; }
.chat-msg.mio .chat-burbuja { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
[data-tema="oscuro"] .chat-msg.mio .chat-burbuja { background: #1D5294; border-color: #1D5294; }
.chat-msg.otro .chat-burbuja { border-bottom-left-radius: 4px; }
.chat-burbuja.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-msg.resaltado .chat-burbuja { animation: chat-resaltar 1.6s ease-out; }
@keyframes chat-resaltar { 0%, 40% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.chat-txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.35; }
.chat-hora { display: flex; justify-content: flex-end; align-items: center; gap: .2rem; font-size: .68rem; opacity: .8; margin-top: .15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chat-hora .ico { width: 11px; height: 11px; vertical-align: 0; }
.chat-burbuja.eliminado .chat-txt { font-style: italic; opacity: .75; }
.chat-burbuja.subiendo { opacity: .65; }
.chat-burbuja.media { padding: 3px 3px .3rem; }
.chat-burbuja.media .chat-hora { padding: 0 .4rem; }
.chat-foto { display: block; border-radius: 11px; max-height: 320px; object-fit: cover; background: var(--border); cursor: zoom-in; }
/* cita (responde a): dentro de la burbuja; al tocarla salta al original */
.chat-cita-b { display: block; width: 100%; min-width: 9rem; text-align: left; font: inherit; color: inherit; background: rgba(0, 30, 61, .07); border: 0; border-left: 4px solid var(--accent);
  border-radius: 8px; padding: .25rem .5rem; margin: .05rem 0 .3rem; cursor: pointer; }
.chat-msg.mio .chat-cita-b { background: rgba(255, 255, 255, .16); border-left-color: rgba(255, 255, 255, .7); }
.chat-cita-b b { display: block; font-size: .75rem; }
.chat-cita-b span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .83rem; opacity: .85; overflow-wrap: anywhere; }
.chat-burbuja.media .chat-cita-b, .chat-burbuja.sticker .chat-cita-b { margin: 2px 2px .3rem; width: calc(100% - 4px); }
/* video: la miniatura con el play y la duración */
.chat-video { position: relative; display: block; padding: 0; border: 0; border-radius: 11px; overflow: hidden; background: #000; max-height: 320px; cursor: pointer; }
.chat-video img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-video-play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }
.chat-video-play .ico { width: 24px; height: 24px; margin-left: 3px; }
.chat-video-dur { position: absolute; right: 6px; bottom: 5px; color: #fff; font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
/* audio */
.chat-audio { display: flex; align-items: center; gap: .55rem; min-width: min(230px, 60vw); padding: .2rem 0 0; }
.chat-audio-play { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--brand); color: #fff; }
.chat-msg.mio .chat-audio-play { background: #fff; color: var(--brand); }
[data-tema="oscuro"] .chat-msg.mio .chat-audio-play { color: #1D5294; }
.chat-audio-play .ico { width: 18px; height: 18px; }
.chat-audio-barra { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 25%, transparent); overflow: hidden; }
.chat-audio-barra i { display: block; height: 100%; width: 0; background: currentColor; }
.chat-audio-dur { font-size: .76rem; min-width: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; }
/* sticker: sin burbuja */
.chat-burbuja.sticker { background: none !important; border: 0 !important; padding: 0; min-width: 0; }
.chat-burbuja.sticker .chat-hora { color: var(--muted); opacity: 1; }
.chat-stk { display: block; width: 140px; height: 140px; object-fit: contain; -webkit-user-drag: none; }
/* reacciones: pastillas debajo de la burbuja */
.chat-reacs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: -.45rem; padding: 0 .35rem; position: relative; z-index: 1; }
.chat-reac { display: inline-flex; align-items: center; gap: .2rem; min-height: 26px; padding: 0 .45rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.chat-reac.mia { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.chat-reac .ico { width: 16px; height: 16px; vertical-align: 0; }
.reac-corazon .ico { color: #E0323E; }
.reac-fuego .ico { color: #F2711C; }
.reac-risa .ico, .reac-sorpresa .ico, .reac-triste .ico, .reac-pulgar .ico { color: var(--acento-tinta); }
[data-tema="oscuro"] .reac-corazon .ico { color: #FF5C66; }
[data-tema="oscuro"] .reac-fuego .ico { color: #FF9447; }
/* barras de arriba del teclado: respondiendo y editando */
.chat-citando { display: flex; align-items: center; gap: .55rem; padding: .35rem .35rem .35rem .75rem; margin-top: .5rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.chat-citando[hidden] { display: none; }
.chat-citando > .ico { color: var(--acento-tinta); }
.chat-citando-t { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: .5rem; }
.chat-citando-t b { display: block; font-size: .78rem; color: var(--acento-tinta); }
.chat-citando-t span { display: block; font-size: .86rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-citando-x { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; }
.chat-edicion { display: flex; justify-content: space-between; align-items: center; padding: .3rem .75rem; background: var(--bg-alt); border: 1px solid var(--border); border-top: 0; font-size: .85rem; color: var(--muted); }
.chat-edicion[hidden] { display: none; }
.chat-form { position: relative; display: flex; align-items: flex-end; gap: .4rem; margin-top: .5rem; }
.chat-texto { flex: 1; min-width: 0; resize: none; max-height: 130px; margin: 0; font-size: 16px; line-height: 1.3; }
.chat-adj, .chat-enviar {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; padding: 0; font-family: inherit;
  background: var(--bg-alt); color: var(--text); border: 1px solid var(--border);
}
.chat-adj .ico, .chat-enviar .ico { width: 22px; height: 22px; }
.chat-enviar { background: var(--brand); color: #fff; border-color: var(--brand); touch-action: none; transition: transform .12s; }
[data-tema="oscuro"] .chat-enviar { background: var(--accent); color: #001E3D; border-color: var(--accent); }
.chat-enviar.grabando { transform: scale(1.25); background: var(--mal); border-color: var(--mal); color: #fff; }
.chat-enviar:disabled { opacity: .5; }
.chat-grabando { position: absolute; left: 0; right: 52px; top: 0; bottom: 0; display: flex; align-items: center; gap: .6rem; padding: 0 .9rem;
  border-radius: 22px; background: var(--bg-alt); border: 1px solid var(--border); font-weight: 600; font-variant-numeric: tabular-nums; }
.chat-grabando[hidden] { display: none; }
.chat-rec { width: 10px; height: 10px; border-radius: 50%; background: var(--mal); animation: chat-latido 1s infinite; }
@keyframes chat-latido { 50% { opacity: .25; } }
.chat-rec-cancelar { margin-left: auto; display: inline-flex; align-items: center; gap: .2rem; color: var(--muted); font-weight: 400; font-size: .85rem; }
.chat-rec-cancelar .ico { width: 16px; height: 16px; }
.chat-grabando.soltar .chat-rec-cancelar { color: var(--mal); font-weight: 700; }
.chat-texto { padding: .65rem .85rem; font-family: var(--fuente-ui); color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 22px; }
.chat-lista:has(> .vacio:only-child)::before { display: none; }
/* capas: hojas que suben desde abajo (menú, adjuntar, stickers, buscar, destacados) */
.chat-capa { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.chat-fondo { position: absolute; inset: 0; background: rgba(0, 14, 30, .5); }
.chat-hoja { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); color: var(--text);
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .3); padding: .6rem .6rem calc(.6rem + env(safe-area-inset-bottom)); animation: chat-subir .18s ease-out; }
@keyframes chat-subir { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.chat-hoja-tit { margin: .3rem .6rem .4rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.chat-item { display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 48px; padding: .6rem .8rem; border: 0; border-radius: 10px; background: none; color: var(--text);
  font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
.chat-item:hover, .chat-item:focus-visible { background: var(--bg-alt); }
.chat-item .ico { width: 22px; height: 22px; color: var(--acento-tinta); }
.chat-item.peligro, .chat-item.peligro .ico { color: var(--mal); }
.chat-item.armado { background: var(--mal); color: #fff; font-weight: 700; }
.chat-item.armado .ico { color: #fff; }
.chat-item-cancelar { justify-content: center; margin-top: .2rem; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; color: var(--muted); font-weight: 600; }
.chat-reac-fila { display: flex; justify-content: space-around; padding: .2rem 0 .5rem; margin-bottom: .2rem; border-bottom: 1px solid var(--border); }
.chat-reac-b { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 0; background: none; cursor: pointer; padding: 0; }
.chat-reac-b .ico { width: 30px; height: 30px; }
.chat-reac-b.mia { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.chat-reac-b:active { transform: scale(1.15); }
/* paneles: buscar y destacados */
.chat-hoja-panel { height: min(80vh, 640px); display: flex; flex-direction: column; overflow: hidden; padding-top: .4rem; }
.chat-panel-cab { display: flex; align-items: center; justify-content: space-between; padding: 0 .2rem .3rem .6rem; }
.chat-panel-cab b { font-family: var(--fuente-titulos); font-size: 1.05rem; }
.chat-buscar-q, .chat-giphy-q { width: 100%; margin: 0 0 .4rem; padding: .6rem .9rem; font: inherit; font-size: 16px; color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 22px; }
.chat-res { flex: 1; overflow-y: auto; }
.chat-res-b { display: block; width: 100%; padding: .7rem .6rem; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-res-b small { display: block; color: var(--muted); font-size: .76rem; }
.chat-res-b span { display: block; overflow-wrap: anywhere; }
.chat-res-b mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; }
.chat-res-nota { color: var(--muted); padding: 1rem .6rem; margin: 0; }
/* stickers */
.chat-hoja-stk { height: min(70vh, 520px); display: flex; flex-direction: column; overflow: hidden; }
.chat-stk-cab { display: flex; align-items: center; justify-content: space-between; padding: 0 0 .5rem .2rem; }
.chat-tabs { display: flex; gap: .35rem; }
.chat-tab { padding: .4rem .95rem; border-radius: 999px; border: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.chat-tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-tema="oscuro"] .chat-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #001E3D; }
.chat-stk-cuerpo { flex: 1; overflow-y: auto; padding: 0 .2rem .4rem; }
.chat-stk-cuerpo[hidden] { display: none; }
.chat-stk-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.chat-stk-cel { position: relative; aspect-ratio: 1; }
.chat-stk-b { width: 100%; height: 100%; padding: 4px; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.chat-stk-b:hover { background: var(--bg-alt); }
.chat-stk-b:disabled { cursor: default; opacity: .7; }
.chat-stk-b img { width: 100%; height: 100%; object-fit: contain; display: block; }
.chat-stk-crear { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; border: 2px dashed var(--border); border-radius: 12px;
  color: var(--muted); font-weight: 700; font-size: .85rem; cursor: pointer; }
.chat-stk-crear .ico { width: 24px; height: 24px; }
.chat-stk-x { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--bg); background: var(--mal); color: #fff; padding: 0; cursor: pointer; }
.chat-stk-x .ico { width: 14px; height: 14px; }
.chat-stk-x.armado { transform: scale(1.2); }
.chat-stk-nota { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; text-align: center; padding: .9rem .4rem; margin: 0; }
.chat-stk-nota[hidden], .chat-stk-quitar-modo[hidden] { display: none; }
.chat-stk-quitar-modo { display: block; margin: .4rem auto 0; }
.chat-giphy-marca { font-size: .72rem; color: var(--muted); text-align: right; margin: .5rem .2rem 0; letter-spacing: .03em; }
.chat-capa-editor { justify-content: center; background: rgba(4, 10, 18, .96); }
.chat-stk-editor { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 1.25rem; color: #fff; }
.chat-stk-editor p { margin: 0; font-size: .9rem; opacity: .85; }
.chat-stk-lienzo { width: min(280px, 74vw); height: min(280px, 74vw); touch-action: none; cursor: grab; border-radius: 14px;
  background: repeating-conic-gradient(#22303f 0 25%, #16202b 0 50%) 0 0 / 20px 20px; }
.chat-stk-editor input[type=range] { width: min(280px, 74vw); accent-color: var(--accent); }
.chat-stk-texto { width: min(280px, 74vw); padding: .6rem .8rem; border-radius: var(--r-ctrl); border: 1px solid var(--border); font: inherit; font-size: 16px; text-transform: uppercase; }
.chat-stk-acc { display: flex; gap: .6rem; }
.chat-stk-acc .btn-primario { margin-top: 0; }
/* visor de fotos y videos */
.chat-visor { position: fixed; inset: 0; z-index: 75; background: rgba(0, 0, 0, .92); display: grid; place-items: center; }
.chat-visor img, .chat-visor video { max-width: 100%; max-height: 100%; object-fit: contain; }
.chat-visor video { background: #000; }
.chat-visor-x { position: absolute; top: calc(env(safe-area-inset-top) + .75rem); right: 1rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .2); color: #fff; cursor: pointer; z-index: 1; }
.chat-visor-x .ico { width: 22px; height: 22px; }

/* ---------- Cuentas claras ---------- */
.cuentas { margin-top: 1.5rem; padding-top: .25rem; border-top: 1px solid var(--border); }
.cuentas[hidden] { display: none; }
.cu-resumen { margin: .5rem 0; padding: .7rem .9rem; font-size: 1.2rem; font-weight: 700; border-radius: var(--r-ctrl); background: var(--bg-alt); border: 1px solid var(--border); }
.cu-resumen:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.cu-resumen.te-deben { border-color: var(--ok); color: var(--ok); }
.cu-resumen.debes { border-color: var(--mal); color: var(--mal); }
.cu-h3 { font-family: var(--fuente-ui); font-size: .85rem; font-weight: 600; color: var(--muted); margin: 1.1rem 0 .4rem; }
.cu-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.cu-lista > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.cu-txt { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.cu-gasto-cab { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.cu-monto-txt { font-weight: 700; white-space: nowrap; }
.cu-meta { font-size: .8rem; color: var(--muted); }
.cu-confirmar { flex-basis: 100%; margin: .25rem 0 0; }
.cu-zona-form { margin-top: .75rem; }
.cu-form { margin-top: .25rem; padding: .85rem; border: 1px solid var(--border); border-radius: var(--r-tarjeta); }
.cu-monto { display: flex; align-items: center; gap: .4rem; }
.cu-monto span { font-weight: 600; font-family: var(--fuente-titulos); }
.cu-entre { margin: .25rem 0 .5rem; padding: .4rem .75rem; border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.cu-entre legend { padding: 0 .25rem; font-size: .9rem; }
.cu-entre .check { margin: .35rem 0; }
#cu-reparto:empty { display: none; }
.aviso-confirmar.neutro { border-color: var(--accent); }

/* ---------- Álbum (el resto de sus estilos vive en album.js) ---------- */
.album { margin-top: 1.5rem; }
.album .album-acciones .btn-con-ico { display: inline-flex; }
.album .album-drive { display: inline-flex; align-items: center; gap: .35rem; color: var(--acento-tinta); }
.album-visor .album-visor-cerrar { display: grid; place-items: center; padding: 10px; }
.album-visor .ico { width: 22px; height: 22px; }

/* La cámara y el editor (pantalla completa) tienen sus estilos en camara.js y editor.js. */

/* ---------- Juegos y Trivia ---------- */
#pantalla-juegos { max-width: 560px; margin: 0 auto; width: 100%; }
.titulo-ico.h1-juego { gap: .5rem; }
h1.titulo-ico > .ico { width: 1.9rem; height: 1.9rem; }
.tarjeta-partida, .tarjeta-juego { flex-direction: row; align-items: center; gap: .85rem; padding: .8rem .9rem; }
.tarjeta-pict { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--acento-tinta); }
.tarjeta-pict .ico { width: 26px; height: 26px; }
.tarjeta-partida .tarjeta-cuerpo, .tarjeta-juego .tarjeta-cuerpo { padding: 0; }
.tarjeta-juego:disabled { opacity: .6; cursor: default; }
.salir-partida { margin-top: 1.25rem; }
.trivia-cabecera { display: flex; justify-content: space-between; align-items: baseline; margin-top: .5rem; }
.trivia-ronda { font-family: var(--fuente-titulos); font-weight: 700; color: var(--muted); }
.reloj { font-weight: 700; font-size: 1.25rem; color: var(--tinta-fuerte); }
[data-tema="oscuro"] .reloj { color: var(--accent); }
.barra-tiempo { height: 6px; margin: .4rem 0 .9rem; background: var(--border); border-radius: 999px; overflow: hidden; }
.barra-tiempo-relleno { display: block; height: 100%; width: 100%; background: var(--accent); transition: width .25s linear; }
.barra-tiempo.revelada .barra-tiempo-relleno { background: var(--muted); }
.carta-trivia {
  padding: 1.2rem 1.1rem 1.35rem; border-radius: var(--r-tarjeta); color: #fff;
  background: var(--talon); border-bottom: 4px solid var(--accent);
}
.carta-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; font-weight: 600; color: var(--talon-suave); }
.carta-pregunta { margin: .6rem 0 0; font-family: var(--fuente-titulos); font-weight: 700; font-size: 1.3rem; line-height: 1.3; letter-spacing: -.01em; }
.ops-trivia { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; }
.op-trivia {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .75rem .8rem; text-align: left; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text); background: var(--bg-alt); border: 2px solid var(--border); border-radius: 10px;
}
.op-trivia:not(:disabled):hover { border-color: var(--accent); }
.op-trivia:disabled { cursor: default; opacity: 1; }
.op-letra { flex: none; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); font-family: var(--fuente-titulos); }
.op-texto { flex: 1; min-width: 0; }
.op-conteo { flex: none; min-width: 1.6rem; text-align: center; font-size: .8rem; color: var(--muted); }
.op-marca { flex: none; display: grid; place-items: center; }
.op-marca .ico { width: 22px; height: 22px; }
.op-trivia.elegida { border-color: var(--brand); background: var(--bg); }
[data-tema="oscuro"] .op-trivia.elegida { border-color: var(--accent); }
.op-trivia.elegida .op-letra { background: var(--brand); color: #fff; border-color: var(--brand); }
.op-trivia.correcta { border-color: #1B7F3B; background: #E7F5EC; color: #0E4D23; }
.op-trivia.correcta .op-letra { background: #1B7F3B; color: #fff; border-color: #1B7F3B; }
.op-trivia.incorrecta { border-color: #B3261E; background: #FCEBEA; color: #7A1712; }
.op-trivia.incorrecta .op-letra { background: #B3261E; color: #fff; border-color: #B3261E; }
[data-tema="oscuro"] .op-trivia.correcta { background: #0F3A22; color: #C9F0D6; border-color: #3DBA6A; }
[data-tema="oscuro"] .op-trivia.incorrecta { background: #3D1412; color: #FFD3CF; border-color: #FF8A80; }
.op-trivia.correcta .op-conteo, .op-trivia.incorrecta .op-conteo { color: inherit; }
.op-trivia.apagada { opacity: .6; }
.trivia-estado { margin-top: .8rem; text-align: center; }
.trivia-resultado { margin: .9rem 0 0; padding: .6rem .8rem; border-radius: var(--r-ctrl); font-weight: 600; text-align: center; background: var(--bg-alt); border: 1px solid var(--border); }
.trivia-resultado.bien { border-color: var(--ok); color: var(--ok); }
#btn-revelar, #btn-siguiente { margin-top: .8rem; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.fila-ranking { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.fila-ranking.yo { border-color: var(--accent); }
.ranking.final .fila-ranking.primero { background: var(--talon); color: #fff; border-color: var(--talon); }
.ranking.final .fila-ranking.primero .rk-puntos, .ranking.final .fila-ranking.primero .puesto { color: var(--talon-acento); }
.puesto { flex: none; width: 1.9rem; text-align: center; font-weight: 700; }
.puesto.podio-1 { font-size: 1.2rem; }
.rk-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-suma { flex: none; font-size: .8rem; font-weight: 600; color: var(--ok); }
.rk-puntos { flex: none; font-weight: 700; }
.titulo-final { font-size: 1.35rem; }
.titulo-final .ico { width: 1.6rem; height: 1.6rem; }
#btn-volver-juegos { margin-top: 1rem; }
/* ---------- El Impostor ---------- */
.carta-impostor { text-align: center; }
.carta-impostor .carta-meta { justify-content: center; }
.palabra-impostor { font-size: 2rem; overflow-wrap: anywhere; }
.carta-impostor.chica { padding: .8rem 1rem .9rem; }
.carta-impostor.chica .palabra-impostor { font-size: 1.4rem; margin-top: .35rem; }
#btn-imp-avanzar { margin-top: .9rem; }
.orden-pistas .fila-ranking.apagada { opacity: .55; }
.pregunta-voto { color: var(--text); text-align: center; margin: .2rem 0 0; }
.voto-imp .avatar { flex: none; }
.resultado-impostor { font-weight: 500; }
.resultado-impostor strong { font-family: var(--fuente-titulos); font-size: 1.3rem; }
.resultado-impostor.mal { border-color: var(--mal); color: #7A1712; }
[data-tema="oscuro"] .resultado-impostor.mal { color: #FFD3CF; }
#impostor-era { margin-top: 1rem; }
.impostor-quien { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-top: .6rem; }
.impostor-quien .carta-pregunta { margin: 0; }
.impostor-vos { margin: .5rem 0 0; font-weight: 600; }
.palabras-final { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; margin: 1rem 0 0; padding: .7rem .8rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-ctrl); }
.palabras-final dt { font-size: .8rem; font-weight: 600; color: var(--muted); grid-row: 1; }
.palabras-final dd { margin: 0; font-family: var(--fuente-titulos); font-weight: 700; font-size: 1.1rem; grid-row: 2; }
.fila-ranking.es-impostor { border-color: var(--mal); }

/* Teléfono en horizontal (poca altura): encabezado y pestañas finitos, para que el contenido tenga lugar */
@media (max-height: 500px) and (orientation: landscape) {
  .barra-sup { padding-top: calc(env(safe-area-inset-top) + .2rem); padding-bottom: .2rem; }
  .logo { height: 20px; }
  .titulo-app { font-size: .9rem; }
  .btn-icono { width: 32px; height: 32px; font-size: 1rem; }
  .pestanas a { flex-direction: row; justify-content: center; gap: .45rem; padding: .3rem 0 .25rem; font-size: .78rem; }
  .pestanas .ico { width: 20px; height: 20px; }
  .pantalla { padding-top: .75rem; }
  .chat-lista { height: min(70vh, 420px); }
  .toast { bottom: calc(env(safe-area-inset-bottom) + 48px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.perfil-avisos .btn-primario + .ayuda { margin-top: .6rem; }
.tarjeta-tipo .ico { color: var(--acento-tinta); }

/* Íconos propios (img/iconos-propios): figuritas multicolor con borde blanco, van como <img> y no toman currentColor.
   Son un poco más grandes que los de Phosphor porque el borde blanco se come parte del lienzo. */
.ico-propio { user-select: none; vertical-align: -.4em; }
.titulo-ico > .ico-propio { width: 2rem; height: 2rem; }
h1.titulo-ico > .ico-propio { width: 2.7rem; height: 2.7rem; }
.tarjeta-tipo .ico-propio { width: 1.9rem; height: 1.9rem; }
.det-tipo .ico-propio { width: 2.1rem; height: 2.1rem; }
.seg .ico-propio { width: 28px; height: 28px; }
.talon-mini .ico-propio { width: 1.9rem; height: 1.9rem; }
.talon-titulo .talon-ico.ico-propio { width: 2.5rem; height: 2.5rem; }
.talon-form .check .ico-propio { width: 2rem; height: 2rem; }
.f-tipo-ico .ico-propio { width: 38px; height: 38px; }
.tarjeta-pict .ico-propio { width: 44px; height: 44px; }
.vacio-act .vacio-ico.ico-propio { width: 3.6rem; height: 3.6rem; }
/* Barra de abajo: toman el color de la pestaña (activa con el acento, las otras apagadas), como el resto de los íconos */
.pestanas .ico-propio { width: 30px; height: 30px; margin-top: -3px; }
@media (max-height: 500px) and (orientation: landscape) {
  .pestanas .ico-propio { width: 24px; height: 24px; margin-top: 0; }
}

/* Barra de abajo: Actividades, Cámara (al centro) y Juegos, del mismo ancho; Perfil está arriba, al lado del tema.
   La cámara se destaca (redonda, celeste y más alta). Es un botón (no una sección): abre la
   cámara del álbum de la actividad en curso o pregunta a cuál va la foto. */
.pestanas { display: grid; grid-template-columns: repeat(3, 1fr); }
.pestana-camara {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  padding: 0 .25rem .5rem; margin: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .72rem; font-weight: 600; color: var(--tinta-fuerte); -webkit-tap-highlight-color: transparent;
}
.pestana-camara .pc-boton {
  width: 58px; height: 58px; margin-top: -20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--bg), 0 6px 16px rgba(0, 47, 104, .28);
  transition: transform .15s ease, background-color .2s;
}
.pestana-camara .pc-boton .ico-propio { width: 32px; height: 32px; margin: 0; vertical-align: 0; }
.pestana-camara:hover .pc-boton { background: var(--accent-hover); }
.pestana-camara:active .pc-boton { transform: scale(.92); }
.pestana-camara:focus-visible { outline: none; }
.pestana-camara:focus-visible .pc-boton { outline: 3px solid var(--tinta-fuerte); outline-offset: 3px; }
@media (max-height: 500px) and (orientation: landscape) {
  .pestana-camara { flex-direction: row; gap: .45rem; padding: .2rem .5rem; font-size: .78rem; }
  .pestana-camara .pc-boton { width: 36px; height: 36px; margin-top: 0; box-shadow: none; }
  .pestana-camara .pc-boton .ico-propio { width: 22px; height: 22px; }
}

/* Hoja de abajo: ¿para qué actividad es la foto? */
.hoja { margin: auto auto 0; width: min(100%, 520px); max-width: 100%; max-height: 80vh; border: 0; border-radius: 20px 20px 0 0;
  padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom)); background: var(--bg); color: var(--tinta-fuerte, inherit);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
.hoja::backdrop { background: rgba(0, 20, 45, .45); }
.hoja h2 { margin: 0 0 .75rem; font-size: 1.1rem; }
.hoja ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.hoja-act { width: 100%; display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border: 1px solid var(--border);
  border-radius: 14px; background: var(--bg-alt); color: inherit; font: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.hoja-act:hover { border-color: var(--accent); }
.hoja-ico { color: var(--acento-tinta); flex: none; }
.hoja-ico .ico-propio { width: 34px; height: 34px; vertical-align: 0; }
.hoja-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hoja-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoja-txt span { color: var(--muted); font-size: .85rem; }
.hoja-cancelar { display: block; margin: .75rem auto 0; }
.acciones-sup { display: flex; align-items: center; gap: .5rem; flex: none; }
#btn-perfil { color: var(--text); text-decoration: none; }
#btn-perfil .ico-propio { width: 26px; height: 26px; margin: 0; vertical-align: 0; }
#btn-perfil.activa { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
body.sin-sesion #btn-perfil { display: none; }

/* Acceso a "Fotos de todos" en la lista de actividades */
.acceso-todos { width: 100%; display: flex; align-items: center; gap: .8rem; margin: .9rem 0 .2rem; padding: .75rem .9rem; border: 1px solid var(--border);
  border-radius: 14px; background: var(--bg-alt); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acceso-todos:hover { border-color: var(--accent); }
.acceso-todos .ico-propio { width: 38px; height: 38px; color: var(--acento-tinta); flex: none; vertical-align: 0; }
.acceso-todos span { display: flex; flex-direction: column; gap: 2px; }
.acceso-todos small { color: var(--muted); font-size: .85rem; }
.hoja-act.elegida { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
