.dream-guide {
    --guide-primary: #584785;
    --guide-primary-dark: #3d315f;
    --guide-surface: #ffffff;
    --guide-soft: #f7f5fb;
    --guide-border: #e8e3f0;
    --guide-text: #241f2d;
    --guide-muted: #716b7a;
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    font-family: inherit;
    font-size: .94rem;
    isolation: isolate;
    position: fixed;
    right: max(1.25rem, env(safe-area-inset-right));
    z-index: 1070;
}

.dream-guide-launcher {
    align-items: center;
    background: linear-gradient(135deg, var(--guide-primary-dark), var(--guide-primary));
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    box-shadow: 0 12px 32px rgba(39, 29, 65, .24), 0 2px 8px rgba(39, 29, 65, .16);
    color: #fff;
    cursor: pointer;
    display: flex;
    gap: .7rem;
    min-height: 52px;
    padding: .45rem 1.05rem .45rem .5rem;
    transition: box-shadow .2s ease, transform .2s ease;
}

.dream-guide-launcher:hover,
.dream-guide-launcher:focus-visible {
    box-shadow: 0 16px 38px rgba(39, 29, 65, .3), 0 3px 9px rgba(39, 29, 65, .18);
    outline: none;
    transform: translateY(-2px);
}

.dream-guide-launcher-icon {
    align-items: center;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1rem;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.dream-guide-launcher-label {
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
}

.dream-guide-panel {
    background: var(--guide-surface);
    border: 1px solid rgba(88, 71, 133, .14);
    border-radius: 22px;
    bottom: 4.25rem;
    box-shadow: 0 24px 70px rgba(30, 23, 48, .24), 0 8px 22px rgba(30, 23, 48, .1);
    color: var(--guide-text);
    display: flex;
    flex-direction: column;
    height: min(640px, calc(100vh - 7.5rem));
    overflow: hidden;
    position: absolute;
    right: 0;
    width: min(410px, calc(100vw - 2.5rem));
}

.dream-guide-header {
    align-items: center;
    background: linear-gradient(135deg, #3d315f 0%, #5f4d8d 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: .9rem 1rem;
}

.dream-guide-avatar {
    align-items: center;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 auto;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.dream-guide-status {
    color: rgba(255, 255, 255, .78);
    display: block;
    font-size: .74rem;
    margin-top: .12rem;
}

.dream-guide-status span {
    background: #6fdfa0;
    border: 2px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    display: inline-block;
    height: .55rem;
    margin-right: .25rem;
    vertical-align: -.03rem;
    width: .55rem;
}

.dream-guide-close {
    align-items: center;
    background: rgba(255, 255, 255, .1);
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1rem;
    height: 36px;
    justify-content: center;
    transition: background-color .2s ease;
    width: 36px;
}

.dream-guide-close:hover,
.dream-guide-close:focus-visible { background: rgba(255, 255, 255, .2); outline: none; }

.dream-guide-messages {
    background: linear-gradient(180deg, #faf9fc 0%, var(--guide-soft) 100%);
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: .75rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem;
    scrollbar-color: #c9c1da transparent;
    scrollbar-width: thin;
}

.dream-guide-row { display: flex; }
.dream-guide-row.user { justify-content: flex-end; }

.dream-guide-bubble {
    background: #fff;
    border: 1px solid rgba(88, 71, 133, .08);
    border-radius: 16px 16px 16px 5px;
    box-shadow: 0 3px 12px rgba(40, 31, 63, .06);
    line-height: 1.5;
    max-width: 88%;
    padding: .75rem .88rem;
    white-space: pre-wrap;
}

.dream-guide-row.user .dream-guide-bubble {
    background: linear-gradient(135deg, #584785, #67549a);
    border: 0;
    border-radius: 16px 16px 5px 16px;
    color: #fff;
}

.dream-guide-suggestions { display: flex; flex-wrap: wrap; gap: .45rem; }

.dream-guide-suggestions button {
    background: rgba(255, 255, 255, .9);
    border: 1px solid #d7d0e4;
    border-radius: 999px;
    color: #4d3d74;
    cursor: pointer;
    font-size: .77rem;
    font-weight: 600;
    padding: .46rem .68rem;
    transition: background-color .18s ease, border-color .18s ease;
}

.dream-guide-suggestions button:hover { background: #fff; border-color: #806eae; }
.dream-guide-results { display: grid; gap: .55rem; margin-top: .1rem; width: 100%; }

.dream-guide-result {
    background: #fff;
    border: 1px solid var(--guide-border);
    border-radius: 13px;
    color: var(--guide-text);
    display: block;
    padding: .72rem .8rem;
    text-decoration: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.dream-guide-result:hover {
    border-color: #9484bc;
    box-shadow: 0 5px 15px rgba(45, 34, 72, .08);
    color: #3f326a;
    transform: translateY(-1px);
}

.dream-guide-result strong { display: block; font-size: .87rem; margin-bottom: .18rem; }
.dream-guide-result span { color: var(--guide-muted); display: block; font-size: .75rem; line-height: 1.4; }

.dream-guide-form {
    align-items: flex-end;
    background: #fff;
    border-top: 1px solid #ebe7f1;
    display: flex;
    gap: .55rem;
    padding: .75rem .8rem .65rem;
}

.dream-guide-form textarea {
    background: #fbfafd;
    border: 1px solid #d9d3e3;
    border-radius: 15px;
    color: var(--guide-text);
    font: inherit;
    max-height: 110px;
    min-height: 44px;
    outline: 0;
    overflow-y: auto;
    padding: .65rem .78rem;
    resize: none;
    width: 100%;
}

.dream-guide-form textarea:focus { background: #fff; border-color: #7562a5; box-shadow: 0 0 0 .2rem rgba(88, 71, 133, .11); }

.dream-guide-form button {
    align-items: center;
    background: linear-gradient(135deg, #4b3b72, #67549a);
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.dream-guide-form button:disabled { cursor: wait; opacity: .55; }
.dream-guide-note { background: #fff; color: #817b87; font-size: .67rem; padding: 0 .85rem .7rem; text-align: center; }
.dream-guide-typing { color: var(--guide-muted); font-size: .8rem; padding: .3rem .1rem; }
.min-w-0 { min-width: 0; }

@media (max-width: 575.98px) {
    .dream-guide {
        bottom: max(.75rem, env(safe-area-inset-bottom));
        right: max(.75rem, env(safe-area-inset-right));
    }

    .dream-guide-panel {
        border-radius: 20px;
        bottom: 4.15rem;
        height: min(680px, calc(100dvh - 5.75rem));
        width: calc(100vw - 1.5rem);
    }

    .dream-guide-launcher { min-height: 52px; padding: .35rem; }
    .dream-guide-launcher-icon { height: 42px; width: 42px; }
    .dream-guide-launcher-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dream-guide-launcher,
    .dream-guide-result { transition: none; }
}
