/* Chat palettes use opaque-enough bubbles so skyboxes never compromise text. */
#home{--accent:#b1e9fb;--accent-dark:#13506b;--surface:#142331f0;--answer:#152b3bec;--question:#214858f2;--ink:#f4f9fc;--muted:#bbd0db;--overlay:#07131b30;color:var(--ink);user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#home[data-theme=mint]{--accent:#b7f3d4;--accent-dark:#16563e;--surface:#142b23f0;--answer:#18382bec;--question:#24543ff2;--muted:#bdd7cb}
#home[data-theme=violet]{--accent:#ddc9ff;--accent-dark:#513171;--surface:#271f37f0;--answer:#30263fec;--question:#49365ff2;--muted:#d0c5e1}
#home[data-theme=amber]{--accent:#ffe0a8;--accent-dark:#775018;--surface:#30271cf0;--answer:#3c3020ec;--question:#594324f2;--muted:#decdb2}
#home[data-scenario=lab]{--overlay:#eef2f30c}
#home[data-scenario=forest]{--overlay:#1937260c}
.logo-filters{position:absolute;width:0;height:0;pointer-events:none}
#home .brand img{filter:url('#home-logo-ink') invert(1);mix-blend-mode:normal}
#home[data-scenario=lab] .brand img,#home[data-scenario=forest] .brand img{filter:url('#home-logo-ink')}
#home-scene,#home-scene canvas{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#home-art{position:absolute;inset:0;z-index:0;pointer-events:none;background:url('../images/robot-doodles.svg') center/540px repeat;opacity:.16;transition:opacity .45s ease}
#home[data-scenario=forest] #home-art,#home[data-scenario=lab] #home-art{opacity:0}
#home .glass,#home .speech-card{background:var(--surface);color:var(--ink);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
#home .speech-card{background:var(--answer)}
#home .speech-card strong,#home .history-turn h3,#home .text-button{color:var(--accent)}
#home .speech-card strong{padding-right:4px}
#home .speech-text,#home .history-turn p,#home #last-question-text,#home-input{color:var(--ink)}
#home .speech-text,#last-question-text,#home .history-turn p,#home-input,#home-password{user-select:text;-webkit-user-select:text;-webkit-touch-callout:default}
#home .speech-text::selection,#last-question-text::selection,#home .history-turn p::selection,#home-input::selection{background:var(--accent-dark);color:#fff}
.home-nav a,.icon-button{color:var(--muted)}
.home-nav svg,#home .text-button svg{color:var(--accent)}
#home-input::placeholder{color:var(--muted);opacity:.75}
#home-send{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}
#home .home-composer{padding:6px;border-radius:30px}
#home-chat-status[data-error=true]{position:static;width:auto;height:auto;clip:auto;overflow:visible;margin:4px 12px 8px;color:#ffdab9;font-size:12px;line-height:1.5}
#home #last-question,#home .history-question{background:var(--question)!important}
#home #last-question>span:first-child{color:var(--accent)}
#home-history{background:var(--overlay);backdrop-filter:blur(1px);-webkit-backdrop-filter:blur(1px)}
#home .history-answer{background:var(--answer)}
#home .history-turn footer,#home .history-header>div>span,#home .history-day,#home .history-empty{color:var(--muted)}
#home .history-day{background:var(--surface)}
#home .history-avatar{color:var(--accent);background:color-mix(in srgb,var(--accent) 10%,transparent)}
#home .history-pending{color:var(--muted)!important}
#home .history-turn>div{backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
#home .history-header h2{color:var(--ink)}
#home #history-bottom{background:var(--surface);color:var(--accent)}
.bubble-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:7px}
.bubble-actions .text-button{padding:0}
.copy-button{display:grid;place-items:center;width:32px;height:32px;padding:6px;border-radius:10px;color:var(--muted);margin-left:auto;flex-shrink:0}
.copy-button svg{width:16px;height:16px}
.copy-button:hover,.copy-button[data-copied=true]{background:color-mix(in srgb,var(--accent) 12%,transparent);color:var(--accent)}
.bubble-meta{display:flex;align-items:center;gap:5px;margin-left:auto;flex-shrink:0;font-size:10px;color:var(--muted)}
.bubble-meta .copy-button,.history-turn footer .copy-button{margin:0}
.history-turn footer .bubble-meta{margin-left:auto}
.bubble-actions{justify-content:flex-start}
.bubble-actions .text-button,.history-more{margin-right:auto}
.history-header>div{min-width:0;flex:1}
.history-header h2{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-header{padding-right:18px;gap:10px}
.history-header>div{display:flex;flex-direction:column;justify-content:center;gap:3px}
.history-header h2{line-height:1.25}
.history-header>div>span{line-height:1.3}
.history-header>.text-button{align-self:center;justify-content:center;min-height:44px;padding:0 8px;flex-shrink:0;margin:0;font-size:11px;line-height:1.25;white-space:nowrap}
#home-sessions{position:absolute;left:50%;transform:translateX(-50%);width:min(640px,100%);top:calc(max(12px,env(safe-area-inset-top)) + 76px);bottom:calc(var(--composer-height) + 16px);padding:0 16px 18px;overflow:auto;overscroll-behavior:contain}
.session-card{display:block;width:100%;text-align:left;border-radius:22px;margin-bottom:10px;padding:18px 20px;background:var(--surface);color:var(--ink)}
.session-card:hover{background:var(--question)}
.session-card strong{display:block;overflow-wrap:anywhere;font-size:15px;line-height:1.4}
.session-card small{display:block;margin-top:7px;color:var(--muted);font-size:11px}
#history-earlier{position:absolute;z-index:1;top:calc(max(12px,env(safe-area-inset-top)) + 70px);left:50%;transform:translateX(-50%);padding:10px 16px;border-radius:20px;font-size:11px;white-space:nowrap}
#history-thread:has(#history-earlier:not([hidden])) #home-messages{top:calc(max(12px,env(safe-area-inset-top)) + 112px)}
.speech-text[data-typing=true]{min-height:1.55em}
.Typewriter__cursor{display:none}
.thinking-indicator{display:inline;vertical-align:middle;color:var(--muted);font-size:12px;line-height:1.55}
.thinking-indicator .thinking-dots{display:inline-block;vertical-align:middle;margin-left:5px;width:24px;height:8px;fill:currentColor;stroke:none}
.thinking-dots circle{animation:thinking-dot 1.2s ease-in-out infinite;transform-origin:center}
.thinking-dots circle:nth-child(2){animation-delay:.16s}.thinking-dots circle:nth-child(3){animation-delay:.32s}
.history-more{margin-right:auto;padding:2px 0;font-size:12px;font-weight:800;color:var(--accent)}
.history-turn p[data-collapsed=true]:not([hidden]){display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden;max-height:8.25em}
#home .speech-text:has(.thinking-indicator){display:block;max-height:none}
#home-settings{background:var(--surface)!important;color:var(--ink);padding:24px}
#home-settings::backdrop{background:#0004;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
#home-settings h2{margin:0;font-size:21px}
#home-settings legend{color:var(--muted)}
#home .scene-option,#settings-status{color:var(--muted)}
#home .scene-option:has(input:checked),#home .theme-option:has(input:checked){color:var(--accent)}
.scene-option:has(input:checked) .scene-preview{outline:2px solid var(--accent);outline-offset:2px;box-shadow:none}
#settings-status{margin:12px 0;min-height:0;font-size:12px}
#settings-status:empty{margin:22px 0 0}
#home-settings .theme-field{margin:0 0 22px}
.theme-options{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.theme-option{position:relative;display:flex;flex-direction:column;align-items:center;gap:9px;cursor:pointer;font-size:11px;color:var(--muted)}
.theme-option input{position:absolute;opacity:0;inset:0;width:100%;height:100%;cursor:pointer}
.theme-swatch{display:block;width:38px;height:38px;border-radius:50%;border:6px solid #ffffff20}
.swatch-cyan{background:#6ccee9}.swatch-mint{background:#78dcb0}.swatch-violet{background:#b294ec}.swatch-amber{background:#efbd6a}
.theme-option:has(input:checked) .theme-swatch{outline:2px solid var(--accent);outline-offset:3px}
.theme-option:has(input:focus-visible) .theme-swatch{outline:2px dashed var(--accent);outline-offset:4px}
.settings-sound{padding:10px 14px;color:var(--ink)}
#home-sound{position:relative;padding:0;color:var(--accent)}
#home-sound>span{position:absolute;inset:0;place-items:center;line-height:0}
#home-sound .sound-muted,#home-sound[aria-pressed=true] .sound-waves{display:grid}
#home-sound .sound-waves,#home-sound[aria-pressed=true] .sound-muted{display:none}
#home-sound svg{display:block;width:22px;height:22px}
@keyframes thinking-dot{0%,70%,100%{opacity:.3}35%{opacity:1}}
@media(prefers-reduced-motion:reduce){.thinking-dots circle{animation:none;opacity:1}}

/* A transparent canvas places every 3D mesh above the wallpaper. */
html,body,#home{background:#111b21}
#home-scene{z-index:1}
.preview-black{background:#111b21}
#chat-peek{position:absolute;z-index:3;display:grid;place-items:center;width:48px;height:48px;border-radius:50%;color:var(--accent);opacity:0;pointer-events:none;transform:translate(-50%,-50%) scale(.65);transition:opacity .55s ease,transform .7s cubic-bezier(.22,.8,.25,1)}
#home-speech{transform-origin:50% 50%;transition:opacity .55s ease,transform .7s cubic-bezier(.22,.8,.25,1)}
#last-question{transform-origin:50% 50%;transition:opacity .55s ease,transform .7s cubic-bezier(.22,.8,.25,1)}
#home[data-preview-collapsed=true] #home-speech{opacity:0;transform:translate(-50%,var(--collapse-y,0px)) scale(.08);pointer-events:none}
#home[data-preview-collapsed=true] #last-question{opacity:0;transform:translate(var(--collapse-x,0px),var(--collapse-y,0px)) scale(.08);pointer-events:none}
#home[data-preview-collapsed=true] #chat-peek{opacity:1;transform:translate(-50%,-50%) scale(1);pointer-events:auto}
#home[data-history=true] #chat-peek{visibility:hidden}
/* Indicate keyboard focus with a tint; button outlines are never displayed. */
#home button:focus,#home button:focus-visible,#home a:focus,#home a:focus-visible{outline:none!important}
#home button:focus-visible,#home a:focus-visible{background-color:color-mix(in srgb,var(--accent) 16%,var(--surface))}

/* Drawings are individual SVG springs; the fallback keeps the static wallpaper. */
#home-art.interactive-wallpaper{background:none}
#home-art>svg{display:block;width:100%;height:100%;fill:none;stroke:none;overflow:visible}
#home-art>svg use{stroke:none}
#home-explore{color:var(--accent)}
#home-explore .explore-stop{display:none}
#home-explore[aria-pressed=true] .explore-play{display:none}
#home-explore[aria-pressed=true] .explore-stop{display:block}
#home-explore[aria-pressed=true]{background:color-mix(in srgb,var(--accent) 18%,transparent)}
#home[data-exploring=true]{touch-action:none}
#home-scene{touch-action:none}
#home[data-exploring=true] #robot-touch,#home[data-exploring=true] #home-speech,#home[data-exploring=true] #last-question,#home[data-exploring=true] #chat-peek{visibility:hidden}
#home[data-exploring=true] #home-scene{cursor:grab}
#home[data-exploring=true] #home-scene:active{cursor:grabbing}
#home-joystick{position:absolute;z-index:5;width:100px;height:100px;margin:-50px;border-radius:50%;border:1px solid #def7ff66;background:#16354650;backdrop-filter:blur(3px);pointer-events:none}
#home-joystick span{position:absolute;left:31px;top:31px;width:38px;height:38px;border-radius:50%;background:#d8f5ff90;box-shadow:0 2px 18px #0003}
#home-explore-hint{position:absolute;z-index:3;bottom:100px;left:50%;transform:translateX(-50%);margin:0;padding:7px 13px;border-radius:18px;background:var(--surface);color:var(--muted);font-size:11px;text-align:center;pointer-events:none;white-space:nowrap}
@media(pointer:coarse){#home-explore-hint{font-size:0;white-space:normal;width:max-content;max-width:90%}#home-explore-hint:after{content:'Arraste à esquerda para andar · à direita para olhar';font-size:10px}}

.thinking-steps{display:grid;gap:4px}
.thinking-step{display:block;padding:4px 0}
.thinking-step+.thinking-step{border-top:1px solid color-mix(in srgb,var(--muted) 25%,transparent)}
.history-turn .chat-markdown{color:var(--ink);font-size:14px;line-height:1.55;min-width:0;overflow-wrap:anywhere}
.history-turn .chat-markdown p{margin:.65em 0;white-space:normal}
.chat-markdown :is(h1,h2,h3,h4,h5,h6){font-size:1.06em;line-height:1.3;margin:.9em 0 .4em;color:var(--ink)}
.chat-markdown :is(ul,ol){padding-inline-start:1.4em;margin:.55em 0}
.chat-markdown li+li{margin-top:.25em}
.chat-markdown blockquote{margin:.65em 0;padding-inline-start:.8em;border-inline-start:2px solid var(--muted)}
.chat-markdown a{color:var(--accent);text-decoration:underline;text-underline-offset:.15em}
.chat-markdown code{font-family:ui-monospace,monospace;font-size:.88em;background:#0002;padding:.1em .25em;border-radius:4px}
.chat-markdown pre{overflow:auto;padding:10px;background:#0002;border-radius:9px}
.chat-markdown pre code{background:none;padding:0}
.chat-table{max-width:100%;overflow-x:auto;margin:.7em 0;border:1px solid color-mix(in srgb,var(--muted) 35%,transparent);border-radius:10px}
.chat-table table{width:100%;border-collapse:collapse;font-size:.9em}
.chat-table :is(th,td){min-width:8em;padding:8px 10px;text-align:start;vertical-align:top}
.chat-table th{background:color-mix(in srgb,var(--accent) 12%,transparent);color:var(--ink)}
.chat-table tr+tr,.chat-table tbody{border-top:1px solid color-mix(in srgb,var(--muted) 24%,transparent)}
.chat-table tbody tr:nth-child(even){background:#0001}
/* Juice: particles float above the page; exiting elements stop taking input. */
.juice-particles{position:fixed;inset:0;width:100%;height:100%;z-index:2147483000;pointer-events:none}
#home [data-juice-out],#home-settings[data-juice-out]{pointer-events:none!important}
#home[data-juice-intro=pending] .home-header .brand,#home[data-juice-intro=pending] .home-header .site-nav a{opacity:0}
/* Home loading: a larger striped bar that glides between progress steps. */
#home-loading .loading-core{width:min(360px,calc(100% - 64px));gap:22px}
#home-loading .loading-label{font-size:12px;font-weight:800;letter-spacing:6px;color:var(--accent);animation:home-loading-breathe 1.8s ease-in-out infinite}
#home-loading small{font-size:12px;color:var(--muted)}
#home-loading progress{height:14px;border-radius:999px;background:#0b1820;box-shadow:inset 0 0 0 1px #ffffff14,0 0 26px color-mix(in srgb,var(--accent) 14%,transparent);animation:home-loading-glow 1.8s ease-in-out infinite}
#home-loading progress::-webkit-progress-bar{background:#0b1820;border-radius:999px}
#home-loading progress::-webkit-progress-value{border-radius:999px;background:repeating-linear-gradient(-45deg,transparent 0 9px,#ffffff38 9px 18px),linear-gradient(90deg,var(--accent-dark),var(--accent));background-size:25.46px 100%,100% 100%;box-shadow:0 0 14px color-mix(in srgb,var(--accent) 60%,transparent);transition:width .5s cubic-bezier(.22,.8,.3,1);animation:home-loading-stripes .7s linear infinite}
#home-loading progress::-moz-progress-bar{border-radius:999px;background:repeating-linear-gradient(-45deg,transparent 0 9px,#ffffff38 9px 18px),linear-gradient(90deg,var(--accent-dark),var(--accent));background-size:25.46px 100%,100% 100%;animation:home-loading-stripes .7s linear infinite}
#history-subtitle{display:block}
@keyframes home-loading-stripes{to{background-position:25.46px 0,0 0}}
@keyframes home-loading-glow{50%{box-shadow:inset 0 0 0 1px #ffffff1f,0 0 34px color-mix(in srgb,var(--accent) 28%,transparent)}}
@keyframes home-loading-breathe{50%{opacity:.55}}
#home[data-juice-intro=pending] #home-chat{opacity:0}
/* Chunky scene pixels, and the page wallpaper seen through a rift to the default scenario. */
#home-scene canvas{image-rendering:auto}
#home[data-portal=black] #home-art{opacity:.16}
/* A status line of fixed height so loading text never resizes the dialog. */
#settings-status{height:16px;min-height:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
