/* ============================================================
           High on Therapy AI · dual-tone (sage + warm gold) design system
           ============================================================ */
        :root {
            --ink: #050706;
            --ink-2: #090c0b;
            --panel: rgba(18, 22, 21, 0.55);
            --panel-strong: rgba(16, 20, 19, 0.78);
            --panel-soft: rgba(255, 255, 255, 0.035);
            --line: rgba(255, 255, 255, 0.10);
            --line-strong: rgba(255, 255, 255, 0.22);
            --text: #f4f1ea;
            --muted: #8a8f8c;
            --soft: #c9cdc9;

            /* Sage (calming primary) */
            --sage: #5fb49c;
            --sage-bright: #7ad3b8;
            --sage-soft: rgba(95, 180, 156, 0.14);
            --sage-line: rgba(95, 180, 156, 0.32);
            --sage-glow: rgba(95, 180, 156, 0.45);
            --sage-dark: rgba(95, 180, 156, 0.18);

            /* Warm gold (companion tone) */
            --gold: #c2a15e;
            --gold-bright: #e0c078;
            --gold-soft: rgba(194, 161, 94, 0.14);
            --gold-line: rgba(194, 161, 94, 0.32);
            --gold-glow: rgba(194, 161, 94, 0.40);

            /* Accent / utility */
            --coral: #ff453a;
            --plum: #bf5af2;
            --sky: #0a84ff;
            --danger: #ff453a;

            --shadow: 0 32px 96px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.10);
            --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.55);
            --glow: 0 0 32px rgba(95, 180, 156, 0.18);

            --grad-dual: linear-gradient(135deg, var(--sage) 0%, var(--gold) 100%);
            --radius: 22px;
            --radius-sm: 12px;
            --ease: cubic-bezier(0.16, 1, 0.3, 1);
        }

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

        html,
        body {
            width: 100%;
            height: 100%;
        }

        body {
            min-height: 100dvh;
            overflow: hidden;
            color: var(--text);
            font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            background-color: #070908;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Subtle measurement grid that fades from center */
        body::before {
            display: none;
        }

        /* Custom scrollbars — dual-tone thumb */
        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, var(--sage-line), var(--gold-line));
            border-radius: 99px;
            border: 2px solid transparent;
            background-clip: padding-box;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, var(--sage), var(--gold));
            background-clip: padding-box;
        }
        * { scrollbar-width: thin; scrollbar-color: var(--sage-dark) transparent; }

        button,
        input,
        select,
        textarea {
            font: inherit;
            color: inherit;
        }

        select {
            background-color: transparent !important;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="rgba(95,180,156,0.65)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>') !important;
            background-repeat: no-repeat !important;
            background-position: right 6px center !important;
            color: var(--text);
            border: 1px solid var(--line) !important;
            border-radius: 10px;
            padding: 7px 26px 7px 10px;
            outline: none;
            color-scheme: dark;
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            font-size: 0.82rem;
            font-weight: 500;
            letter-spacing: 0.01em;
            transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background-color 0.25s var(--ease);
            cursor: pointer;
        }
        select:hover {
            background-color: var(--sage-soft) !important;
            border-color: var(--sage-line) !important;
            color: var(--text-primary, #ffffff);
        }
        select:focus-visible {
            border-color: var(--sage) !important;
            box-shadow: 0 0 0 3px var(--sage-soft);
        }
        select option { background: #0c100f; color: var(--text); }

        a { color: inherit; text-decoration: none; }
        i[data-lucide] { width: 18px; height: 18px; stroke-width: 1.6; }

        /* ---------- App container ---------- */
        .app-container {
            position: relative;
            z-index: 1;
            display: flex;
            flex-direction: column;
            height: 100dvh;
            padding: 14px 18px 18px;
            gap: 14px;
        }

        /* ---------- Generic interactive buttons ---------- */
        .nav-action,
        .icon-btn,
        .mode-btn,
        .send-btn,
        .close-sos,
        .close-tools,
        .close-zen,
        .start-zen-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            height: 38px;
            padding: 0 14px;
            border-radius: 11px;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            color: var(--text);
            font-size: 0.82rem;
            font-weight: 500;
            letter-spacing: 0.01em;
            cursor: pointer;
            transition: transform 0.25s var(--ease), background 0.25s var(--ease),
                        border-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
        }
        .nav-action:hover,
        .icon-btn:hover,
        .mode-btn:hover,
        .send-btn:hover,
        .close-sos:hover,
        .close-tools:hover,
        .close-zen:hover,
        .start-zen-btn:hover {
            background: var(--sage-soft);
            border-color: var(--sage-line);
            color: var(--text-primary, #ffffff);
        }
        .nav-action:active,
        .icon-btn:active,
        .mode-btn:active,
        .send-btn:active,
        .close-sos:active,
        .close-tools:active,
        .close-zen:active,
        .start-zen-btn:active { transform: scale(0.97); }

        .nav-action i { color: var(--sage-bright); }

        /* ---------- Workspace (3-column grid) ---------- */
        .workspace {
            display: grid;
            grid-template-columns: 220px minmax(0, 1fr) 340px;
            grid-template-rows: minmax(0, 1fr);
            gap: 14px;
            flex: 1;
            min-height: 0;
        }

        .session-rail,
        .chat-section,
        .presence-panel {
            position: relative;
            display: flex;
            flex-direction: column;
            background: var(--panel);
            backdrop-filter: blur(26px) saturate(180%) brightness(108%);
            -webkit-backdrop-filter: blur(26px) saturate(180%) brightness(108%);
            border: 1px solid var(--line);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            overflow: hidden;
            min-height: 0;
        }

        /* ---------- Session / mood rail ---------- */
        .session-rail {
            padding: 18px 14px;
            gap: 14px;
        }

        .rail-header,
        .chat-top,
        .presence-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-shrink: 0;
        }
        .rail-header span,
        .eyebrow,
        .metric span {
            font-size: 0.68rem;
            font-weight: 600;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: var(--muted);
        }
        .rail-header {
            position: relative;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--line);
        }
        .rail-header span { color: var(--sage-bright); }
        .rail-header strong {
            font-size: 0.82rem;
            font-weight: 700;
            min-width: 24px;
            text-align: center;
            padding: 2px 9px;
            border-radius: 99px;
            background: var(--sage-soft);
            border: 1px solid var(--sage-line);
            color: var(--sage-bright);
        }

        .mood-tracker {
            position: relative;
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 14px;
            overflow-y: auto;
            padding: 4px 6px 4px 18px;
        }
        /* sage gradient spine running down the tracker */
        .mood-tracker::before {
            content: "";
            position: absolute;
            left: 7px;
            top: 6px;
            bottom: 6px;
            width: 2px;
            border-radius: 2px;
            background: linear-gradient(180deg, var(--sage) 0%, var(--gold) 100%);
            opacity: 0.45;
        }

        .mood-empty {
            font-size: 0.78rem;
            color: var(--muted);
            font-style: italic;
            padding: 8px 0;
        }

        .mood-dot {
            position: relative;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            flex-shrink: 0;
            margin-left: -16px;
            align-self: flex-start;
            box-shadow: 0 0 0 3px rgba(7, 9, 8, 0.9), 0 0 14px currentColor;
            opacity: 0.92;
            transition: transform 0.25s var(--ease);
        }
        .mood-dot:hover { transform: scale(1.25); }
        .mood-dot::after {
            content: attr(data-mood);
            position: absolute;
            left: 22px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.66rem;
            font-weight: 600;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--soft);
            white-space: nowrap;
            opacity: 0.65;
        }

        .rail-note {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: auto;
            padding-top: 12px;
            border-top: 1px solid var(--line);
        }
        .rail-note .nav-action {
            justify-content: flex-start;
            padding: 0 12px;
            width: 100%;
        }

        /* ---------- Chat section ---------- */
        .chat-section { padding: 20px 22px; gap: 14px; }
        .chat-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding-bottom: 6px;
            border-bottom: 1px solid var(--line);
            flex-shrink: 0;
        }
        .chat-top-row {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }
        .chat-top h1 {
            font-size: clamp(1.15rem, 1.8vw, 1.4rem);
            font-weight: 720;
            line-height: 1.15;
            letter-spacing: -0.02em;
        }
        .new-session-btn {
            display: grid;
            place-items: center;
            width: 34px;
            height: 34px;
            border-radius: 10px;
            padding: 0;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            color: var(--muted);
            cursor: pointer;
            flex-shrink: 0;
            transition: transform 0.25s var(--ease), background 0.25s var(--ease),
                        border-color 0.25s var(--ease), color 0.25s var(--ease);
        }
        .new-session-btn:hover {
            background: var(--sage-soft);
            border-color: var(--sage-line);
            color: var(--sage-bright);
            transform: rotate(90deg);
        }
        .new-session-btn:active { transform: rotate(90deg) scale(0.94); }
        .new-session-btn i { width: 16px; height: 16px; }

        .chat-container {
            flex: 1;
            width: 100%;
            max-width: 800px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            overflow-y: auto;
            padding: 10px 10px 30px;
            min-height: 0;
            scrollbar-width: thin;
            scrollbar-color: var(--sage) transparent;
        }

        .message {
            max-width: 80%;
            padding: 13px 17px;
            border-radius: 16px;
            font-size: 0.92rem;
            line-height: 1.6;
            animation: messageIn 0.5s var(--ease) both;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }
        .message.ai {
            align-self: flex-start;
            border-top-left-radius: 4px;
            background: var(--panel-strong);
            border: 1px solid var(--line);
            border-left: 3px solid var(--sage);
            box-shadow: var(--shadow-soft);
        }
        .message.user {
            align-self: flex-end;
            border-top-right-radius: 4px;
            background: linear-gradient(135deg, var(--gold-soft) 0%, rgba(194, 161, 94, 0.05) 100%);
            border: 1px solid var(--gold-line);
            color: #fbf6ea;
        }
        .message p:not(:last-child),
        .message ul:not(:last-child),
        .message ol:not(:last-child) { margin-bottom: 8px; }
        .message ul,
        .message ol { padding-left: 20px; }
        .message strong { color: var(--text-primary, #ffffff); font-weight: 650; }
        .message a { color: var(--sage-bright); text-decoration: underline; }
        .message code {
            font-family: ui-monospace, "SF Mono", Menlo, monospace;
            font-size: 0.85em;
            background: rgba(255, 255, 255, 0.07);
            padding: 1px 6px;
            border-radius: 5px;
        }

        /* Typing indicator (3 dots, sage) */
        .typing-indicator {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 2px;
        }
        .typing-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--sage-bright);
            box-shadow: 0 0 8px var(--sage-glow);
            animation: typingPulse 1.2s infinite ease-in-out both;
        }
        .typing-dot:nth-child(1) { animation-delay: -0.24s; }
        .typing-dot:nth-child(2) { animation-delay: -0.12s; }

        /* ---------- Controls / input ---------- */

        .controls-section {
            display: flex;
            align-items: center;
            gap: 10px;
            padding-top: 12px;
            border-top: 1px solid var(--line);
            flex-shrink: 0;
        }
        .mode-toggle {
            display: inline-flex;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 3px;
            gap: 2px;
            flex-shrink: 0;
        }
        .mode-btn {
            height: 32px;
            padding: 0 12px;
            border-radius: 9px;
            background: transparent;
            border: none;
            color: var(--muted);
            font-size: 0.78rem;
        }
        .mode-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
        .mode-btn.active {
            background: var(--grad-dual);
            color: #060807;
            font-weight: 600;
            box-shadow: 0 0 18px var(--sage-glow);
        }
        .mode-btn.active i { color: #060807; }

        .text-input-area {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
            min-width: 0;
        }
        .chat-input {
            flex: 1;
            min-width: 0;
            height: 42px;
            padding: 0 16px;
            border-radius: 12px;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            color: var(--text);
            font-size: 0.92rem;
            transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
        }
        .chat-input::placeholder { color: var(--muted); }
        .chat-input:focus {
            outline: none;
            border-color: var(--sage);
            background: rgba(95, 180, 156, 0.05);
            box-shadow: 0 0 0 4px var(--sage-soft);
        }
        .send-btn {
            height: 42px;
            padding: 0 18px;
            background: var(--grad-dual);
            border: none;
            color: #060807;
            font-weight: 600;
            box-shadow: 0 6px 22px var(--sage-glow);
        }
        .send-btn:hover {
            filter: brightness(1.08);
            box-shadow: 0 8px 28px var(--sage-glow);
        }
        .send-btn i { color: #060807; }

        .voice-input-area {
            display: none;
            align-items: center;
            gap: 12px;
            flex: 1;
            min-width: 0;
        }
        .mic-btn {
            width: 46px;
            height: 46px;
            border-radius: 50%;
            padding: 0;
            background: var(--sage-soft);
            border: 1px solid var(--sage-line);
            color: var(--sage-bright);
            position: relative;
            flex-shrink: 0;
        }
        .mic-btn:hover {
            background: var(--sage-dark);
            color: var(--sage-bright);
            border-color: var(--sage);
        }
        .mic-btn.recording {
            background: rgba(255, 69, 58, 0.16);
            border-color: var(--coral);
            color: #ff6a5e;
            animation: voiceRing 1.4s var(--ease) infinite;
        }
        .mic-btn.recording::after {
            content: "";
            position: absolute;
            inset: -4px;
            border-radius: 50%;
            border: 2px solid var(--coral);
            opacity: 0.6;
            animation: voiceRing 1.4s var(--ease) infinite;
        }
        .voice-state {
            font-size: 0.82rem;
            color: var(--soft);
            letter-spacing: 0.04em;
        }
        #user-waveform {
            flex: 1;
            height: 36px;
            min-width: 0;
            opacity: 0.35;
            transition: opacity 0.3s var(--ease);
        }
        #user-waveform.active { opacity: 1; }

        /* ---------- Presence panel ---------- */
        .presence-panel {
            display: grid;
            grid-template-columns: 1fr;
            grid-template-rows: auto minmax(0, 1fr) auto;
        }
        .presence-panel::before {
            content: "";
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 120px;
            background: radial-gradient(ellipse at 50% 0%, var(--sage-soft), transparent 70%);
            pointer-events: none;
        }
        .presence-header {
            padding: 16px 18px;
            border-bottom: 1px solid var(--line);
            position: relative;
            z-index: 1;
        }
        .presence-header h2 {
            font-size: 1rem;
            font-weight: 650;
            letter-spacing: -0.01em;
        }
        .lang-shell {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .lang-shell i {
            width: 14px;
            height: 14px;
            color: var(--muted);
        }

        .avatar-stage {
            position: relative;
            display: grid;
            place-items: center;
            padding: 24px;
            overflow: hidden;
        }
        .avatar-container {
            position: relative;
            width: clamp(220px, 26vw, 290px);
            aspect-ratio: 1;
            border-radius: 50%;
            display: grid;
            place-items: center;
            background:
                radial-gradient(circle at 50% 40%, rgba(95, 180, 156, 0.12), transparent 70%),
                var(--panel-strong);
            border: 1px solid var(--sage-line);
            box-shadow: 0 0 60px var(--sage-glow), inset 0 0 40px rgba(95, 180, 156, 0.08);
            overflow: hidden;
        }
        .avatar-container::before {
            content: "";
            position: absolute;
            inset: -2px;
            border-radius: 50%;
            padding: 2px;
            background: conic-gradient(from 0deg, var(--sage), var(--gold), var(--sage));
            -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            animation: brandPulse 6s linear infinite;
            opacity: 0.6;
        }
        .avatar-container canvas {
            width: 100%;
            height: 100%;
            display: block;
        }

        .placeholder-text {
            position: absolute;
            inset: 0;
            display: grid;
            place-items: center;
            text-align: center;
            padding: 18px;
            color: var(--soft);
        }
        .placeholder-text i {
            width: 38px;
            height: 38px;
            color: var(--sage-bright);
            margin-bottom: 8px;
        }
        .placeholder-text strong {
            font-size: 0.9rem;
            color: var(--text-primary, #ffffff);
            letter-spacing: 0.04em;
        }
        .placeholder-text span {
            font-size: 0.74rem;
            color: var(--muted);
            margin-top: 4px;
            max-width: 180px;
        }

        #audio-waveform {
            position: absolute;
            left: 16px;
            right: 16px;
            bottom: 14px;
            height: 32px;
            width: calc(100% - 32px);
            opacity: 0.5;
            pointer-events: none;
        }

        .presence-metrics {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            padding: 14px 16px;
            border-top: 1px solid var(--line);
        }
        .metric {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 10px 6px;
            border-radius: 12px;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            text-align: center;
        }
        .metric strong {
            font-size: 0.84rem;
            font-weight: 600;
            color: var(--text);
            letter-spacing: 0.01em;
        }
        .metric:nth-child(1) strong { color: var(--sage-bright); }
        .metric:nth-child(2) strong { color: var(--gold-bright); }

        /* ---------- Overlays (tools + zen) ---------- */
        .overlay {
            position: fixed;
            inset: 0;
            z-index: 200;
            display: grid;
            place-items: center;
            padding: 0;
            background: rgba(4, 6, 5, 0.72);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.35s var(--ease);
        }
        .overlay.active { opacity: 1; pointer-events: auto; }
        .overlay-panel {
            width: min(640px, 100%);
            max-height: 88dvh;
            overflow-y: auto;
            padding: 28px;
            border-radius: var(--radius);
            background: var(--panel-strong);
            border: 1px solid var(--line-strong);
            box-shadow: var(--shadow);
            transform: translateY(14px) scale(0.98);
            transition: transform 0.4s var(--ease);
        }
        .overlay.active .overlay-panel { transform: translateY(0) scale(1); }
        .overlay-panel h2 {
            font-size: 1.5rem;
            font-weight: 720;
            letter-spacing: -0.02em;
            margin-bottom: 6px;
        }
        .overlay-panel > p {
            color: var(--muted);
            font-size: 0.88rem;
            margin-bottom: 20px;
        }

        .tools-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }
        .tool-card {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
            padding: 18px;
            border-radius: 16px;
            background: var(--panel-soft);
            border: 1px solid var(--line);
            color: var(--text);
            text-align: left;
            cursor: pointer;
            transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
        }
        .tool-card:hover {
            transform: translateY(-3px);
            border-color: var(--sage-line);
            background: var(--sage-soft);
        }
        .tool-icon {
            display: grid;
            place-items: center;
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: var(--grad-dual);
            color: #060807;
            box-shadow: 0 6px 18px var(--sage-glow);
        }
        .tool-icon i { width: 20px; height: 20px; stroke-width: 2; }
        .tool-card h3 {
            font-size: 0.95rem;
            font-weight: 650;
            color: var(--text-primary, #ffffff);
        }
        .tool-card p {
            font-size: 0.8rem;
            color: var(--muted);
            line-height: 1.5;
        }

        .overlay-actions {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 22px;
        }
        .close-sos,
        .close-tools,
        .close-zen,
        .start-zen-btn {
            min-width: 140px;
        }
        .start-zen-btn {
            background: var(--grad-dual);
            border: none;
            color: #060807;
            font-weight: 600;
            box-shadow: 0 6px 22px var(--sage-glow);
        }

        .breathe-wrap {
            display: grid;
            place-items: center;
            padding: 30px 0 10px;
        }
        .breathe-circle,
        .zen-breathe-circle {
            display: grid;
            place-items: center;
            width: 200px;
            height: 200px;
            border-radius: 50%;
            font-size: 0.92rem;
            font-weight: 700;
            letter-spacing: 0.16em;
            color: var(--text-primary, #ffffff);
            background:
                radial-gradient(circle at 50% 40%, var(--sage-soft), transparent 70%),
                var(--panel-strong);
            border: 1px solid var(--sage-line);
            box-shadow: 0 0 50px var(--sage-glow);
            transition: transform 4s var(--ease), box-shadow 4s var(--ease);
        }

        /* ---------- Crisis banner ---------- */
        .crisis-banner {
            position: fixed;
            top: -320px;
            left: 50%;
            transform: translateX(-50%);
            width: min(560px, calc(100% - 32px));
            z-index: 1000;
            padding: 24px 28px;
            border-radius: 20px;
            background: linear-gradient(180deg, rgba(60, 12, 10, 0.8), rgba(40, 8, 8, 0.85));
            border: 1px solid rgba(255, 90, 80, 0.35);
            box-shadow: 0 24px 70px rgba(255, 69, 58, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
            transition: top 0.6s cubic-bezier(0.16, 1, 0.3, 1);
            backdrop-filter: blur(25px);
        }
        .crisis-banner.active { top: 18px; }
        .crisis-banner h2 {
            font-size: 1.15rem;
            font-weight: 700;
            line-height: 1.3;
            margin-bottom: 8px;
        }
        .crisis-banner p {
            font-size: 0.86rem;
            color: rgba(255, 220, 218, 0.85);
            line-height: 1.55;
        }
        .crisis-actions {
            display: flex;
            gap: 10px;
            margin-top: 16px;
            flex-wrap: wrap;
        }
        .hotline-btn {
            flex: 1;
            min-width: 130px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            height: 42px;
            border-radius: 11px;
            background: var(--coral);
            color: var(--text-primary, #ffffff);
            font-weight: 600;
            font-size: 0.86rem;
            transition: filter 0.2s var(--ease), transform 0.2s var(--ease);
        }
        .hotline-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
        .crisis-close {
            position: absolute;
            top: 10px;
            right: 12px;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.08);
            border: none;
            color: rgba(255, 220, 218, 0.8);
            font-size: 1.2rem;
            line-height: 1;
            cursor: pointer;
            transition: background 0.2s var(--ease);
        }
        .crisis-close:hover { background: rgba(255, 255, 255, 0.18); }

        /* ---------- Auth loader ---------- */
        #auth-loader {
            position: fixed;
            inset: 0;
            z-index: 500;
            display: grid;
            place-items: center;
            background: #060807;
            transition: opacity 0.32s var(--ease);
        }
        #auth-loader.is-hidden { opacity: 0; pointer-events: none; }
        .loader-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            color: var(--soft);
            font-size: 0.85rem;
            letter-spacing: 0.04em;
        }
        .loader-spinner {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            border: 2px solid var(--line);
            border-top-color: var(--sage);
            border-right-color: var(--gold);
            animation: spin 0.9s linear infinite;
        }

        /* ---------- Keyframes ---------- */
        @keyframes brandPulse {
            0%, 100% { opacity: 0.5; transform: scale(1); }
            50% { opacity: 1; transform: scale(1.05); }
        }
        @keyframes messageIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes typingPulse {
            0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
            40% { transform: scale(1); opacity: 1; }
        }
        @keyframes voiceRing {
            0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); }
            100% { box-shadow: 0 0 0 16px rgba(255, 69, 58, 0); }
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        /* ---------- Ambient orbs ---------- */
        .ambient-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: -2; }
        .orb {
            position: absolute;
            border-radius: 50%;
            filter: blur(90px);
            opacity: 0.42;
            animation: floatOrb 22s infinite alternate ease-in-out;
        }
        .orb-1 { width: 460px; height: 460px; background: rgba(95, 180, 156, 0.18); top: -140px; left: -120px; }
        .orb-2 { width: 540px; height: 540px; background: rgba(194, 161, 94, 0.13); bottom: -220px; right: -120px; animation-delay: -6s; }
        .orb-3 { width: 340px; height: 340px; background: rgba(120, 166, 200, 0.1); top: 42%; left: 58%; animation-delay: -11s; }
        @keyframes floatOrb {
            0% { transform: translate(0, 0) scale(1); }
            100% { transform: translate(110px, 60px) scale(1.22); }
        }

        /* ---------- Responsive ---------- */
        @media (max-width: 1180px) {
            .workspace {
                grid-template-columns: 88px minmax(0, 1fr);
                grid-template-rows: minmax(0, 1fr) auto;
            }
            .session-rail { padding: 14px 8px; }
            .rail-header span,
            .rail-note { display: none; }
            .mood-tracker { padding-left: 14px; }
            .mood-dot { margin-left: -10px; }
            .mood-dot::after { display: none; }
            .mood-tracker::before { left: 5px; }

            .presence-panel {
                grid-column: 1 / -1;
                grid-template-columns: minmax(220px, 0.5fr) minmax(280px, 1fr);
                grid-template-rows: auto;
            }
            .presence-header {
                grid-column: 1 / 2;
                border-right: 1px solid var(--line);
                border-bottom: 0;
            }
            .avatar-stage {
                grid-column: 2 / 3;
                grid-row: 1 / span 2;
                min-height: 240px;
            }
            .presence-metrics {
                grid-column: 1 / 2;
                grid-template-columns: 1fr;
                border-right: 1px solid var(--line);
                border-top: 1px solid var(--line);
            }
        }

        @media (max-width: 760px) {
            body { overflow: auto; }
            .app-container { min-height: 100dvh; height: auto; padding: 10px; }
            .nav-action { width: 100%; }

            .workspace {
                grid-template-columns: 1fr;
                grid-template-rows: auto minmax(430px, 54dvh) auto;
                padding: 0;
                gap: 10px;
            }
            .session-rail {
                grid-template-columns: auto 1fr auto;
                grid-template-rows: auto;
                align-items: center;
                min-height: 64px;
                padding: 10px 12px;
            }
            .rail-header { display: flex; padding-bottom: 0; border-bottom: 0; }
            .rail-header strong { display: block; }
            .mood-tracker {
                flex-direction: row;
                margin: 0 10px;
                overflow-x: auto;
                overflow-y: hidden;
                padding-left: 8px;
            }
            .mood-tracker::before { display: none; }
            .mood-dot { margin-left: 0; }
            .rail-note { display: none; }

            .chat-section { padding: 16px; }
            .chat-top { flex-direction: column; align-items: flex-start; }
            .new-session-btn { align-self: flex-end; }
            .message { max-width: 92%; }
            .text-input-area { display: grid; grid-template-columns: 1fr; }
            .send-btn { width: 100%; }

            .presence-panel { grid-template-columns: 1fr; }
            .presence-header,
            .presence-metrics,
            .avatar-stage {
                grid-column: auto;
                grid-row: auto;
                border-right: 0;
            }
            .tools-grid { grid-template-columns: 1fr; }
        }
/* Extracted from highontherapy.html */
:root {
            --bg-color: #030303;
            --text-main: #f0f0f0;
            --text-muted: #888888;
            --accent: #5e43f3;
            --glass-bg: rgba(255, 255, 255, 0.03);
            --glass-border: rgba(255, 255, 255, 0.08);
            --glass-hover: rgba(255, 255, 255, 0.06);
            --glass-hover: rgba(255, 255, 255, 0.06);
        }

        button, a {
            touch-action: manipulation;
        }
        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            font-family: 'Geist', sans-serif;
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background-image: radial-gradient(circle at 50% 0%, rgba(94, 67, 243, 0.05) 0%, transparent 50%);
        }
        .header { padding: 15px 40px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; z-index: 500; position: fixed; top: 0; left: 0; right: 0; background: rgba(5, 7, 6, 0.6); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
        .nav-group { display: flex; align-items: center; gap: 15px; }
        .nav-group.right { justify-content: flex-end; transition: opacity 0.3s; opacity: 0; pointer-events: none; }
        .brand { font-weight: 600; letter-spacing: 4px; color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
        .brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 10px var(--sage-bright); animation: pulseDot 2s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; }
        @keyframes pulseDot { from { transform: scale(0.8); opacity: 0.6; box-shadow: 0 0 5px var(--sage); } to { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px var(--sage-bright); } }
        .bottom-actions { position: absolute; bottom: 30px; left: 30px; display: flex; flex-direction: column; gap: 12px; z-index: 100; }
        .action-btn { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-muted); padding: 12px 20px; border-radius: 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: all 0.3s; font-family: 'Geist', sans-serif; font-size: 14px; font-weight: 500; backdrop-filter: blur(10px); }
        .action-btn:hover { background: var(--glass-hover); border-color: rgba(255,255,255,0.15); color: #fff; transform: translateX(5px); }
        .stress-graph-widget { position: absolute; bottom: 30px; right: 30px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 16px; padding: 18px 24px; backdrop-filter: blur(20px); box-shadow: 0 15px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 12px; z-index: 100; transition: transform 0.3s ease, box-shadow 0.3s ease; }
        .stress-graph-widget:hover { transform: translateY(-3px); box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.15); }
        .stress-graph-header { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; }
        .stress-value { color: #fff; font-size: 12px; }
        .stress-svg { width: 120px; height: 40px; }
        .icon-btn { background: transparent; border: 1px solid transparent; color: var(--text-muted); padding: 8px 15px; border-radius: 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all 0.3s; font-family: 'Geist', sans-serif; font-size: 13px; }
        .icon-btn:hover { background: var(--glass-bg); border-color: var(--glass-border); color: #fff; }
        .dropdown { position: relative; }
        .dropdown-menu { position: absolute; top: 50px; right: 0; background: rgba(10, 15, 12, 0.7); backdrop-filter: blur(25px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 10px; min-width: 180px; opacity: 0; visibility: hidden; transform: translateY(-15px); transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 15px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05); }
        .dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
        .dropdown-item { padding: 12px 16px; color: var(--text-muted); font-size: 13.5px; cursor: pointer; border-radius: 10px; transition: all 0.25s ease; display: flex; align-items: center; gap: 10px; font-weight: 500; }
        .dropdown-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(4px); }
        .dropdown-item.active { color: var(--sage-bright); background: rgba(95, 180, 156, 0.15); box-shadow: inset 0 0 10px rgba(95, 180, 156, 0.1); }
        .mode-toggle { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 30px; display: flex; padding: 4px; position: relative; backdrop-filter: blur(10px); margin: 0 auto; }
        .toggle-pill { position: absolute; top: 4px; left: 4px; width: calc(50% - 4px); height: calc(100% - 8px); background: rgba(255,255,255,0.1); border-radius: 20px; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 0; }
        .mode-toggle button { background: transparent; border: none; color: var(--text-muted); padding: 10px 30px; border-radius: 20px; cursor: pointer; font-family: 'Geist', sans-serif; font-size: 14px; font-weight: 500; transition: color 0.4s; z-index: 1; }
        .mode-toggle button.active { color: #fff; }
        .scene { position: absolute; top: 80px; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.8s ease, transform 0.8s ease; transform: translateY(20px); }
        .header .glass-panel { opacity: 0; pointer-events: none; transition: opacity 0.5s; position: absolute; top: 100%; left: 0; right: 0; }
        .header:hover .glass-panel { opacity: 1; pointer-events: auto; }

/* ── MOBILE RESPONSIVENESS FIXES ── */
@media (max-width: 768px) {
    .header {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px 20px;
        position: relative;
    }
    .nav-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    .nav-group.right {
        justify-content: center;
        opacity: 1;
        pointer-events: auto;
    }
    .header .glass-panel {
        display: none;
    }
    
    .chat-top h1 { font-size: 1.2rem; }
    
    .avatar-container { width: 180px; }
    .presence-panel::before { display: none; }
    
    .dashboard-grid { grid-template-columns: 1fr; }
    
    .app-container { padding: 4px; }
    
    /* Login screen mobile tweaks */
    .login-box { margin-top: 20px; padding: 30px 20px; }
}

        .scene.active { opacity: 1; pointer-events: auto; transform: translateY(0); }
        .chat-container { width: 100%; max-width: 800px; flex: 1; display: flex; flex-direction: column; gap: 15px; padding: 20px 40px 40px; overflow-y: auto; }
        .chat-container::-webkit-scrollbar { width: 6px; }
        .chat-container::-webkit-scrollbar-thumb { background: rgba(95, 180, 156, 0.4); border-radius: 4px; }
        .chat-container::-webkit-scrollbar-thumb:hover { background: var(--sage); }
        .msg-wrapper { display: flex; flex-direction: column; max-width: 85%; animation: messageIn 0.5s ease both; }
        @keyframes messageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        .msg-wrapper.ai { align-self: flex-start; }
        .msg-wrapper.user { align-self: flex-end; }
        .msg-sender { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
        .ai-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
        .msg { line-height: 1.7; font-size: 16px; font-weight: 300; }
        .msg-wrapper.ai .msg { color: #ccc; padding-left: 14px; border-left: 2px solid rgba(255,255,255,0.1); }
        .msg-wrapper.user .msg { color: #fff; background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 18px 24px; border-radius: 16px; border-bottom-right-radius: 4px; backdrop-filter: blur(10px); }
        .input-wrapper { width: 100%; max-width: 800px; padding: 0 20px 40px; }
        .input-bar { position: relative; width: 100%; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; display: flex; align-items: center; padding: 10px 10px 10px 24px; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
        .input-bar:focus-within { background: rgba(255,255,255,0.06); border-color: rgba(95, 180, 156, 0.4); box-shadow: 0 15px 50px rgba(0,0,0,0.6), 0 0 20px rgba(95, 180, 156, 0.2); transform: translateY(-2px); }
        .input-bar input { flex: 1; background: transparent; border: none; color: #fff; font-size: 15.5px; font-family: 'Geist', sans-serif; outline: none; padding: 10px 0; }
        .input-bar input::placeholder { color: rgba(255,255,255,0.3); font-weight: 300; }
        .send-btn { width: 44px; height: 44px; border-radius: 16px; background: var(--sage); border: none; color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 4px 15px rgba(95, 180, 156, 0.3); }
        .send-btn:hover { background: var(--sage-bright); transform: scale(1.08) translateY(-2px); box-shadow: 0 8px 25px rgba(95, 180, 156, 0.5); }
        #area-voice { justify-content: center; padding-bottom: 80px; }
        .aura-wrapper { position: relative; width: 340px; height: 340px; display: flex; align-items: center; justify-content: center; }
        .aura { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle, rgba(95, 180, 156, 0.45) 0%, rgba(194, 161, 94, 0.2) 40%, transparent 70%); animation: breathe 4s ease-in-out infinite alternate; z-index: 0; filter: blur(10px); }
        @keyframes breathe { 0% { transform: scale(0.9); opacity: 0.6; } 100% { transform: scale(1.15); opacity: 1; filter: blur(15px); } }
        .avatar-container { position: relative; z-index: 1; width: 220px; height: 220px; border-radius: 50%; overflow: hidden; background: var(--glass-bg); backdrop-filter: blur(20px); border: 2px solid var(--sage-line); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 50px rgba(95, 180, 156, 0.2); }
        .avatar-img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.5s; }
        .talk-status { margin-top: 50px; font-size: 14px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; animation: pulseText 2s infinite; }
        @keyframes pulseText { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
        .mic-btn { margin-top: 0; width: 64px; height: 64px; border-radius: 50%; background: var(--sage); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s; box-shadow: 0 0 30px rgba(95, 180, 156, 0.4); border: 2px solid rgba(255,255,255,0.1); }
        .mic-btn:hover { transform: scale(1.05); box-shadow: 0 0 40px rgba(95, 180, 156, 0.6); }
        /* Voice pulsing animation triggered by highontherapy.js */
        .recording { box-shadow: 0 0 0 16px rgba(255, 69, 58, 0.3); animation: voicePulse 0.8s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate; background: var(--coral) !important; border-color: transparent !important; }
        @keyframes voicePulse { from { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.6); } to { box-shadow: 0 0 0 25px rgba(255, 69, 58, 0); } }

        /* --- ADVANCED CHAT UI (Glassmorphism & Shadows) --- */
        .message { display: flex; flex-direction: column; max-width: 85%; animation: messageIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; margin-bottom: 24px; line-height: 1.65; font-size: 13.5px; font-weight: 400; position: relative; }
        
        .message.ai { 
            align-self: flex-start; 
            color: var(--text); 
            background: rgba(95, 180, 156, 0.05); /* Sage tint */
            border: 1px solid rgba(95, 180, 156, 0.15); 
            padding: 16px 22px; 
            border-radius: 20px; 
            border-bottom-left-radius: 4px; 
            backdrop-filter: blur(12px); 
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .message.ai:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
        
        .message.user { 
            align-self: flex-end; 
            color: #fff; 
            background: rgba(255, 255, 255, 0.07);
            border: 1px solid rgba(255, 255, 255, 0.12); 
            padding: 16px 22px; 
            border-radius: 20px; 
            border-bottom-right-radius: 4px; 
            backdrop-filter: blur(12px); 
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .message.user:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15); }

        /* Kokonut UI Animations */
        @keyframes spin { 100% { transform: rotate(360deg); } }
        .k-bar { width: 2px; background: rgba(255,255,255,0.1); border-radius: 99px; transition: all 0.3s ease; }
        .k-bar.active { background: rgba(255,255,255,0.5); animation: pulse-bar 1s infinite alternate; }
        @keyframes pulse-bar { 0% { transform: scaleY(0.2); opacity: 0.5; } 100% { transform: scaleY(1.5); opacity: 1; } }
        .kokonut-thinking-text {
            display: inline-block;
            background: linear-gradient(to right, var(--sage-bright) 0%, var(--gold-bright) 50%, var(--sage-bright) 100%);
            background-size: 200% 100%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: shimmer-fast 2s linear infinite;
            font-weight: 600;
            font-size: 14.5px;
            letter-spacing: 0.5px;
            white-space: nowrap;
        }
        @keyframes shimmer-fast { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }

