/* =========================================================
   Sala do Oráculo (Nov 2026) — visual imersivo do oraculo.php
   Sempre escura (decisão do dono, 11 Nov 2026). Céu e sigilo em assets/js/oraculo-room.js.
   Cores da sala: --room-* (dourado no Grande Oráculo, vermelho no Proibido).
   Seletores com "html body.om-room" porque o global-theme.css é carregado outra vez pelo cabeçalho.
   ========================================================= */
html body.om-room {
    --room-deep: #06050b;
    --room-deep-rgb: 6, 5, 11;
    --room-ink: #f3ead6;
    --room-mute: #a99f8c;
    --room-a: #d8b46a;
    --room-a2: #f3dca0;
    --room-a-rgb: 216, 180, 106;
    background: var(--room-deep) !important;
    color: var(--room-ink);
}
html body.om-room.om-forbidden {
    --room-deep: #070303;
    --room-deep-rgb: 7, 3, 3;
    --room-ink: #f0dcd6;
    --room-mute: #a8857e;
    --room-a: #d2402f;
    --room-a2: #ff9b7d;
    --room-a-rgb: 210, 64, 47;
}
html body.om-room.om-nogl {
    background:
        radial-gradient(ellipse at 50% 22%, rgba(var(--room-a-rgb), .12), transparent 55%),
        radial-gradient(ellipse at 25% 60%, rgba(70, 40, 130, .22), transparent 50%),
        radial-gradient(ellipse at 80% 85%, rgba(70, 40, 130, .16), transparent 45%),
        var(--room-deep) !important;
    background-attachment: fixed !important;
}
html body.om-room.om-forbidden.om-nogl {
    background:
        radial-gradient(ellipse at 50% 22%, rgba(var(--room-a-rgb), .14), transparent 55%),
        radial-gradient(ellipse at 30% 65%, rgba(120, 14, 10, .22), transparent 50%),
        var(--room-deep) !important;
    background-attachment: fixed !important;
}

/* A sala é sempre escura: sem botão de tema nesta página */
html body.om-room #themeToggleBtn,
html body.om-room #themeFloatBtn,
html body.om-room .om-dr-row:has([data-om-theme]) { display: none !important; }

/* "Instalar App" (computador) por cima da consola de escrita, que agora fica presa no fundo */
html body.om-room #pwaFabWrap { bottom: 140px; }

#omSky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; pointer-events: none; }

/* ---------- cabeçalho da sala ---------- */
html body.om-room .main-content { max-width: 820px; padding: .5rem 1.25rem 0; }
html body.om-room .page-header { margin: 0 0 .75rem; text-align: center; }

.om-switch { position: relative; display: inline-flex; align-items: center; justify-content: center; margin: .2rem auto .6rem; }
html body.om-room .om-sw-opt {
    position: relative; display: inline-flex; align-items: center; gap: 9px;
    min-height: 44px; padding: 6px 14px 10px; background: none; border: 0; border-radius: 0; cursor: pointer;
    font-family: 'Cormorant Garamond', Georgia, serif; font-size: 18px; font-weight: 500; letter-spacing: .06em;
    color: var(--room-mute); white-space: nowrap; transition: color .4s, text-shadow .4s;
}
html body.om-room .om-sw-opt:hover { color: var(--room-ink); }
html body.om-room .om-sw-opt[aria-pressed="true"] { color: var(--room-a2); text-shadow: 0 0 18px rgba(var(--room-a-rgb), .7); }
.om-sw-opt svg { width: 20px; height: 20px; flex: none; }
.om-sw-opt .om-sw-lock { width: 13px; height: 13px; opacity: .85; }
.om-sw-sep { width: 34px; height: 1px; position: relative; background: linear-gradient(90deg, transparent, rgba(var(--room-a-rgb), .6), transparent); }
.om-sw-sep::after { content: ''; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; background: var(--room-a); transform: translate(-50%, -50%) rotate(45deg); }
.om-sw-line { position: absolute; bottom: 4px; left: 0; width: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--room-a2), transparent); transition: left .7s cubic-bezier(.7,0,.2,1), width .7s cubic-bezier(.7,0,.2,1); pointer-events: none; }

.om-sigil-wrap { width: min(60vw, 320px); aspect-ratio: 1; margin: 0 auto; touch-action: pan-y; transition: opacity .9s; opacity: .72; }
#omSigil { width: 100%; height: 100%; overflow: visible; display: block; filter: drop-shadow(0 0 4px rgba(var(--room-a-rgb), .22)); }
#omSigil .ln { stroke: url(#omGs); fill: none; }
#omSigil .gl { fill: var(--room-a2); font-family: 'Cormorant Garamond', 'Segoe UI Symbol', 'Apple Symbols', serif; font-size: 17px; text-anchor: middle; dominant-baseline: central; }
#omSigil .om-dot { fill: var(--room-a); }
.om-setA, .om-setF { transition: opacity 1.1s; }
.om-setF { opacity: 0; }
body.om-forbidden .om-setA { opacity: 0; }
body.om-forbidden .om-setF { opacity: 1; }
#omEye, #omPupil { transform-box: fill-box; transform-origin: center; }
#omPupil { transition: transform 1.2s cubic-bezier(.7,0,.2,1); }
body.om-forbidden #omPupil { transform: scale(.32, 1.45); }
body.om-thinking #omPupil { transform: scale(1.45); }
body.om-forbidden.om-thinking #omPupil { transform: scale(.45, 1.7); }

html body.om-room .page-title {
    font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500;
    font-size: clamp(24px, 3.6vw, 34px); letter-spacing: .34em; text-indent: .34em; text-transform: uppercase;
    color: var(--room-a2); text-shadow: none; margin: .5rem 0 .3rem;
}
html body.om-room .page-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 19px; line-height: 1.4;
    color: var(--room-mute); max-width: 32em; margin: 0 auto;
}

/* Depois da 1.ª pergunta: título recolhe e o sigilo fica atrás da conversa, grande e ténue */
html body.om-room.om-chatting .page-title,
html body.om-room.om-chatting .page-subtitle,
html body.om-room.om-chatting .guest-banner { display: none; }
html body.om-room.om-chatting .om-sigil-wrap {
    position: fixed; left: 50%; top: 54%; width: min(118vw, 720px); transform: translate(-50%, -50%);
    margin: 0; z-index: 0; opacity: .055; pointer-events: none;
}
html body.om-room.om-chatting #omSigil { filter: none; }
html body.om-room.om-chatting.om-thinking .om-sigil-wrap { opacity: .2; }

html body.om-room .guest-banner {
    max-width: 560px; background: rgba(var(--room-deep-rgb), .55); border: 1px solid rgba(var(--room-a-rgb), .28);
    border-radius: 12px; color: var(--room-mute); justify-content: center; text-align: center;
}
html body.om-room .guest-banner svg, html body.om-room .guest-banner strong, html body.om-room .guest-banner a { color: var(--room-a2); }
html body.om-room .guest-banner a { border-bottom-color: var(--room-a2); }

/* ---------- conversa ---------- */
html body.om-room .oracle-interface {
    position: relative; z-index: 1; background: none !important; border: 0; border-radius: 0; box-shadow: none !important;
    -webkit-backdrop-filter: none; backdrop-filter: none; min-height: 0; overflow: visible;
}
html body.om-room .chat-area { padding: .25rem 0 1.25rem; overflow: visible; gap: 0; }

html body.om-room .message { max-width: 100%; padding: 0; animation: omRoomIn .7s ease both; scroll-margin-top: 92px; }
@keyframes omRoomIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html body.om-room .message.user {
    align-self: flex-end; max-width: 82%; margin: 2.3rem 0 1.1rem; padding: 2px 14px 2px 0;
    background: none !important; border: 0; border-right: 1px solid rgba(var(--room-a-rgb), .55); border-radius: 0; box-shadow: none !important;
    color: var(--room-mute); font-size: 15.5px; line-height: 1.55; text-align: right;
}
html body.om-room .message.user p { margin: 0; color: inherit; }
html body.om-room .message.oracle {
    align-self: stretch; border: 0; padding: 0; margin: 0 0 .5rem;
    font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(20px, 2.2vw, 22px); line-height: 1.6; color: var(--room-ink);
}
html body.om-room .message.oracle::before {
    content: ''; display: block; height: 14px; margin: 0 0 1.1rem;
    background: linear-gradient(90deg, rgba(var(--room-a-rgb), .5), transparent) 24px 50% / calc(100% - 24px) 1px no-repeat;
}
html body.om-room .message.oracle::after {
    content: ''; position: absolute; left: 3px; top: 3px; width: 7px; height: 7px;
    border: 1px solid var(--room-a); transform: rotate(45deg);
}
html body.om-room .message.oracle p { margin: 0 0 .85em; color: inherit; }
html body.om-room .message.oracle strong { color: var(--room-a2); font-weight: 600; }
html body.om-room .message.oracle em { color: var(--room-ink); }
html body.om-room .message.oracle h2 { color: var(--room-a2); font-size: 1.05em; font-weight: 600; margin: .9em 0 .3em; }
html body.om-room .message.oracle ul { color: var(--room-ink); }
html body.om-room .message-level-badge { display: none; }

/* Palavras a aparecer, como tinta (oraculo-room.js) */
.om-w { opacity: 0; transition: opacity .8s ease; }
.om-w.on { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
    .om-w { filter: blur(4px); transition: opacity .8s ease, filter .8s ease; }
    .om-w.on { filter: none; }
}

html body.om-room .message-actions {
    border-top: 0; padding-top: 0; margin-top: .2rem; gap: 20px; flex-wrap: wrap;
    font-family: 'DM Sans', system-ui, sans-serif;
}
html body.om-room .message-actions .btn-share {
    min-height: 36px; padding: 4px 0; background: none !important; border: 0 !important; border-radius: 0;
    color: var(--room-a) !important; font: 500 12.5px/1 'DM Sans', system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 7px;
}
html body.om-room .message-actions .btn-share:hover { color: var(--room-a2) !important; }
html body.om-room .message-actions .btn-share svg { width: 16px; height: 16px; flex: none; }
html body.om-room .message-actions .btn-share.playing { color: var(--room-a2) !important; animation: none; }

/* À espera da resposta */
html body.om-room .loading-container { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; padding: .3rem 0 1rem; }
.om-wait { display: flex; gap: 7px; }
.om-wait b { width: 5px; height: 5px; background: var(--room-a); transform: rotate(45deg); animation: omWait 1.4s infinite ease-in-out; }
.om-wait b:nth-child(2) { animation-delay: .2s; }
.om-wait b:nth-child(3) { animation-delay: .4s; }
@keyframes omWait { 50% { opacity: .15; } }
html body.om-room .loading-text { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 19px; color: var(--room-mute); animation: none; }

/* Boas-vindas e exemplos */
html body.om-room .welcome-message { border: 0; padding: 0; margin: .5rem auto 0; max-width: 540px; width: 100%; text-align: center; background: none; }
html body.om-room .welcome-message > p:first-child strong {
    font: 500 12.5px/1.4 'DM Sans', system-ui, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--room-mute);
}
html body.om-room .welcome-message > p + p {
    font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 18px !important; color: var(--room-mute) !important;
}
html body.om-room .om-examples { display: block; margin-top: 1.3rem; text-align: left; }
html body.om-room.om-chatting .om-examples { display: none; }
html body.om-room .om-example {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; margin: 0; padding: 13px 6px;
    background: none; border: 0; border-top: 1px solid rgba(var(--room-a-rgb), .16); border-radius: 0;
    font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; line-height: 1.3; color: var(--room-ink);
    cursor: pointer; transition: color .3s, padding .3s;
}
html body.om-room .om-example:last-child { border-bottom: 1px solid rgba(var(--room-a-rgb), .16); }
html body.om-room .om-example::before { content: ''; width: 6px; height: 6px; flex: none; border: 1px solid var(--room-a); transform: rotate(45deg); transition: background .3s; }
html body.om-room .om-example:hover { color: var(--room-a2); padding-left: 12px; }
html body.om-room .om-example:hover::before { background: var(--room-a); }

/* ---------- consola de escrita ---------- */
html body.om-room .input-area {
    position: sticky; bottom: var(--om-kb, 0px); z-index: 20;
    padding: 18px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--room-deep) 62%, rgba(var(--room-deep-rgb), 0)) !important;
    border: 0; border-radius: 0; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
html body.om-room .om-bar-row { margin-bottom: .35rem; }
html body.om-room .om-bar-btn {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: .2rem .35rem;
    background: none; border: 0; border-radius: 0; color: var(--room-mute);
    font: 500 12.5px/1 'DM Sans', system-ui, sans-serif; letter-spacing: .05em;
}
html body.om-room .om-bar-btn:hover { color: var(--room-a2); }
html body.om-room .om-bar-btn svg { width: 15px; height: 15px; flex: none; }
html body.om-room #omSwMini { display: none; color: var(--room-a); }
html body.om-room.om-chatting #omSwMini { display: inline-flex; }
html body.om-room .om-bar-voice { color: var(--room-mute); }

html body.om-room .input-wrapper {
    display: flex; flex-direction: row; align-items: flex-end; gap: 8px;
    padding: 7px 7px 7px 20px; border-radius: 26px;
    border: 1px solid rgba(var(--room-a-rgb), .38); background: rgba(var(--room-deep-rgb), .86);
    box-shadow: 0 0 0 4px rgba(var(--room-a-rgb), .05), 0 0 40px rgba(var(--room-a-rgb), .10);
    transition: border-color .4s, box-shadow .4s;
}
html body.om-room .input-wrapper:focus-within {
    border-color: rgba(var(--room-a-rgb), .7);
    box-shadow: 0 0 0 4px rgba(var(--room-a-rgb), .10), 0 0 50px rgba(var(--room-a-rgb), .18);
}
html body.om-room .question-input {
    flex: 1; min-width: 0; height: 44px; min-height: 44px; max-height: 132px; padding: 10px 0;
    background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0;
    color: var(--room-ink); font: 400 16px/1.5 'DM Sans', system-ui, sans-serif;
    overflow-y: auto; scrollbar-width: none;
}
html body.om-room .question-input::-webkit-scrollbar { display: none; }
html body.om-room .question-input::placeholder { color: var(--room-mute); font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 19px; }
html body.om-room .input-actions { width: auto; gap: 8px; align-items: flex-end; }
html body.om-room .btn-mic {
    width: 44px; height: 44px; min-height: 44px; background: none; border: 1px solid rgba(var(--room-a-rgb), .35); color: var(--room-a);
}
html body.om-room .btn-mic svg { width: 20px; height: 20px; }
html body.om-room .btn-mic:hover { background: rgba(var(--room-a-rgb), .1); box-shadow: none; }
html body.om-room .btn-mic.listening { background: var(--room-a); color: var(--room-deep); border-color: var(--room-a); }
html body.om-room .input-actions .btn-consult,
html body.om-room.om-forbidden .input-actions .btn-consult,
html body.om-room.om-forbidden .input-actions .btn-consult:hover {
    flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0 !important; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 30%, var(--room-a2), var(--room-a) 70%) !important;
    color: #1a1208 !important; box-shadow: 0 0 18px rgba(var(--room-a-rgb), .45);
}
html body.om-room.om-forbidden .input-actions .btn-consult { color: #fff3ef !important; }
html body.om-room .btn-consult .om-send-label { display: none; }
html body.om-room .btn-consult .om-send-icon { display: block; width: 20px; height: 20px; }
html body.om-room .btn-consult:hover:not(:disabled) { transform: scale(1.05); }
/* Visitante depois da consulta grátis: o botão passa a "Regista-te" com texto */
html body.om-room .input-actions .btn-consult[data-track-name$="registo no botão"] { width: auto; padding: 0 18px; border-radius: 22px; }
html body.om-room .btn-consult[data-track-name$="registo no botão"] .om-send-label { display: inline; font: 600 14px 'DM Sans', sans-serif; letter-spacing: .02em; text-transform: none; }
html body.om-room .btn-consult[data-track-name$="registo no botão"] .om-send-icon { display: none; }

html body.om-room .input-area .ai-notice-foot { color: var(--room-mute); opacity: 1; font-size: 11.5px !important; margin-top: .55rem !important; }

/* ---------- cartas e mapa ---------- */
html body.om-room .om-tool-title { font-family: 'Cormorant Garamond', Georgia, serif; color: var(--room-a2); letter-spacing: .08em; }
html body.om-room .om-cards { gap: 1rem .8rem; }
html body.om-room .om-card-face { border-radius: 8px; }
html body.om-room .om-card-back {
    font-size: 0; border: 1px solid rgba(var(--room-a-rgb), .7);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 100' fill='none' stroke='%23d8b46a'%3E%3Cpath d='M30 35 Q41 44 52 50 Q41 56 30 65 Q19 56 8 50 Q19 44 30 35Z' stroke-width='.5' opacity='.35'/%3E%3Ccircle cx='30' cy='50' r='15' fill='%230c0907' stroke-width='.6'/%3E%3Cpath d='M19 50 Q30 41 41 50 Q30 59 19 50Z' stroke-width='.6'/%3E%3Ccircle cx='30' cy='50' r='3.5' fill='%23d8b46a'/%3E%3Cpath d='M30 10v14M30 76v14M24 17h12M24 83h12' stroke-width='.5'/%3E%3C/svg%3E") center / 100% 100% no-repeat,
        repeating-linear-gradient(45deg, rgba(216,180,106,.10) 0 1px, transparent 1px 7px),
        repeating-linear-gradient(-45deg, rgba(216,180,106,.10) 0 1px, transparent 1px 7px),
        linear-gradient(170deg, #1c1610, #0c0907);
}
html body.om-room .om-card-back::after { border-color: rgba(var(--room-a-rgb), .3); }
html body.om-room .om-card-front { border: 1px solid rgba(var(--room-a-rgb), .55); }
html body.om-room .om-card.flipped .om-card-front { box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 22px rgba(var(--room-a-rgb), .25); }
html body.om-room .om-card-pos { color: var(--room-mute); }
html body.om-room .om-card-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: .82rem; letter-spacing: .06em; color: var(--room-a2); }
html body.om-room .om-tool-chip { font-family: 'DM Sans', system-ui, sans-serif; color: var(--room-mute); border-color: rgba(var(--room-a-rgb), .25); }
html body.om-room .om-sky-legend { font-family: 'DM Sans', system-ui, sans-serif; color: var(--room-mute); }

/* ---------- janelas ---------- */
html body.om-room .modal-overlay { background: rgba(0, 0, 0, .72); -webkit-backdrop-filter: none; backdrop-filter: none; }
html body.om-room .modal-card,
html body.om-room #guestCtaModal .gcm-card,
html body.om-room #historyModal .history-card,
html body.om-room #sessionsModal > div {
    background: linear-gradient(170deg, rgba(20, 16, 26, .98), rgba(8, 7, 12, .98)) !important;
    border: 1px solid rgba(var(--room-a-rgb), .35) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(var(--room-a-rgb), .12) !important;
    border-radius: 18px;
}
html body.om-room .modal-card h3,
html body.om-room #guestCtaModal h2,
html body.om-room .history-header h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; color: var(--room-a2) !important; letter-spacing: .04em; }

/* ---------- véu da troca de oráculo ---------- */
.om-veil { position: fixed; inset: 0; z-index: 9000; pointer-events: none; display: grid; place-items: center; background: #000; clip-path: circle(0 at 50% 0); }
.om-veil svg { width: 120px; height: 120px; opacity: 0; color: var(--room-a2); filter: drop-shadow(0 0 20px var(--room-a)); }
html.om-veil-in .om-veil { clip-path: none; }

/* ---------- telemóvel ---------- */
@media (max-width: 768px) {
    html body.om-room .main-content { padding: .25rem 1rem 0; }
    html body.om-room .om-sw-opt { font-size: 15.5px; gap: 6px; padding: 6px 7px 10px; }
    html body.om-room .om-sw-opt svg { width: 17px; height: 17px; }
    .om-sw-sep { width: 16px; }
    .om-sigil-wrap { width: min(62vw, 260px); }
    html body.om-room .page-title { font-size: 22px; letter-spacing: .2em; text-indent: .2em; }
    html body.om-room .page-subtitle { font-size: 17px; }
    html body.om-room .om-example { font-size: 18.5px; padding: 12px 4px; }
    html body.om-room .input-area { padding-top: 14px; }
    html body.om-room .input-wrapper { padding-left: 16px; }
    html body.om-room .question-input { max-height: 44px; }
    html body.om-room .message.user { max-width: 88%; margin-top: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) {
    .om-w, .om-w.on { opacity: 1; filter: none; transition: none; }
    html body.om-room .message { animation: none; }
}
