/* Anatomy-first layouts. The 3D stage owns its space; controls never cover it. */
.agent-page, .memory-page { letter-spacing: 0; }
.agent-page { width: 100%; max-width: 1040px; height: 100dvh; min-height: 0; padding: calc(18px + env(safe-area-inset-top)) 24px calc(16px + env(safe-area-inset-bottom)); gap: 0; }
.agent-page .topbar { flex: 0 0 auto; min-height: 48px; }
.agent-page .topbar h1 { font-size: 18px; }
.agent-page .topbar p { font-size: 12px; }
.agent-page .agent-intro { flex: 0 0 auto; margin: 18px auto 2px; }
.agent-page .agent-intro .eyebrow { letter-spacing: 0; font-size: 10px; }
.agent-page .agent-intro h2 { font-size: 28px; line-height: 1.2; letter-spacing: 0; margin: 8px auto 0; max-width: 500px; }
.agent-page:has(.conversation .message) .agent-intro h2 { display: none; }
.agent-page .hologram-avatar { width: 100%; max-width: 680px; height: auto; min-height: 0; flex: 1 1 36%; margin: 0 auto; perspective: none; isolation: isolate; }
.hologram-avatar::before, .hologram-avatar::after { display: none; }
bento-hologram { display: block; position: absolute; inset: 0; overflow: hidden; }
bento-hologram canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
bento-hologram .brain-static { width: 100%; height: 100%; object-fit: contain; display: block; }
bento-hologram .static-core { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #061522; border: 1px solid #67e8f9; padding: 8px; font-size: 13px; color: #d9fbff; }
bento-hologram[data-ready=true] > .brain-static, bento-hologram[data-ready=true] > .static-core { display: none; }
.agent-page .face-status { flex: 0 0 auto; margin: 0 0 8px; font-size: 12px; line-height: 18px; color: #9dcddd; }
.agent-page .face-status::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px; background: #67e8f9; border-radius: 50%; vertical-align: middle; }
.agent-page .conversation { flex: 0 1 20%; min-height: 62px; width: 100%; max-width: 700px; margin: 0 auto; padding: 8px 4px; mask-image: none; border-top: 1px solid #9edceb19; }
.agent-page .message { line-height: 1.55; font-size: 14px; margin-bottom: 14px; }
.agent-page .message.out { max-width: 100%; padding: 4px 0; }
.agent-page .message-label { font-size: 9px; margin-bottom: 5px; }
.agent-page .empty-chat { padding: 6px 0; margin: 0; font-size: 12px; }
.agent-page .reply-actions { flex: 0 0 auto; min-height: 0; margin: 0; }
.agent-page .reply-actions:has(button:not([hidden])) { min-height: 38px; }
.agent-page .composer { flex: 0 0 auto; width: 100%; max-width: 700px; margin: auto auto 0; padding: 12px 0 0; }
.agent-page .voice-controls { padding: 0; gap: 18px; }
.agent-page .mic-button { width: 68px; height: 68px; box-shadow: 0 0 22px #67e8f925; }
.agent-page .voice-hint { font-size: 11px; line-height: 16px; margin: 12px 0 0; }
.agent-page .error { max-height: 70px; overflow: auto; flex: 0 0 auto; margin: 6px 0; }
.agent-page::before { display: none; }

.memory-page { --gutter: 22px; position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(140px, 1fr) auto auto auto auto; grid-template-areas: 'header' 'meta' 'scene' 'event' 'tools' 'tabs' 'list'; gap: 8px; width: 100%; height: 100dvh; min-height: 0; max-width: none; margin: 0; padding: calc(16px + env(safe-area-inset-top)) var(--gutter) calc(12px + env(safe-area-inset-bottom)); overflow: hidden; background: #03040c; }
.memory-page::before, .memory-page::after { display: none; }
.memory-page .memory-top { grid-area: header; position: static; min-width: 0; width: 100%; max-width: 1200px; min-height: 44px; margin: 0 auto; gap: 12px; z-index: 2; }
.memory-page .memory-top > div { min-width: 0; }
.memory-page .memory-top h1 { font-size: 28px; letter-spacing: 0; line-height: 1.15; margin: 3px 0 0; text-shadow: none; }
.memory-page .memory-top .eyebrow { font-size: 9px; letter-spacing: 0; }
.memory-page .memory-back { border-radius: 8px; min-height: 44px; height: 44px; font-size: 12px; padding: 0 12px; }
.memory-page .memory-meta { grid-area: meta; position: static; transform: none; width: 100%; max-width: 1200px; margin: 0 auto; padding: 8px 0; min-height: 30px; flex-wrap: wrap; gap: 8px 12px; justify-content: flex-start; font-size: 11px; border: 0; border-bottom: 1px solid #bde8ff20; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.memory-page .memory-meta .live-pill { margin-left: auto; font-size: 9px; }
.memory-page .brain-stage { grid-area: scene; position: relative; inset: auto; width: calc(100% + var(--gutter) * 2); height: 100%; min-height: 0; max-width: none; margin: 0 calc(var(--gutter) * -1); background: none; overflow: hidden; }
.memory-page .brain-stage::before, .memory-page .brain-stage::after { display: none; }
.memory-page .brain-stage canvas { filter: none; width: 100%!important; height: 100%!important; }
.memory-page .node-labels { position: absolute; inset: 0; }
.memory-page .node-labels button { max-width: 126px; font-size: 10px; padding: 4px 7px; border-radius: 4px; box-shadow: none; text-shadow: none; background: #06101ded; }
.memory-page .brain-fallback { position: absolute; inset: 0; background: none; }
.memory-page .brain-fallback img { max-height: 80%; height: 220px; object-fit: contain; }
.memory-page .live-event { grid-area: event; position: static; display: flex; transform: none; width: 100%; max-width: 1000px; margin: 0 auto; min-height: 26px; padding: 4px 0; gap: 8px; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; font-size: 11px; }
.memory-page .live-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory-page #activity-toggle { margin-left: auto; flex-shrink: 0; padding: 8px; min-height: 34px; color: #a6f1ff; font-size: 11px; }
.memory-page:not(:has([data-tab=live][aria-selected=true])) #activity-toggle { display: none; }
.memory-page .live-dot { width: 5px; height: 5px; flex: 0 0 5px; box-shadow: none; animation: none; }
.memory-page .brain-tools { grid-area: tools; position: static; transform: none; width: 100%; max-width: 1000px; margin: 0 auto; padding: 0; gap: 6px; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.memory-page .brain-tools input { min-width: 160px; min-height: 42px; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: #0b101b; }
.memory-page .brain-tools button { flex: 0 0 auto; min-height: 42px; padding: 9px 14px; border-radius: 8px; font-size: 12px; background: #0b101b; }
.memory-page .brain-tools button[aria-pressed=true] { background: #122c38; color: #a6f1ff; border-color: #67e8f969; box-shadow: none; }
.memory-page .tabs { grid-area: tabs; position: static; transform: none; width: 100%; max-width: 1000px; margin: 0 auto; padding: 0; gap: 4px; border: 0; border-bottom: 1px solid #9edceb20; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; overflow: visible; }
.memory-page .tabs button { flex: 1 1 0; min-width: 0; padding: 12px 2px; font-size: 12px; border-radius: 0; border-bottom: 2px solid transparent; }
.memory-page .tabs button[aria-selected=true] { color: #a6f1ff; background: none; box-shadow: none; border-bottom-color: #67e8f9; }
.memory-page .node-list { grid-area: list; position: static; width: 100%; max-width: 1000px; min-height: 0; max-height: 22dvh; margin: 0 auto; padding: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; mask-image: none; background: none; overflow: auto; }
.memory-page:has([data-tab=live][aria-selected=true]) .node-list { display: none; }
.memory-page[data-activity=true]:has([data-tab=live][aria-selected=true]) .node-list { display: grid; }
.memory-page .node-row { min-height: 58px; padding: 11px 12px; border-radius: 8px; background: #080e18; box-shadow: none; backdrop-filter: none; }
.memory-page .node-row::after { display: none; }
.memory-page .node-row strong { font-size: 12px; text-shadow: none; }
.memory-page .node-row small { font-size: 10px; }
.memory-page .node-color { width: 6px; height: 6px; box-shadow: none; }
.memory-page .legend, .memory-page #knowledge { display: none; }
.memory-page #screen-error { z-index: 20; top: 88px; max-height: 110px; overflow: auto; }

@media (min-width: 1000px) {
  .memory-page { grid-template-columns: minmax(0, 1fr) 310px; grid-template-rows: auto auto minmax(220px, 1fr) auto auto; grid-template-areas: 'header header' 'meta meta' 'scene list' 'event list' 'tools tabs'; gap: 12px 24px; }
  .memory-page .node-list { max-height: none; grid-template-columns: 1fr; }
  .memory-page .brain-stage { width: 100%; margin: 0; }
  .memory-page:has([data-tab=live][aria-selected=true]) { grid-template-areas: 'header header' 'meta meta' 'scene scene' 'event event' 'tools tabs'; }
  .memory-page[data-activity=true]:has([data-tab=live][aria-selected=true]) { grid-template-areas: 'header header' 'meta meta' 'scene list' 'event list' 'tools tabs'; }
}
@media (max-width: 650px) {
  .agent-page { padding-left: 18px; padding-right: 18px; }
  .agent-page .agent-intro { margin-top: 12px; }
  .agent-page .agent-intro h2 { font-size: 24px; max-width: 320px; }
  .agent-page .topbar p { font-size: 11px; }
  .agent-page .voice-controls { gap: 16px; }
  .agent-page .icon-button { width: 42px; min-width: 42px; height: 42px; }
  .memory-page { --gutter: 14px; gap: 6px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .memory-page .memory-top h1 { font-size: 26px; }
  .memory-page .brain-tools input { order: -1; flex-basis: 100%; font-size: 16px; }
  .memory-page .brain-tools button { flex: 1 1 0; padding: 8px 4px; min-height: 38px; }
  .memory-page .node-list { grid-template-columns: 1fr; max-height: 20dvh; }
}
@media (max-height: 620px) {
  .agent-page .agent-intro { display: none; }
  .agent-page .mic-button { width: 54px; height: 54px; }
  .agent-page .voice-hint { margin-top: 7px; }
  .agent-page.text-mode .hologram-avatar, .agent-page.text-mode .face-status { display: none; }
  .agent-page.text-mode .conversation { flex: 1 1 auto; }
  .memory-page { overflow-y: auto; grid-template-rows: auto auto minmax(140px, 1fr) auto auto auto auto; }
  .memory-page .memory-top .eyebrow { display: none; }
}
@media (prefers-reduced-motion: reduce) { .agent-page *, .memory-page * { animation: none!important; } }
