:root {
    --ei-mood-accent: var(--text-secondary, #475569);
    --ei-mood-surface: rgba(15, 23, 42, 0.04);
}

body[data-emotion-mood="sad"] {
    --ei-mood-accent: #3b82f6;
    --ei-mood-surface: rgba(59, 130, 246, 0.08);
}

body[data-emotion-mood="stressed"] {
    --ei-mood-accent: #d97706;
    --ei-mood-surface: rgba(217, 119, 6, 0.08);
}

body[data-emotion-mood="happy"] {
    --ei-mood-accent: #0f766e;
    --ei-mood-surface: rgba(15, 118, 110, 0.08);
}

body[data-emotion-mood="angry"] {
    --ei-mood-accent: #6b7280;
    --ei-mood-surface: rgba(107, 114, 128, 0.1);
}

body[data-emotion-mood="neutral"] {
    --ei-mood-accent: var(--text-secondary, #475569);
    --ei-mood-surface: rgba(15, 23, 42, 0.04);
}

body.ei-adaptive-page {
    transition: background-color 220ms ease;
}

.emotion-indicator {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: min(340px, calc(100vw - 28px));
    z-index: 1200;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.emotion-indicator.emotion-indicator--embedded {
    position: static;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 720px;
    margin: 0 0 16px;
    z-index: auto;
}

.emotion-indicator.is-pulsing {
    animation: eiPulse 2.4s ease-in-out infinite;
}

@keyframes eiPulse {
    0%,
    100% {
        box-shadow: var(--shadow-card, 0 10px 30px rgba(0, 0, 0, 0.05));
    }
    50% {
        box-shadow: var(--shadow-card-hover, 0 16px 40px rgba(0, 0, 0, 0.09));
    }
}

.emotion-indicator-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 8px;
}

.emotion-indicator-title {
    margin: 0;
}

.emotion-indicator-mood {
    margin: 2px 0 0;
    color: var(--ei-mood-accent);
    font-size: 1rem;
    font-weight: 700;
}

.emotion-indicator-confidence {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.emotion-indicator-body {
    padding: 0 14px 12px;
}

.emotion-indicator-support {
    margin: 0 0 6px;
    color: var(--text-secondary, #475569);
    font-size: 0.84rem;
    line-height: 1.45;
}

.emotion-indicator-hint {
    margin: 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.75rem;
}

.emotion-indicator-details {
    margin-top: 8px;
    border-top: 1px solid var(--border-light, #e2e8f0);
    padding-top: 8px;
}

.emotion-indicator-details summary {
    cursor: pointer;
    color: var(--text-secondary, #475569);
    font-size: 0.78rem;
    font-weight: 600;
}

.emotion-indicator-breakdown {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

.emotion-indicator-breakdown li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary, #475569);
}

.emotion-intel-panel .emotion-intel-current {
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 12px;
    background: var(--ei-mood-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.emotion-intel-meta-label {
    margin: 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.emotion-intel-mood {
    color: var(--ei-mood-accent);
    font-size: 1rem;
    line-height: 1.25;
}

.emotion-intel-confidence {
    color: var(--text-primary, #0f172a);
    font-size: 0.86rem;
    font-weight: 700;
}

.emotion-intel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.emotion-intel-source {
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 12px;
    padding: 9px 10px;
    background: var(--bg-card, #ffffff);
}

.emotion-intel-source strong {
    display: block;
    margin-top: 4px;
    color: var(--text-primary, #0f172a);
}

.emotion-intel-pattern {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--ei-mood-accent);
    border-radius: 8px;
    background: var(--ei-mood-surface);
}

.emotion-intel-explain {
    margin-top: 10px;
}

.emotion-intel-explain summary {
    cursor: pointer;
    color: var(--text-secondary, #475569);
    font-size: 0.82rem;
    font-weight: 600;
}

.emotion-intel-explain p {
    margin-top: 8px;
}

@media (max-width: 767px) {
    .emotion-indicator {
        right: 10px;
        bottom: 78px;
        width: calc(100vw - 18px);
    }

    .emotion-indicator.emotion-indicator--embedded {
        width: 100%;
        margin: 0 0 14px;
    }
}
