:root {
  --bg: #0f0b1f; --surface: #1a1433; --surface-2: #251d47; --fg: #efeafc; --soft: #b9aedb; --line: #3a2f66;
  --gold: #d2b567; --gold-2: #a98a45; --violet: #a591f0; --ok: #6fd0a2; --warn: #e8bf63; --bad: #f09aa6; --btn-fg: #1a1230;
  --display: Georgia, "Times New Roman", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 19px; line-height: 1.6; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(36px, 9vw, 52px); }
h2 { font-size: 30px; }
h3 { font-size: 23px; font-weight: 600; }
p { margin: 0; }
a { color: var(--violet); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.soft { color: var(--soft); }
.note { font-size: 16px; color: var(--soft); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.page { padding: 20px max(16px, env(safe-area-inset-right)) 72px max(16px, env(safe-area-inset-left)); background:
  radial-gradient(60rem 30rem at 85% -10%, rgba(220, 189, 106, .10), transparent 60%),
  radial-gradient(50rem 30rem at -10% 10%, rgba(165, 145, 240, .12), transparent 60%), var(--bg); min-height: 100vh; }
.wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 17px; color: var(--soft); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 12px; color: var(--fg); }
input, select, textarea { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 50px; width: 100%; }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input[type="checkbox"] { width: 26px; height: 26px; min-height: 0; accent-color: var(--gold); }
input[readonly] { color: var(--soft); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn { min-height: 50px; padding: 10px 24px; border-radius: 999px; border: 1px solid var(--gold-2); background: transparent; color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.btn.solid { background: var(--gold); border-color: var(--gold); color: var(--btn-fg); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 44px; padding: 6px 18px; font-size: 17px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 15px; font-weight: 600; border: 1px solid currentColor; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.info { color: var(--violet); }
.item { padding: 16px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.item:first-child { border-top: 0; padding-top: 0; }
.meta { color: var(--soft); font-size: 16px; }
.linkbox { display: flex; flex-wrap: wrap; gap: 10px; }
.linkbox input { flex: 1 1 240px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg); padding: 12px 22px; border-radius: 999px; font-size: 17px; z-index: 50; max-width: 90vw; text-align: center; }

/* Espacio de trabajo */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 48px; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--soft); font: inherit; font-size: 18px; cursor: pointer; }
.tab[aria-selected="true"] { border-color: var(--gold); color: var(--gold); background: var(--surface-2); }
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.msg { padding: 12px 18px; border-radius: 18px; max-width: 92%; white-space: pre-wrap; word-break: break-word; }
.msg.ai { background: var(--surface-2); border-top-left-radius: 6px; align-self: flex-start; }
.msg.me { background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border: 1px solid var(--gold-2); border-top-right-radius: 6px; align-self: flex-end; }
.msg b { display: block; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.progress { display: flex; gap: 6px; }
.progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress i.on { background: var(--gold); }
.day { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.day:first-child { border-top: 0; padding-top: 0; }
.net { display: inline-flex; padding: 2px 12px; border-radius: 999px; background: var(--surface-2); color: var(--violet); font-size: 15px; font-weight: 600; border: 1px solid var(--line); }
.preview { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.sec { display: flex; flex-direction: column; gap: 8px; }
@media (prefers-reduced-motion: no-preference) { .btn { transition: transform .15s; } .btn:hover { transform: translateY(-1px); } }

/* Sello de la casa: triada viva (tres círculos y un triángulo) */
.eyebrow::before { content: ""; width: 26px; height: 26px; flex: none; background: url(/sello.svg) center / contain no-repeat; }
h1 { text-shadow: 0 0 38px color-mix(in srgb, var(--gold) 28%, transparent); }
.panel { background-image: linear-gradient(160deg, color-mix(in srgb, var(--violet) 7%, transparent), transparent 55%); }

.photo-prev{display:block;width:120px;height:120px;object-fit:cover;border-radius:58% 42% 55% 45% / 48% 56% 44% 52%;border:2px solid var(--gold,#d2b567);margin:.6rem 0}
.photo-prev[hidden]{display:none}

/* ---- Cielo vivo: estrellas y aurora suaves ---- */
.page::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,255,255,.75), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 47% 12%, rgba(210,181,103,.8), transparent),
    radial-gradient(1px 1px at 63% 48%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.5px 1.5px at 78% 22%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 88% 74%, rgba(210,181,103,.7), transparent),
    radial-gradient(1px 1px at 8% 84%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 40% 90%, rgba(255,255,255,.6), transparent);
  animation: titilar 7s ease-in-out infinite alternate; }
.wrap { position: relative; z-index: 1; }
@keyframes titilar { from { opacity: .55; } to { opacity: 1; } }

/* ---- Loto que florece ---- */
.loto { display: block; width: 132px; height: 132px; margin: 4px auto 0; animation: florecer 2.4s cubic-bezier(.2,.8,.2,1) both, respirar 6s ease-in-out 2.4s infinite;
  filter: drop-shadow(0 0 18px rgba(210,181,103,.45)); }
.loto.chico { width: 84px; height: 84px; }
@keyframes florecer { from { opacity: 0; transform: scale(.4) translateY(14px); filter: blur(6px) drop-shadow(0 0 0 transparent); } to { opacity: 1; transform: none; } }
@keyframes respirar { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); filter: drop-shadow(0 0 28px rgba(210,181,103,.65)); } }

.bienvenida { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; padding-top: 8px; }
.bienvenida .eyebrow::before { display: none; }
.luz-dia { text-align: center; font-family: var(--display); font-style: italic; font-size: 21px; color: var(--gold); padding: 6px 10px; }
.luz-dia small { display: block; font-family: var(--body); font-style: normal; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; }

/* ---- Ritual mientras la guía escribe ---- */
.ritual { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 6px; }
.ritual p.frase { font-family: var(--display); font-style: italic; font-size: 22px; color: var(--gold); min-height: 2.6em; transition: opacity .6s; }

@media (prefers-reduced-motion: reduce) {
  .page::before, .loto { animation: none; }
}

/* calidez natural: un resplandor verde-loto muy suave abajo */
.page { background-image: radial-gradient(46rem 26rem at 50% 108%, rgba(111, 208, 162, .10), transparent 65%), radial-gradient(60rem 30rem at 85% -10%, rgba(220, 189, 106, .10), transparent 60%), radial-gradient(50rem 30rem at -10% 10%, rgba(165, 145, 240, .12), transparent 60%); }
