/* ==========================================================================
   CARTE À GRATTER SURPRISE – CSS LUXE GLASSMORPHISM
   ========================================================================== */

:root {
    --bg-start: #FAF6F0;
    --bg-end: #FFF0F2;
    
    --color-gold: #D4AF37;
    --color-gold-light: #F9E7B9;
    --color-gold-dark: #AA771C;
    
    --color-rose: #FFD1DC;
    --color-rose-deep: #B35C72;
    --color-text: #3A3232;
    
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(212, 175, 55, 0.25);
    --glass-shadow: 
        0 20px 50px rgba(170, 119, 28, 0.08), 
        0 10px 20px rgba(0, 0, 0, 0.03), 
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    --glass-blur: blur(20px);
    
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Montserrat', Helvetica, sans-serif;
    --font-cursive: 'Italianno', cursive;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: -webkit-fill-available;
}

body {
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
    font-family: var(--font-sans);
    color: var(--color-text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* --- LUEURS D'AMBIANCE --- */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
    animation: drift 25s infinite alternate ease-in-out;
}

.bg-glow-pink {
    width: 450px;
    height: 450px;
    background-color: var(--color-rose);
    top: -10%;
    left: -10%;
}

.bg-glow-gold {
    width: 400px;
    height: 400px;
    background-color: rgba(212, 175, 55, 0.15);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -50px) scale(1.1); }
    100% { transform: translate(-30px, 30px) scale(0.9); }
}

/* --- CONTENEUR PRINCIPAL --- */
.app-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    gap: 20px;
    z-index: 5;
    
    /* Fade-in élégant */
    opacity: 0;
    transform: translateY(15px);
    animation: appEntrance 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes appEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- EN-TÊTE --- */
.card-header {
    text-align: center;
    width: 100%;
}

.header-title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--color-gold-dark) 0%, var(--color-gold) 50%, var(--color-gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-subtitle {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--color-rose-deep);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: pulseHint 2.5s infinite ease-in-out;
}

@keyframes pulseHint {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

/* --- CARTE À GRATTER --- */
.scratch-card-container {
    position: relative;
    width: min(320px, 85vw);
    height: min(440px, 65vh);
    border-radius: 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    z-index: 10;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

/* --- LE CANVAS À GRATTER --- */
.scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    cursor: grab;
    touch-action: none;
    transition: opacity 0.8s ease;
}

.scratch-canvas:active {
    cursor: grabbing;
}

.scratch-canvas.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* --- BARRE DE PROGRESSION DU GRATTAGE --- */
.scratch-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 40;
    overflow: hidden;
}

.scratch-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
}

/* --- CONTENU RÉVÉLÉ --- */
.revealed-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    /* Visible dès le départ pour apparaître sous le grattage */
    opacity: 1;
    transform: scale(1);
    transition: transform 0.6s ease;
}

/* Petit effet "pop" quand tout est révélé */
.revealed-content.show {
    transform: scale(1.02);
}

/* Cadre ornemental doré */
.ornamental-frame {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1.5px solid rgba(212, 175, 55, 0.35);
    border-radius: 18px;
    pointer-events: none;
}

.ornamental-frame::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 14px;
}

/* --- CONTENU DE LA CARTE --- */
.content-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 8px 4px;
    z-index: 5;
    overflow: hidden;
}

.gift-icon {
    font-size: 4rem;
    animation: bounce 2s infinite ease-in-out;
}

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

.revealed-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 2rem;
    color: var(--color-gold-dark);
    letter-spacing: -0.5px;
}

.revealed-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 6px auto 0;
}

.revealed-poem {
    font-family: var(--font-serif);
    font-size: clamp(0.85rem, 2.5vw, 1.05rem);
    line-height: 1.6;
    color: var(--color-text);
    max-width: 95%;
    word-break: break-word;
}

.gift-name {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
    margin: 6px 0;
    position: relative;
    padding: 4px 16px;
    
    /* Dégradé doré animé qui glisse en boucle */
    background: linear-gradient(
        90deg, 
        var(--color-gold-dark) 0%, 
        var(--color-gold) 20%, 
        #FFF3A8 40%, 
        var(--color-gold) 60%, 
        var(--color-gold-dark) 80%,
        var(--color-gold) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldShimmer 3s linear infinite;
    
    /* Halo doré autour du texte */
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.4));
}

/* Étoiles scintillantes autour du texte */
.gift-name::before,
.gift-name::after {
    content: '✦';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    -webkit-text-fill-color: var(--color-gold);
    animation: sparkle 1.5s ease-in-out infinite alternate;
}

.gift-name::before {
    left: -4px;
    animation-delay: 0s;
}

.gift-name::after {
    right: -4px;
    animation-delay: 0.75s;
}

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

@keyframes sparkle {
    0%   { opacity: 0.3; transform: translateY(-50%) scale(0.7); }
    100% { opacity: 1;   transform: translateY(-50%) scale(1.2); }
}

.revealed-subtitle {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-rose-deep);
    font-weight: 400;
}

.revealed-signature {
    font-family: var(--font-cursive);
    font-size: clamp(1.6rem, 5vw, 2.3rem);
    color: var(--color-gold-dark);
    line-height: 1.1;
    max-width: 95%;
}

/* --- BOUTON CÉLÉBRER --- */
.love-btn {
    position: relative;
    background: linear-gradient(135deg, #FFF 0%, #FFF5F7 100%);
    border: 1px solid var(--color-gold);
    color: var(--color-rose-deep);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(170, 119, 28, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.love-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(170, 119, 28, 0.15);
}

.love-btn:active {
    transform: translateY(0);
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.15), transparent);
    transform: skewX(-25deg);
    animation: shimmer 4s infinite linear;
}

@keyframes shimmer {
    0% { left: -100%; }
    30%, 100% { left: 150%; }
}

/* --- FOOTER --- */
.app-footer {
    text-align: center;
}

.app-footer p {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(58, 50, 50, 0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --- PARTICULES CONFETTIS --- */
.particle-element {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    will-change: transform, opacity;
}

/* --- RESPONSIVE PETITS ÉCRANS --- */
@media (max-height: 700px) {
    .app-container {
        padding: 15px;
        gap: 10px;
    }
    
    .header-title { font-size: 1.7rem; }
    
    .scratch-card-container {
        width: min(280px, 85vw);
        height: min(380px, 60vh);
    }
    
    .gift-icon { font-size: 2.5rem; }
    .revealed-title { font-size: 1.5rem; }
    .gift-name { font-size: 1.2rem; }
    .revealed-signature { font-size: 1.5rem; }
    .revealed-poem { font-size: 0.85rem; line-height: 1.5; }
    .content-wrapper { gap: 6px; }
}

/* iPhone SE et très petits écrans */
@media (max-height: 600px) {
    .app-container {
        padding: 10px;
        gap: 8px;
    }
    
    .header-title { font-size: 1.4rem; }
    .header-subtitle { font-size: 0.65rem; }
    
    .scratch-card-container {
        width: min(260px, 80vw);
        height: min(340px, 55vh);
    }
    
    .gift-icon { font-size: 2rem; }
    .revealed-title { font-size: 1.3rem; }
    .gift-name { font-size: 1.1rem; padding: 2px 12px; }
    .revealed-poem { font-size: 0.78rem; line-height: 1.4; }
    .revealed-subtitle { font-size: 0.72rem; }
    .revealed-signature { font-size: 1.3rem; }
    .content-wrapper { gap: 4px; }
    .ornamental-frame { top: 8px; left: 8px; right: 8px; bottom: 8px; }
}

/* Écrans larges mais courts (paysage) */
@media (max-height: 500px) {
    .scratch-card-container {
        width: min(300px, 50vw);
        height: min(280px, 80vh);
    }
    .gift-icon { font-size: 1.5rem; }
    .content-wrapper { gap: 3px; }
}
