/* Casas de lectores: cada casa define su color y el resto de los componentes lo reutiliza. */
/* --house: color de texto/acento (contraste AA sobre --house-tint); --house-glow: degradado de la paleta. */
.house-ignia { --house: #8e1b2e; --house-tint: #fdeeea; --house-glow: linear-gradient(135deg, #6e1423, #d9412f 55%, #f08a6c 80%, #d8a84e); }
.house-nerea { --house: #1d3f73; --house-tint: #eaf1fb; --house-glow: linear-gradient(135deg, #0f1f3d, #1f4e8c 50%, #7fb8e6 80%, #b9a8e8); }
.house-aeria { --house: #5b3fb0; --house-tint: #f5f1fe; --house-glow: linear-gradient(135deg, #8f74de, #c4b2f3 50%, #e7ddfb 80%, #fbf9ff); }
.house-gaia { --house: #2d5536; --house-tint: #f1f4ea; --house-glow: linear-gradient(135deg, #1f3d27, #5f8a66 50%, #b9c9a4 75%, #d8b865); }

.house-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: 999px; background: var(--house-tint); color: var(--house); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.house-icon { display: block; width: 1em; height: 1em; flex-shrink: 0; }
.house-badge .house-icon { width: 1.2em; height: 1.2em; stroke-width: 2; }
a:has(> .house-badge) { text-decoration: none; }
.user-menu-info .house-badge { margin-top: .5rem; }
.user-info .house-badge { margin-top: .35rem; }

/* Un refugio luminoso con la identidad de la casa del lector. */
.house-ignia { --house-light: #f5b653; --house-aura: #e68055; }
.house-nerea { --house-light: #8ee5ff; --house-aura: #74a8de; }
.house-aeria { --house-light: #e3c5ff; --house-aura: #b39ae7; }
.house-gaia { --house-light: #e0e993; --house-aura: #9ebd7b; }
body.house-sanctuary {
    background: var(--house-tint);
    background-image: radial-gradient(ellipse at 5% 20%, color-mix(in srgb, var(--house-aura) 28%, transparent), transparent 55%), radial-gradient(ellipse at 95% 70%, color-mix(in srgb, var(--house-light) 30%, transparent), transparent 55%);
}
.house-sanctuary .top-strip { background: var(--house); }
.house-sanctuary .app-header { --violet: var(--house); --violet-dark: var(--house); --violet-tint: var(--house-tint); background: color-mix(in srgb, var(--house-tint) 35%, white); border-bottom-color: color-mix(in srgb, var(--house) 18%, white); }
.house-page { position: relative; isolation: isolate; --violet: var(--house); --violet-dark: var(--house); --violet-tint: var(--house-tint); --line: color-mix(in srgb, var(--house) 18%, white); }
.house-page > :not(.house-enchantment) { position: relative; z-index: 1; }
.house-enchantment { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.house-firefly { position: absolute; left: var(--x); top: var(--y); width: var(--size); height: var(--size); border-radius: 50%; background: #fffde9; color: var(--house-light); box-shadow: 0 0 5px 2px currentColor, 0 0 18px 5px currentColor; opacity: .6; animation: house-firefly-drift var(--duration) ease-in-out var(--delay) infinite alternate; }
.house-firefly:nth-child(3n) { border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); width: 12px; height: 12px; background: var(--house); }
.house-firefly:nth-child(4n) { box-shadow: 0 0 7px 3px currentColor, 0 0 26px 8px currentColor; }
.house-page .house-crest-identity { position: relative; }
.house-page .house-crest-identity::before { width: 320px; height: 320px; border: 0; border-radius: 0; opacity: .7; background: radial-gradient(circle at 15% 25%, #fff 0 2px, transparent 4px), radial-gradient(circle at 85% 20%, var(--house-light) 0 3px, transparent 6px), radial-gradient(circle at 75% 75%, #fff 0 2px, transparent 5px), radial-gradient(circle at 10% 80%, var(--house-light) 0 2px, transparent 5px), radial-gradient(circle at 92% 52%, #fff 0 3px, transparent 6px); filter: drop-shadow(0 0 5px var(--house-light)); animation: house-sparkle 5s ease-in-out infinite alternate; }
.house-page .house-crest-emblem { position: relative; }
.house-page .house-crest-emblem::before, .house-page .house-crest-emblem::after { content: ""; position: absolute; width: 20px; height: 20px; background: #fff; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); pointer-events: none; animation: house-sparkle 4s ease-in-out infinite alternate; }
.house-page .house-crest-emblem::before { top: -8px; right: 3px; }
.house-page .house-crest-emblem::after { bottom: 2px; left: -10px; width: 14px; height: 14px; animation-delay: -2s; }
.house-page .house-page-heading { padding: 1.5rem 0 1rem; }
.house-page .house-page-heading h1, .house-page .house-community-heading h2 { color: var(--house); }
.house-page .house-crest { border-color: color-mix(in srgb, var(--house) 25%, white); background: linear-gradient(120deg, #ffffffed, var(--house-tint)); box-shadow: 0 18px 55px color-mix(in srgb, var(--house) 12%, transparent); }
.house-page .house-crest-identity { background: linear-gradient(145deg, #fff, var(--house-tint)); color: var(--house); }
.house-page .house-crest-identity h2 { color: inherit; }
.house-page .house-crest-tagline { color: var(--house); }
.house-page .house-crest-emblem { color: var(--house); box-shadow: 0 0 25px 5px color-mix(in srgb, var(--house-light) 60%, transparent), inset 0 0 18px #fff; animation: house-emblem-glow 6s ease-in-out infinite alternate; }
.house-page .house-points { background: linear-gradient(115deg, #fffffff2, var(--house-tint)); border-color: color-mix(in srgb, var(--house) 25%, white); box-shadow: 0 8px 30px color-mix(in srgb, var(--house) 8%, transparent); }
.house-page .house-points-intro h2 { color: var(--house); }
.house-page .house-keywords li { border: 1px solid color-mix(in srgb, var(--house) 15%, white); }
.house-page .house-list-item.is-current { box-shadow: 0 0 0 2px color-mix(in srgb, var(--house) 15%, transparent), 0 8px 28px color-mix(in srgb, var(--house) 15%, transparent); }
@keyframes house-firefly-drift {
    0% { transform: translate3d(0, 12px, 0); opacity: .15; }
    45% { opacity: .75; }
    100% { transform: translate3d(var(--drift), -65px, 0); opacity: .3; }
}
@keyframes house-emblem-glow { to { box-shadow: 0 0 38px 10px color-mix(in srgb, var(--house-light) 70%, transparent), inset 0 0 24px #fff; } }
@keyframes house-sparkle { from { opacity: .35; transform: scale(.85); } to { opacity: .9; transform: scale(1.08); } }
@media (max-width: 600px) { .house-firefly:nth-child(n+21) { display: none; } }
@media (prefers-reduced-motion: reduce) { .house-firefly, .house-page .house-crest-emblem, .house-page .house-crest-identity::before, .house-page .house-crest-emblem::before, .house-page .house-crest-emblem::after { animation: none; } .house-firefly { opacity: .35; } }

/* Invitación después de iniciar sesión. */
.house-invite-modal { box-sizing: border-box; width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 44px 36px 32px; overflow-y: auto; border: 1px solid #d0bfff; border-radius: 24px; background: #fff; color: var(--ink); text-align: center; box-shadow: 0 24px 80px #24183d33; }
.house-invite-modal::backdrop { background: #21163199; backdrop-filter: blur(4px); }
html:has(.house-invite-modal[open]) { overflow: hidden; }
.house-invite-close { position: absolute; top: 10px; right: 12px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 28px; cursor: pointer; }
.house-invite-close:hover { background: #f2edff; }
.house-invite-modal-emblems { display: flex; justify-content: center; gap: 12px; margin-bottom: 24px; }
.house-invite-modal-emblems > span { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--house); background: var(--house-tint); }
.house-invite-modal-emblems .house-icon { width: 30px; height: 30px; }
.house-invite-eyebrow { color: var(--violet-dark); font-size: .75rem; font-weight: 600; }
.house-invite-modal h2 { margin: 12px 0; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; }
.house-invite-modal #houseInviteDescription { margin: 0; font-size: .95rem; line-height: 1.7; }
.house-invite-modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.house-invite-modal-actions > * { box-sizing: border-box; justify-content: center; width: 100%; min-height: 48px; white-space: normal; }
@media (max-width: 480px) { .house-invite-modal { padding: 48px 20px 24px; border-radius: 20px; } .house-invite-modal-emblems { gap: 8px; } .house-invite-modal-emblems > span { width: 48px; height: 48px; } }

/* Invitacion en el panel para quienes todavia no tienen casa. */
.house-invite { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-top: 1.5rem; padding: 1.1rem 1.4rem; border: 1px solid #d0bfff; border-radius: 6px; background: var(--violet-tint); color: var(--ink); text-decoration: none; font-size: .85rem; }
.house-invite > span:nth-child(2) { flex: 1 1 260px; }
.house-invite-emblems { display: flex; gap: .55rem; }
.house-invite-emblems > span { display: flex; color: var(--house); }
.house-invite-emblems .house-icon { width: 1.35rem; height: 1.35rem; }
.house-invite-cta { color: var(--violet-dark); font-weight: 600; white-space: nowrap; }
.house-invite:hover { border-color: var(--violet); }

/* Cuestionario */
.page-narrow.house-quiz { max-width: 760px; }
.house-quiz-intro { margin-bottom: 1.75rem; }
.house-quiz-intro h1 { margin: .5rem 0 .75rem; }
.house-quiz-intro p { color: var(--muted); max-width: 580px; margin: 0; }
.house-quiz-form { gap: 1rem; }
.house-question { border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; margin: 0; min-width: 0; background: #fff; }
/* float saca al legend del borde del fieldset y lo deja como titulo dentro de la tarjeta */
.house-question legend { float: left; width: 100%; padding: 0; margin-bottom: .9rem; font-weight: 600; font-size: 1rem; line-height: 1.45; }
.house-question legend + * { clear: both; }
.house-question-number { display: block; color: var(--violet); font-size: .7rem; font-weight: 600; letter-spacing: .12em; margin-bottom: .25rem; }
.house-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.form .house-answer { display: flex; align-items: flex-start; gap: .7rem; margin: 0; padding: .8rem .95rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; font-size: .88rem; line-height: 1.5; transition: border-color .15s, background .15s; }
/* anula el estilo global de .form input (ancho 100%, borde, padding) para los radios */
.form .house-answer input { width: 1.05rem; height: 1.05rem; min-height: 0; padding: 0; margin: .15rem 0 0; border: 0; flex-shrink: 0; }
.house-answer:hover { border-color: #bba6ff; background: #faf8ff; }
.house-answer:has(input:checked) { border-color: var(--violet); background: var(--violet-tint); }
.house-answer:has(input:focus-visible) { outline: 3px solid #9673ff; outline-offset: 2px; }
.house-quiz-note { color: var(--muted); font-size: .8rem; margin: .25rem 0 0; }
@media (max-width: 600px) {
    .house-answers { grid-template-columns: 1fr; }
    .house-question { padding: 1rem; }
}

/* Pagina de la casa */
.page-narrow.house-page { max-width: 1120px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.house-page-heading { margin-bottom: 2rem; }
.house-section-label { display: block; font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--violet-dark); }
.house-page-heading h1 { margin: .5rem 0; color: var(--ink); font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.25; }
.house-page-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.house-crest { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.4fr); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 12px 40px #32245a06; }
.house-crest-identity { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--house-tint); text-align: center; color: var(--house); }
.house-crest-identity::before, .house-crest-identity::after { content: ""; position: absolute; z-index: -1; width: 320px; height: 320px; border: 1px solid currentColor; border-radius: 50%; opacity: .09; pointer-events: none; }
.house-crest-identity::after { width: 420px; height: 420px; }
.house-crest-eyebrow { font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.house-crest-emblem { display: grid; place-items: center; width: 110px; height: 110px; margin: 1.6rem 0 1rem; border-radius: 32px; background: #ffffffb8; border: 1px solid #fff; box-shadow: 0 10px 28px #32245a08; }
.house-crest-emblem .house-icon { width: 3.8rem; height: 3.8rem; stroke-width: 1.2; }
.house-crest h2 { font-family: Georgia, serif; font-size: clamp(3rem, 5vw, 4rem); font-weight: 400; letter-spacing: -.04em; color: var(--house); line-height: 1.1; margin: 0; }
.house-crest-tagline { margin: .5rem 0 1.5rem; font-size: .9rem; }
.house-crest-membership { padding: .4rem .85rem; border: 1px solid currentColor; border-radius: 999px; font-size: .65rem; }
.house-crest-story { padding: clamp(1.5rem, 4vw, 3rem); align-self: center; min-width: 0; }
.house-crest-story .house-section-label { color: var(--house); }
.house-crest-motto { font: 400 clamp(1.5rem, 2.8vw, 2rem)/1.35 Georgia, serif; color: var(--ink); margin: .8rem 0 1rem; }
.house-crest-description { color: var(--muted); font-size: .86rem; line-height: 1.85; margin: 0; }
.house-keywords { list-style: none; padding: 0; margin: 1.3rem 0 1.7rem; display: flex; flex-wrap: wrap; gap: .45rem; }
.house-keywords li { padding: .3rem .75rem; border-radius: 7px; background: var(--house-tint); color: var(--house); font-size: .72rem; }
.house-crest-details { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.house-crest-details dt { font-size: .65rem; color: var(--muted); margin-bottom: .2rem; }
.house-crest-details dd { margin: 0; font-size: .8rem; color: var(--ink); }
.house-points { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; margin-top: 1.25rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.house-points-intro { flex: 1 1 260px; }
.house-points-intro h2 { color: var(--ink); font-size: 1.05rem; margin: 0 0 .35rem; }
.house-points-intro p { color: var(--muted); font-size: .78rem; margin: 0; max-width: 380px; }
.house-points-totals { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 0; }
.house-points-totals dt { font-size: .7rem; color: var(--muted); }
.house-points-totals dd { margin: .15rem 0 0; font-size: 1.8rem; font-weight: 600; line-height: 1.3; color: var(--house); }
.house-points-totals dd span { font-size: .7rem; font-weight: 400; }
.house-list-points { color: var(--house); font-size: .7rem; margin: .9rem 0 0; }
.house-list-points strong { font-size: 1.35rem; font-weight: 600; }
.house-contributors { margin-top: 2rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(120deg, #fffffff2, var(--house-tint)); }
.house-contributors h2 { margin: .4rem 0; font-size: 1.2rem; color: var(--house); }
.house-contributors-caption { font-size: .8rem; color: var(--muted); margin: .5rem 0; }
.house-contributors-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; list-style: none; padding: 0; margin: 1.2rem 0 0; }
.house-contributors-list li { display: flex; align-items: center; gap: .65rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #ffffffcf; min-width: 0; }
.house-contributors-list li.is-leading { border-color: var(--house); box-shadow: 0 0 20px color-mix(in srgb, var(--house-light) 35%, transparent); }
.house-contributor-rank { color: var(--house); font: 600 1.2rem Georgia, serif; }
.house-contributors-list .avatar { width: 36px; height: 36px; flex-shrink: 0; object-fit: cover; }
.house-contributor-info { min-width: 0; }
.house-contributor-info strong { display: block; font-size: .8rem; overflow-wrap: anywhere; }
.house-contributor-info > span { display: block; margin-top: .25rem; font-size: .72rem; color: var(--house); }
@media (max-width: 850px) { .house-contributors-list { grid-template-columns: minmax(0, 1fr); } }
.house-community { margin-top: 3rem; }
.house-community-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.house-community-heading h2 { color: var(--ink); font-size: 1.5rem; margin: .35rem 0 0; }
.house-community-heading > p { color: var(--muted); font-size: .78rem; margin: 0; }
.house-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.house-list-item { position: relative; overflow: hidden; padding: 1.4rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.house-list-item::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--house-glow); }
.house-list-item.is-current { background: var(--house-tint); border-color: var(--house); }
.house-list-top { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: 1.3rem; }
.house-list-emblem { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 12px; background: var(--house-tint); color: var(--house); flex-shrink: 0; }
.is-current .house-list-emblem { background: #ffffffa8; }
.house-list-emblem .house-icon { width: 1.5rem; height: 1.5rem; stroke-width: 1.5; }
.house-current-label { border-radius: 999px; background: var(--house); color: #fff; font-size: .6rem; padding: .2rem .6rem; white-space: nowrap; }
.house-list-element { color: var(--house); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; }
.house-list-item h3 { color: var(--house); font: 400 1.8rem/1.2 Georgia, serif; margin: .3rem 0; }
.house-list-tagline { color: var(--ink); font-size: .75rem; margin: 0; }
.house-list-essence { margin: 1rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
@media (max-width: 850px) {
    .house-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .house-community-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 600px) {
    .page-narrow.house-page { width: calc(100% - 2rem); margin: 1.5rem auto; }
    .house-crest { grid-template-columns: minmax(0, 1fr); border-radius: 18px; }
    .house-crest-identity { padding: 2rem 1rem; }
    .house-crest-emblem { width: 90px; height: 90px; margin-top: 1.2rem; }
    .house-community { margin-top: 2rem; }
    .house-list { gap: .7rem; }
    .house-list-item { padding: 1rem; }
}
@media (max-width: 360px) {
    .house-list { grid-template-columns: minmax(0, 1fr); }
}
