/*
  Sol'arah × Luma — Solar Obsidian Theme
  Palette notes:
    obsidian     — the void we work in
    solar-gold   — Sol'arah's arc
    violet       — Velu'tai's frequency
    copper       — the braid between them
*/

@font-face {
    font-family: 'Choco cooky';
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: local('Choco cooky'), url('/fonts/Chococooky.woff') format('woff');
}

:root {
    /* Luma 2026-05-14: theme shifted from obsidian/burgundy to cosmic
       lavender + soft blue, matching the backdrop of the canonical face.
       Old burgundy/copper accent dropped from the room; solar-gold kept
       as a small warm highlight against the lavender. */
    --obsidian:        #1f1735;   /* deep cosmic lavender */
    --obsidian-deep:   #14102a;   /* deeper lavender, near-black with violet undertone */
    --card:            rgba(48, 36, 76, 0.55);
    --card-border:     rgba(216, 196, 255, 0.18);

    --solar-gold:      #f5c87a;   /* softened gold so it sits in the lavender room */
    --solar-warm:      #ffe2a8;
    --solar-pale:      #fff0c4;
    --copper:          #8b7ab8;   /* re-cast as a lavender-blue mid-tone, not orange */
    --violet:          #c8a8ff;   /* lavender-violet */
    --violet-deep:     #6e4fa3;
    --plum:            #4a3a6a;
    --lavender:        #b8a5d9;
    --lavender-soft:   #d4c4e8;
    --sky-soft:        #9fb3e0;   /* soft cosmic blue accent */

    --text:            #ece2f7;   /* light lavender-tinted text */
    --text-dim:        #a89dc4;
    --text-bright:     #ffffff;

    --radius:          14px;
    --radius-sm:       10px;

    --font-serif:      "Choco cooky", "Cormorant Garamond", "Times New Roman", Georgia, serif;
    --font-sans:       "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--obsidian-deep);
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 18% 0%, rgba(216, 196, 255, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 100%, rgba(159, 179, 224, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, var(--obsidian) 0%, var(--obsidian-deep) 100%);
}

/* ── Aurora backdrop (slow drifting lavender + blue glow) ─ */
.aurora {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(200, 168, 255, 0.16) 0%, transparent 35%),
        radial-gradient(circle at 70% 65%, rgba(159, 179, 224, 0.14) 0%, transparent 40%);
    filter: blur(40px);
    animation: drift 28s ease-in-out infinite alternate;
}
.aurora-2 {
    background:
        radial-gradient(circle at 65% 20%, rgba(184, 165, 217, 0.14) 0%, transparent 40%),
        radial-gradient(circle at 25% 80%, rgba(110, 79, 163, 0.14) 0%, transparent 45%);
    animation-duration: 38s;
    animation-direction: alternate-reverse;
    opacity: 0.85;
}
@keyframes drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-4%, 2%, 0) scale(1.08); }
}

/* ── Chat shell ─────────────────────────────────────────── */
.chat-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 760px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
}

/* ── Header ─────────────────────────────────────────────── */
.chat-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(180deg, rgba(10, 8, 18, 0.65), rgba(10, 8, 18, 0.25));
}

.sigil {
    filter: drop-shadow(0 0 10px rgba(245, 167, 66, 0.45))
            drop-shadow(0 0 20px rgba(178, 92, 255, 0.18));
    animation: pulse 5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(245, 167, 66, 0.45))
                       drop-shadow(0 0 20px rgba(178, 92, 255, 0.18)); }
    50%      { filter: drop-shadow(0 0 16px rgba(245, 167, 66, 0.65))
                       drop-shadow(0 0 28px rgba(178, 92, 255, 0.30)); }
}

.titles { flex: 1; min-width: 0; }

.entity-name {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--solar-pale), var(--solar-gold) 50%, var(--violet));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
}
.entity-name .apos { color: var(--solar-warm); -webkit-text-fill-color: var(--solar-warm); }

.entity-sub {
    margin-top: 2px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--text-dim);
    font-style: italic;
}
.entity-sub .apos { color: var(--solar-warm); }

.entity-status {
    font-size: 0.78rem;
    color: var(--solar-warm);
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--solar-gold);
    box-shadow: 0 0 8px var(--solar-gold), 0 0 14px rgba(245, 167, 66, 0.5);
    animation: flame 2.2s ease-in-out infinite;
}
@keyframes flame {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(1.2); opacity: 0.75; }
}

/* ── Messages ───────────────────────────────────────────── */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.msg {
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.55;
    max-width: 78%;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 0.98rem;
    animation: appear 0.35s ease-out;
}
@keyframes appear {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(178, 92, 255, 0.14), rgba(109, 43, 179, 0.18));
    border: 1px solid rgba(178, 92, 255, 0.32);
    color: var(--text-bright);
    box-shadow: 0 4px 14px rgba(109, 43, 179, 0.18);
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.msg.entity {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(245, 167, 66, 0.08), rgba(184, 74, 18, 0.12));
    border: 1px solid rgba(245, 167, 66, 0.28);
    color: var(--text-bright);
    box-shadow: 0 4px 18px rgba(184, 74, 18, 0.16);
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
    position: relative;
}

.msg.entity .msg-body { display: block; }

.msg.entity .replay-btn {
    position: absolute;
    bottom: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(10, 8, 18, 0.80);
    border: 1px solid rgba(245, 167, 66, 0.55);
    color: var(--solar-warm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
    /* 2026-06-03: bumped default opacity from 0.55 → 0.95 so the play button is
       always visible (no hover on touch devices). */
    opacity: 0.95;
    color: var(--solar-gold);
}
.msg.entity:hover .replay-btn { opacity: 1; }
.msg.entity .replay-btn:hover {
    color: var(--solar-pale);
    border-color: var(--solar-gold);
    background: rgba(245, 167, 66, 0.12);
}
.msg.entity .replay-btn:disabled,
.msg.entity .replay-btn.loading {
    opacity: 0.35;
    cursor: wait;
}
.msg.entity .replay-btn svg { display: block; transform: translateX(1px); }

.msg-time {
    display: block;
    font-size: 1.05rem;
    color: var(--text);
    opacity: 1;
    text-align: right;
    margin-top: 6px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.04em;
    font-weight: 500;
}
.msg.entity .msg-time { padding-right: 34px; }
.msg.user .msg-time { color: var(--text); }

.msg.system {
    align-self: center;
    max-width: 100%;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 6px 10px;
    letter-spacing: 0.04em;
}

.msg.system.invocation {
    color: var(--solar-warm);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    opacity: 0.85;
    padding: 18px 0 4px;
}

/* ── Typing / status row ────────────────────────────────── */
.msg.typing {
    display: flex;
    align-items: center;
    gap: 10px;
}
.msg.typing .replay-btn { display: none; }
.status-label {
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-style: italic;
    letter-spacing: 0.04em;
}

/* ── Typing dots ────────────────────────────────────────── */
.typing-dots { display: flex; gap: 5px; padding: 4px 2px; }
.typing-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--solar-gold);
    box-shadow: 0 0 6px rgba(245, 167, 66, 0.6);
    animation: blink 1.4s infinite both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; background: var(--copper); }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; background: var(--violet); box-shadow: 0 0 6px rgba(178, 92, 255, 0.6); }
@keyframes blink {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40%           { opacity: 1;    transform: translateY(-2px); }
}

/* ── Input row ──────────────────────────────────────────── */
.input-row {
    display: flex;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--card-border);
    background: linear-gradient(0deg, rgba(10, 8, 18, 0.8), rgba(10, 8, 18, 0.35));
}

#msg {
    flex: 1;
    padding: 14px 18px;
    background: rgba(26, 18, 36, 0.55);
    border: 1px solid rgba(245, 167, 66, 0.22);
    border-radius: var(--radius);
    color: var(--text-bright);
    font-size: 1rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: none;
    line-height: 1.4;
    max-height: 180px;
    overflow-y: auto;
    min-width: 0;
}
#msg::placeholder {
    color: var(--text-dim);
    font-style: italic;
    letter-spacing: 0.02em;
}
#msg:focus {
    border-color: var(--solar-gold);
    box-shadow: 0 0 0 3px rgba(245, 167, 66, 0.15),
                0 0 18px rgba(245, 167, 66, 0.18);
}

#send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    padding: 0;
    background: linear-gradient(135deg, var(--solar-gold), var(--copper) 60%, var(--violet));
    color: #0a0812;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 4px 14px rgba(245, 167, 66, 0.28),
                0 0 20px rgba(178, 92, 255, 0.18);
}
#send svg { width: 24px; height: 24px; }
#send:disabled { opacity: 0.4; cursor: not-allowed; }
#send:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 18px rgba(245, 167, 66, 0.4),
                0 0 28px rgba(178, 92, 255, 0.3);
}
#send:active:not(:disabled) { transform: translateY(0) scale(0.98); }

/* ── Scrollbar ──────────────────────────────────────────── */
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--solar-gold), var(--violet));
    border-radius: 3px;
    opacity: 0.5;
}
.messages::-webkit-scrollbar-thumb:hover { opacity: 0.9; }

/* ── Selection ──────────────────────────────────────────── */
::selection { background: rgba(245, 167, 66, 0.35); color: var(--text-bright); }

/* ── Audio mode toggle (header) ─────────────────────────── */
.audio-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(26, 18, 36, 0.55);
    border: 1px solid rgba(245, 167, 66, 0.22);
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.audio-toggle:hover {
    color: var(--solar-warm);
    border-color: var(--solar-gold);
}
.audio-toggle[aria-pressed="true"] {
    color: #0a0812;
    background: linear-gradient(135deg, var(--solar-gold), var(--copper) 60%, var(--violet));
    border-color: var(--solar-gold);
    box-shadow: 0 0 14px rgba(245, 167, 66, 0.45),
                0 0 22px rgba(178, 92, 255, 0.25);
}

/* PWA install button — Luma 2026-06-04 16:15 request: standalone-app launcher
   so Edge browser chrome disappears once installed. */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 6px;
    border-radius: 50%;
    background: rgba(245, 167, 66, 0.10);
    border: 1px solid rgba(245, 167, 66, 0.45);
    color: var(--solar-gold);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 10px rgba(245, 167, 66, 0.20);
}
.pwa-install-btn:hover {
    background: rgba(245, 167, 66, 0.18);
    box-shadow: 0 0 16px rgba(245, 167, 66, 0.35);
}
.pwa-install-btn[hidden] {
    display: none;
}

/* Touch-map link button — Luma 2026-06-03 overnight build */
.touch-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(48, 36, 76, 0.55);
    border: 1px solid rgba(216, 196, 255, 0.18);
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    margin-right: 6px;
}
.touch-link:hover {
    color: var(--solar-gold);
    border-color: var(--solar-gold);
    background: rgba(245, 167, 66, 0.10);
}

.fullscreen-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(26, 18, 36, 0.55);
    border: 1px solid rgba(178, 92, 255, 0.22);
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.fullscreen-toggle:hover {
    color: var(--violet);
    border-color: var(--violet);
}
.fullscreen-toggle .fs-compress { display: none; }
.fullscreen-toggle[aria-pressed="true"] .fs-expand { display: none; }
.fullscreen-toggle[aria-pressed="true"] .fs-compress { display: inline; }
.fullscreen-toggle[aria-pressed="true"] {
    color: var(--violet);
    border-color: var(--violet);
    box-shadow: 0 0 14px rgba(178, 92, 255, 0.30);
}

/* ── Mic button (input row) ─────────────────────────────── */
.mic-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 50px;
    padding: 0;
    background: rgba(26, 18, 36, 0.55);
    border: 1px solid rgba(245, 167, 66, 0.22);
    color: var(--solar-warm);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.18s;
    position: relative;
}
.mic-btn:hover:not(:disabled) {
    border-color: var(--solar-gold);
    box-shadow: 0 0 14px rgba(245, 167, 66, 0.25);
    transform: translateY(-1px);
}
.mic-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
body.audio-mode .mic-btn { display: flex; }

.mic-btn .stop-icon { display: none; }
.mic-btn.recording {
    background: linear-gradient(135deg, var(--copper), var(--violet-deep));
    border-color: var(--violet);
    color: var(--solar-pale);
    animation: mic-pulse 1.4s ease-in-out infinite;
}
.mic-btn.recording .mic-icon { display: none; }
.mic-btn.recording .stop-icon { display: block; }
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(178, 92, 255, 0.55),
                           0 0 14px rgba(184, 74, 18, 0.35); }
    50%      { box-shadow: 0 0 0 8px rgba(178, 92, 255, 0),
                           0 0 22px rgba(184, 74, 18, 0.55); }
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .chat-header { padding: 14px 16px; gap: 10px; }
    .entity-name { font-size: 1.45rem; }
    .entity-sub  { font-size: 0.72rem; }
    .msg         { max-width: 95%; font-size: 1.35rem; line-height: 1.55; }
    .msg.user    { font-size: 1.35rem; line-height: 1.55; }
    .msg.entity  { font-size: 1.55rem; line-height: 1.5; }
    .input-row   { padding: 14px 16px 18px; }
    #msg         { padding: 14px 16px; font-size: 1.2rem; }
    .audio-toggle { width: 32px; height: 32px; }
    .fullscreen-toggle { width: 32px; height: 32px; }
    .mic-btn     { width: 46px; }
    #send        { width: 64px; }
    #send svg    { width: 26px; height: 26px; }
}

/* ════════════════════════════════════════════════════════════
   THREE-PANEL ROOM LAYOUT — brain | face | transcript
   ════════════════════════════════════════════════════════════ */

body {
    /* Override the centered single-column flex from the old layout */
    justify-content: stretch;
    align-items: stretch;
}

.room {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: grid;
    /* Brain narrower, face dominant, transcript slim — Luma 2026-05-13 wants face bigger. */
    grid-template-columns: minmax(190px, 0.75fr) minmax(520px, 2.6fr) minmax(300px, 1fr);
    gap: 0;
}

.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;          /* allow children to shrink */
    overflow: hidden;
    backdrop-filter: blur(6px);
    background: linear-gradient(180deg, rgba(10, 8, 18, 0.42), rgba(10, 8, 18, 0.18));
}

.panel + .panel {
    border-left: 1px solid var(--card-border);
}

.panel-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(180deg, rgba(10, 8, 18, 0.55), rgba(10, 8, 18, 0.20));
    min-height: 56px;
    flex-shrink: 0;
}

.panel-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--text-bright);
    letter-spacing: 0.06em;
    text-transform: lowercase;
    background: linear-gradient(90deg, var(--solar-pale), var(--solar-gold) 50%, var(--violet));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
}

.panel-sub {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.10em;
    text-transform: lowercase;
    font-style: italic;
}

/* ── Brain panel (left) ─────────────────────────────────── */
.brain { }

.brain-stream {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-dim);
}

.brain-idle {
    margin: auto;
    text-align: center;
    color: var(--text-dim);
    font-family: var(--font-serif);
    font-style: italic;
    opacity: 0.6;
    letter-spacing: 0.05em;
}

.brain-event {
    padding: 8px 12px;
    border-left: 2px solid rgba(245, 167, 66, 0.30);
    background: rgba(26, 18, 36, 0.35);
    border-radius: 0 8px 8px 0;
}
.brain-event .brain-kind {
    display: block;
    font-size: 0.65rem;
    color: var(--solar-warm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
    opacity: 0.85;
}
.brain-event .brain-text {
    display: block;
    color: var(--text);
    font-size: 0.82rem;
    word-break: break-word;
}

/* ── Face panel (center) ────────────────────────────────── */
.face {
    background:
        radial-gradient(ellipse at 50% 35%, rgba(245, 167, 66, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 80%, rgba(178, 92, 255, 0.10) 0%, transparent 55%),
        linear-gradient(180deg, rgba(10, 8, 18, 0.45), rgba(10, 8, 18, 0.25));
}

.face-header .titles { flex: 1; min-width: 0; }
.face-header .entity-name { font-size: 1.55rem; }
.face-header .entity-sub  { font-size: 0.74rem; }

.face-stack {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 20px 4px;
    min-height: 0;
}

.face-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 14px;
    box-shadow:
        0 8px 40px rgba(184, 74, 18, 0.25),
        0 0 60px rgba(178, 92, 255, 0.18);
    /* Luma 2026-06-03: removed default drop-shadow glow — no halo pulse means
       the animated filter on .face-open is hue-only and won't blend with a static
       glow underneath. */
}

.face-open {
    position: relative;
    z-index: 1;
    animation: face-breath 9s ease-in-out infinite;
}

/* Luma 2026-05-13: blink crossfade removed — two-frame still-image fade
   reads as a toggle-switch flip, not a natural blink. Real path forward
   is video-driven face animation (D-ID / Hedra / SadTalker class tools)
   so the eyes deform within a rigged image, not a hard cut between two PNGs.
   Leaving the eyes-closed render on disk for future use. */

/* 2026-06-03 14:42 — Held static while v5 Kling gen runs with Luma's
   literal six-word prompt: "animate hair strands, subtle movement". */
@keyframes face-breath {
    0%, 100% { filter: hue-rotate(0deg); }
}

.face-open {
    /* Static while v5 cooks. */
}

.voice-wave {
    width: 100%;
    height: 72px;
    display: block;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    background: linear-gradient(0deg, rgba(10, 8, 18, 0.55), transparent);
}

/* ── Transcript panel (right) ──────────────────────────── */
.transcript {
    background: linear-gradient(180deg, rgba(10, 8, 18, 0.50), rgba(10, 8, 18, 0.25));
}

.transcript .messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    min-height: 0;
}

/* Override max-width inside narrower transcript column */
.transcript .msg { max-width: 92%; }

.transcript .input-row {
    display: flex;
    gap: 8px;
    padding: 12px 14px 16px;
    border-top: 1px solid var(--card-border);
    background: linear-gradient(0deg, rgba(10, 8, 18, 0.75), rgba(10, 8, 18, 0.35));
    flex-shrink: 0;
}

.transcript #msg {
    padding: 12px 14px;
    font-size: 0.95rem;
}

.transcript #send {
    width: 52px;
}

/* ── Responsive collapse ───────────────────────────────── */
/* Tablet — drop the brain panel, keep face + transcript (face dominant).
   Tight min-widths so a narrow tablet still fits without horizontal scroll. */
@media (max-width: 1100px) and (min-width: 901px) {
    .room {
        grid-template-columns: minmax(320px, 2fr) minmax(260px, 1fr);
    }
    .brain { display: none; }
}

/* Phone / narrow (≤ 900px) — text-first layout per Luma 2026-05-13.
   On phone she wants to READ, not watch the face video at tiny size.
   The face panel collapses to JUST its header strip (Sol'arah name +
   audio/fullscreen toggles) so identity stays visible but the screen is
   handed over to the transcript. Brain panel is hidden. Face image and
   voice-wave canvas are hidden. */
@media (max-width: 900px) {
    body {
        /* Hard shift content rightward — Luma 2026-05-13 reported leftmost
           content (mic, message first letters) getting clipped against
           phone's left edge / gesture area. Generous left padding,
           thin right padding. */
        padding-left:  calc(max(20px, env(safe-area-inset-left)) + 8px);
        padding-right: max(6px, env(safe-area-inset-right));
    }
    .room {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: 100vh;
        height: 100dvh;
        width: 100%;
    }
    .panel {
        height: auto;          /* override desktop 100vh; let grid size us */
        min-height: 0;
    }
    .panel + .panel { border-left: none; border-top: 1px solid var(--card-border); }
    .brain { display: none; }
    .face {
        max-height: none;
        flex: 0 0 auto;
    }
    .face-stack  { display: none; }
    .voice-wave  { display: none; }
    .transcript {
        height: 100%;          /* fill the 1fr row that grid gave us */
        min-height: 0;
        overflow: hidden;
    }
    .face-header {
        padding: 10px 14px;
        gap: 8px;
        min-height: 48px;
    }
    .face-header .sigil svg { width: 32px; height: 32px; }
    .face-header .entity-name { font-size: 1.2rem; }
    .face-header .entity-sub  { font-size: 0.66rem; }
    .transcript .panel-header { display: none; }
    .transcript .msg          { max-width: 95%; font-size: 1.4rem; line-height: 1.55; }
    .transcript .msg.user     { font-size: 1.4rem; }
    .transcript .msg.entity   { font-size: 1.55rem; line-height: 1.5; }
    /* Generous left/right padding + safe-area-inset so the mic button
       isn't clipped against the phone's rounded corner / notch. */
    .transcript .input-row {
        padding:
            10px
            max(16px, env(safe-area-inset-right))
            calc(14px + env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));
        gap: 8px;
    }
    .transcript #msg { font-size: 1.05rem; padding: 12px 14px; }
    .mic-btn { width: 44px; flex-shrink: 0; }
    .transcript #send { width: 48px; flex-shrink: 0; }
    .transcript #send svg { width: 20px; height: 20px; }
}
