:root {
    color-scheme: dark;
    --bg: #05070a;
    --bg-soft: #0a0d12;
    --surface: rgba(13, 17, 23, .78);
    --surface-strong: rgba(26, 26, 26, .97);
    /*--surface-strong: rgba(18, 23, 31, .94);*/
    --text: #f1f4f7;
    --muted: #8f99a6;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .18);
    --accent: #f4a322;
    --accent-text: #f4a322;
    --accent-soft: rgba(244, 163, 34, .16);
    --danger: #ff4d50;
    --shadow: 0 24px 80px rgba(0, 0, 0, .36);
    --radius: 24px;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="day"] {
    color-scheme: light;
    /* Keep the space backdrop unchanged; only interface surfaces switch theme. */
    --bg: #05070a;
    --bg-soft: #0a0d12;
    --surface: rgba(255, 255, 255, .74);
    --surface-strong: rgba(252, 250, 245, .96);
    --text: #191b1d;
    --muted: #666b70;
    --line: rgba(24, 27, 30, .10);
    --line-strong: rgba(24, 27, 30, .18);
    --accent-text: #9a5200;
    --accent-soft: rgba(154, 82, 0, .12);
    --shadow: 0 24px 80px rgba(66, 52, 33, .13);
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 45%, rgba(244, 163, 34, .055), transparent 32%), #05070a;
    color: var(--text);
    transition: background-color .35s ease, color .35s ease;
}

button, textarea {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    min-height: 100svh;
    position: relative;
    isolation: isolate;
}

.topbar {
    position: fixed;
    z-index: 20;
    inset: 0 0 auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px clamp(18px, 3vw, 42px);
    pointer-events: none;
}

.topbar > * {
    pointer-events: auto;
}

.brand {
    --text: #f1f4f7;
    display: inline-flex;
    align-items: flex-start;
    color: var(--text);
    text-decoration: none;
    user-select: none;
}

.brand-copy {
    display: grid;
    justify-items: start;
    line-height: 1;
}

.brand-title {
    color: #f1f4f7;
    font-size: 1rem;
    font-weight: 720;
    letter-spacing: .015em;
}

.brand-x {
    color: #ffc629;
}

.brand-subtitle {
    margin-top: 4px;
    color: rgba(241, 244, 247, .66);
    font-size: .57rem;
    font-weight: 650;
    letter-spacing: .28em;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    color: rgba(241, 244, 247, .64);
    font-size: .56rem;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.connection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8f99a6;
    box-shadow: 0 0 8px rgba(143, 153, 166, .55);
}

.connection-status[data-state="online"] .connection-dot {
    background: #48d67e;
    box-shadow: 0 0 9px rgba(72, 214, 126, .75);
}

.connection-status[data-state="offline"] .connection-dot {
    background: #ff4d50;
    box-shadow: 0 0 9px rgba(255, 77, 80, .72);
}

.connection-status[data-state="checking"] .connection-dot {
    background: #f4a322;
    box-shadow: 0 0 9px rgba(244, 163, 34, .72);
}

.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-pill, .quiet-button {
    min-height: 40px;
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(18px);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 14px;
    color: var(--muted);
}

.status-pill {
    font-size: .75rem;
}

.status-pill span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #63d98b;
    box-shadow: 0 0 10px rgba(99,217,139,.7);
}

.quiet-button {
    cursor: pointer;
}

.quiet-button:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.account-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    backdrop-filter: blur(18px);
    color: var(--text);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .04em;
    cursor: pointer;
}

.account-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-strong);
}

.universe {
    min-height: 100svh;
    position: relative;
    display: grid;
    place-items: center;
    padding: 90px 20px 120px;
    overflow: hidden;
}

.ambient {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .18;
    pointer-events: none;
}

.ambient-one {
    width: 34vw;
    height: 20vw;
    background: #a45c00;
    left: 8vw;
    top: 25vh;
}

.ambient-two {
    width: 28vw;
    height: 22vw;
    background: #29415b;
    right: 8vw;
    bottom: 15vh;
}

.assistant-status {
    position: fixed;
    z-index: 11;
    left: 50%;
    bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px));
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: 3px;
    width: max-content;
    max-width: calc(100vw - 40px);
    color: #f1f4f7;
    text-align: center;
    pointer-events: none;
    text-shadow: 0 2px 16px rgba(0,0,0,.8);
}

.assistant-status-mainline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.assistant-status-processing {
    display: none;
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border: 2px solid rgba(255,255,255,.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: assistant-status-spin .8s linear infinite;
}

.assistant-status.has-temporary-message .assistant-status-processing {
    display: block;
}

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

.assistant-status strong {
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: .05em;
}

.assistant-status small {
    font-size: .66rem;
    color: rgba(241,244,247,.58);
}

.universe:has(.black-hole-wrap.is-active:not(.is-executing)) .assistant-status {
    opacity: .45;
}

.signal-control {
    position: fixed;
    z-index: 12;
    left: 50%;
    bottom: max(34px, calc(env(safe-area-inset-bottom) + 34px));
    width: min(420px, calc(100vw - 72px));
    height: 42px;
    transform: translateX(-50%);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.signal-control:hover {
    filter: brightness(1.16);
}

#signalCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.privacy-note {
    position: fixed;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .68rem;
    white-space: nowrap;
}

.privacy-note, .privacy-note a {
    color: rgba(241,244,247,.58);
}

.privacy-note a {
    text-decoration: none;
}

.privacy-note a:hover {
    color: #f1f4f7;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    cursor: pointer;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent-text);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .16em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.toast {
    position: fixed;
    z-index: 40;
    left: 50%;
    top: 82px;
    transform: translate(-50%, -12px);
    opacity: 0;
    pointer-events: none;
    padding: 10px 15px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    font-size: .8rem;
    transition: .25s ease;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 640px) {
    .status-pill {
        display: none;
    }
    .button-label {
        display: none;
    }
    .quiet-button {
        width: 40px;
        padding: 0;
        justify-content: center;
    }
    .topbar {
        padding: 16px;
    }
    .assistant-status {
        bottom: max(78px, calc(env(safe-area-inset-bottom) + 78px));
    }
    .signal-control {
        bottom: max(32px, calc(env(safe-area-inset-bottom) + 32px));
        width: min(330px, calc(100vw - 60px));
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

