#page-companion {
    min-height: calc(100vh - 120px);
}

.cmp-shell {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 18px;
    height: calc(100vh - 150px);
}

.cmp-side, .cmp-chat {
    background: var(--bg-secondary, #111827);
    border: 1px solid var(--border, #263244);
    border-radius: 16px;
    padding: 16px;
    overflow: auto;
}

.cmp-side h2, .cmp-side h3 {
    margin: 0 0 10px;
}

.cmp-side p, .cmp-status, .cmp-persona-card span, .cmp-persona-card small, .cmp-match small {
    color: var(--text-secondary, #9ca3af);
}

.cmp-wizard {
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.08);
}

.cmp-onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 32px;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(14px);
}

.cmp-onboarding-card {
    width: min(920px, 94vw);
    min-height: min(560px, 86vh);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    padding: clamp(32px, 7vw, 72px);
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 34px;
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.35), transparent 34%),
        linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96));
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.cmp-onboarding-card h2 {
    margin: 0;
    font-size: clamp(2.6rem, 7vw, 6rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.cmp-onboarding-card p {
    max-width: 720px;
    margin: 0;
    color: var(--text-secondary, #cbd5e1);
    font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.cmp-onboarding-progress {
    width: max-content;
    padding: 8px 14px;
    border-radius: 999px;
    color: #ddd6fe;
    background: rgba(124, 58, 237, 0.22);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cmp-jumbo-input {
    width: 100%;
    min-height: 74px;
    padding: 18px 22px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 20px;
    color: var(--text-primary, #f8fafc);
    background: rgba(2, 6, 23, 0.72);
    font-size: clamp(1.35rem, 3vw, 2.1rem);
    outline: none;
}

.cmp-jumbo-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
}

.cmp-jumbo-btn {
    align-self: flex-start;
    min-width: 220px;
    min-height: 64px;
    padding: 18px 28px;
    border-radius: 18px;
    font-size: 1.15rem;
    font-weight: 800;
}

.cmp-wizard input, .cmp-wizard select, .cmp-form textarea {
    width: 100%;
    color: var(--text-primary, #f8fafc);
    background: var(--bg, #0b1120);
    border: 1px solid var(--border, #263244);
    border-radius: 10px;
    padding: 10px;
    margin: 8px 0;
}

.cmp-check {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.cmp-check input {
    width: auto;
}

.cmp-primary, .cmp-playbar button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    cursor: pointer;
}

.cmp-primary:disabled, .cmp-playbar button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cmp-persona-grid, .cmp-match-list {
    display: grid;
    gap: 10px;
}

.cmp-persona-card, .cmp-match {
    display: grid;
    gap: 5px;
    text-align: left;
    color: var(--text-primary, #f8fafc);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border, #263244);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
}

.cmp-persona-card:hover, .cmp-match:hover {
    border-color: #7c3aed;
}

.cmp-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #312e81;
    font-weight: 700;
}

.cmp-chat {
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    min-width: 0;
}

.cmp-chat-head, .cmp-playbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
}

.cmp-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 12px 0;
}

.cmp-avatar-stage {
    position: relative;
    min-height: clamp(280px, 46vh, 460px);
    display: grid;
    place-items: center;
    margin: 4px 0 12px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 22%, rgba(168, 85, 247, 0.24), transparent 36%),
        radial-gradient(circle at 50% 90%, rgba(37, 99, 235, 0.20), transparent 44%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.92));
}

.cmp-avatar-stage::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    pointer-events: none;
}

.cmp-avatar-sprite {
    position: relative;
    z-index: 2;
    width: min(76%, 360px);
    aspect-ratio: 1;
    background-image: url("/static/companion/luna/luna_sprite_sheet.png?v=20260615luna");
    background-repeat: no-repeat;
    background-size: 500% 600%;
    background-position: 0 0;
    filter: drop-shadow(0 28px 42px rgba(0, 0, 0, 0.42));
    transform-origin: 50% 72%;
    transition: transform 160ms ease;
}

.cmp-avatar-stage.is-talking .cmp-avatar-sprite {
    transform: translateY(-3px) scale(1.018);
}

.cmp-avatar-glow {
    position: absolute;
    z-index: 1;
    width: min(70%, 340px);
    height: min(28%, 120px);
    bottom: 10%;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.25);
    filter: blur(26px);
}

.cmp-msg {
    max-width: 78%;
    white-space: pre-wrap;
    border-radius: 14px;
    padding: 10px 12px;
}

.cmp-user {
    align-self: flex-end;
    background: #2563eb;
    color: white;
}

.cmp-assistant {
    align-self: flex-start;
    background: rgba(148, 163, 184, 0.12);
}

.cmp-system {
    align-self: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #9ca3af);
    background: transparent;
}

.cmp-status {
    min-height: 22px;
}

.cmp-status.is-error, .cmp-error {
    color: #f87171;
}

.cmp-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.cmp-mic {
    min-width: 58px;
    min-height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    color: var(--text-primary, #f8fafc);
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    font-weight: 800;
}

.cmp-mic.is-listening {
    color: #0f172a;
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.cmp-mic:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cmp-hidden-reply {
    opacity: 0.72;
    font-style: italic;
}

.cmp-playbar audio {
    width: 100%;
}

.cmp-voice-mode {
    padding: 4px 10px;
    border-radius: 999px;
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.14);
    font-size: 0.82rem;
    font-weight: 700;
}

@media (max-width: 900px) {
    .cmp-shell {
        grid-template-columns: 1fr;
        height: auto;
    }
}
