/* Variables CSS */
:root {
    --primary-color: #ff6b9d;
    --secondary-color: #c44569;
    --accent-color: #f8b500;
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-color: #333;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --border-radius: 20px;
    --transition: all 0.3s ease;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background-gradient);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

/* Pantalla de carga */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
    color: var(--white);
}

.loader i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loader p {
    font-size: 1.2rem;
    font-weight: 300;
}

#surprise-photo {
    transform: rotate(180deg);
}

/* Pantallas generales */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

/* Pantalla de bienvenida */
#welcome-screen {
    background: var(--background-gradient);
    position: relative;
    overflow: hidden;
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20% 30%, #fff, transparent),
        radial-gradient(2px 2px at 40% 70%, #fff, transparent),
        radial-gradient(1px 1px at 90% 40%, #fff, transparent),
        radial-gradient(1px 1px at 50% 50%, #fff, transparent),
        radial-gradient(2px 2px at 80% 10%, #fff, transparent);
    background-size: 200px 200px;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.content {
    text-align: center;
    z-index: 2;
    max-width: 600px;
    padding: 2rem;
}

.content h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 4rem;
    color: var(--white);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.content p {
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 2rem;
    font-weight: 300;
}

/* Botones */
.btn-primary, .btn-secondary, .btn-card, .btn-surprise {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
    background: var(--accent-color);
    color: var(--white);
}

.btn-card {
    background: var(--primary-color);
    color: var(--white);
    font-size: 1rem;
}

.btn-surprise {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    color: var(--text-color);
}

/* Corazones flotantes */
.floating-hearts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.heart {
    position: absolute;
    font-size: 2rem;
    opacity: 0.7;
}

.heart:nth-child(1) { left: 10%; top: 20%; }
.heart:nth-child(2) { left: 80%; top: 40%; }
.heart:nth-child(3) { left: 60%; top: 70%; }

/* Pantalla del jardín */
#garden-screen {
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc8 100%);
}

.garden-header {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
}

.garden-header h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.garden-header p {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
}

#three-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.garden-controls {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    z-index: 10;
}

.flower-counter {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    color: var(--text-color);
    box-shadow: var(--shadow);
}

/* Pantalla de la tarjeta */
#card-screen {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
}

.card-container {
    perspective: 1000px;
}

.birthday-card {
    width: 500px;
    height: 700px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
    margin: 0 auto;
}

.birthday-card.flipped {
    transform: rotateY(-180deg) !important;
}

.birthday-card.flipped .card-front {
    opacity: 0;
    visibility: hidden;
}

.birthday-card.flipped .card-front * {
    opacity: 0;
    visibility: hidden;
}

/* Ocultar elementos específicos del frente cuando está volteada */
.birthday-card.flipped .card-decoration,
.birthday-card.flipped .card-title,
.birthday-card.flipped .cake,
.birthday-card.flipped .card-message,
.birthday-card.flipped #open-card {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.card-front, .card-inside {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.card-front {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: var(--text-color);
}

.card-inside {
    background: var(--white);
    transform: rotateY(-180deg);
    color: var(--text-color);
    opacity: 0;
    visibility: hidden;
}

/* Ocultar elementos del interior por defecto */
.card-inside * {
    opacity: 0;
    visibility: hidden;
}

/* Mostrar el contenido del reverso solo cuando está volteada */
.birthday-card.flipped .card-inside {
    opacity: 1 !important;
    visibility: visible !important;
}

.birthday-card.flipped .card-inside * {
    opacity: 1 !important;
    visibility: visible !important;
}

.card-decoration {
    position: absolute;
    top: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
}

.balloon {
    font-size: 2rem;
}

.card-title {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.cake {
    font-size: 4rem;
    margin: 1rem 0;
}

.card-message {
    font-size: 1.4rem;
    font-weight: 300;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.message-container {
    max-width: 400px;
    width: 100%;
    padding: 1rem;
}

.message-container h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.message-text p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-size: 1.2rem;
    font-weight: 400;
}

.signature {
    margin-top: 2.5rem;
    font-style: italic;
}

.signature-name {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Pantalla final */
#final-screen {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: var(--white);
}

.final-content {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.final-content h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.photo-frame {
    width: 300px;
    height: 200px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 2rem auto;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-placeholder {
    text-align: center;
    color: var(--text-color);
    opacity: 0.6;
}

.photo-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.final-message {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Controles de audio */
.audio-controls {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.audio-btn:hover {
    transform: scale(1.1);
}

.audio-btn.muted {
    background: rgba(255, 255, 255, 0.5);
    color: #ccc;
}

/* Responsive */
/* Media queries para tablets y pantallas medianas */
@media (max-width: 1024px) and (min-width: 769px) {
    .birthday-card {
        width: 450px;
        height: 650px;
    }
}

/* Media queries para tablets en modo portrait */
@media (max-width: 768px) and (min-width: 481px) {
    .content h1 {
        font-size: 2.8rem;
    }
    
    .content p {
        font-size: 1.3rem;
    }
    
    .birthday-card {
        width: 85%;
        max-width: 420px;
        height: 620px;
    }
    
    .card-title {
        font-size: 2.8rem;
    }
    
    .card-front, .card-inside {
        padding: 2.5rem;
    }
    
    .message-container {
        max-width: 340px;
        padding: 1rem;
    }
    
    .message-container h2 {
        font-size: 2.8rem;
    }
    
    .message-text p {
        font-size: 1.2rem;
        line-height: 1.8;
    }
    
    .signature-name {
        font-size: 1.7rem;
    }
    
    .final-content h1 {
        font-size: 2.8rem;
    }
    
    .photo-frame {
        width: 280px;
        height: 180px;
    }
}

/* Media queries para móviles */
@media (max-width: 480px) {
    .content h1 {
        font-size: 2.2rem;
    }
    
    .content p {
        font-size: 1.1rem;
    }
    
    .birthday-card {
        width: 95%;
        max-width: 350px;
        height: 75vh;
        min-height: 580px;
        max-height: 700px;
    }
    
    .card-title {
        font-size: 2.3rem;
        margin-bottom: 1rem;
    }
    
    .card-front, .card-inside {
        padding: 1.5rem;
    }

    .card-container {
        width: inherit !important;
    }
    
    .message-container {
        max-width: 280px;
        padding: 0.5rem;
    }
    
    .message-container h2 {
        font-size: 2.3rem;
        margin-bottom: 1rem;
    }
    
    .message-text p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .signature {
        margin-top: 1.5rem;
    }
    
    .signature-name {
        font-size: 1.5rem;
    }
    
    .final-content h1 {
        font-size: 2.3rem;
    }
    
    .photo-frame {
        width: 240px;
        height: 140px;
    }
    
    .cake {
        font-size: 3rem;
        margin: 0.5rem 0;
    }
    
    .card-message {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }
}

/* Media queries para pantallas muy pequeñas */
@media (max-width: 360px) {
    .birthday-card {
        width: 98%;
        max-width: 320px;
        height: 80vh;
        min-height: 560px;
        max-height: 650px;
    }
    
    .card-title {
        font-size: 2rem;
    }
    
    .card-front, .card-inside {
        padding: 1.2rem;
    }
    
    .message-container {
        max-width: 250px;
        padding: 0.3rem;
    }
    
    .message-container h2 {
        font-size: 2rem;
    }
    
    .message-text p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .signature-name {
        font-size: 1.3rem;
    }
    
    .cake {
        font-size: 2.5rem;
    }
    
    .card-message {
        font-size: 1.1rem;
    }
}

/* Animaciones personalizadas */
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.heartbeat {
    animation: heartbeat 1s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Caja de regalo */
.gift-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    transition: opacity 0.5s ease;
}

.gift-box.hidden {
    opacity: 0;
    pointer-events: none;
}

.gift-box-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
}

.gift-box-base {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-radius: 10px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid #a93226;
}

.gift-box-lid {
    width: 130px;
    height: 40px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-radius: 10px 10px 5px 5px;
    position: absolute;
    top: -20px;
    left: -5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid #a93226;
    z-index: 2;
}

.gift-ribbon-horizontal {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 15px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    transform: translateY(-50%);
    border: 2px solid #d68910;
}

.gift-ribbon-vertical {
    position: absolute;
    top: 0;
    left: 50%;
    width: 15px;
    height: 140px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    transform: translateX(-50%);
    border: 2px solid #d68910;
}

.gift-bow {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    z-index: 3;
    animation: bounce 2s infinite;
}

.gift-sparkles {
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 1.5rem;
    animation: sparkle-rotate 3s infinite;
}

@keyframes sparkle-rotate {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
}

.btn-gift {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.btn-gift:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Imagen sorpresa */
.surprise-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    transition: opacity 0.5s ease;
    text-align: center;
}

.surprise-image #continue-to-card {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.surprise-image.hidden {
    opacity: 0;
    pointer-events: none;
}

.image-frame {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin-bottom: 2rem;
}

.image-frame img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 1rem;
}

.image-caption h3 {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.image-caption p {
    font-size: 1.1rem;
    color: var(--text-color);
    font-style: italic;
}

/* Efectos especiales */
.sparkle {
    position: relative;
    overflow: hidden;
}

.sparkle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: sparkle 2s linear infinite;
}

@keyframes sparkle {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Estilos para la escena 3D */
#photo-3d-container {
    font-family: 'Poppins', sans-serif;
}

#photo-3d-container canvas {
    display: block;
    cursor: grab;
}

#photo-3d-container canvas:active {
    cursor: grabbing;
}

#continue-from-3d-photo {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#continue-from-3d-photo:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Animaciones adicionales para la presentación 3D */
@keyframes photo3DEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg) translateZ(-100px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotateY(90deg) translateZ(-50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg) translateZ(0px);
    }
}

@keyframes photo3DFloat {
    0%, 100% {
        transform: translateY(0px) rotateZ(0deg);
    }
    33% {
        transform: translateY(-10px) rotateZ(1deg);
    }
    66% {
        transform: translateY(5px) rotateZ(-1deg);
    }
}

@keyframes photo3DGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 107, 157, 0.8), 0 0 60px rgba(196, 69, 105, 0.6);
    }
}

/* Efectos de partículas para la escena 3D */
.particle-3d {
    position: absolute;
    pointer-events: none;
    animation: particle3DFloat 3s infinite ease-in-out;
}

@keyframes particle3DFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
}

/* Responsive Design para caja de regalo */
@media (max-width: 768px) {
    /* Caja de regalo responsive */
    .gift-box-container {
        width: 120px;
        height: 120px;
    }
    
    .gift-box-base {
        width: 100px;
        height: 100px;
    }
    
    .gift-box-lid {
        width: 110px;
        height: 35px;
    }
    
    .btn-gift {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Imagen sorpresa responsive */
    .image-frame {
        max-width: 90%;
        padding: 1rem;
    }
    
    .image-frame img {
        height: 200px;
    }
    
    .image-caption h3 {
        font-size: 1.5rem;
    }
    
    .image-caption p {
        font-size: 1rem;
    }
}