/* Estilos románticos para Rosa Luz */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

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

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.hearts-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.heart-float {
    position: absolute;
    font-size: 2rem;
    opacity: 0;
    animation: floatHeart 8s ease-in-out infinite;
    z-index: -1;
}

@keyframes floatHeart {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

header {
    margin-bottom: 40px;
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    margin-top: 20px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(45deg,
        #ff0000, #ff8000, #ffff00, #80ff00,
        #00ff00, #00ff80, #00ffff, #0080ff,
        #0000ff, #8000ff, #ff00ff, #ff0080, #ff0000);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    animation: rainbow 8s ease infinite;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

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

/* Create a border effect with moving colors */
header h1::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px solid transparent;
    border-image: linear-gradient(45deg,
        #ff0000, #ff8000, #ffff00, #80ff00,
        #00ff00, #00ff80, #00ffff, #0080ff,
        #0000ff, #8000ff, #ff00ff, #ff0080, #ff0000) 1;
    border-image-slice: 1;
    animation: border-move 3s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes border-move {
    0% {
        filter: hue-rotate(0deg);
        border-image-source: linear-gradient(45deg,
            #ff0000, #ff8000, #ffff00, #80ff00,
            #00ff00, #00ff80, #00ffff, #0080ff,
            #0000ff, #8000ff, #ff00ff, #ff0080, #ff0000);
    }
    100% {
        filter: hue-rotate(360deg);
        border-image-source: linear-gradient(45deg,
            #ff0000, #ff8000, #ffff00, #80ff00,
            #00ff00, #00ff80, #00ffff, #0080ff,
            #0000ff, #8000ff, #ff00ff, #ff0080, #ff0000);
    }
}

header p {
    font-size: 1.4rem;
    color: #fff;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.romantic-phrases {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    margin: 30px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    overflow: hidden;
}

.phrase-container {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.heart-group {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    z-index: 0;
    opacity: 0.2;
    pointer-events: none;
}

.heart-item {
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 6s ease-in-out infinite;
}

.heart-item:nth-child(1) { animation-delay: 0s; }
.heart-item:nth-child(2) { animation-delay: 1.5s; }
.heart-item:nth-child(3) { animation-delay: 3s; }
.heart-item:nth-child(4) { animation-delay: 4.5s; }

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); }
    25% { transform: translate(-50%, -50%) translate(-5px, -5px) rotate(5deg); }
    50% { transform: translate(-50%, -50%) translate(0, 5px) rotate(0deg); }
    75% { transform: translate(-50%, -50%) translate(5px, -5px) rotate(-5deg); }
}

.firework-particle {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.growing-flower {
    position: fixed;
    pointer-events: none;
    z-index: 50;
    transition: bottom 3s ease-in-out;
}

#currentPhrase {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 30px;
    line-height: 1.8;
    transition: all 0.5s ease;
    font-weight: 300;
    font-style: italic;
    text-shadow: 0 0 15px rgba(255, 105, 180, 0.7);
    padding: 25px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.2), rgba(176, 196, 222, 0.2));
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 2;
    font-family: 'Dancing Script', cursive, 'Arial', sans-serif;
    letter-spacing: 1px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Add decorative elements to the phrase container */
#currentPhrase::before {
    content: """;
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 4rem;
    color: rgba(255, 182, 193, 0.3);
    font-family: serif;
    line-height: 1;
    z-index: 1;
}

#currentPhrase::after {
    content: """;
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 4rem;
    color: rgba(255, 182, 193, 0.3);
    font-family: serif;
    line-height: 1;
    transform: rotate(180deg);
    z-index: 1;
}

#nextPhraseBtn {
    background: linear-gradient(45deg, #1871A3, #3a9dc4);
    color: white;
    border: none;
    padding: 16px 35px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(24, 113, 163, 0.4);
    min-width: 220px;
}

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

#nextPhraseBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(24, 113, 163, 0.6);
}

#nextPhraseBtn:hover::before {
    left: 100%;
}

#nextPhraseBtn:active {
    transform: translateY(1px);
}

.envelope {
    position: relative;
    perspective: 1000px;
    margin: 30px 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.envelope-front {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 0.6s;
    z-index: 2;
}

.envelope-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: -1;
}

.letter-content {
    background:
        linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23ffcce6" stroke-width="0.5" opacity="0.3"/></svg>');
    background-size: 100% 100%, 30px 30px;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: #333;
    position: relative;
    z-index: 3;
    margin-top: 20px;
    font-family: 'Dancing Script', cursive, serif;
    border: 1px solid rgba(255, 182, 193, 0.4);
}

.letter-heart-group {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    z-index: 0;
    opacity: 0.18;
    pointer-events: none;
}

.letter-heart-item {
    font-size: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 7s ease-in-out infinite;
}

.letter-heart-item:nth-child(1) { animation-delay: 0s; }
.letter-heart-item:nth-child(2) { animation-delay: 1.75s; }
.letter-heart-item:nth-child(3) { animation-delay: 3.5s; }
.letter-heart-item:nth-child(4) { animation-delay: 5.25s; }

.letter-content::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid rgba(255, 182, 193, 0.2);
    border-radius: 10px;
    pointer-events: none;
}

.letter-content p {
    margin-bottom: 25px;
    line-height: 2.2;
    color: #444;
    font-size: 1.3rem;
    text-align: justify;
    position: relative;
    padding-left: 15px;
}

.letter-content p::before {
    content: "❦";
    position: absolute;
    left: -15px;
    top: 0;
    color: rgba(230, 57, 70, 0.3);
    font-size: 1.5rem;
    font-family: serif;
}

.letter-content h3 {
    color: #e63946;
    text-align: center;
    margin-bottom: 35px;
    font-size: 2.2rem;
    position: relative;
    font-weight: 600;
    letter-spacing: 1px;
}

.letter-content h3::before,
.letter-content h3::after {
    content: "❧";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(230, 57, 70, 0.4);
    font-size: 1.8rem;
    font-family: serif;
}

.letter-content h3::before {
    left: -40px;
}

.letter-content h3::after {
    right: -40px;
}

.letter-content h3::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(to right, transparent, #e63946, transparent);
    border-radius: 2px;
}

.signature-line {
    border-top: 1px dashed rgba(230, 57, 70, 0.4);
    width: 200px;
    margin: 30px auto 10px;
    padding-top: 5px;
    text-align: center;
    font-style: italic;
    color: #e63946;
}

.decoration-corner {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0.1;
    z-index: 1;
}

.corner-tl {
    top: 15px;
    left: 15px;
    transform: rotate(-90deg);
}

.corner-tr {
    top: 15px;
    right: 15px;
    transform: rotate(180deg);
}

.corner-bl {
    bottom: 15px;
    left: 15px;
    transform: rotate(0deg);
}

.corner-br {
    bottom: 15px;
    right: 15px;
    transform: rotate(90deg);
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: rgba(230, 57, 70, 0.3);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 1;
    transform-origin: top;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.envelope.opened .envelope-flap {
    transform: rotateX(180deg);
}

.envelope.opened .envelope-front {
    transform: translateY(15px);
}

.envelope {
    cursor: pointer;
}

.envelope-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    z-index: 0;
    transform: rotateX(180deg);
    backface-visibility: hidden;
}

.floating-hearts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
}

.heart {
    font-size: 2.5rem;
    animation: pulse 1.5s infinite;
    opacity: 0.9;
}

.heart:nth-child(2) {
    animation-delay: 0.2s;
}

.heart:nth-child(3) {
    animation-delay: 0.4s;
}

.heart:nth-child(4) {
    animation-delay: 0.6s;
}

.heart:nth-child(5) {
    animation-delay: 0.8s;
}

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

footer {
    margin-top: 40px;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 300;
}

/* Animación para cambiar frases */
.phrase-change {
    animation: phraseChange 0.5s ease;
}

@keyframes phraseChange {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 15px;
        max-width: 90%;
    }

    header h1 {
        font-size: 2.5rem;
    }

    header p {
        font-size: 1.2rem;
    }

    .romantic-phrases {
        padding: 30px 20px;
    }

    #currentPhrase {
        font-size: 1.6rem;
        min-height: 120px;
    }

    #nextPhraseBtn {
        padding: 14px 25px;
        font-size: 1rem;
        min-width: 200px;
    }

    .love-letter {
        padding: 25px 20px;
    }

    .love-letter h2 {
        font-size: 1.6rem;
    }

    .letter-content p {
        font-size: 1.1rem;
        line-height: 1.7;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 95%;
    }

    header {
        margin-bottom: 30px;
    }

    header h1 {
        font-size: 2rem;
        padding: 5px 10px;
    }

    header p {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .romantic-phrases {
        padding: 25px 15px;
        margin: 20px 0;
    }

    #currentPhrase {
        font-size: 1.4rem;
        min-height: 100px;
        padding: 15px;
    }

    #nextPhraseBtn {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-width: 180px;
        letter-spacing: 1px;
    }

    .love-letter {
        padding: 20px 15px;
        margin: 20px 0;
    }

    .love-letter h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .letter-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .floating-hearts {
        bottom: 10px;
        gap: 10px;
    }

    .heart {
        font-size: 2rem;
    }

    footer {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .romantic-phrases {
        padding: 20px 10px;
    }

    #currentPhrase {
        font-size: 1.2rem;
        min-height: 90px;
    }

    #nextPhraseBtn {
        padding: 10px 15px;
        font-size: 0.85rem;
        min-width: 150px;
    }

    .love-letter {
        padding: 15px 10px;
    }

    .love-letter h2 {
        font-size: 1.2rem;
    }

    .letter-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .heart {
        font-size: 1.8rem;
    }

    footer {
        font-size: 0.8rem;
    }
}

/* Extra small devices (phones, 320px and up) */
@media (max-width: 320px) {
    .container {
        padding: 5px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    #currentPhrase {
        font-size: 1.1rem;
        min-height: 80px;
    }

    #nextPhraseBtn {
        padding: 9px 12px;
        font-size: 0.8rem;
        min-width: 130px;
    }

    .letter-content p {
        font-size: 0.9rem;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Prevents zoom on mobile when font is too small */
    }

    .container {
        padding: 10px;
        max-width: 95%;
    }

    header h1 {
        font-size: 2rem;
        padding: 5px 10px;
    }

    header p {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .romantic-phrases {
        padding: 25px 15px;
        margin: 20px 0;
    }

    #currentPhrase {
        font-size: 1.4rem;
        min-height: 100px;
        padding: 15px;
    }

    #nextPhraseBtn {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-width: 180px;
        letter-spacing: 1px;
    }

    .love-letter {
        padding: 20px 15px;
        margin: 20px 0;
    }

    .love-letter h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .letter-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .floating-hearts {
        bottom: 10px;
        gap: 10px;
    }

    .heart {
        font-size: 2rem;
    }

    footer {
        font-size: 0.9rem;
    }
}

/* Extra mobile optimizations */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .romantic-phrases {
        padding: 20px 10px;
    }

    #currentPhrase {
        font-size: 1.2rem;
        min-height: 90px;
    }

    #nextPhraseBtn {
        padding: 10px 15px;
        font-size: 0.85rem;
        min-width: 150px;
    }

    .letter-content {
        padding: 25px;
    }

    .letter-content h3 {
        font-size: 1.8rem;
    }

    .letter-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .heart-item {
        font-size: 1.5rem;
    }

    .letter-heart-item {
        font-size: 2rem;
    }

    .heart {
        font-size: 1.8rem;
    }

    footer {
        font-size: 0.8rem;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .container {
        padding: 10px 5px;
    }

    header {
        margin-bottom: 20px;
    }

    .romantic-phrases {
        padding: 15px;
        margin: 15px 0;
    }

    #currentPhrase {
        min-height: 80px;
        font-size: 1.2rem;
    }

    .love-letter {
        padding: 15px;
        margin: 15px 0;
    }
}

/* Touch-friendly elements */
button, .envelope {
    touch-action: manipulation;
}

/* Optimize for mobile performance */
@media (max-width: 768px) {
    .hearts-container {
        display: none; /* Hide background hearts on mobile for performance */
    }

    /* Reduce animation complexity on mobile */
    .heart-item, .letter-heart-item {
        animation-duration: 8s; /* Slower animations for better performance */
    }
}