:root {
    /* Colors Premium Romantic */
    --emerald: #D4AF37; /* Gold */
    --forest: #4C0519; /* Deep Wine */
    --light-green: #FFE4E6; /* Blush Pink */
    --ruby: #E11D48; /* Crimson Love */
    --wine: #881337; /* Rose Wine */
    --light-red: #FECDD3; /* Soft Rose */
    --white: #FAFAF9; /* Soft White */
    --cream: #FFF1F2; /* Cream Pink */
    --dark-gray: #1C1917; /* Warm Dark */

    /* Fonts */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Montserrat', sans-serif;
    --font-script: 'Dancing Script', cursive;

    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--dark-gray);
    color: var(--white);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
}

.title {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.subtitle {
    font-size: clamp(1.2rem, 5vw, 3rem);
    font-weight: 400;
    font-style: italic;
    color: var(--white);
    margin-bottom: 2.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Utility Classes */
.screen {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2rem;
    overflow: hidden;
}

.hidden-section {
    display: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 4rem 3rem;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 800px;
    width: 100%;
    z-index: 10;
}

/* Buttons */
.music-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.music-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.primary-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    padding: 15px 45px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.4s ease;
    margin-top: 2.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Tela 1 — Abertura */
.hero-screen {
    background: #000;
    transition: opacity 1s ease-in-out;
}

.bg-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    z-index: 0;
    object-fit: cover;
    opacity: 0.6;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0,0,0,0.2) 0%, rgba(17, 24, 39, 0.9) 100%);
    z-index: 1;
}

.hero-content {
    animation: fadeInZoom 2s ease-out forwards;
}

.typewriter-text {
    font-size: 1.4rem;
    line-height: 1.6;
    min-height: 60px;
    margin: 1rem 0;
    font-weight: 300;
    opacity: 0.95;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Tela 2 — Contador */
.counter-screen {
    background: radial-gradient(circle at center, var(--forest), var(--dark-gray));
}

.heart-title {
    color: var(--ruby);
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.counter-intro {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--light-green);
}

.time-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.time-box {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 1.5rem;
    min-width: 120px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.time-box .number {
    display: block;
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--emerald);
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.time-box .label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.counter-date {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--light-red);
    margin-bottom: 1rem;
}

.counter-footer {
    font-size: 1rem;
    line-height: 1.5;
    color: #ccc;
}

/* Tela 3 e 4 — Envelope e Carta */
.letter-screen {
    background: linear-gradient(135deg, var(--dark-gray), var(--wine));
    perspective: 1200px;
}

.scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.envelope-wrapper {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: 400px;
    transition: transform 1s ease;
    transform-style: preserve-3d;
    cursor: pointer;
    animation: float 4s ease-in-out infinite;
}

.envelope {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--cream);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform-style: preserve-3d;
}

.envelope-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #f4ebd8;
    border-radius: 10px;
    z-index: 3;
    clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%);
    border: 2px solid rgba(212, 175, 55, 0.3);
}

.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--cream);
    border-radius: 10px;
    z-index: 1;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: #eaddc5;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 4;
    transform-origin: top;
    transition: transform 1s ease-in-out;
    border-top: 2px solid rgba(212, 175, 55, 0.3);
}

.seal {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: var(--ruby);
    border-radius: 50%;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: opacity 0.5s;
}

.click-hint {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    white-space: nowrap;
    animation: pulse 2s infinite;
}

.letter {
    position: absolute;
    top: 10px;
    left: 5%;
    width: 90%;
    height: 80vh; /* Altura fixa para forçar o scroll interno */
    max-height: 800px;
    background: var(--cream);
    z-index: 2;
    transition: all 1.5s ease-in-out;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    color: var(--dark-gray);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 5px;
    opacity: 0;
    transform: translateY(100px) scale(0.9);
}

.letter::-webkit-scrollbar {
    width: 6px;
}
.letter::-webkit-scrollbar-thumb {
    background: var(--emerald);
    border-radius: 3px;
}

.photo-wrapper {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 1.5rem;
    border: 8px solid white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    transform: rotate(-2deg);
}

.photo-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.letter-title {
    font-size: 2rem;
    color: var(--ruby);
    margin-bottom: 1.5rem;
    text-align: center;
}

.letter-content {
    position: relative;
    padding-bottom: 3rem; /* Espaço interno seguro na base do conteúdo */
}

.letter-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1.1rem;
}

.letter-signature {
    margin-top: 3rem;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
}

.letter-signature .sign-text {
    font-family: var(--font-script);
    font-size: 1.8rem;
    color: var(--wine);
    margin-bottom: 0.5rem;
}

.letter-signature .sign-name {
    font-family: var(--font-script);
    font-size: 2.2rem;
    color: var(--wine);
}

/* Animations for Envelope Opening */
.envelope-wrapper.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}
.envelope-wrapper.open .seal {
    opacity: 0;
}
.envelope-wrapper.open .click-hint {
    opacity: 0;
}
.envelope-wrapper.open .letter {
    transform: translateY(-50px) scale(1);
    opacity: 1;
    z-index: 20; /* Eleva a carta acima do envelope aberto */
}
.envelope-wrapper.open {
    animation: none;
    transform: translateY(10vh); /* Sobe um pouco mais a estrutura para focar na carta */
    z-index: 10;
}

/* Tela 5 — Galeria */
.gallery-screen {
    background: var(--dark-gray);
}

.gallery-container {
    width: 100%;
    max-width: 1000px;
    text-align: center;
}

.section-title {
    font-size: 3rem;
    color: var(--emerald);
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--light-green);
}

.carousel {
    position: relative;
    height: 400px;
    width: 100%;
    margin: 0 auto;
}

.carousel-track-container {
    height: 100%;
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

.carousel-track {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel-slide.current-slide {
    opacity: 1;
    z-index: 2;
}

.polaroid {
    background: white;
    padding: 10px 10px 40px 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.carousel-slide:nth-child(even) .polaroid {
    transform: rotate(3deg);
}

.polaroid:hover, .carousel-slide:nth-child(even) .polaroid:hover {
    transform: scale(1.05) rotate(0deg);
}

.polaroid img {
    width: 100%;
    max-width: 300px;
    height: 300px;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 50%;
    z-index: 10;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn-left {
    left: -20px;
}

.carousel-btn-right {
    right: -20px;
}

/* Tela 6 — Homenagem Final */
.finale-screen {
    background: linear-gradient(135deg, var(--forest), var(--wine));
    background-size: 200% 200%;
    animation: gradientBG 10s ease infinite;
}

.finale-content {
    text-align: center;
    max-width: 800px;
    z-index: 2;
}

.finale-title {
    font-size: clamp(2.5rem, 8vw, 4rem);
}

.finale-subtitle {
    margin-bottom: 3rem;
}

.finale-messages .fade-text {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s ease;
}

.finale-messages .fade-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.highlight-message {
    margin: 3rem 0;
    font-size: 2rem;
    font-family: var(--font-heading);
    color: var(--light-red);
    font-style: italic;
    opacity: 0;
    transition: opacity 2s ease 1s;
}

.highlight-message.visible {
    opacity: 1;
}

.signature {
    margin-top: 3rem;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 2s ease 2s;
}

.signature.visible {
    opacity: 1;
}

.signature .name {
    font-family: var(--font-script);
    font-size: 3rem;
    color: var(--light-green);
    margin-top: 0.5rem;
}

/* Animations */
@keyframes fadeInZoom {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .screen { padding: 1rem 0.5rem; }
    .glass-panel { padding: 2rem 1rem; width: 95%; max-width: 100%; border-radius: 15px; }
    
    .title { font-size: clamp(2rem, 10vw, 3.5rem); }
    .subtitle { font-size: clamp(1.2rem, 6vw, 2rem); margin-bottom: 1.5rem; }
    .typewriter-text { font-size: 1rem; min-height: 50px; }
    .primary-btn { font-size: 1rem; padding: 12px 25px; margin-top: 1.5rem; }
    
    .heart-title { font-size: clamp(1.5rem, 6vw, 2rem); margin-bottom: 0.5rem; }
    .counter-intro { font-size: 1rem; margin-bottom: 1rem; }
    .time-display { gap: 0.5rem; margin-bottom: 1rem; }
    .time-box { min-width: 75px; padding: 0.8rem; border-radius: 10px; }
    .time-box .number { font-size: clamp(2rem, 8vw, 2.5rem); }
    .time-box .label { font-size: 0.8rem; }
    .counter-date { font-size: 0.9rem; }
    .counter-footer { font-size: 0.85rem; }
    
    .envelope-wrapper { width: 95%; height: 260px; z-index: 5; }
    .letter { width: 95%; left: 2.5%; height: 75vh; max-height: 75vh; padding: 1.5rem 1.5rem 6rem 1.5rem; }
    .letter-title { font-size: 1.3rem; margin-bottom: 1rem; }
    .letter-content p { font-size: 0.95rem; margin-bottom: 0.8rem; line-height: 1.5; }
    .letter-signature { margin-top: 2rem; margin-bottom: 3rem; }
    .letter-signature .sign-text { font-size: 1.5rem; margin-bottom: 0.2rem; }
    .letter-signature .sign-name { font-size: 1.8rem; }
    .photo-wrapper { max-width: 200px; margin-bottom: 1rem; border-width: 5px; }
    
    .section-title { font-size: 2.5rem; }
    .section-desc { font-size: 1rem; margin-bottom: 1.5rem; padding: 0 1rem; }
    .gallery-container { width: 100%; padding: 0; }
    .carousel { height: 420px; }
    .polaroid { padding: 10px 10px 35px 10px; }
    .polaroid img { width: 100%; max-width: 90vw; height: 320px; }
    .carousel-btn { font-size: 1.2rem; padding: 8px 12px; }
    .carousel-btn-left { left: 0px; }
    .carousel-btn-right { right: 0px; }
    
    .finale-title { font-size: clamp(2.5rem, 10vw, 3.5rem); }
    .finale-subtitle { margin-bottom: 1.5rem; }
    .finale-messages .fade-text { font-size: 1.1rem; margin-bottom: 1rem; padding: 0 1rem; }
    .highlight-message { font-size: 1.3rem; margin: 1.5rem auto; width: 90%; padding: 1.5rem 1rem; }
    .signature { margin-top: 1.5rem; }
    .signature .name { font-size: clamp(2rem, 8vw, 2.5rem); }
    
    .music-btn { top: 10px; right: 10px; padding: 8px 15px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .time-display { flex-wrap: nowrap; }
    .time-box { min-width: 70px; padding: 0.5rem; }
    .time-box .number { font-size: 2rem; }
    .envelope-wrapper { height: 220px; }
    .polaroid img { max-width: 85vw; height: 300px; }
    .carousel { height: 400px; }
}

@media (min-width: 768px) {
    .carousel-btn-left { left: 20px; }
    .carousel-btn-right { right: 20px; }
    .polaroid img { max-width: 500px; height: 400px; }
}
