/* ÉCRAN TITRE (js/shared/landing.js) : une nuit étoilée ; à gauche l'emblème, le titre, l'accroche et
   « Jouer » (ou la connexion) ; à droite le compagnon en 3D sur son îlot (CreatureStage, fond « stars »)
   et sa plaque ; les éleveurs en ligne et la version en pied de page */

#landing {
    --fam: #5fd4ff;
    --gutter: clamp(28px, 6.5vw, 120px);
    --col: min(470px, 40vw);
    position: fixed;
    inset: 0;
    z-index: 60;
    color: var(--text);
    /* Le même ciel que la scène : rien ne saute quand elle apparaît */
    background: radial-gradient(ellipse at 68% 42%, #081329 0%, #040a18 52%, #01040b 100%);
    overflow: hidden;
    transition: opacity 0.7s ease, visibility 0.7s;
}

#landing.leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- Scène 3D et voile ---------- */

.landing-stage {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.6s ease;
}

#landing.has-stage .landing-stage {
    opacity: 1;
}

.landing-stage canvas {
    display: block;
    cursor: grab;
    touch-action: pan-y;
}

.landing-stage canvas.is-dragging {
    cursor: grabbing;
}

/* Le texte reste lisible : ombre à gauche et en bas, la créature garde toute sa lumière */
.landing-veil {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(1, 4, 11, 0.8) 0%, rgba(1, 4, 11, 0.52) 28%, rgba(1, 4, 11, 0) 56%),
        linear-gradient(0deg, rgba(1, 4, 11, 0.75) 0%, rgba(1, 4, 11, 0) 20%);
}

/* Le vent (landing.js startWind) : filets, poussières et pétales, au-dessus du voile, sous le texte */
.landing-wind {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: landing-wind-in 2.4s ease 0.6s both;
}

@keyframes landing-wind-in {
    from {
        opacity: 0;
    }
}

/* ---------- Colonne de gauche ---------- */

.landing-main {
    position: absolute;
    inset: 0 0 52px;
    display: flex;
    align-items: center;
    padding: 24px var(--gutter);
    pointer-events: none;
}

.landing-left {
    width: var(--col);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.landing-head,
.landing-actions {
    pointer-events: auto;
}

.landing-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.landing-mark {
    width: clamp(100px, 11vw, 150px);
    height: clamp(100px, 11vw, 150px);
    margin: 0 0 -4px -14px;
    animation: landing-rise 0.9s ease-out both;
}

.landing-title {
    font-size: clamp(60px, 7.2vw, 116px);
    line-height: 0.92;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.6));
    animation: landing-rise 0.9s 0.08s ease-out both;
}

.landing-tagline {
    max-width: 34ch;
    text-wrap: balance;
    margin: 16px 0 36px;
    font-family: var(--serif, 'Fraunces', Georgia, serif);
    font-style: italic;
    font-size: clamp(17px, 1.45vw, 22px);
    line-height: 1.35;
    color: var(--muted);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
    animation: landing-rise 0.9s 0.16s ease-out both;
}

.landing-actions {
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: landing-rise 0.9s 0.26s ease-out both;
}

.landing-play {
    width: 100%;
    min-height: 58px;
    border-radius: 16px;
    font-family: var(--display, 'Lilita One', sans-serif);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: #2b1206;
    background: linear-gradient(180deg, #ffe46c 0%, #ffb53d 55%, #f07a2e 100%);
    box-shadow: 0 16px 36px -14px rgba(255, 140, 60, 0.95), inset 0 -3px 0 rgba(140, 40, 10, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.landing-play:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 20px 42px -14px rgba(255, 140, 60, 1), inset 0 -3px 0 rgba(140, 40, 10, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.landing-play:active {
    transform: translateY(1px);
}

.landing-who,
.landing-note {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.landing-note {
    font-size: 12.5px;
    color: var(--faint);
}

.landing-who b {
    color: var(--text);
}

.landing-link {
    padding: 0;
    color: var(--muted);
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.landing-link:hover {
    color: var(--text);
}

/* Ce qu'offre le jeu, en une ligne (visiteurs) */
.landing-facts {
    font-size: 12.5px;
    letter-spacing: 0.02em;
    color: var(--faint);
}

.landing-facts i {
    display: inline-block;
    width: 3px;
    height: 3px;
    margin: 0 8px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: middle;
}

/* Connexion : boutons aux couleurs de Discord et de Google */
.landing-login {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 52px;
    padding: 13px 18px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}

.landing-login:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.landing-logo {
    width: 22px;
    height: 22px;
    flex: none;
}

.landing-login-discord {
    color: #ffffff;
    background: #5865f2;
    box-shadow: 0 12px 28px -14px rgba(88, 101, 242, 0.95);
}

.landing-login-google {
    color: #1f1f1f;
    background: #ffffff;
    box-shadow: 0 12px 28px -16px rgba(255, 255, 255, 0.5);
}

/* Mode invité (landing.js renderLogin) : « Jouer maintenant », sa ligne, le séparateur avant Discord et Google ;
   pour un habitué de ce navigateur, « Continuer en tant que … » (initiale, nom, service) et le mode invité en petit */
.landing-sub {
    margin-top: -4px;
    font-size: 13.5px;
    line-height: 1.45;
    text-align: center;
    color: var(--muted);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.landing-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 2px;
    font-size: 12.5px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.landing-or::before,
.landing-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(205, 228, 244, 0), rgba(205, 228, 244, 0.28), rgba(205, 228, 244, 0));
}

.landing-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #ffc542;
}

.landing-known {
    justify-content: flex-start;
    gap: 14px;
    min-height: 66px;
    padding: 10px 18px;
    border-radius: 16px;
    text-align: left;
}

.landing-avatar {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 800;
    color: #2b1206;
    background: linear-gradient(180deg, #ffe46c, #f0a03a);
}

.landing-known-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.landing-known-text b {
    font-size: 16.5px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.landing-known-text small {
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.82;
}

.landing-guest-link {
    align-self: flex-start;
    padding: 6px 0;
    font-size: 13.5px;
    font-weight: 600;
}

.landing-dev {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

.landing-dev input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    font: inherit;
    color: var(--text);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.landing-error {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 120, 110, 0.4);
    background: rgba(255, 90, 80, 0.1);
    font-size: 13px;
    color: #ffb3a8;
}

.landing-wait {
    font-size: 13px;
    color: var(--faint);
    animation: pulse 1.6s ease-in-out infinite;
}

/* Zones réservées (invisibles) : la scène cadre la créature entre le haut du ciel et le pied de
   l'îlot, qui pend au-dessus de la plaque */
.landing-sky-pad,
.landing-floor {
    position: absolute;
    left: calc(var(--gutter) + var(--col));
    right: 0;
    pointer-events: none;
}

.landing-sky-pad {
    top: 0;
    height: clamp(50px, 10vh, 130px);
}

.landing-floor {
    bottom: 0;
    height: clamp(170px, 30vh, 320px);
}

/* ---------- Plaque du compagnon, sous l'îlot ---------- */

/* Au-dessus de la créature : l'îlot flotte librement dans le noir, sans texte dessus */
.landing-plate {
    position: absolute;
    top: clamp(30px, 8vh, 90px);
    left: calc(var(--gutter) + var(--col));
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 0 16px;
    text-align: center;
    pointer-events: none;
    animation: landing-rise 1s 0.4s ease-out both;
}

.landing-plate::after {
    content: '';
    width: 56px;
    height: 1px;
    margin-top: 10px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fam) 80%, white), transparent);
}

.landing-plate.is-empty {
    display: none;
}

.plate-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--fam) 75%, white);
    text-shadow: 0 0 18px color-mix(in srgb, var(--fam) 55%, transparent);
}

.plate-name {
    font-family: var(--serif, 'Fraunces', Georgia, serif);
    font-size: clamp(26px, 2.3vw, 36px);
    font-weight: 600;
    line-height: 1.1;
    color: var(--text);
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85);
}

.plate-shiny {
    margin-left: 6px;
    font-style: normal;
    color: #ffe38a;
}

.plate-line {
    font-size: 14px;
    color: var(--muted);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.plate-hint {
    margin-top: 3px;
    font-style: normal;
    font-size: 13px;
    font-weight: 700;
    color: #ffd27a;
}

/* ---------- Pied ---------- */

.landing-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px calc(var(--gutter) + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
    font-size: 12px;
    color: var(--faint);
    pointer-events: none;
}

.landing-foot > * {
    pointer-events: auto;
}

.landing-online::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: #5ee08a;
    box-shadow: 0 0 8px #5ee08a;
    vertical-align: 1px;
}

.landing-foot-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.landing-version {
    font-variant-numeric: tabular-nums;
    cursor: default;
}

/* Discord du jeu : une pastille aux couleurs de Discord, plus visible que les liens légaux */
.landing-discord {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(88, 101, 242, 0.55);
    background: rgba(88, 101, 242, 0.18);
    color: #dfe3ff;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.landing-discord svg {
    width: 16px;
    height: 16px;
}

.landing-discord:hover,
.landing-discord:focus-visible {
    background: rgba(88, 101, 242, 0.42);
    border-color: #5865f2;
    color: #fff;
}

/* Téléphone : l'icône seule */
@media (max-width: 640px), (max-height: 560px) {
    .landing-discord span {
        display: none;
    }

    .landing-discord {
        padding: 6px;
    }
}

/* Liens vers les pages Confidentialité et Conditions : discrets, comme la version */
.landing-privacy {
    color: inherit;
    text-decoration: none;
}

.landing-privacy:hover {
    color: #ffd27a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Son : haut-parleur discret (ondes quand la musique joue, croix quand elle est coupée) */
.landing-sound {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.landing-sound:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.landing-sound[hidden] {
    display: none;
}

.landing-sound svg {
    width: 17px;
    height: 17px;
}

.landing-sound .sound-off,
.landing-sound.is-muted .sound-on {
    display: none;
}

.landing-sound.is-muted .sound-off {
    display: inline;
}

/* ---------- Petits écrans : titre en haut, créature au milieu, plaque et boutons en bas ---------- */

@media (max-width: 760px) {
    #landing {
        --gutter: 20px;
    }

    /* Le pied de l'îlot se fond dans le noir derrière la plaque et les boutons */
    .landing-veil {
        background:
            linear-gradient(180deg, rgba(1, 4, 11, 0.7) 0%, rgba(1, 4, 11, 0) 24%),
            linear-gradient(0deg, rgba(1, 4, 11, 0.97) 0%, rgba(1, 4, 11, 0.9) 30%, rgba(1, 4, 11, 0.55) 42%, rgba(1, 4, 11, 0) 56%);
    }

    .landing-main {
        inset: 0 0 40px;
        align-items: stretch;
        padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 12px;
    }

    .landing-left {
        width: 100%;
        align-items: center;
        justify-content: space-between;
        text-align: center;
    }

    .landing-head {
        align-items: center;
    }

    .landing-mark {
        width: 72px;
        height: 72px;
        margin: 0 0 -4px;
    }

    .landing-title {
        font-size: clamp(46px, 14vw, 64px);
    }

    .landing-tagline {
        margin: 8px 0 0;
        font-size: 15px;
    }

    .landing-sky-pad,
    .landing-floor {
        display: none;
    }

    .landing-plate {
        position: static;
        margin-top: auto;
        margin-bottom: 18px;
        padding: 0;
    }

    .landing-actions {
        width: min(380px, 100%);
    }

    .landing-foot {
        padding-top: 8px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        font-size: 11px;
    }
}

/* Écrans bas (téléphone couché, petite fenêtre) : l'essentiel seulement */
@media (max-height: 560px) {
    .landing-mark {
        display: none;
    }

    .landing-tagline {
        margin-bottom: 18px;
    }

    .landing-facts,
    .landing-note {
        display: none;
    }
}

@keyframes landing-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-mark,
    .landing-title,
    .landing-tagline,
    .landing-actions,
    .landing-plate,
    .landing-wait {
        animation: none;
    }

    .landing-stage {
        transition: none;
    }

    .landing-wind {
        display: none;
    }
}

/* ---------- Téléphone à l'horizontale (html.phone, index.html) ----------
   Deux colonnes même sous 760 px de large : à gauche le titre, l'accroche et les boutons, toujours entiers ; à droite
   le compagnon sur son îlot et sa plaque. Tailles d'après la hauteur visible (--phone-k) */
html.phone #landing {
    --gutter: calc(22px + env(safe-area-inset-left));
    --col: min(360px, 44vw);
}

html.phone .landing-veil {
    background:
        linear-gradient(90deg, rgba(1, 4, 11, 0.85) 0%, rgba(1, 4, 11, 0.55) 34%, rgba(1, 4, 11, 0) 60%),
        linear-gradient(0deg, rgba(1, 4, 11, 0.75) 0%, rgba(1, 4, 11, 0) 22%);
}

html.phone .landing-main {
    inset: 0 0 calc(34px + env(safe-area-inset-bottom));
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 4px;
}

html.phone .landing-left {
    width: var(--col);
    max-height: 100%;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

html.phone .landing-head {
    align-items: flex-start;
}

html.phone .landing-mark,
html.phone .landing-facts,
html.phone .landing-note {
    display: none;
}

html.phone .landing-title {
    font-size: calc(46px * var(--phone-k));
}

html.phone .landing-tagline {
    margin: 6px 0 calc(14px * var(--phone-k));
    font-size: 14px;
}

html.phone .landing-actions {
    width: 100%;
    gap: 8px;
}

html.phone .landing-play {
    min-height: calc(46px * var(--phone-k));
    font-size: 20px;
}

html.phone .landing-login {
    min-height: calc(42px * var(--phone-k));
    padding: 8px 14px;
    font-size: 14px;
}

/* Mode invité sur un téléphone couché : pas de hauteur à perdre, Discord et Google suivent « Jouer maintenant »
   sans le séparateur ; l'habitué garde un bouton plus bas */
html.phone .landing-or {
    display: none;
}

html.phone .landing-sub {
    margin-top: -3px;
    font-size: 12px;
}

html.phone .landing-known {
    min-height: calc(50px * var(--phone-k));
    padding: 6px 14px;
}

html.phone .landing-avatar {
    width: 34px;
    height: 34px;
    font-size: 16px;
}

html.phone .landing-dev {
    padding-top: 8px;
}

html.phone .landing-sky-pad,
html.phone .landing-floor {
    display: block;
}

html.phone .landing-sky-pad {
    height: calc(64px * var(--phone-k));
}

html.phone .landing-floor {
    height: calc(56px * var(--phone-k));
}

html.phone .landing-plate {
    position: absolute;
    top: calc(6px + env(safe-area-inset-top));
    left: calc(var(--gutter) + var(--col));
    right: 0;
    margin: 0;
    padding: 0 12px;
    gap: 2px;
}

html.phone .landing-plate::after {
    margin-top: 4px;
}

html.phone .plate-name {
    font-size: calc(22px * var(--phone-k));
}

html.phone .plate-line,
html.phone .plate-hint {
    font-size: 12px;
}

html.phone .landing-foot {
    padding: 6px calc(16px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
    font-size: 11px;
}

/* Installer le jeu (shared/install.js) : même pastille que le lien Discord, en or ; son libellé reste sur téléphone,
   où l'installation sert le plus (plein écran sans barre du navigateur) */
.landing-install {
    font: inherit;
    font-weight: 600;
    border-color: rgba(255, 201, 77, 0.55);
    background: rgba(255, 201, 77, 0.14);
    color: #ffe7a8;
    cursor: pointer;
}

.landing-install:hover,
.landing-install:focus-visible {
    background: rgba(255, 201, 77, 0.3);
    border-color: #ffc94d;
    color: #fff;
}

.landing-install[hidden] {
    display: none;
}

@media (max-width: 640px), (max-height: 560px) {
    .landing-install span {
        display: inline;
    }

    .landing-install {
        padding: 6px 12px 6px 10px;
    }
}
