.recovery-loop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.recovery-loop-overlay.active {
    display: flex;
    opacity: 1;
}

.recovery-loop-container {
    background: #ffffff;
    border-radius: 28px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.35),
                0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: recoveryLoopSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes recoveryLoopSlideUp {
    from { transform: translateY(40px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.recovery-loop-phase {
    padding: 36px 28px 32px;
    text-align: center;
    animation: recoveryFadeIn 0.4s ease-out;
}

.recovery-loop-phase.hidden {
    display: none;
}

@keyframes recoveryFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.recovery-loop-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 1.6rem;
    color: #2563eb;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

.recovery-loop-icon.sunnie-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #B45309;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.15);
}

.recovery-loop-icon.action-icon {
    background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
    color: #16a34a;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.15);
}

.recovery-loop-kicker {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 5px 14px;
    margin-bottom: 14px;
}

.recovery-loop-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.recovery-loop-subtitle {
    color: #475569;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 22px;
    font-weight: 400;
    font-style: italic;
}

.recovery-loop-input-wrap {
    position: relative;
    margin-bottom: 20px;
}

.recovery-loop-input-wrap textarea {
    width: 100%;
    padding: 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
    transition: all 0.3s;
    background: #f8fafc;
    color: #0f172a;
    line-height: 1.5;
}

.recovery-loop-input-wrap textarea:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.recovery-loop-char-count {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.recovery-loop-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
    transition: all 0.3s;
    font-family: inherit;
    margin-bottom: 10px;
}

.recovery-loop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.recovery-loop-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.recovery-loop-btn.hidden {
    display: none;
}

.recovery-loop-btn-secondary {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    font-family: inherit;
}

.recovery-loop-btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.recovery-loop-skip {
    display: block;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    margin: 8px auto 0;
    padding: 8px 12px;
    font-family: inherit;
    transition: color 0.2s;
}

.recovery-loop-skip:hover {
    color: #475569;
}

.recovery-loop-feedback-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: left;
    min-height: 80px;
}

.feedback-loading {
    text-align: center;
    padding: 12px 0;
}

.feedback-loading p {
    color: #64748b;
    font-size: 0.88rem;
    margin-top: 14px;
    font-weight: 500;
}

.feedback-loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.feedback-loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3b82f6;
    animation: feedbackDotBounce 1.4s ease-in-out infinite both;
}

.feedback-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.feedback-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.feedback-loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes feedbackDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.feedback-content {
    animation: recoveryFadeIn 0.5s ease-out;
}

.feedback-content.hidden {
    display: none;
}

.feedback-content p {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0;
}

.recovery-loop-action-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid rgba(22, 163, 74, 0.15);
    border-radius: 18px;
    padding: 28px 24px;
    margin-bottom: 22px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.recovery-loop-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.1);
}

.action-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1.4rem;
    color: #15803d;
}

.recovery-loop-action-card h3 {
    color: #166534;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.recovery-loop-action-card p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0 0 12px;
}

.action-card-tag {
    display: inline-block;
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.recovery-loop-action-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.recovery-loop-action-btns .recovery-loop-btn {
    margin-bottom: 0;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.2);
}

.recovery-loop-action-btns .recovery-loop-btn:hover {
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.3);
}

@media (max-width: 480px) {
    .recovery-loop-container {
        border-radius: 20px;
        max-height: 95vh;
    }

    .recovery-loop-phase {
        padding: 28px 20px 24px;
    }

    .recovery-loop-title {
        font-size: 1.3rem;
    }

    .recovery-loop-action-btns {
        grid-template-columns: 1fr;
    }
}
