:root {
  --bg: #f4f4f1; --card: #fff; --fg: #1c1c1a; --muted: #6a6a64; --line: #deded8;
  --green: #1f8a4c; --green-bg: #e3f4ea; --nc: #2f6fb7; --nc-bg: #e4eefa;
  --warn: #c2410c; --warn-bg: #fdebdd; --brand: #52525b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --card: #232321; --fg: #ecece8; --muted: #9a9a93; --line: #383835;
    --green: #4cc27f; --green-bg: #1d3a2b; --nc: #6aa6ec; --nc-bg: #1d2f46;
    --warn: #f08a4b; --warn-bg: #43291a; --brand: #7b7b85;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 20px 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.sub { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px 16px; font-size: 17px; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; text-align: center; text-decoration: none; }
.btn.alt { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; }
.input { width: 100%; padding: 14px; font-size: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 16px; }
.check input { width: 22px; height: 22px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; }
.link { color: var(--brand); background: none; border: 0; font-size: 15px; padding: 6px 0; cursor: pointer; }
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 2px; }
.progress > i { display: block; height: 100%; background: var(--green); }
#map, .map { height: 300px; border-radius: 14px; border: 1px solid var(--line); margin: 10px 0; }
.map.tall { height: 420px; }
.house { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; margin: 8px 0; }
.house .addr { flex: 1; min-width: 0; }
.house .num { font-size: 30px; font-weight: 800; line-height: 1; }
.house .st { color: var(--muted); font-size: 14px; margin-top: 2px; }
.house.s-hecha { background: var(--green-bg); border-color: var(--green); }
.house.s-nc { background: var(--nc-bg); border-color: var(--nc); }
.house.s-no_tocar { background: var(--red-bg); border-color: var(--red); }
.house.s-otro_idioma { background: var(--amber-bg); border-color: var(--amber); }
.house.s-por_revisar { background: var(--warn-bg); border-color: var(--warn); }
.house.s-pendiente { opacity: .92; }
.acts { display: flex; gap: 6px; }
.act { width: 52px; height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--fg);
  font-size: 22px; font-weight: 800; cursor: pointer; display: grid; place-items: center; }
.act.nc { font-size: 17px; }
.act.on.hecha { background: var(--green); border-color: var(--green); color: #fff; }
.act.on.nc { background: var(--nc); border-color: var(--nc); color: #fff; }
.act.on.no_tocar { background: var(--red); border-color: var(--red); color: #fff; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
td, th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.r, th.r { text-align: right; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px;
  border-radius: 99px; font-size: 14px; z-index: 9999; max-width: 90vw; }
.gbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 16px;
  border-radius: 16px; color: #fff; }
.gbar .gnum { font-size: 30px; font-weight: 800; line-height: 1.05; }
.gbar .gsub { font-size: 16px; opacity: .95; margin-top: 2px; }
.gbar .btn { background: #fff; color: #1c1c1a; font-size: 15px; font-weight: 700; padding: 10px 14px; white-space: nowrap; }
.btn.leave-btn { background: transparent; color: var(--warn); border: 2px solid var(--warn); font-weight: 700; }
.tabs { display: flex; gap: 8px; margin: 12px 0 4px; }
.tab { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font-size: 15px; font-weight: 600; cursor: pointer; }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.card.full { opacity: .6; }
.card.full .pill { font-weight: 700; color: var(--warn); border-color: var(--warn); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 20px; z-index: 10000; }
.modal .card { width: 100%; max-width: 380px; }
.done-box { text-align: center; padding: 18px; }
.big { font-size: 40px; font-weight: 800; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

:root { --red: #dc2626; --red-bg: #fde8e8; --amber: #d4a017; --amber-bg: #fbf1d3; }
@media (prefers-color-scheme: dark) { :root { --red: #ef4444; --red-bg: #431d1d; --amber: #e0b030; --amber-bg: #3d3210; } }
.btn.danger { background: var(--red); color: #fff; }
.btn.amber { background: var(--amber); color: #1c1c1a; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; margin-left: 6px; vertical-align: 1px; }
.tag.no_tocar { background: var(--red); color: #fff; }
.tag.otro_idioma { background: var(--amber); color: #1c1c1a; }
.tag.por_revisar { background: #d9570c; color: #fff; }

#app { position: relative; }
.topline { display: flex; justify-content: flex-end; padding-top: 10px; }
.acirc { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: var(--fg);
  font-size: 17px; font-weight: 800; cursor: pointer; display: grid; place-items: center; padding: 0; }
.top .acirc { margin-left: auto; }
.topline + .gbar { margin-top: 8px; }
.statbtn { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.statbtn:active { opacity: .7; }
.gpill { cursor: pointer; font: inherit; font-size: 13px; }
.note { margin: 8px 0 4px; padding: 8px 10px; border-left: 3px solid var(--line); color: var(--fg); font-size: 15px; }
.decide { display: grid; gap: 8px; margin-top: 10px; }
.undo { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 8px 8px 16px;
  border-radius: 99px; font-size: 14px; z-index: 9999; display: flex; align-items: center; gap: 12px; }
.undo button { background: #fff; color: #111; border: 0; border-radius: 99px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
textarea.input { font: inherit; font-size: 17px; resize: vertical; }

.gbtn { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin: 12px 0; padding: 16px 18px; border: 0;
  border-radius: 16px; color: #fff; cursor: pointer; text-align: left; font: inherit; }
.gbtn b { font-size: 22px; line-height: 1.1; }
.gbtn span { font-size: 15px; opacity: .95; margin-top: 3px; }
.gbtn:active { opacity: .8; }
.trows { padding: 4px 14px; }
.trow { display: grid; grid-template-columns: 70px 1fr 48px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.tnum b { font-size: 20px; }
.tnum .pill { display: block; width: fit-content; margin-top: 2px; font-size: 11px; padding: 0 6px; }
.mini { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--green); }
.trow .sub { font-size: 12px; margin-top: 4px; }
.tpct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tlabel { font-weight: 800; font-size: 13px; color: #000; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }

.btn.alert { background: #d9570c; color: #fff; }

.lnav { display: flex; align-items: center; gap: 10px; }
.topline { justify-content: space-between !important; }
.mods { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.mod { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; min-height: 150px; padding: 16px;
  border-radius: 20px; border: 2px solid var(--brand); background: var(--card); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.mod .mi { font-size: 40px; line-height: 1; }
.mod b { font-size: 19px; line-height: 1.15; }
.mod:active { opacity: .75; }
.mod.off { border: 1px dashed var(--line); opacity: .55; cursor: default; }
.mod.off .pill { font-size: 12px; }
.top .acirc[data-home], .topline .acirc[data-home] { margin-left: 0; }

.mod { border: 0 !important; color: #fff !important; min-height: 130px; }
.mod b { font-size: 22px; }
.mod.off { opacity: .45; }
.mod .soon { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.22); padding: 2px 10px; border-radius: 99px; }

.mod.off { opacity: 1 !important; cursor: default; justify-content: flex-end; }

.act.flag.on { background: #eab308; border-color: #eab308; color: #1c1c1a; }
.house { transition: opacity .25s ease, transform .25s ease, background .12s ease; }
.house.flash { color: #fff; }
.house.flash .st { color: rgba(255,255,255,.9); }
.house.flash.f-hecha { background: var(--green) !important; border-color: var(--green) !important; }
.house.flash.f-nc { background: var(--nc) !important; border-color: var(--nc) !important; }
.house.flash.f-flag { background: #eab308 !important; border-color: #eab308 !important; color: #1c1c1a; }
.house.flash.f-flag .st { color: rgba(28,28,26,.8); }
.house.gone { opacity: 0; transform: translateX(32px); }

/* ---------- animaciones breves ---------- */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeOut { to { opacity: 0 } }
@keyframes pop { 0% { opacity: 0; transform: scale(.82) } 100% { opacity: 1; transform: scale(1) } }
@keyframes popOut { to { opacity: 0; transform: scale(.92) } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 16px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes beat { 0% { transform: scale(1) } 40% { transform: scale(1.18); color: var(--green) } 100% { transform: scale(1) } }
@keyframes fall { to { transform: translateY(108vh) rotate(720deg); opacity: .95 } }
.modal { animation: fadeIn .15s ease both; }
.modal .card { animation: pop .24s cubic-bezier(.2, .9, .3, 1.25) both; }
.modal.out { animation: fadeOut .13s ease forwards; }
.modal.out .card { animation: popOut .13s ease forwards; }
.gbar { animation: pop .35s cubic-bezier(.2, .9, .3, 1.15) both; }
#list .house { animation: rise .3s ease both; animation-delay: calc(var(--i, 0) * 35ms); }
.mod { animation: pop .4s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 70ms); }
.card.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
#toast { animation: slideUp .25s ease both; }
.undo { animation: slideUp .25s ease both; }
.progress > i { transition: width .55s cubic-bezier(.2, .8, .2, 1); }
#prog.bump { display: inline-block; animation: beat .4s ease; }
.btn:active, .gbtn:active, .mod:active { transform: scale(.97); }
.act:active { transform: scale(.88); }
.btn, .act, .gbtn, .mod { transition: transform .12s ease, background .12s ease, opacity .12s ease; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10001; }
.confetti i { position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .confetti { display: none; }
}

@keyframes burst { 0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1 } 100% { transform: translate(var(--dx), var(--dy)) rotate(540deg) scale(.6); opacity: 0 } }
@keyframes thumb { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0 } 25% { transform: translate(-50%, -80%) scale(1.5); opacity: 1 } 100% { transform: translate(-50%, -210%) scale(1.2); opacity: 0 } }
.mini { position: fixed; inset: 0; pointer-events: none; z-index: 10002; }
.mini i { position: fixed; width: 7px; height: 11px; border-radius: 2px; animation: burst .85s cubic-bezier(.15, .7, .3, 1) forwards; }
.thumb { position: fixed; font-size: 34px; line-height: 1; pointer-events: none; z-index: 10002; animation: thumb .95s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .mini, .thumb { display: none; } }

.mini i { width: 10px; height: 16px; animation-duration: 1.25s !important; }
.thumb { font-size: 64px !important; animation-duration: 1.4s !important; }
@keyframes thumb { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0 } 18% { transform: translate(-50%, -90%) scale(1.5); opacity: 1 } 70% { transform: translate(-50%, -150%) scale(1.3); opacity: 1 } 100% { transform: translate(-50%, -230%) scale(1.1); opacity: 0 } }

@keyframes excl { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0 } 20% { transform: translate(-50%, -60%) scale(1.4); opacity: 1 } 70% { transform: translate(-50%, -85%) scale(3); opacity: 1 } 100% { transform: translate(-50%, -100%) scale(4.2); opacity: 0 } }
.excl { position: fixed; font-size: 56px; font-weight: 900; line-height: 1; color: #eab308; text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 18px rgba(234,179,8,.7);
  pointer-events: none; z-index: 10002; animation: excl 1.4s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .excl { display: none; } }

.tag.solo_cartas { background: #7c3aed; color: #fff; }
.house.s-solo_cartas { background: var(--card); border-color: #7c3aed; }

/* ---------- Home con el diseño de la congregación ---------- */
body.home { --card: #12304d; --line: #27557f; --fg: #e8f1fa; --muted: #7fa6cc;
  background: #152333 url(img/fondo.jpg) center bottom / cover no-repeat fixed; }
body.home #app { position: relative; z-index: 1; min-height: 100vh; }
.htitle { text-align: center; color: #3b86c8; font-size: 34px; font-weight: 500; line-height: 1.15; margin: 28px 0 44px; }
.hfoot { position: fixed; left: 0; right: 0; bottom: 22px; z-index: 2; text-align: center; color: #3b86c8; font-size: 30px; font-weight: 500; }
body.home .lform { max-width: 380px; margin: 70px auto 0; padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }
body.home .lform .input { text-align: center; font-size: 20px; padding: 16px; background: #12304d; border-color: #27557f; color: #fff; }
body.home .lform .input::placeholder { color: #7fa6cc; }
body.home .lform .btn { background: #3187d0; color: #fff; padding: 16px; font-size: 20px; }
body.home .mods { max-width: 380px; margin: 0 auto; gap: 18px; }
body.home .mod { aspect-ratio: 1 / 1; min-height: 0 !important; padding: 12px; gap: 12px; flex-direction: column;
  align-items: center !important; justify-content: center !important; text-align: center; border-radius: 22px; opacity: 1 !important; }
body.home .mod .mi { display: flex; align-items: center; justify-content: center; height: 66px; width: 100%; }
body.home .mod .mi img { max-height: 66px; max-width: 72px; width: auto; height: auto; object-fit: contain; display: block; }
body.home .mod .ml { display: block; width: 100%; text-align: center; font-size: 21px; font-weight: 500; line-height: 1.1; color: #fff; }

/* Botón "Cerca de mí": alfiler rojo; encendido = texto claro y alfiler con aro */
.nearbtn { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 16px auto 0; background: none; border: 0; color: var(--muted); font: inherit; font-size: 19px; padding: 6px 18px; }
.nearbtn svg { transition: transform .15s, filter .15s; }
.rgrp { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rbtn { margin-left: 0 !important; }
.top > .rbtn { margin-left: auto !important; }
.rbtn.spin svg { animation: spin .35s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.htop > .rbtn { margin-left: 0 !important; }
