/**
 * CAD_deliroom-share — surcouche écran de fin + partage.
 * Tout est scopé `.cadshare-*` pour ne pas fuir sur le reste de la page.
 */

.cadshare-overlay {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .3s ease;
    background:
        linear-gradient(180deg, rgba(10, 8, 18, .78), rgba(10, 8, 18, .92)),
        var(--cadshare-poster, none);
    background-size: cover;
    background-position: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    font-family: Georgia, "Times New Roman", serif;
    box-sizing: border-box;
}
.cadshare-overlay.is-open { opacity: 1; }
.cadshare-overlay * { box-sizing: border-box; }

.cadshare-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 94vh;
    overflow-y: auto;
    text-align: center;
    color: #fff;
    padding: 30px 26px 26px;
    border-radius: 22px;
    background: linear-gradient(165deg, rgba(38, 28, 54, .96), rgba(18, 13, 26, .98));
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
    transform: translateY(14px) scale(.98);
    transition: transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
.cadshare-overlay.is-open .cadshare-card { transform: translateY(0) scale(1); }

.cadshare-close {
    position: absolute;
    top: 10px; right: 14px;
    background: none; border: 0;
    color: rgba(255, 255, 255, .6);
    font-size: 28px; line-height: 1;
    cursor: pointer;
}
.cadshare-close:hover { color: #fff; }

.cadshare-medal {
    font-size: 84px;
    line-height: 1;
    margin: 4px 0 2px;
    animation: cadshare-pop .6s cubic-bezier(.2, .9, .3, 1.4) both;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .5));
}
@keyframes cadshare-pop {
    0% { transform: scale(0) rotate(-25deg); opacity: 0; }
    70% { transform: scale(1.18) rotate(6deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.cadshare-medal-label {
    font-size: 15px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--cadshare-accent, #f0b429);
    margin-bottom: 6px;
}
.cadshare-medal--gold { --cadshare-accent: #f0b429; }
.cadshare-medal--silver { --cadshare-accent: #d3d9e2; }
.cadshare-medal--bronze { --cadshare-accent: #d98a4c; }

.cadshare-team {
    font-size: 24px;
    font-weight: 700;
    margin: 2px 0 12px;
    color: #fff;
    word-break: break-word;
}

.cadshare-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px 0 18px;
}
.cadshare-pts {
    font-size: 66px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 4px 24px rgba(240, 180, 41, .3);
}
.cadshare-ptslabel {
    font-size: 13px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--cadshare-accent, #f0b429);
    margin-top: 4px;
}

.cadshare-stats {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    padding: 14px 0;
    margin-bottom: 18px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.cadshare-stats > div { flex: 1; }
.cadshare-stats span {
    display: block;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
}
.cadshare-stats label {
    display: block;
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
    margin-top: 3px;
}

.cadshare-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.cadshare-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, filter .2s ease;
}
.cadshare-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cadshare-btn:active { transform: translateY(0); }
.cadshare-btn--primary {
    background: linear-gradient(135deg, var(--cadshare-accent, #f0b429), #e0912a);
    color: #1a1206;
}
.cadshare-btn--challenge {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
}

.cadshare-networks {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}
.cadshare-net {
    width: 42px; height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 0;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    cursor: pointer;
    transition: transform .12s ease, filter .2s ease;
}
.cadshare-net:hover { transform: translateY(-2px); filter: brightness(1.1); }
.cadshare-net--fb { background: #1877f2; }
.cadshare-net--wa { background: #25d366; color: #05391c; }
.cadshare-net--x { background: #000; }
.cadshare-net--in { background: #0a66c2; font-size: 15px; }
.cadshare-net--dl,
.cadshare-net--copy { background: rgba(255, 255, 255, .14); }

.cadshare-leaderboard {
    display: inline-block;
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .3);
    padding-bottom: 2px;
}
.cadshare-leaderboard:hover { color: #fff; }

/* Bannière « défi » sur l'accueil du jeu. */
.cadshare-defi-banner {
    position: fixed;
    left: 50%;
    top: 14px;
    transform: translate(-50%, -140%);
    z-index: 99991;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 92vw;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2a1f3a, #17101f);
    border: 1px solid rgba(240, 180, 41, .4);
    color: #fff;
    font-family: Georgia, serif;
    font-size: 15px;
    box-shadow: 0 18px 50px -14px rgba(0, 0, 0, .7);
    transition: transform .4s cubic-bezier(.2, .9, .3, 1.2);
}
.cadshare-defi-banner.is-open { transform: translate(-50%, 0); }
.cadshare-defi-banner button {
    background: none; border: 0;
    color: rgba(255, 255, 255, .6);
    font-size: 22px; line-height: 1;
    cursor: pointer;
}
.cadshare-defi-banner button:hover { color: #fff; }

@media (max-width: 480px) {
    .cadshare-card { padding: 26px 18px 20px; border-radius: 18px; }
    .cadshare-medal { font-size: 72px; }
    .cadshare-pts { font-size: 56px; }
    .cadshare-team { font-size: 21px; }
}
