:root {
    --bg-color: #030407;
    --glass-bg: rgba(8, 12, 24, 0.65);
    --glass-border: rgba(212, 175, 55, 0.18);
    --primary-glow: #d4af37; /* Starfleet Gold */
    --secondary-glow: #00F0FF; /* Medical Cyan */
    --text-main: #FFFFFF;
    --text-muted: #8A9BB5;
    --accent: #d4af37;
    --danger: #FF3366;
    --success: #00FF66;
    --tech-green: #00FF9D;
    
    /* Solar System Colors */
    --sun-color: #d4af37;
    --p1-color: #00F0FF;
    --p2-color: #A0B0C0;
    --p3-color: #FF3366;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    /* Prevent iOS/desktop browser chrome from hiding sticky header under notches */
    scroll-padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
}
body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.04) 0%, transparent 80%),
                      radial-gradient(circle at 10% 20%, rgba(0, 242, 255, 0.03) 0%, transparent 40%);
    color: var(--text-main);
    font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
    /* svh = visible viewport (avoids mobile/desktop chrome clipping 100vh layouts) */
    min-height: 100vh;
    min-height: 100svh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    /* Never clip the sticky app chrome */
    padding-top: 0;
}
/* Skip link — keyboard / a11y */
.emh-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    background: #0a1018;
    color: #e8f4fa;
    padding: 0.5rem 0.85rem;
    border-radius: 0 0 8px 0;
    border: 1px solid rgba(126, 200, 227, 0.45);
    font-size: 0.85rem;
}
.emh-skip:focus {
    left: 0;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

#loading-screen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: black;
}

.loading-text {
    margin-top: 2rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary-glow);
    letter-spacing: 4px;
    font-size: 1rem;
    animation: blink 1.5s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Background Mesh & Grid */
.bg-mesh {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.08), transparent 45%),
                radial-gradient(circle at 80% 20%, rgba(0, 240, 255, 0.04), transparent 30%);
    animation: slowRotate 80s linear infinite;
    z-index: -2;
}

.grid-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(212, 175, 55, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, 0.02) 1px, transparent 1px);
    background-size: 45px 45px;
    z-index: -1;
}

.top-controls {
    /* sticky app chrome — NEVER absolute (absolute + 100dvh overflow hid Persona/Details) */
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    transform: none !important;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: max(0.55rem, env(safe-area-inset-top, 0px)) 0.75rem 0.55rem;
    box-sizing: border-box;
    background: rgba(3, 4, 7, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(126, 200, 227, 0.22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.top-controls .emh-brand-chip {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c5a572;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(197, 165, 114, 0.4);
    background: rgba(197, 165, 114, 0.08);
    white-space: nowrap;
}
.persona-pick {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(8, 12, 24, 0.75);
    border: 1px solid rgba(126, 200, 227, 0.35);
    border-radius: 999px;
    padding: 0.28rem 0.55rem 0.28rem 0.75rem;
    backdrop-filter: blur(12px);
}
.persona-pick select {
    background: transparent;
    border: none;
    color: #e8f4fa;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: none;
    max-width: 11rem;
    outline: none;
    cursor: pointer;
}
.persona-pick select option {
    background: #0a1018;
    color: #e8f4fa;
}

/* 3-column sickbay: chat | hero hologram | care board */
#bridge-container {
    display: grid !important; /* visible by default; script must not force flex */
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr) minmax(240px, 1fr);
    grid-template-rows: auto;
    align-items: start;
    width: 100%;
    max-width: 100%;
    /* NEVER 100dvh + overflow:hidden — that clipped top chrome + Doctor crown */
    height: auto !important;
    min-height: calc(100svh - 3.5rem);
    padding: 0.85rem 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
    gap: 1rem;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    /* Keep sickbay in the viewport — no horizontal off-screen panels */
    position: relative;
    left: 0;
    transform: none !important;
}

body.tech-mode #bridge-container {
    height: 62dvh;
    min-height: 0;
    padding-top: 4.5rem;
}

#comm-panel { grid-column: 1; min-width: 0; min-height: 0; }
#holo-center { grid-column: 2; min-width: 0; min-height: 0; }
#dispatch-panel { grid-column: 3; min-width: 0; min-height: 0; }

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    height: 100%;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.85), inset 0 0 0 1px rgba(255,255,255,0.03);
    overflow: hidden;
    position: relative;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
    opacity: 0.6;
}

.panel-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.4);
}

.panel-header h2 { font-size: 0.85rem; letter-spacing: 2px; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.live { background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulseDot 2s infinite; }
.dot.standby { background: #FFAA00; box-shadow: 0 0 10px #FFAA00; }

@keyframes pulseDot { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.badge { font-size: 0.6rem; letter-spacing: 1px; padding: 0.2rem 0.6rem; border: 1px solid var(--secondary-glow); color: var(--secondary-glow); border-radius: 4px; background: rgba(0, 240, 255, 0.08); font-weight: 600; }
.badge.danger { border-color: var(--danger); color: var(--danger); background: rgba(255, 51, 102, 0.08); }

/* Vitals & Diagnostics widgets */
.widget-list {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-glow) transparent;
}

.widget {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(212, 175, 55, 0.08);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    transition: all 0.3s ease;
}
.widget:hover {
    border-color: rgba(212, 175, 55, 0.25);
    background: rgba(255, 255, 255, 0.03);
}

.widget-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-glow);
    letter-spacing: 2px;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
}

.vitals-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.vitals-row:last-child { margin-bottom: 0; }
.vitals-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.vitals-value { font-size: 1.1rem; font-weight: 800; color: #FFF; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.status-dot.success { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.critical { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* Chat Stream */
#chat-history { flex-grow: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.5rem; scrollbar-width: thin; scrollbar-color: var(--primary-glow) transparent; }
.message { display: flex; gap: 1rem; animation: fadeIn 0.3s ease-out forwards; }
.msg-avatar { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.sys-avatar { background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow)); box-shadow: 0 0 15px rgba(212, 175, 55, 0.4); }
.user-avatar { background: #1B263B; border: 1px solid var(--text-muted); }

.msg-content strong { display: block; font-size: 0.75rem; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 0.3rem; }
.msg-content p { font-size: 0.92rem; line-height: 1.5; color: #E2E8F0; word-wrap: break-word; overflow-wrap: anywhere; }

.chat-input-wrapper { padding: 1.2rem 1.5rem; display: flex; gap: 0.75rem; border-top: 1px solid var(--glass-border); background: rgba(0,0,0,0.45); align-items: center; }
.chat-input-wrapper input { flex-grow: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); padding: 0.75rem 1rem; border-radius: 10px; color: white; font-family: 'Outfit', sans-serif; font-size: 0.9rem; outline: none; transition: all 0.3s ease; }
.chat-input-wrapper input:focus { border-color: var(--secondary-glow); background: rgba(0, 240, 255, 0.04); }

.control-btn { background: transparent; color: var(--primary-glow); border: 1px solid var(--primary-glow); height: 42px; width: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; flex-shrink: 0; }
.control-btn:hover { background: rgba(212, 175, 55, 0.15); box-shadow: 0 0 12px rgba(212, 175, 55, 0.25); }
.control-btn.active { color: var(--secondary-glow); border-color: var(--secondary-glow); background: rgba(0, 240, 255, 0.1); animation: micPulse 1.5s infinite; }

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.3); }
    70% { box-shadow: 0 0 0 10px rgba(0, 240, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); }
}

.transmit-btn { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.85rem; letter-spacing: 1px; padding: 0 1.2rem; width: auto; height: 42px; border-radius: 10px; cursor: pointer; }

/* Center: Hologram & Solar System */
#holo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* flex-start keeps face/title in view; center+overflow:hidden was clipping the top */
  justify-content: flex-start;
  position: relative;
  width: 100%;
  min-width: 0;
  gap: 0.45rem;
  /* Glass holodeck bay — center is not empty black */
  background: rgba(8, 12, 24, 0.55);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(126, 200, 227, 0.28);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 1rem 0.75rem 1.1rem;
  min-height: 0;
  max-height: none;
  overflow: visible;
  align-self: start;
}
#holo-center::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(126, 200, 227, 0.65), transparent);
  opacity: 0.7;
  pointer-events: none;
}
body.tech-mode #holo-center { transform: none; }

/* Glass Orb Character */
.glass-orb {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    position: relative;
    background: rgba(8, 12, 24, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 45px rgba(212, 175, 55, 0.2), inset 0 0 35px rgba(212, 175, 55, 0.08);
    animation: orb-float 5s ease-in-out infinite;
    overflow: hidden;
    transition: all 0.5s ease;
    z-index: 20;
    margin-bottom: -50px; /* Overlap with solar system disk */
}

@keyframes orb-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

.orb-glow {
    position: absolute;
    top: -20%; left: -20%; width: 140%; height: 140%;
    background: radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.2), transparent 60%);
    pointer-events: none;
}

.orb-face {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.orb-eyes { display: flex; gap: 28px; margin-top: -10px; }
.orb-eye {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(212, 175, 55, 0.12);
    border: 1.5px solid rgba(212, 175, 55, 0.45);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.orb-eye.glowing {
    background: rgba(0, 242, 255, 0.18);
    border-color: rgba(0, 242, 255, 0.65);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.45);
}

.pupil { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-glow); transition: all 0.3s; }
.orb-eye.glowing .pupil { background: #00f2ff; box-shadow: 0 0 8px #00f2ff; }

.orb-mouth-area { margin-top: 14px; display: flex; justify-content: center; }
.orb-mouth {
    width: 34px; height: 5px; background: rgba(212, 175, 55, 0.55);
    border-radius: 3px; transition: all 0.15s ease;
}
.orb-mouth.open {
    width: 38px; height: 18px;
    border-radius: 0 0 18px 18px;
    background: rgba(255, 51, 102, 0.22);
    border: 1.5px solid rgba(212, 175, 55, 0.45);
    border-top: none;
}

.glass-ring {
    position: absolute;
    top: -4px; left: -4px; width: calc(100% + 8px); height: calc(100% + 8px);
    border-radius: 50%; border: 1.5px solid rgba(212, 175, 55, 0.18);
    pointer-events: none; animation: ring-pulse 3s ease-in-out infinite;
}
@keyframes ring-pulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(1.05); }
}

.glass-shine {
    position: absolute;
    top: 10%; left: 15%; width: 30%; height: 20%;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent);
    border-radius: 50%; transform: rotate(-30deg); pointer-events: none;
}

/* Speaking/Thinking visual overlays */
.speaking .glass-orb { border-color: var(--secondary-glow); box-shadow: 0 0 55px rgba(0, 240, 255, 0.25); }

/* Realistic Solar System */
.solar-system-container {
    position: relative;
    width: 340px; height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    transform-style: preserve-3d;
    transform: rotateX(76deg);
    z-index: 10;
}

.solar-glow {
    position: absolute;
    width: 140px; height: 140px;
    background: var(--sun-color);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    transform: rotateX(-76deg);
}

.sun {
    position: absolute;
    width: 50px; height: 50px;
    background: radial-gradient(circle at 30% 30%, #FFF, var(--sun-color));
    border-radius: 50%;
    box-shadow: 0 0 35px var(--sun-color), inset 0 0 15px #FFF;
    transform: rotateX(-76deg);
    z-index: 15;
}

.orbit {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-sizing: border-box;
    transform-style: preserve-3d;
}

.orbit1 { width: 130px; height: 130px; animation: orbitSpin 9s linear infinite; }
.orbit2 { width: 210px; height: 210px; animation: orbitSpin 16s linear infinite; }
.orbit3 { width: 300px; height: 300px; animation: orbitSpin 28s linear infinite; }

.planet {
    position: absolute;
    top: -5px; left: 50%;
    margin-left: -5px;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,255,255,0.4);
    transform: rotateX(-76deg);
}

.p1 { width: 9px; height: 9px; background: var(--p1-color); }
.p2 { width: 13px; height: 13px; background: var(--p2-color); top: -6px; margin-left: -6.5px; }
.p3 { width: 18px; height: 18px; background: var(--p3-color); top: -9px; margin-left: -9px; }

.moon {
    position: absolute;
    width: 3px; height: 3px;
    background: #FFF;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform-origin: 13px 0;
    animation: orbitSpin 2.5s linear infinite;
}

.planet-ring {
    position: absolute;
    top: 50%; left: 50%;
    width: 30px; height: 30px;
    margin-top: -15px; margin-left: -15px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    transform: rotateX(76deg);
}

@keyframes orbitSpin { 0% { transform: rotateZ(0deg); } 100% { transform: rotateZ(360deg); } }

/* Solar System Active State */
.solar-system-container.active .solar-glow { filter: blur(90px); opacity: 0.7; background: var(--secondary-glow); }
.solar-system-container.active .sun { background: radial-gradient(circle at 30% 30%, #FFF, var(--secondary-glow)); box-shadow: 0 0 50px var(--secondary-glow); }
.solar-system-container.active .orbit { border-color: rgba(0, 240, 255, 0.35); }

.holo-title { font-size: 1.35rem; font-weight: 800; letter-spacing: 4px; background: linear-gradient(90deg, var(--primary-glow), #FFF); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0.4rem; z-index: 20; text-transform: uppercase; }
.holo-status { font-size: 0.78rem; letter-spacing: 2px; color: var(--text-muted); z-index: 20; text-transform: uppercase; }

.sims-status {
    margin-top: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--secondary-glow);
    opacity: 0;
    transition: opacity 0.3s;
    height: 1rem;
    z-index: 20;
}
.sims-status.visible { opacity: 1; }

/* JSON Triage Panel */
.json-container { flex-grow: 1; padding: 1.5rem; background: rgba(0,0,0,0.45); border-bottom: 1px solid var(--glass-border); display: flex; flex-direction: column; }
.json-header { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.8rem; letter-spacing: 1.5px; }
.json-lang { color: var(--primary-glow); font-weight: bold; }
pre#json-preview { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; color: #A0C0E0; line-height: 1.5; overflow: auto; max-width: 100%; white-space: pre-wrap; word-wrap: break-word; flex-grow: 1; scrollbar-width: thin; scrollbar-color: var(--primary-glow) transparent; }
.json-key { color: #82aaff; } .json-string { color: #c3e88d; } .json-number { color: #f78c6c; } .json-boolean { color: #ff9cac; } .json-null { color: #ff9cac; }

.dispatch-actions { padding: 1.2rem 1.5rem; display: flex; flex-direction: column; gap: 0.8rem; }
.status-indicator { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; }
.status-indicator .line { flex-grow: 1; height: 1px; background: var(--glass-border); }

.glow-btn {
    background: linear-gradient(90deg, #1d1808, #3b2f0a);
    border: 1.5px solid var(--primary-glow);
    border-radius: 10px;
    color: var(--primary-glow);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-transform: uppercase;
}
#execute-btn { width: 100%; padding: 1.1rem; }
#execute-btn.critical-dispatch {
    background: linear-gradient(90deg, #3a0815, #6b0c24);
    border-color: var(--danger);
    color: var(--danger);
    animation: criticalPulse 1s infinite alternate;
}

@keyframes criticalPulse {
    from { box-shadow: 0 0 10px rgba(255, 51, 102, 0.2); }
    to { box-shadow: 0 0 25px rgba(255, 51, 102, 0.6); }
}

.glow-btn.small { padding: 0.55rem 1.2rem; font-size: 0.7rem; letter-spacing: 2.5px; background: rgba(212, 175, 55, 0.05); }

.glow-btn:not(.disabled):hover {
    background: var(--primary-glow);
    color: #030407;
    box-shadow: 0 0 22px rgba(212, 175, 55, 0.45);
}
#execute-btn.critical-dispatch:not(.disabled):hover {
    background: var(--danger);
    color: #FFF;
    box-shadow: 0 0 25px rgba(255, 51, 102, 0.6);
}
.glow-btn.disabled { opacity: 0.4; cursor: not-allowed; border-color: var(--text-muted); color: var(--text-muted); background: rgba(255,255,255,0.02); }

/* Tech Stream Panel */
#tech-stream-panel {
    display: none;
    width: calc(100% - 4rem);
    margin: 0 2rem 2rem 2rem;
    height: 35vh;
    background: rgba(0, 3, 8, 0.9);
    border: 1.5px solid var(--primary-glow);
    box-shadow: 0 -10px 40px rgba(212, 175, 55, 0.12);
    border-radius: 16px;
    overflow: hidden;
}
body.tech-mode #tech-stream-panel { display: flex; }

#tech-logs {
    flex-grow: 1;
    padding: 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--tech-green);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-glow) transparent;
}
.log-line { opacity: 0.9; word-break: break-all; }
.log-line.error { color: var(--danger); }
.log-line.warn { color: #FFAA00; }
.log-line.info { color: #82aaff; }
.log-line.success { color: var(--success); }

/* Animations */
@keyframes slowRotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.slide-in-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.slide-in-right { animation: slideInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fade-in-up { animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.slide-in-up { animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

/* === Companion magic layer (2026-07-12) === */
.scanline {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 240, 255, 0.015) 3px
    );
    opacity: 0.35;
}
.magic-btn {
    border-color: var(--secondary-glow) !important;
    color: var(--secondary-glow) !important;
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}
.magic-btn:hover {
    background: rgba(0, 240, 255, 0.12) !important;
}
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1rem 0.75rem;
    border-top: 1px solid rgba(212, 175, 55, 0.08);
}
.quick-chips button {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    background: rgba(0, 240, 255, 0.06);
    color: var(--secondary-glow);
    cursor: pointer;
    transition: 0.2s ease;
}
.quick-chips button:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--secondary-glow);
}
.quick-chips button[data-q*="chest"] {
    border-color: rgba(255, 51, 102, 0.5);
    color: var(--danger);
    background: rgba(255, 51, 102, 0.08);
}
.companion-summary {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 0.6rem;
}
.trend-feed {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.trend-item {
    font-size: 0.68rem;
    line-height: 1.35;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-glow);
    background: rgba(0, 0, 0, 0.25);
    color: #c5d0e0;
}
.trend-item.high { border-left-color: var(--danger); }
.trend-item.medium { border-left-color: #ffaa00; }
.trend-item.low { border-left-color: var(--success); }
.cdss-box {
    font-size: 0.72rem;
    line-height: 1.4;
    color: #b8c4d8;
    font-family: 'JetBrains Mono', monospace;
}
.cdss-box strong { color: var(--secondary-glow); }
.disclaimer-foot {
    font-size: 0.58rem;
    color: rgba(138, 155, 181, 0.75);
    text-align: center;
    padding: 0.4rem 0.8rem 0.8rem;
    letter-spacing: 0.03em;
}
.esi-ring {
    margin-top: 1rem;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(0, 240, 255, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.15);
    transition: border-color 0.4s, box-shadow 0.4s;
}
.esi-ring[data-esi="1"], .esi-ring[data-esi="2"] {
    border-color: var(--danger);
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.45);
    animation: pulseDot 1s infinite;
}
.esi-ring[data-esi="3"] {
    border-color: #ffaa00;
    box-shadow: 0 0 24px rgba(255, 170, 0, 0.35);
}
.esi-label {
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    color: var(--text-muted);
}
.esi-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--secondary-glow);
    line-height: 1;
}
.esi-ring[data-esi="1"] .esi-num,
.esi-ring[data-esi="2"] .esi-num {
    color: var(--danger);
}
body.critical-mode .bg-mesh {
    background: radial-gradient(circle at 50% 50%, rgba(255, 51, 102, 0.12), transparent 50%);
}
/* Human product mode: never lock body/bridge to overflow:hidden full-viewport */
body.emh-human {
    height: auto;
    min-height: 100svh;
    overflow-y: auto;
    overflow-x: hidden;
}
body.emh-human .glass-panel {
    height: auto;
    min-height: min(72svh, 720px);
    max-height: none;
}
body.emh-human #comm-panel,
body.emh-human #dispatch-panel {
    max-height: none;
}

/* Windowed / tablet / mobile: hero first, full-width stack, no empty half-screen */
@media (max-width: 1200px) {
    #bridge-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        min-height: 100svh;
        overflow-y: visible;
        overflow-x: hidden;
        padding: 0.5rem 0.85rem 1.25rem;
        gap: 0.85rem;
    }
    #holo-center {
        grid-column: 1;
        grid-row: 1;
        min-height: unset;
        padding: 0.75rem 0.65rem 0.85rem;
        overflow: visible;
        justify-content: flex-start;
    }
    #comm-panel {
        grid-column: 1;
        grid-row: 2;
        height: auto;
        min-height: min(48vh, 420px);
        max-height: none;
    }
    #dispatch-panel {
        grid-column: 1;
        grid-row: 3;
        height: auto;
        min-height: min(36vh, 320px);
        max-height: none;
    }
    .glass-panel {
        width: 100%;
        height: auto;
    }
}

@media (max-width: 640px) {
    #bridge-container {
        padding: 0.35rem 0.6rem 1rem;
        gap: 0.7rem;
    }
    .top-controls {
        top: 0;
        gap: 0.4rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    }
    body.emh-human .glow-btn.small {
        font-size: 0.62rem;
        padding: 0.35rem 0.55rem;
    }
    .panel-header { padding: 0.85rem 1rem; }
    #chat-history { padding: 1rem; gap: 1rem; }
    .chat-input-wrapper { padding: 0.85rem 1rem; }
}

/* Night + severity + visit modal */
body.night-mode .bg-mesh {
    background: radial-gradient(circle at 50% 40%, rgba(80, 40, 140, 0.14), transparent 55%),
                radial-gradient(circle at 80% 20%, rgba(0, 240, 255, 0.05), transparent 35%);
}
body.night-mode .holo-title { color: #c9b6ff; }
.severity-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1rem 0.55rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.severity-row input[type=range] {
    flex: 1;
    accent-color: var(--secondary-glow);
}
#sevVal {
    font-family: 'JetBrains Mono', monospace;
    color: var(--secondary-glow);
    min-width: 1.5rem;
}
.mini-badge {
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    padding: 0.15rem 0.4rem;
    border: 1px solid #a78bfa;
    color: #c4b5fd;
    border-radius: 4px;
    margin-left: 0.4rem;
    vertical-align: middle;
}
.meds-line {
    font-size: 0.68rem;
    color: #9fb0c9;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}
.visit-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0,0,0,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.visit-modal-card {
    width: min(820px, 96vw);
    max-height: 88vh;
    background: rgba(8, 12, 24, 0.96);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 16px;
    box-shadow: 0 0 60px rgba(0, 240, 255, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.visit-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}
.visit-modal-head h2 {
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    color: var(--primary-glow);
}
.visit-md {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 1rem 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #c5d0e0;
    white-space: pre-wrap;
}
.visit-actions {
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem 1.1rem;
    border-top: 1px solid rgba(212, 175, 55, 0.12);
}

/* --- Truth-first UI: wizard, help, guided logs --- */
.chip-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 1rem 0.35rem;
  letter-spacing: 0.02em;
}
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(126, 200, 227, 0.55);
  color: #b8dce8;
  font-size: 0.65rem;
  cursor: help;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.help-bubble {
  position: fixed;
  z-index: 30000;
  max-width: 280px;
  padding: 0.75rem 0.9rem;
  background: rgba(8, 14, 24, 0.96);
  border: 1px solid rgba(126, 200, 227, 0.45);
  border-radius: 12px;
  color: #e8f4fa;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  pointer-events: none;
}
.wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: 25000;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.wizard-card {
  width: min(520px, 96vw);
  padding: 1.4rem 1.5rem 1.1rem;
  height: auto !important;
  max-height: 90vh;
  overflow-y: auto;
}
.wizard-card h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: #e8f4fa;
}
.wizard-body { color: #c5d4e0; font-size: 0.95rem; line-height: 1.5; margin-bottom: 1.1rem; }
.wizard-body p { margin-bottom: 0.65rem; }
.wizard-list { margin: 0.4rem 0 0.6rem 1.1rem; }
.wizard-list li { margin-bottom: 0.4rem; }
.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.wizard-foot {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.wizard-progress {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.wiz-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(126,200,227,0.25);
}
.wiz-dot.on { background: #7ec8e3; box-shadow: 0 0 8px rgba(126,200,227,0.6); }
.wiz-dot.done { background: rgba(126,200,227,0.55); }
.log-modal-card { width: min(480px, 96vw); max-height: 88vh; }
.log-modal-body { padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.85rem; }
.log-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.log-field input,
.log-field select,
.log-field textarea {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(126,200,227,0.3);
  background: rgba(0,0,0,0.45);
  color: #e8f4fa;
  font-family: inherit;
}
.log-modal-foot {
  padding: 0.85rem 1.2rem 1.1rem;
  border-top: 1px solid rgba(126,200,227,0.15);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.log-modal-note, .log-modal-warn {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.log-modal-warn { color: #f0a0b0; }

/* === Human presence (fixit 2026-07-13) — photoreal hero, not cartoon orb === */
body.emh-human {
  --primary-glow: #7ec8e3;
  --secondary-glow: #c5a572;
  font-family: 'DM Sans', system-ui, sans-serif;
}
body.emh-human .holo-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.35rem;
  color: #e8f4fa;
}
.matrix-line {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(184, 220, 232, 0.72);
  text-align: center;
}
.doctor-stage {
  position: relative;
  /* Portrait stage: room for full head + shoulders; never a thin strip */
  width: min(100%, min(40vw, 440px));
  aspect-ratio: 3 / 4;
  height: auto;
  max-height: min(58svh, 520px);
  border-radius: 24px;
  /* Clip media only — stage itself is not scaled (see avatar_director) */
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(126, 200, 227, 0.45);
  box-shadow:
    0 0 56px rgba(30, 90, 140, 0.5),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 40px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 50% 28%, #1a2a3c 0%, #0a1018 68%);
  flex-shrink: 0;
  z-index: 1;
  /* Reserve visual headroom so crown is never under frame edge */
  padding-top: 0;
  transform: none !important;
}
@media (max-width: 1200px) {
  .doctor-stage {
    width: min(86vw, 380px);
    max-height: min(48svh, 440px);
  }
}
@media (max-width: 640px) {
  .doctor-stage {
    width: min(90vw, 340px);
    max-height: min(46svh, 400px);
  }
}
.doctor-glow {
  position: absolute; inset: -20%;
  background: radial-gradient(circle at 50% 30%, rgba(126,200,227,0.25), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.doctor-video, .doctor-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* contain + top bias = full crown visible; cover crops forehead */
  object-fit: contain;
  object-position: center 12%;
  transform-origin: center top;
  z-index: 1;
  background: transparent;
}
.doctor-video {
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
}
.doctor-video.active { opacity: 1; z-index: 4; }
.doctor-video-legacy { display: none !important; }
.doctor-still {
  z-index: 3;
  transition: opacity 0.35s ease;
  opacity: 1;
}
/* Video may layer above still only when a real frame is playing.
   has-video alone is NOT enough (404 videos used to blank the Doctor). */
.doctor-stage.has-video.video-painted .doctor-still {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.doctor-stage.has-video .doctor-video.active {
  z-index: 4;
  opacity: 1;
}
.doctor-stage .doctor-still {
  opacity: 1 !important;
  z-index: 5;
  display: block !important;
  visibility: visible !important;
  object-fit: cover;
  object-position: center 18%;
}
.doctor-stage.has-video.video-painted .doctor-still {
  opacity: 0 !important;
  z-index: 1;
}
.doctor-scan {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(126, 200, 227, 0.06) 48%,
    transparent 52%
  );
  background-size: 100% 220%;
  animation: doctor-scan 7s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.55;
}
@keyframes doctor-scan {
  0% { background-position: 0% 0%; }
  100% { background-position: 0% 100%; }
}
.doctor-speak-ring {
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  border: 1px solid transparent;
  z-index: 5;
  pointer-events: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
.doctor-stage.speaking {
  box-shadow: 0 0 72px rgba(197, 165, 114, 0.55), 0 0 28px rgba(126,200,227,0.4);
  border-color: rgba(197, 165, 114, 0.6);
}
.doctor-stage.speaking .doctor-speak-ring {
  opacity: 1;
  border-color: rgba(197, 165, 114, 0.65);
  box-shadow: inset 0 0 24px rgba(197, 165, 114, 0.18);
  animation: speak-pulse 1.4s ease-in-out infinite;
}
@keyframes speak-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.012); opacity: 1; }
}
.doctor-stage.thinking {
  box-shadow: 0 0 56px rgba(126, 200, 227, 0.45);
}
.hidden-compat { display: none !important; }
#loading-portrait {
  width: min(220px, 50vw);
  height: min(280px, 45vh);
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid rgba(126,200,227,0.4);
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
body.emh-human .badge {
  border-color: rgba(126,200,227,0.4);
  color: #b8dce8;
}
body.emh-human .glow-btn.subtle {
  opacity: 0.75;
  font-size: 0.7rem;
}
.msg-avatar.sys-avatar {
  background-size: cover !important;
  background-position: center top !important;
}
/* hide solar system / old orb if leftover CSS */
body.emh-human .solar-system-container,
body.emh-human .glass-orb:not(.doctor-stage) { display: none; }

/* Heal-first board */
.heal-widget .heal-tagline { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.6rem; }
.heal-step { margin: 0.45rem 0; padding: 0.45rem 0.5rem; border-left: 2px solid var(--secondary-glow); background: rgba(0,240,255,0.04); border-radius: 0 6px 6px 0; }
.heal-step strong { display: block; color: var(--primary-glow); font-size: 0.8rem; margin-bottom: 0.2rem; }
.heal-step span { font-size: 0.75rem; color: var(--text-muted); line-height: 1.35; }
.heal-mods { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.heal-chip { font-size: 0.68rem; padding: 0.25rem 0.5rem; border-radius: 999px; border: 1px solid rgba(212,175,55,0.35); color: var(--text-main); background: rgba(212,175,55,0.08); }
.heal-food { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.35rem; }
.heal-note { font-size: 0.72rem; color: var(--text-muted); margin: 0.4rem 0 0.6rem; }
.oncall-widget .glow-btn { width: 100%; margin-top: 0.25rem; }

/* Care network + PWYC */
.care-widget .care-practitioners { display: flex; flex-direction: column; gap: 0.45rem; max-height: 220px; overflow-y: auto; }
.care-prac {
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(126,200,227,0.22);
  border-radius: 8px;
  background: rgba(8, 16, 28, 0.55);
}
.care-prac-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem; }
.care-prac-head strong { font-size: 0.78rem; color: var(--primary-glow); }
.care-tier { font-size: 0.62rem; color: var(--secondary-glow); letter-spacing: 0.04em; text-transform: uppercase; }
.care-prac-roles { font-size: 0.68rem; color: var(--text-muted); margin: 0.2rem 0 0.4rem; }
.care-prac .care-book-btn { width: 100%; }
.care-contrib-row { display: flex; gap: 0.35rem; margin-bottom: 0.35rem; }
.care-contrib-row input,
.care-contrib-row select,
.care-contrib textarea {
  flex: 1;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.35rem 0.45rem;
  font-family: inherit;
}
.care-contrib textarea { width: 100%; resize: vertical; margin-bottom: 0.35rem; }
.care-contrib .glow-btn { width: 100%; }
#careContribStatus { min-height: 1.1em; color: var(--secondary-glow); }

/* Live vitals bridge */
.vitals-widget .vitals-connect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0.55rem;
}
.vitals-widget .vitals-connect-row .glow-btn {
  flex: 1 1 auto;
  min-width: 5.5rem;
}
#vitalsStatus { color: var(--secondary-glow); min-height: 1.2em; }
#tricorderTeaser {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.85;
  border-top: 1px solid rgba(126,200,227,0.15);
  padding-top: 0.45rem;
}

/* Viseme energy ring (avatar director) */
.doctor-stage {
  --viseme-energy: 0;
}
.doctor-stage.speaking .doctor-speak-ring {
  box-shadow: 
      inset 0 0 calc(18px + var(--viseme-energy) * 28px) rgba(197, 165, 114, calc(0.12 + var(--viseme-energy) * 0.35)),
      0 0 calc(12px + var(--viseme-energy) * 40px) rgba(0, 240, 255, calc(0.08 + var(--viseme-energy) * 0.25));
}
.doctor-stage.speaking .doctor-video-talk.active,
.doctor-stage.speaking .doctor-still {
  filter: brightness(calc(1 + var(--viseme-energy) * 0.06)) contrast(calc(1 + var(--viseme-energy) * 0.04));
}
.doctor-stage[data-shot="WHISPER"] {
  box-shadow: 0 0 48px rgba(126, 200, 227, 0.35);
}
.doctor-stage[data-shot="WIDE"] {
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.2);
}

/* Presence HUD — live-call director chrome */
.presence-hud {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 8;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  pointer-events: none;
  opacity: 0.85;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.presence-shot, .presence-viseme {
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(126,200,227,0.35);
  background: rgba(0,0,0,0.45);
  color: #b8dce8;
}
.presence-viseme { border-color: rgba(212,175,55,0.4); color: var(--primary-glow); }
.presence-breath {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--secondary-glow);
  box-shadow: 0 0 10px rgba(0,240,255,0.7);
  animation: presence-breath 2.8s ease-in-out infinite;
}
.doctor-stage.speaking .presence-breath {
  animation-duration: 0.7s;
  background: var(--primary-glow);
  box-shadow: 0 0 14px rgba(212,175,55,0.85);
}
@keyframes presence-breath {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50% { transform: scale(1.15); opacity: 1; }
}
.presence-line {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0.25rem auto 0;
  text-align: center;
  line-height: 1.35;
  min-height: 1.9em;
}
.heal-progress {
  font-size: 0.68rem;
  color: var(--secondary-glow);
  margin-bottom: 0.45rem;
  letter-spacing: 0.03em;
}
.heal-step label {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  cursor: pointer;
}
.heal-step input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--primary-glow);
}
.heal-step.done {
  opacity: 0.72;
  border-left-color: var(--success);
}
.heal-step.done strong { text-decoration: line-through; text-decoration-color: rgba(212,175,55,0.5); }
#btnHealReset { width: 100%; margin-top: 0.5rem; }
.care-tier-a { color: var(--primary-glow) !important; }
.care-prac[data-tier="A"] { border-color: rgba(212,175,55,0.4); box-shadow: 0 0 12px rgba(212,175,55,0.08); }
.care-prac[data-tier="B"] { border-color: rgba(126,200,227,0.35); }
.care-fee {
  font-size: 0.65rem;
  color: var(--primary-glow);
  margin: 0.15rem 0 0.35rem;
}
.care-referral {
  margin-top: 0.55rem;
  padding: 0.45rem;
  border-radius: 8px;
  background: rgba(0,240,255,0.05);
  border: 1px dashed rgba(126,200,227,0.3);
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.care-referral button { margin-top: 0.35rem; width: 100%; }


/* 3D Meshy canvas — OFF by default (photoreal video is one hero). Enable with ?render=3d */
.doctor-3d-canvas {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.85;
  transition: filter 0.3s ease;
}
.doctor-3d-canvas.emh-3d-on { display: block; }
.doctor-stage.speaking .doctor-3d-canvas.emh-3d-on {
  filter: brightness(calc(1 + var(--viseme-energy, 0.5) * 0.06))
          contrast(calc(1 + var(--viseme-energy, 0.5) * 0.04));
}
/* Ensure still/video stay above empty canvas failures */
.doctor-stage .doctor-still { z-index: 3; }
.doctor-stage .doctor-video.active { z-index: 4; }

