:root {
    /* Couleurs principales */
    --bg-body: #020617;
    --bg-playground: #0b1120;

    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.15);
    --accent-blue: #38bdf8;
    --accent-pink: #fb7185;
    --accent-gold: #facc15;

    --text-main: #f9fafb;
    --text-muted: #9ca3af;

    --radius-xl: clamp(1.25rem, 3vw, 2rem);
    --shadow-soft: 0 0 1.5rem rgba(15, 23, 42, 0.65);
    --control-size: clamp(2.35rem, 5vw, 3rem);

    /* Typo */
    --font-base-size: clamp(1rem, 1.2vw, 1.2rem);
    --font-title-size: clamp(1.6rem, 3vw, 2.4rem);
    --font-subtitle-size: clamp(1.3rem, 2.4vw, 1.8rem);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100lvh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: var(--font-base-size);
    color: var(--text-main);
    background: var(--bg-body);
    overflow: hidden; /* important pour la tablette : pas de scroll */
}

/* CONTENEUR GLOBAL */
.app {
    width: 100vw;
    min-height: 100lvh;
    display: flex;
}

/* ÉCRANS */
.screen {
    flex: 1;
    display: none;
    padding: min(5em, 8%);
}

.screen--active {
    display: flex;
}

.screen--hidden {
    display: none;
}

/* INTRO */
.intro-wrapper {
    margin: auto;
    max-width: min(900px, 100%);
    background: color-mix(in srgb, #020617 40%, #111827 60%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: min(4em, 7%);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vh, 2.5rem);
}

.intro-title {
    margin: 0;
    font-size: var(--font-title-size);
    text-align: center;
}

.intro-video-wrapper {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vh, 1.5rem);
    align-items: center;
}

.intro-video {
    width: 100vw;
    height: 100lvh;
    max-width: 100vw;
    max-height: 100lvh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    background: #000;
}

.intro-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.intro-text {
    margin: 0;
    text-align: center;
    color: var(--text-muted);
}

/* BOUTONS GÉNÉRIQUES */
.btn {
    border: none;
    cursor: pointer;
    padding: clamp(0.8rem, 1.8vh, 1rem) clamp(1.8rem, 3.5vw, 2.8rem);
    border-radius: 9999px;
    font-size: clamp(1rem, 1.4vw, 1.1rem);
    font-weight: 600;
    /* letter-spacing: 0.02em;
    background: radial-gradient(circle at top left, #4ade80 0, #22c55e 40%, #15803d 100%); */
    color: #052e16;
    box-shadow: 0 0.3rem 1.2rem rgba(21, 128, 61, 0.65);
    transform: translateY(0);
    background-color: transparent;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        filter 160ms ease;
}

.btn:hover {
    transform: translateY(-0.12rem);
    filter: brightness(1.04);
    box-shadow: 0 0.5rem 1.6rem rgba(21, 128, 61, 0.8);
}

.btn:active {
    transform: translateY(0.1rem);
    box-shadow: 0 0.15rem 0.6rem rgba(21, 128, 61, 0.5);
}

.btn--ghost {
    background: transparent;
    color: var(--text-main);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.6);
}

.btn--ghost:hover {
    filter: none;
    background: rgba(148, 163, 184, 0.12);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.9);
}

.btn--small {
    padding: clamp(0.5rem, 1.2vh, 0.6rem) clamp(1.2rem, 2.2vw, 1.6rem);
    font-size: clamp(0.9rem, 1.1vw, 1rem);
}

/* ÉCRAN DE JEU PLEIN ÉCRAN */
#introScreen {
    padding: 0;
}

#playScreen {
    padding: 0;               /* pas de marge autour du paysage */
}

/* AIRE DE JEU */
.playground {
    position: relative;
    width: 100vw;
    height: 100lvh;
    --bg-image: url("../img/paysage1.jpg"); /* image par défaut */

    background: var(--bg-image); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    isolation: isolate;
    transition: filter 220ms ease;
}

.playground::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 16%, rgba(250, 204, 21, 0.22), transparent 12%),
        linear-gradient(rgba(2, 6, 23, 0.1), rgba(2, 6, 23, 0.48));
    opacity: 0;
    transition: opacity 220ms ease;
}

.playground.is-night::after {
    opacity: 1;
}

/* BARRE DU HAUT (logo + titre + boutons) */
.play-header {
    position: absolute;
    inset-inline: clamp(0.8rem, 2vw, 1.4rem);
    top: clamp(0.6rem, 1.6vh, 1rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 2000; /* au-dessus des personnages */
}

.play-title {
    margin: 0;
    font-size: var(--font-subtitle-size);
    text-shadow: 0 0.15rem 0.4rem rgba(0, 0, 0, 0.6);
}

/* Logo accueil */
.home-logo {
    border: none;
    padding: 0;
    cursor: pointer;
    background: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    overflow: hidden;
    width: clamp(2.4rem, 4vw, 3rem);
    height: clamp(2.4rem, 4vw, 3rem);
    box-shadow: 0 0.25rem 0.9rem rgba(15, 23, 42, 0.8);
}

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

/* Zone actions à droite (prev/next + reset) */
.play-actions {
    display: inline-flex;
    align-items: center;
    gap: clamp(0.35rem, 1vw, 0.6rem);
    padding: clamp(0.25rem, 0.8vw, 0.45rem);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(10px);
}

/* Petits boutons rond pour les paysages */
.icon-btn {
    border: none;
    cursor: pointer;
    width: var(--control-size);
    height: var(--control-size);
    border-radius: 999px;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.86);
    color: #0f172a;
    box-shadow: 0 0.2rem 0.8rem rgba(15, 23, 42, 0.22);
    transition:
        transform 140ms ease,
        background-color 140ms ease,
        color 140ms ease,
        box-shadow 140ms ease;
}

.icon-btn:hover {
    transform: translateY(-0.06rem);
    background: #0f172a;
    color: #f9fafb;
}

.icon-btn:active {
    transform: translateY(0.08rem);
}

.icon-btn[aria-pressed="true"] {
    background: var(--accent-gold);
    color: #1e293b;
    box-shadow: 0 0.35rem 1.1rem rgba(250, 204, 21, 0.38);
}

.scene-message {
    position: absolute;
    left: 50%;
    top: clamp(4.3rem, 10vh, 5.7rem);
    z-index: 2100;
    max-width: min(78vw, 42rem);
    min-height: 2.4rem;
    margin: 0;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #0f172a;
    font-size: clamp(0.95rem, 1.7vw, 1.2rem);
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    opacity: 0;
    transform: translate(-50%, -0.35rem);
    pointer-events: none;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.22);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.scene-message.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* PERSONNAGES */
.character {
    position: absolute;
    width: clamp(5.5rem, 14vw, 9rem);
    max-width: 28vw;
    touch-action: none; /* drag sur tablette */
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.4rem, 0.8vh, 0.6rem);
    border-radius: 1.2rem;
    /* background: radial-gradient(circle at top, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.95));
    box-shadow: 0 0.7rem 1.4rem rgba(15, 23, 42, 0.9); */
    z-index: 100; /* de base tous à 100 */
    will-change: left, top, transform;
    transition: filter 160ms ease;
}

.character img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none; /* on interagit avec le conteneur, pas l'image */
    filter: drop-shadow(0 0.45rem 0.5rem rgba(15, 23, 42, 0.28));
    transform-origin: 50% 86%;
}

.character.is-talking img {
    animation: character-pop 360ms ease;
}

.playground.is-dancing .character img {
    animation: character-dance 620ms ease-in-out infinite;
}

.character:nth-of-type(2n).is-talking img,
.playground.is-dancing .character:nth-of-type(2n) img {
    animation-delay: 90ms;
}

.character-bubble {
    position: absolute;
    left: 50%;
    bottom: 86%;
    width: max-content;
    max-width: min(54vw, 13rem);
    padding: 0.45rem 0.7rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translate(-50%, 0.3rem) scale(0.92);
    pointer-events: none;
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.character-bubble.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.play-sparkle,
.play-bubble {
    position: absolute;
    left: var(--x);
    top: var(--y);
    z-index: 1800;
    width: var(--size);
    height: var(--size);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.play-sparkle {
    color: var(--spark-color);
    font-size: var(--size);
    line-height: 1;
    text-shadow: 0 0.2rem 0.45rem rgba(15, 23, 42, 0.22);
    animation: sparkle-fly 780ms ease-out forwards;
}

.play-bubble {
    border-radius: 50%;
    border: max(2px, 0.12rem) solid rgba(255, 255, 255, 0.78);
    background:
        radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.92), transparent 16%),
        radial-gradient(circle at 72% 74%, rgba(56, 189, 248, 0.28), rgba(251, 113, 133, 0.12));
    box-shadow: inset 0 0 0.55rem rgba(255, 255, 255, 0.42);
    animation: bubble-rise 1050ms ease-out forwards;
}

@keyframes character-pop {
    0%,
    100% {
        transform: scale(1) rotate(0);
    }
    38% {
        transform: scale(1.08) rotate(-2deg);
    }
    68% {
        transform: scale(0.98) rotate(2deg);
    }
}

@keyframes character-dance {
    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }
    50% {
        transform: translateY(-7%) rotate(2deg);
    }
}

@keyframes sparkle-fly {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.45) rotate(0);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(90deg);
    }
}

@keyframes bubble-rise {
    0% {
        opacity: 0;
        transform: translate(-50%, -20%) scale(0.5);
    }
    25% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% - var(--dy))) scale(1.15);
    }
}

/* INFOS EN BAS */
.play-infos {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: clamp(0.8rem, 2vh, 1.2rem);
    padding: min(2.5em, 5%);
    border-radius: calc(var(--radius-xl) * 0.75);
    background: rgba(15, 23, 42, 0.78);
    box-shadow: var(--shadow-soft);
    color: var(--text-muted);
    line-height: 1.6;
    max-width: min(900px, 92vw);
    z-index: 2000;
}

/* RESPONSIVE : PETITES TABLETTES / PORTRAIT */
@media (max-width: 768px) {
    .screen {
        padding: min(3em, 6%);
    }

    #playScreen {
        padding: 0;
    }

    .character {
        width: clamp(6rem, 24vw, 9.5rem);
    }

    .play-infos {
        font-size: clamp(0.9rem, 1rem, 1rem);
    }

    .play-actions {
        gap: 0.25rem;
        padding: 0.25rem;
    }

    .scene-message {
        top: clamp(4rem, 9vh, 5rem);
        max-width: 88vw;
    }
}



/* INTRO PLEIN ÉCRAN */
/* INTRO PLEIN ÉCRAN AVEC IFRAME YOUTUBE */
.intro-fullscreen {
    width: 100vw;
    height: 100lvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    position: relative;
    overflow: hidden;
}

.intro-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}




* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  
}
