:root {
  --fondo: #fff5f8;
  --tarjeta: #ffffff;
  --texto: #2b1a22;
  --suave: #8a6b78;
  --borde: #f3d6e1;
  --acento: #e8457c;
  --acento-texto: #ffffff;
  --acento-suave: #fde4ed;
  --mel: #b0398f;
  --nahuel: #2f6fb5;
  --error: #c62828;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #1a1216;
    --tarjeta: #261b20;
    --texto: #f7e9ef;
    --suave: #b897a6;
    --borde: #3c2a33;
    --acento: #ff6b9a;
    --acento-texto: #2b0a16;
    --acento-suave: #3d1d2a;
    --mel: #f08ad3;
    --nahuel: #8ab8f0;
    --error: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.primario {
  background: var(--acento);
  color: var(--acento-texto);
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  min-height: 48px;
  padding: 0 18px;
}
.enlace { background: none; border: 0; color: var(--suave); padding: 8px; min-height: 44px; text-decoration: underline; }

/* Entrar */
.entrar { max-width: 420px; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 16px 32px; text-align: center; }
.logo { font-size: 56px; }
.entrar h1 { margin: 8px 0 4px; }
.sub { color: var(--suave); margin: 0 0 24px; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 20px; padding: 20px; text-align: left; display: grid; gap: 16px; }
.ayuda { margin: 0; color: var(--suave); font-size: 14px; font-weight: 400; }
.quien { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quien legend { font-weight: 600; margin-bottom: 10px; }
.quien label { display: block; }
.quien input { position: absolute; opacity: 0; }
.quien span {
  display: block; text-align: center; padding: 14px; border-radius: 14px;
  border: 2px solid var(--borde); font-weight: 600; transition: transform .15s;
}
.quien input:checked + span { border-color: var(--acento); background: var(--acento-suave); }
.quien input:focus-visible + span { outline: 3px solid var(--acento); outline-offset: 2px; }
.quien .mel input:checked + span { border-color: var(--mel); animation: latido .4s ease-out; }

.brillo {
  position: fixed; pointer-events: none; font-size: 20px; z-index: 10;
  translate: -50% -50%;
  animation: brillar .9s ease-out forwards;
}
@keyframes brillar {
  0% { opacity: 0; transform: translate(0, 0) scale(.3) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.1) rotate(var(--giro)); }
}
@keyframes latido { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .quien .mel input:checked + span { animation: none; } }
.campo { display: grid; gap: 6px; font-weight: 600; }
.campo input, .agregar input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px;
  border: 2px solid var(--borde); background: var(--fondo);
}
.campo input:focus, .agregar input:focus { border-color: var(--acento); outline: none; }
.error { color: var(--error); margin: 0; min-height: 1.4em; }

/* App */
.app { max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top) 16px calc(32px + env(safe-area-inset-bottom)); }
.cabecera { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; }
.cabecera h1 { font-size: 22px; margin: 0; }

.pestanas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 16px; padding: 5px; }
.pestanas button {
  border: 0; background: none; border-radius: 12px; min-height: 44px; padding: 6px 4px;
  font-size: 15px; font-weight: 600; color: var(--suave);
  display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap;
}
.pestanas button[aria-selected="true"] { background: var(--acento-suave); color: var(--texto); }
.cuenta { font-size: 12px; background: var(--acento); color: var(--acento-texto); border-radius: 999px; padding: 0 7px; min-width: 20px; }
.cuenta:empty { display: none; }

.agregar { display: flex; gap: 8px; margin: 14px 0; }
.agregar .primario { font-size: 26px; width: 52px; padding: 0; flex: none; }

.items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.item {
  display: flex; align-items: center; gap: 4px; background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: 14px; padding: 4px 4px 4px 0;
}
.tilde {
  flex: none; width: 48px; height: 48px; border: 0; background: none; display: grid; place-items: center;
}
.tilde::before {
  content: ""; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--acento);
}
.hechos .tilde::before { background: var(--acento); box-shadow: inset 0 0 0 4px var(--tarjeta); }
.cuerpo { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 8px 0; }
.hechos .texto { text-decoration: line-through; color: var(--suave); }
.quien-fue { display: block; font-size: 13px; font-weight: 600; }
.quien-fue.mel { color: var(--mel); }
.quien-fue.nahuel { color: var(--nahuel); }
.miniatura {
  display: block; width: 56px; height: 56px; object-fit: cover; border-radius: 10px;
  background: var(--acento-suave); margin-right: 8px; flex: none;
}
.hechos .miniatura { opacity: .5; }
.link { display: block; font-size: 14px; color: var(--acento); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link:hover { text-decoration: underline; }
.borrar { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--suave); font-size: 22px; border-radius: 10px; }

.vacio { text-align: center; color: var(--suave); padding: 32px 0; }
.hechos-cabecera { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 6px; }
.hechos-cabecera h2 { font-size: 15px; color: var(--suave); margin: 0; text-transform: uppercase; letter-spacing: .05em; }
.estado { text-align: center; color: var(--suave); font-size: 14px; min-height: 1.4em; }
