/* ======================================================
   AuraLash · Défi Mascara — Design sauge & élégant
   ====================================================== */

:root {
    --sage-50:  #f4f7f2;
    --sage-100: #e8efe3;
    --sage-200: #d2dfc8;
    --sage-300: #b8caa9;
    --sage-400: #9cb18a;
    --sage-500: #8ba37a;   /* vert principal du logo */
    --sage-600: #728a62;
    --sage-700: #566a4b;
    --sage-800: #3f4f37;
    --cream:    #fbf9f3;
    --ivory:    #f7f3e8;
    --ink:      #2d3a2a;
    --ink-soft: #556152;
    --gold:     #c9a86a;

    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;

    --shadow-soft: 0 8px 30px rgba(86, 106, 75, 0.12);
    --shadow-lift: 0 20px 50px rgba(86, 106, 75, 0.18);
    --shadow-deep: 0 30px 80px rgba(63, 79, 55, 0.35);

    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(ellipse at top left, #eef3e7 0%, transparent 55%),
        radial-gradient(ellipse at bottom right, #dde7d1 0%, transparent 50%),
        linear-gradient(135deg, #f4f7f2 0%, #e8efe3 100%);
    color: var(--ink);
    min-height: 100vh;
    min-height: 100svh;
    text-align: center;
    padding: 20px 16px 40px;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- Motif décoratif en fond ----- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 163, 122, 0.08) 0, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(139, 163, 122, 0.1) 0, transparent 1px);
    background-size: 40px 40px, 60px 60px;
    opacity: 0.6;
}

/* ======================================================
   SPLASH / ANIMATION D'INTRO
   ====================================================== */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at center, #f4f7f2 0%, #dde7d1 70%, #b8caa9 100%);
    animation: splashOut 0.9s var(--ease-smooth) 3.2s forwards;
    overflow: hidden;
}

.splash-glow {
    position: absolute;
    width: 80vmin;
    height: 80vmin;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(156,177,138,0.2) 50%, transparent 75%);
    filter: blur(25px);
    animation: glowPulse 2.4s var(--ease-smooth) infinite alternate;
}

.splash-logo-wrap {
    position: relative;
    width: min(62vw, 340px);
    opacity: 0;
    transform: scale(0.7);
    animation: logoIn 1.4s var(--ease-smooth) 0.2s forwards;
}

.splash-logo {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 10px 30px rgba(86, 106, 75, 0.2));
}

.splash-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(255, 255, 255, 0.65) 45%,
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0.65) 55%,
        transparent 80%
    );
    animation: shimmer 1.4s var(--ease-smooth) 1.4s forwards;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.splash-tagline {
    margin-top: 28px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.1rem, 3.4vw, 1.5rem);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--sage-700);
    opacity: 0;
    transform: translateY(10px);
    animation: taglineIn 1s var(--ease-smooth) 1.8s forwards;
}

@keyframes logoIn {
    0%   { opacity: 0; transform: scale(0.7) rotate(-5deg); }
    60%  { opacity: 1; transform: scale(1.05) rotate(0deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

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

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

@keyframes glowPulse {
    from { transform: scale(0.9); opacity: 0.55; }
    to   { transform: scale(1.1); opacity: 0.85; }
}

@keyframes splashOut {
    to { opacity: 0; visibility: hidden; transform: scale(1.05); }
}

/* Le body est caché tant que le splash joue */
.hidden-on-load {
    opacity: 0;
    animation: appIn 0.7s var(--ease-smooth) 3.3s forwards;
}

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

/* ======================================================
   APP
   ====================================================== */
.app {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 780px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    overflow: hidden;
    position: relative;
}

/* ------- HEADER ------- */
.app-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--sage-500) 0%, var(--sage-600) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.app-header::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.18), transparent 60%);
    pointer-events: none;
}

.brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
    padding: 4px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    flex-shrink: 0;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.brand-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand-sub {
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.9;
    margin-top: 2px;
}

/* ======================================================
   ÉCRANS
   ====================================================== */
.screen {
    padding: 36px 24px 28px;
    animation: fadeUp 0.6s var(--ease-smooth);
}

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

/* ------- ÉCRAN D'ACCUEIL ------- */
#start-screen {
    position: relative;
}

.start-decor {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--sage-400), transparent);
    opacity: 0.6;
}

.intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.75rem, 5.5vw, 2.6rem);
    font-weight: 500;
    line-height: 1.15;
    color: var(--sage-800);
    letter-spacing: -0.01em;
}

.hero-title span {
    font-style: italic;
    font-weight: 600;
    color: var(--sage-600);
    position: relative;
    display: inline-block;
}

.hero-title span::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 10%;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hero-rule {
    display: flex;
    align-items: stretch;
    gap: 10px;
    background: linear-gradient(135deg, var(--ivory) 0%, var(--cream) 100%);
    border: 1px solid var(--sage-200);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    max-width: 580px;
    width: 100%;
    box-shadow: inset 0 2px 8px rgba(139, 163, 122, 0.05);
}

.rule-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: var(--ink-soft);
    line-height: 1.5;
}

.rule-item strong {
    color: var(--sage-700);
    font-weight: 600;
}

.rule-item em {
    color: var(--gold);
    font-style: normal;
    font-weight: 600;
}

.rule-icon {
    color: var(--sage-500);
    font-size: 1.2rem;
    line-height: 1;
}

.rule-divider {
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--sage-300), transparent);
    flex-shrink: 0;
}

/* ======================================================
   BOUTONS
   ====================================================== */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    transition: transform 0.3s var(--ease-bounce), box-shadow 0.3s var(--ease-smooth), background 0.3s, filter 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sage-500) 0%, var(--sage-600) 100%);
    color: white;
    padding: 16px 32px;
    border-radius: 100px;
    font-size: 1rem;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 30px rgba(114, 138, 98, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(114, 138, 98, 0.45);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-glow {
    position: relative;
}

.btn-glow::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 100px;
    background: linear-gradient(135deg, var(--sage-400), var(--gold));
    z-index: -1;
    filter: blur(14px);
    opacity: 0.55;
    animation: glowBreathe 2.8s ease-in-out infinite;
}

@keyframes glowBreathe {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.75; }
}

.btn-ghost {
    background: transparent;
    color: var(--sage-700);
    padding: 14px 24px;
    border-radius: 100px;
    font-size: 0.95rem;
    border: 1.5px solid var(--sage-300);
}

.btn-ghost:hover {
    background: var(--sage-100);
    border-color: var(--sage-500);
    transform: translateY(-1px);
}

/* ======================================================
   JEU
   ====================================================== */
.round-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.round-indicator .dot {
    width: 28px;
    height: 4px;
    border-radius: 4px;
    background: var(--sage-200);
    transition: all 0.4s var(--ease-smooth);
}

.round-indicator .dot.active {
    background: var(--sage-500);
    width: 44px;
}

.round-indicator .dot.done {
    background: var(--sage-400);
}

.challenge {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.15rem, 3.6vw, 1.5rem);
    font-weight: 500;
    line-height: 1.35;
    color: var(--sage-800);
    min-height: 60px;
    margin-bottom: 18px;
    padding: 0 8px;
}

.challenge strong {
    color: var(--sage-600);
    font-weight: 700;
    font-style: italic;
}

.challenge small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-style: normal;
    color: var(--ink-soft);
    margin-top: 8px;
    letter-spacing: 0.02em;
    font-weight: 400;
}

/* ------- CANVAS ------- */
.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 12px auto 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f4f7f2 100%);
    border-radius: var(--radius-md);
    padding: 10px;
    box-shadow:
        inset 0 2px 10px rgba(114, 138, 98, 0.1),
        0 6px 20px rgba(86, 106, 75, 0.08);
    border: 1px solid var(--sage-200);
    max-width: 100%;
    overflow: hidden;
}

.canvas-container::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: calc(var(--radius-md) - 4px);
    border: 1px dashed var(--sage-300);
    pointer-events: none;
    opacity: 0.4;
}

canvas {
    display: block;
    width: 100%;
    max-width: 700px;
    height: auto;
    aspect-ratio: 700 / 520;
    border-radius: var(--radius-sm);
    touch-action: none;
    cursor: crosshair;
    background: linear-gradient(180deg, #fdfcf8 0%, #f4f7f2 100%);
}

.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--sage-700);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 20px rgba(86, 106, 75, 0.2);
    border: 1px solid var(--sage-200);
    pointer-events: none;
    animation: hintPulse 2s ease-in-out infinite;
    transition: opacity 0.3s;
}

.canvas-hint.hide {
    opacity: 0;
    pointer-events: none;
}

@keyframes hintPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.04); }
}

.status {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin: 12px 0 18px;
    min-height: 24px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.status strong {
    color: var(--sage-700);
    font-size: 1.05em;
}

/* ------- CONTROLS ------- */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 16px;
}

.controls button {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 220px;
}

/* ------- RESULT ------- */
.result {
    margin: 18px auto 0;
    max-width: 600px;
    font-size: 1rem;
    line-height: 1.6;
    padding: 0;
    border-radius: var(--radius-md);
    transition: all 0.5s var(--ease-smooth);
}

.result:not(:empty) {
    background: linear-gradient(135deg, var(--ivory) 0%, var(--cream) 100%);
    border: 1px solid var(--sage-200);
    padding: 20px 22px;
    box-shadow: var(--shadow-soft);
    animation: resultIn 0.5s var(--ease-bounce);
}

.result strong {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--sage-800);
    margin-bottom: 6px;
    font-weight: 600;
}

.result small {
    color: var(--ink-soft);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ======================================================
   MODALE
   ====================================================== */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: modalFade 0.4s var(--ease-smooth);
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 58, 42, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: linear-gradient(160deg, #ffffff 0%, var(--cream) 100%);
    max-width: 440px;
    width: 100%;
    border-radius: var(--radius-lg);
    padding: 36px 26px 30px;
    text-align: center;
    box-shadow: var(--shadow-deep);
    border: 1px solid rgba(255,255,255,0.8);
    animation: modalPop 0.55s var(--ease-bounce);
}

.modal-logo-wrap {
    width: 110px;
    height: 110px;
    margin: -70px auto 14px;
    background: white;
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(86, 106, 75, 0.25);
    border: 3px solid var(--sage-100);
}

.modal-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--sage-800);
    margin-bottom: 16px;
    line-height: 1.2;
}

.modal p {
    color: var(--ink-soft);
    font-size: 0.98rem;
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: left;
    padding: 18px 20px;
    background: var(--sage-50);
    border-left: 3px solid var(--sage-400);
    border-radius: var(--radius-sm);
}

.modal p strong {
    color: var(--sage-700);
}

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

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

/* ======================================================
   FOOTER
   ====================================================== */
.app-footer {
    margin: 30px auto 10px;
    max-width: 780px;
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--sage-600);
    opacity: 0.8;
}

/* ======================================================
   UTILS
   ====================================================== */
.hidden { display: none !important; }

/* ======================================================
   RESPONSIVE — TÉLÉPHONE
   ====================================================== */
@media (max-width: 640px) {
    body {
        padding: 10px 10px 30px;
    }

    .container {
        border-radius: var(--radius-md);
    }

    .app-header {
        padding: 14px 16px;
        gap: 12px;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .brand-sub {
        font-size: 0.62rem;
        letter-spacing: 0.25em;
    }

    .screen {
        padding: 26px 16px 22px;
    }

    .hero-rule {
        flex-direction: column;
        gap: 14px;
        padding: 18px 16px;
    }

    .rule-divider {
        width: 80%;
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--sage-300), transparent);
        margin: 0 auto;
    }

    .btn-primary {
        padding: 15px 26px;
        font-size: 0.95rem;
        width: 100%;
        max-width: 320px;
    }

    .btn-ghost {
        padding: 13px 20px;
        font-size: 0.9rem;
    }

    .controls {
        gap: 8px;
    }

    .controls button {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .challenge {
        min-height: 50px;
        margin-bottom: 14px;
    }

    .challenge small {
        font-size: 0.78rem;
    }

    .canvas-container {
        padding: 6px;
        margin: 8px auto 14px;
    }

    .canvas-hint {
        font-size: 0.75rem;
        padding: 8px 14px;
    }

    .modal-content {
        padding: 32px 20px 26px;
    }

    .modal-logo-wrap {
        width: 90px;
        height: 90px;
        margin-top: -56px;
    }

    .modal h2 {
        font-size: 1.5rem;
    }

    .modal p {
        font-size: 0.9rem;
        padding: 14px 16px;
    }

    .app-footer {
        font-size: 0.7rem;
        letter-spacing: 0.25em;
    }

    .splash-tagline {
        letter-spacing: 0.28em;
    }
}

@media (max-width: 380px) {
    .brand-name { font-size: 1.35rem; }
    .hero-title { font-size: 1.6rem; }
    .challenge { font-size: 1.1rem; }
}

/* Préserve l'expérience sur appareils haute densité */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .splash { animation: splashOut 0.01ms 0.8s forwards; }
    .hidden-on-load { animation: appIn 0.01ms 0.9s forwards; }
}
