/* Planta 1 Pino · estética "liquid glass" cálida pastel */
:root {
  --bg: #fff4ea;
  --blob1: #ffd3b6; --blob2: #c6f0df; --blob3: #ead9ff; --blob4: #fff0b8;
  --glass: rgba(255, 255, 255, .55);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .25);
  --shadow: 0 10px 34px rgba(110, 65, 34, .13), 0 2px 6px rgba(110, 65, 34, .06);
  --ink: #3b2416; --muted: #8a6a55; --faint: rgba(59, 36, 22, .08);
  --accent: #8b5a2b; --accent-2: #b07442; --accent-ink: #fff;
  --go: #2fa57a; --go-2: #4cc79a; --danger: #e25555; --warn: #e8a33d;
  --track: rgba(139, 90, 43, .12);
  --hm0: rgba(139, 90, 43, .08); --hm2: #d9a877; --hm3: #b07442; --hm4: #6e4122;
  --radius: 26px; --radius-sm: 16px;
  --tabbar-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17110d;
    --blob1: #5a3423; --blob2: #1d4a3c; --blob3: #3a2b58; --blob4: #4d3d18;
    --glass: rgba(48, 34, 26, .55); --glass-strong: rgba(58, 42, 32, .82);
    --glass-border: rgba(255, 255, 255, .09);
    --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .08);
    --shadow: 0 10px 34px rgba(0, 0, 0, .35);
    --ink: #fbeee2; --muted: #c3a58f; --faint: rgba(255, 255, 255, .07);
    --accent: #e3a56b; --accent-2: #c98a52; --accent-ink: #2a170b;
    --track: rgba(255, 255, 255, .08);
    --hm0: rgba(255, 255, 255, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17110d;
  --blob1: #5a3423; --blob2: #1d4a3c; --blob3: #3a2b58; --blob4: #4d3d18;
  --glass: rgba(48, 34, 26, .55); --glass-strong: rgba(58, 42, 32, .82);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .08);
  --shadow: 0 10px 34px rgba(0, 0, 0, .35);
  --ink: #fbeee2; --muted: #c3a58f; --faint: rgba(255, 255, 255, .07);
  --accent: #e3a56b; --accent-2: #c98a52; --accent-ink: #2a170b;
  --track: rgba(255, 255, 255, .08);
  --hm0: rgba(255, 255, 255, .06);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  -webkit-user-select: none; user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Fondo con manchas de color que flotan */
.bg { position: fixed; inset: -20%; z-index: -1; overflow: hidden; filter: blur(60px) saturate(1.1); }
.bg i { position: absolute; border-radius: 50%; opacity: .85; animation: float 22s ease-in-out infinite alternate; }
.bg i:nth-child(1) { width: 55vmax; height: 55vmax; background: var(--blob1); left: -5%; top: -10%; }
.bg i:nth-child(2) { width: 45vmax; height: 45vmax; background: var(--blob2); right: -10%; top: 25%; animation-delay: -6s; }
.bg i:nth-child(3) { width: 40vmax; height: 40vmax; background: var(--blob3); left: 10%; bottom: -15%; animation-delay: -12s; }
.bg i:nth-child(4) { width: 25vmax; height: 25vmax; background: var(--blob4); right: 20%; top: -5%; animation-delay: -3s; }
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(6vmax, 4vmax) scale(1.12); } }

/* Vidrio */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow), var(--glass-hi);
}

/* Layout */
#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); min-height: 100vh; }
.view { animation: viewIn .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.topbar { display: flex; align-items: center; gap: 10px; margin: 2px 2px 16px; }
.topbar .mini { width: 38px; height: 38px; }
.topbar h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; flex: 1; font-weight: 800; }
.topbar h1 small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.avatar-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; cursor: pointer; border: 0; }
h2.title { font-size: 30px; letter-spacing: -.03em; margin: 4px 2px 14px; font-weight: 800; }

.card { border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card h3 .right { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-sm); padding: 13px 18px; font-weight: 650; font-size: 16px; cursor: pointer;
  background: var(--glass-strong); color: var(--ink); box-shadow: var(--glass-hi), 0 2px 8px rgba(0, 0, 0, .05);
  transition: transform .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.96); }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(139, 90, 43, .3), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.go { background: linear-gradient(180deg, var(--go-2), var(--go)); color: #fff; box-shadow: 0 8px 22px rgba(47, 165, 122, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .5; }

/* Botón gigante "Entro" */
.enter-wrap { display: grid; place-items: center; padding: 18px 0 8px; }
.enter-btn {
  position: relative; width: min(64vw, 240px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .4) 60%, rgba(255, 255, 255, .25));
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(139, 90, 43, .28), inset 0 2px 0 rgba(255, 255, 255, .9), inset 0 -10px 30px rgba(176, 116, 66, .18);
  border: 1px solid var(--glass-border);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] .enter-btn { background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 60%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .enter-btn { background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 60%); } }
.enter-btn:active { transform: scale(.94); }
.enter-btn .poo { width: 58%; height: 58%; }
.enter-btn::before, .enter-btn::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent-2); opacity: 0; animation: ring 2.8s ease-out infinite; }
.enter-btn::after { animation-delay: 1.4s; }
@keyframes ring { 0% { transform: scale(.95); opacity: .5; } 100% { transform: scale(1.25); opacity: 0; } }
.enter-label { margin-top: 18px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.enter-sub { color: var(--muted); font-size: 14px; }

/* Caquita: animaciones */
.poo { overflow: visible; }
.poo .poo-body { transform-origin: 64px 116px; transform-box: view-box; }
.poo .poo-eyes { transform-origin: 64px 68px; transform-box: view-box; animation: blink 4.5s infinite; }
.poo .poo-blush { opacity: .55; }
.poo .poo-blush.strong { opacity: .9; animation: blushPulse 1s ease-in-out infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes blushPulse { 50% { opacity: .5; } }
.poo.idle .poo-body { animation: idle 3.2s ease-in-out infinite; }
@keyframes idle { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .97); } }
.poo.bounce .poo-body { animation: bounce 1.1s cubic-bezier(.3, 0, .3, 1) infinite; }
.poo.bounce .poo-shadow { animation: shadowB 1.1s cubic-bezier(.3, 0, .3, 1) infinite; transform-origin: 64px 121px; transform-box: view-box; }
@keyframes bounce {
  0% { transform: translateY(0) scale(1.12, .86); }
  18% { transform: translateY(-6px) scale(.92, 1.1); }
  50% { transform: translateY(-34px) scale(1, 1); }
  82% { transform: translateY(-4px) scale(.95, 1.06); }
  100% { transform: translateY(0) scale(1.12, .86); }
}
@keyframes shadowB { 0%, 100% { transform: scale(1); opacity: .22; } 50% { transform: scale(.6); opacity: .08; } }
.poo.push .poo-body { animation: push .5s ease-in-out infinite; }
@keyframes push { 0%, 100% { transform: translate(0, 0) scale(1, 1); } 25% { transform: translate(-1.2px, 1px) scale(1.04, .95); } 75% { transform: translate(1.2px, 1px) scale(1.04, .95); } }
.poo .poo-sweat { animation: sweat 1.6s ease-in infinite; transform-box: view-box; }
@keyframes sweat { 0% { transform: translateY(-4px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }
.poo .poo-zzz { animation: zzz 2s ease-in-out infinite; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 4px); } 50% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -10px); } }
.poo.wiggle .poo-body { animation: wiggle .9s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* En el váter */
.inside-card { text-align: center; padding-top: 10px; }
.toilet { width: min(56vw, 220px); height: auto; display: block; margin: 0 auto; }
.toilet .toilet-poo .poo-body { animation: push .5s ease-in-out infinite; }
.timer { font-size: 64px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; margin: 6px 0 4px; }
.inside-msg { min-height: 24px; color: var(--muted); transition: opacity .4s; }
.inside-actions { display: grid; gap: 10px; margin-top: 18px; }
.inside-actions .btn.go { padding: 18px; font-size: 19px; border-radius: 20px; }
.badge-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--go); background: rgba(47, 165, 122, .12); padding: 5px 10px; border-radius: 999px; }
.badge-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--go); animation: live 1.2s infinite; }
@keyframes live { 50% { opacity: .3; } }

/* Mini estadísticas */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { text-align: center; padding: 12px 6px; border-radius: 18px; background: var(--faint); }
.kpi b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi em { display: block; font-style: normal; font-size: 11px; font-weight: 700; margin-top: 2px; }
.kpi em.up { color: var(--go); } .kpi em.down { color: var(--danger); }
.kpis.k2 { grid-template-columns: 1fr 1fr; }

/* Listas de visitas */
.vlist { display: flex; flex-direction: column; gap: 8px; }
.vitem { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--faint); cursor: pointer; transition: transform .12s; }
.vitem:active { transform: scale(.98); }
.vitem .ve { font-size: 24px; width: 34px; text-align: center; }
.vitem .vm { flex: 1; min-width: 0; }
.vitem .vt { font-weight: 700; font-variant-numeric: tabular-nums; }
.vitem .vs { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vitem .vr { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.day-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 4px 8px; }
.day-h:first-child { margin-top: 0; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--track); color: var(--muted); }

/* Chips / segmentado */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; padding: 10px 14px; border-radius: 999px; font-weight: 650; font-size: 15px; cursor: pointer;
  background: var(--faint); color: var(--ink); transition: transform .12s, background .2s;
}
.chip:active { transform: scale(.94); }
.chip.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 4px 12px rgba(139, 90, 43, .25); }
.chip.big { padding: 14px 16px; font-size: 17px; flex: 1; min-width: 40%; text-align: center; }
.seg { display: flex; background: var(--faint); border-radius: 14px; padding: 4px; gap: 2px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 11px; font-weight: 650; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

/* Bristol picker */
.bristol-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bristol-opt { border: 0; border-radius: 16px; padding: 10px 4px 8px; background: var(--faint); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .12s; }
.bristol-opt:active { transform: scale(.94); }
.bristol-opt b { font-size: 12px; } .bristol-opt span { font-size: 10px; color: var(--muted); line-height: 1.15; text-align: center; }
.bristol-opt.on { background: rgba(139, 90, 43, .18); box-shadow: inset 0 0 0 2px var(--accent); }
.bristol-opt.ideal b::after { content: " ✨"; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transition: transform .12s; }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); transform: scale(1.05); }
.faces { display: flex; justify-content: space-between; }
.faces button { font-size: 30px; border: 0; background: transparent; cursor: pointer; filter: grayscale(1); opacity: .45; transition: transform .15s, filter .15s, opacity .15s; padding: 4px; }
.faces button.on { filter: none; opacity: 1; transform: scale(1.25); }

/* Campos */
.field { margin-bottom: 14px; }
.field > label, .lbl-t { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 8px 2px; text-transform: uppercase; letter-spacing: .03em; }
.input, select.input, textarea.input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--faint); background: var(--faint);
  font: inherit; color: inherit; outline: none; transition: box-shadow .15s, background .15s;
}
.input:focus { box-shadow: 0 0 0 3px rgba(176, 116, 66, .3); background: var(--glass-strong); }
textarea.input { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
.warn { font-size: 13px; background: rgba(232, 163, 61, .15); color: #9a5b00; padding: 10px 12px; border-radius: 12px; margin-top: 10px; }
:root[data-theme="dark"] .warn { color: #ffcf8a; }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-sum { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--faint); cursor: pointer; font-weight: 650; }

/* Interruptor */
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.toggle + .toggle { border-top: 1px solid var(--faint); }
.toggle .tt { flex: 1; } .toggle .tt small { display: block; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--track); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + i { background: var(--go); }
.switch input:checked + i::after { transform: translateX(20px); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; }
.set-row + .set-row { border-top: 1px solid var(--faint); }

/* Barra de pestañas */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); z-index: 20;
  width: min(calc(100% - 24px), 520px); height: 64px; border-radius: 26px; display: flex; padding: 6px;
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 650; border-radius: 20px; position: relative; transition: color .2s, background .2s; }
.tabbar a svg { width: 24px; height: 24px; transition: transform .2s; }
.tabbar a.on { color: var(--accent); background: var(--faint); }
.tabbar a.on svg { transform: translateY(-1px) scale(1.08); }
.tabbar .pip { position: absolute; top: 6px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }

/* Hoja inferior */
.sheet-bg { position: fixed; inset: 0; background: rgba(30, 15, 5, .35); z-index: 40; animation: fadeIn .25s; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 41; width: min(100%, 560px);
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 30px 30px 0 0; padding: 10px 18px calc(18px + var(--safe-b));
  background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  animation: sheetIn .38s cubic-bezier(.2, .9, .25, 1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--track); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.sheet h2 .poo { width: 36px; height: 36px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; padding-top: 10px; }
.sheet.closing { animation: sheetOut .25s ease-in forwards; }
.sheet-bg.closing { animation: fadeOut .25s forwards; }
@keyframes sheetIn { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sheetOut { to { transform: translate(-50%, 100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

/* Toast */
.toasts { position: fixed; top: calc(var(--safe-t) + 12px); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 18px; font-weight: 650; font-size: 15px; max-width: calc(100% - 32px); animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.3); pointer-events: auto; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.95); } }

/* Splash / cargando */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .4s; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash .poo { width: 120px; height: 120px; }
.splash p { text-align: center; color: var(--muted); font-weight: 600; margin-top: 14px; }
.loader-inline { display: grid; place-items: center; padding: 40px 0; }
.loader-inline .poo { width: 64px; height: 64px; }

/* Animación de cisterna al guardar */
.flush { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(255, 244, 234, .4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fadeIn .2s; }
.flush.out { animation: fadeOut .35s forwards; }
.flush .vortex { position: relative; width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(from 0deg, #bfe9f7, #8fd0ea, #e6f8ff, #7cc8f0, #bfe9f7); animation: spin .9s linear infinite;
  box-shadow: inset 0 0 40px rgba(0, 80, 120, .25), 0 20px 60px rgba(60, 140, 180, .35); }
.flush .vortex::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: radial-gradient(circle, #5fb3d9, #9fd8ef); }
.flush .poo { position: absolute; width: 110px; height: 110px; z-index: 2; animation: flushed 1.3s cubic-bezier(.5, 0, .7, .4) forwards; }
.flush .flush-txt { position: absolute; bottom: 18%; left: 0; right: 0; text-align: center; font-size: 34px; font-weight: 900; letter-spacing: -.03em; color: #2f86b0; animation: pop .5s .3s both cubic-bezier(.2, .9, .3, 1.5); }
.flush .drop { position: absolute; font-size: 22px; animation: dropFly 1.1s ease-out forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flushed { 0% { transform: rotate(0) scale(1); } 100% { transform: rotate(900deg) scale(0); opacity: .2; } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes dropFly { from { transform: translate(0, 0) scale(.5); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }

/* Estadísticas */
.chart { width: 100%; height: 140px; display: block; overflow: visible; }
.chart .axis { stroke: var(--track); stroke-width: 1; }
.chart .lbl, .heat .lbl { font-size: 9px; fill: var(--muted); font-weight: 600; }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .6s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.heat-wrap { overflow-x: auto; padding-bottom: 4px; direction: rtl; }
.heat-wrap svg { direction: ltr; }
.heat .hm.l0 { fill: var(--hm0); } .heat .hm.l2 { fill: var(--hm2); } .heat .hm.l3 { fill: var(--hm3); } .heat .hm.l4 { fill: var(--hm4); }
.gauge { width: 100%; max-width: 240px; display: block; margin: 0 auto; }
.gauge-num { font-size: 40px; font-weight: 900; fill: var(--ink); letter-spacing: -.03em; }
.gauge-val { animation: gaugeIn 1.2s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes gaugeIn { from { stroke-dashoffset: var(--len); } }
.donut { width: 120px; height: 120px; flex: none; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hbar .hb-ic { width: 46px; flex: none; display: grid; place-items: center; }
.hbar .hb-track { flex: 1; height: 12px; border-radius: 6px; background: var(--track); overflow: hidden; }
.hbar .hb-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); animation: fillIn .8s cubic-bezier(.2, .9, .3, 1) both; transform-origin: left; }
.hbar .hb-fill.ideal { background: linear-gradient(90deg, var(--go-2), var(--go)); }
.hbar .hb-n { width: 34px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
@keyframes fillIn { from { transform: scaleX(0); } }
.rec { display: flex; justify-content: space-between; padding: 10px 0; }
.rec + .rec { border-top: 1px solid var(--faint); }
.rec b { font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach { text-align: center; padding: 12px 6px; border-radius: 18px; background: var(--faint); }
.ach .ai { font-size: 32px; display: block; transition: transform .3s; }
.ach b { display: block; font-size: 12.5px; margin-top: 4px; }
.ach span { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
.ach.locked .ai { filter: grayscale(1); opacity: .3; }
.ach.locked b { color: var(--muted); }
.ach:not(.locked) .ai { animation: achPop .6s cubic-bezier(.2, .9, .3, 1.6) both; }
@keyframes achPop { from { transform: scale(.3) rotate(-20deg); } }
.big-num { font-size: 44px; font-weight: 900; letter-spacing: -.04em; line-height: 1; }

/* Amigos */
.code-box { font-size: 30px; font-weight: 900; letter-spacing: .14em; text-align: center; padding: 14px; border-radius: 18px; background: var(--faint); font-variant-numeric: tabular-nums; -webkit-user-select: all; user-select: all; }
.friend { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.friend + .friend { border-top: 1px solid var(--faint); }
.friend .fa { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--faint); flex: none; position: relative; }
.friend .fa.inside::after { content: "🚽"; position: absolute; right: -4px; bottom: -4px; font-size: 16px; animation: wobble 1s ease-in-out infinite; }
@keyframes wobble { 50% { transform: rotate(12deg); } }
.friend .fm { flex: 1; min-width: 0; } .friend .fm b { display: block; } .friend .fm span { font-size: 13px; color: var(--muted); }
.cheers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cheers button { font-size: 24px; border: 0; background: var(--faint); border-radius: 12px; padding: 6px 8px; cursor: pointer; transition: transform .12s; }
.cheers button:active { transform: scale(.85); }
.podium { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--faint); }
.prow.me { box-shadow: inset 0 0 0 2px var(--accent); }
.prow .pp { width: 30px; font-size: 22px; text-align: center; font-weight: 800; }
.prow .pa { font-size: 24px; }
.prow .pn { flex: 1; min-width: 0; } .prow .pn b { display: block; } .prow .pn span { font-size: 12px; color: var(--muted); }
.prow .pc { font-size: 20px; font-weight: 900; }
.inside-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px; }
.inside-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--faint); white-space: nowrap; font-size: 14px; font-weight: 650; }

/* Auth */
.auth { min-height: calc(100vh - 60px); display: flex; flex-direction: column; justify-content: center; }
.auth-hero { text-align: center; margin-bottom: 18px; }
.auth-hero .poo { width: 130px; height: 130px; }
.auth-hero h1 { font-size: 36px; letter-spacing: -.04em; margin: 8px 0 4px; font-weight: 900; }
.auth-hero h1 span { color: var(--accent); }
.auth-hero p { color: var(--muted); margin: 0; }

.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatars button { font-size: 24px; border: 0; background: var(--faint); border-radius: 12px; padding: 6px 0; cursor: pointer; }
.avatars button.on { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(139, 90, 43, .15); }
.banner { display: flex; align-items: center; gap: 12px; }
.banner .bi { font-size: 30px; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .poo { width: 80px; height: 80px; display: block; margin: 0 auto 10px; }

@media (max-width: 360px) {
  .timer { font-size: 52px; }
  .bristol-grid { grid-template-columns: repeat(3, 1fr); }
  .avatars { grid-template-columns: repeat(6, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- v1.1: saludo, pasos, bienvenida, pantallas pequeñas ---------- */
.hello { display: flex; align-items: center; gap: 14px; margin: 0 4px 6px; animation: viewIn .5s cubic-bezier(.2, .8, .2, 1); }
.hello-e { font-size: 40px; line-height: 1; animation: helloE 3s ease-in-out infinite; }
@keyframes helloE { 50% { transform: translateY(-4px) rotate(-6deg); } }
.hello small { display: block; font-size: 15px; font-weight: 600; color: var(--muted); }
.hello b { display: block; font-size: 30px; font-weight: 850; letter-spacing: -.035em; line-height: 1.05; }

.dots { display: flex; gap: 6px; align-items: center; }
.dots button { width: 8px; height: 8px; border-radius: 4px; border: 0; padding: 0; background: var(--track); transition: width .3s cubic-bezier(.2, .8, .2, 1), background .3s; cursor: pointer; }
.dots button.done { background: var(--accent-2); opacity: .6; }
.dots button.on { width: 24px; background: var(--accent); }
.vs-head { display: flex; align-items: center; gap: 8px; min-height: 34px; margin-bottom: 6px; }
.vs-head .dots { flex: 1; }
.vs-body { min-height: 300px; }
@keyframes stepIn { from { opacity: 0; transform: translateX(28px); } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-28px); } }
.kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-opt { border: 0; border-radius: 22px; padding: 18px 8px; background: var(--faint); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .12s, background .2s, box-shadow .2s; }
.kind-opt span { font-size: 36px; line-height: 1; }
.kind-opt b { font-size: 16px; }
.kind-opt:active { transform: scale(.95); }
.kind-opt.on { background: rgba(139, 90, 43, .16); box-shadow: inset 0 0 0 2px var(--accent); }
.seg.mini { margin-bottom: 0; }
.seg.mini button { padding: 10px 2px; font-size: 13.5px; }
.chips.tight { gap: 6px; } .chips.tight .chip { padding: 9px 12px; font-size: 14px; }
.sheet .field { margin-bottom: 16px; }
.sheet-actions { background: linear-gradient(to top, var(--glass-strong) 70%, transparent); }

.onb { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px);
  background: rgba(30, 15, 5, .45); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: fadeIn .3s; overflow-y: auto; }
.onb.out { animation: fadeOut .3s forwards; }
.onb-card { width: min(100%, 420px); border-radius: 30px; padding: 22px 20px 12px; text-align: center; background: var(--glass-strong); animation: sheetPop .45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes sheetPop { from { opacity: 0; transform: translateY(30px) scale(.95); } }
.onb-card .dots { justify-content: center; margin-bottom: 14px; }
.onb-card .poo { width: 96px; height: 96px; }
.onb-card h2 { font-size: 26px; letter-spacing: -.03em; margin: 8px 0 6px; }
.onb-card p { color: var(--muted); margin: 0 0 6px; }
.onb-ic { font-size: 56px; line-height: 1.1; animation: helloE 2.6s ease-in-out infinite; }
.onb-ok { color: var(--go) !important; font-weight: 700; margin-top: 10px !important; }
.onb-actions { display: grid; gap: 8px; margin-top: 18px; }
.onb-steps { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; display: grid; gap: 10px; }
.onb-steps li { display: flex; gap: 12px; align-items: center; background: var(--faint); border-radius: 16px; padding: 10px 12px; font-size: 15px; }
.onb-steps li > span { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent); color: var(--accent-ink); }
.ios-share { width: 20px; height: 20px; vertical-align: -4px; color: #0a84ff; }
.onb-arrow { margin-top: 12px; color: #0a84ff; display: flex; flex-direction: column; align-items: center; font-size: 22px; font-weight: 800; animation: arrowB 1.2s ease-in-out infinite; }
.onb-arrow .ios-share { width: 30px; height: 30px; }
@keyframes arrowB { 50% { transform: translateY(8px); } }
.onb .warn { text-align: left; }
.onb-card .card .toggle { text-align: left; }

.topbar h1 { font-size: 18px; }
.topbar .mini { width: 32px; height: 32px; }

/* Pantallas pequeñas (iPhone SE, Android compactos) */
@media (max-width: 380px) {
  #app { padding-left: 12px; padding-right: 12px; }
  .card { padding: 15px; border-radius: 22px; }
  .hello b { font-size: 26px; } .hello-e { font-size: 34px; }
  .kpi b { font-size: 21px; }
  .kpis { gap: 8px; }
  .enter-label { font-size: 20px; }
  .tabbar { width: calc(100% - 16px); bottom: calc(6px + var(--safe-b)); height: 60px; }
  .tabbar a { font-size: 9.5px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .sheet { padding-left: 14px; padding-right: 14px; }
  .kind-opt { padding: 14px 6px; } .kind-opt span { font-size: 30px; }
  .bristol-opt span { font-size: 9.5px; }
  .ach-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  h2.title { font-size: 26px; }
}
@media (max-height: 700px) {
  .enter-btn { width: min(50vw, 190px); }
  .enter-wrap { padding-top: 6px; }
  .toilet { width: min(40vw, 150px); }
  .timer { font-size: 50px; }
  .inside-actions { margin-top: 10px; }
  .vs-body { min-height: 0; }
  .onb-card .poo { width: 72px; height: 72px; } .onb-ic { font-size: 44px; }
}
@media (max-width: 340px) {
  .bristol-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi span { font-size: 11px; }
  .seg button { font-size: 12.5px; }
}
a.btn { text-decoration: none; }
.grid2 .btn { white-space: nowrap; font-size: 15px; padding: 13px 10px; }
@media (max-width: 380px) { .grid2 .btn { font-size: 13.5px; } }
.ki-both { position: relative; display: inline-block; }
.ki-both i { position: absolute; right: -6px; bottom: -2px; font-style: normal; font-size: 14px; }
.vitem .ve { display: grid; place-items: center; }
.kind-opt span { display: grid; place-items: center; height: 40px; }
