/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pink-light: #ffe0ec;
    --pink: #ff6b9d;
    --pink-dark: #e84393;
    --red: #e74c6f;
    --red-deep: #c0392b;
    --white: #fff;
    --bg-gradient: linear-gradient(135deg, #ffecd2 0%, #fcb69f 30%, #ff9a9e 60%, #fecfef 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --shadow: 0 20px 60px rgba(231, 76, 111, 0.2);
    --shadow-hover: 0 25px 70px rgba(231, 76, 111, 0.3);
    --font-display: 'Dancing Script', cursive;
    --font-body: 'Quicksand', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    color: #4a2040;
}

/* ===== Floating Hearts Background ===== */
.hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    bottom: -10%;
    animation: floatUp linear infinite;
    opacity: 0;
    font-size: 1.5rem;
    user-select: none;
    filter: drop-shadow(0 0 4px rgba(255, 107, 157, 0.3));
}

.floating-photo {
    position: absolute;
    bottom: -15%;
    animation: floatUpPhoto linear infinite;
    opacity: 0;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(232, 67, 147, 0.25));
    border-radius: 12px;
}

@keyframes floatUpPhoto {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    8% {
        opacity: 0.85;
    }
    50% {
        opacity: 0.7;
        transform: translateY(-55vh) rotate(var(--rotate-mid, 10deg)) scale(0.9);
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-115vh) rotate(var(--rotate-end, -10deg)) scale(0.6);
        opacity: 0;
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(-110vh) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* ===== Main Content ===== */
.main-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 600px;
    padding: 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    min-height: 100vh;
    min-height: 100dvh;
    justify-content: safe center;
}

/* ===== Hero Photo ===== */
.hero-photo {
    animation: fadeInDown 0.8s ease-out;
    position: relative;
}

.hero-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 32px rgba(232, 67, 147, 0.3), 0 0 0 8px rgba(255, 107, 157, 0.15);
    transition: var(--transition);
}

.hero-img:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(232, 67, 147, 0.4), 0 0 0 10px rgba(255, 107, 157, 0.2);
}

/* ===== Header ===== */
.header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--pink-dark);
    text-shadow: 2px 2px 4px rgba(232, 67, 147, 0.15);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--red);
    opacity: 0.85;
    letter-spacing: 0.02em;
}

/* ===== Quote Card ===== */
.quote-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 1.8rem 1.5rem;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.quote-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pink), var(--pink-dark), var(--red), var(--pink));
    background-size: 300% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.quote-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.quote-card.pop {
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

.quote-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.quote-text {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.6;
    color: #4a2040;
    font-style: italic;
    max-width: 100%;
    word-wrap: break-word;
}

.quote-context {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--pink-dark);
    opacity: 0.75;
    font-style: normal;
    min-height: 1.2em;
}

/* ===== Controls ===== */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.generate-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 2rem;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 50%, var(--red) 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(232, 67, 147, 0.35);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.generate-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 40px rgba(232, 67, 147, 0.45);
    background-position: 100% 100%;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.speak-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(232, 67, 147, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(232, 67, 147, 0.15);
}

.speak-btn:hover:not(:disabled) {
    background: var(--pink-light);
    border-color: var(--pink);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(232, 67, 147, 0.25);
}

.speak-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.speak-btn.speaking {
    animation: speakPulse 0.8s ease-in-out infinite;
    border-color: var(--pink-dark);
    background: var(--pink-light);
}

@keyframes speakPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.footer p {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pink-dark);
    opacity: 1;
    text-shadow: 1px 1px 2px rgba(232, 67, 147, 0.15);
}

/* ===== Animations ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===== Burst Hearts on Generate ===== */
.burst-heart {
    position: fixed;
    pointer-events: none;
    z-index: 10;
    font-size: 1.5rem;
    animation: burstOut 0.8s ease-out forwards;
}

@keyframes burstOut {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .main-content {
        padding: 1rem 1rem;
        gap: 0.8rem;
    }

    .hero-img {
        width: 120px;
        height: 120px;
    }

    .title {
        font-size: 2rem;
        margin-bottom: 0.2rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .quote-card {
        padding: 1.2rem 1.2rem;
        border-radius: 20px;
        min-height: 120px;
    }

    .quote-text {
        font-size: 1.1rem;
    }

    .quote-icon {
        font-size: 1.6rem;
    }

    .generate-btn {
        padding: 0.75rem 1.4rem;
        font-size: 0.95rem;
    }

    .speak-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .footer p {
        font-size: 1.25rem;
    }
}

@media (max-width: 380px) {
    .main-content {
        gap: 0.6rem;
    }

    .hero-img {
        width: 100px;
        height: 100px;
    }

    .title {
        font-size: 1.7rem;
    }

    .quote-text {
        font-size: 1rem;
    }

    .generate-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}
