/*
    Personaggio del Giorno — l'aspetto delle sue pagine pubbliche (README §8.2).

    È un gioco: colori pieni, una polaroid col volto sfocato, gli indizi come fumetti, i punti come una
    scala che scende. Tutto sotto .theme-dg, la classe che il layout dell'host mette sul contenitore di
    pagina quando si è in questo gioco (e sulla sua scheda e sulla sua card in home): fuori da lì questo
    file non tocca niente.

    Zero JavaScript, come tutta la superficie pubblica. Le due palette, chiara e scura, sono entrambe
    definite: una pagina indicizzata la apre chiunque, col tema che ha.
*/

.theme-dg {
    --bg: #fcfaff;
    --surface: #ffffff;
    --surface-2: #f5f0ff;
    --line: #ebe3fb;
    --line-strong: #d9ccf5;

    --accent: #7c3aed;
    --accent-ink: #ffffff;
    --accent-soft: #f1e9ff;

    --dg-pink: #ec4899;
    --dg-sun: #f59e0b;
    --dg-mint: #10b981;
    --dg-sky: #0ea5e9;
    --dg-paper: #ffffff;
    --dg-hero: linear-gradient(125deg, #6d28d9 0%, #a21caf 45%, #ec4899 75%, #f59e0b 115%);
}

@media (prefers-color-scheme: dark) {
    .theme-dg {
        --bg: #100d18;
        --surface: #181424;
        --surface-2: #211b30;
        --line: #2e2642;
        --line-strong: #3d3358;

        --accent: #b794ff;
        --accent-ink: #160d26;
        --accent-soft: #241a3a;

        --dg-pink: #f472b6;
        --dg-sun: #fbbf24;
        --dg-mint: #34d399;
        --dg-sky: #38bdf8;
        --dg-paper: #f4f1fa;
        --dg-hero: linear-gradient(125deg, #4c1d95 0%, #86198f 45%, #be185d 80%, #b45309 120%);
    }
}

/* ---------- pulsanti ---------- */

.theme-dg .dg-cta {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1.35rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--dg-sun), var(--dg-pink));
    color: #ffffff;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: .01em;
    text-decoration: none;
    box-shadow: 0 10px 24px -10px var(--dg-pink);
    transition: transform .15s ease, box-shadow .15s ease;
}

.theme-dg .dg-cta:hover { text-decoration: none; transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 30px -10px var(--dg-pink); }

.theme-dg .dg-ghost {
    display: inline-flex;
    align-items: center;
    padding: .72rem 1.2rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .55);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.theme-dg .dg-ghost:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }

/* ---------- hero con la polaroid ---------- */

.dg-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    padding: clamp(1.5rem, 1rem + 3vw, 3rem);
    border-radius: 26px;
    background: var(--dg-hero);
    color: #ffffff;
    overflow: hidden;
    box-shadow: 0 24px 60px -30px #7c3aed;
    margin-bottom: 2.5rem;
}

/* I punti interrogativi sullo sfondo: decorazione, nessun contenuto. */
.dg-hero::before,
.dg-hero::after {
    content: "?";
    position: absolute;
    font-weight: 900;
    line-height: 1;
    color: rgba(255, 255, 255, .09);
    pointer-events: none;
}

.dg-hero::before { font-size: 16rem; right: -1.5rem; top: -3rem; transform: rotate(14deg); }
.dg-hero::after { font-size: 8rem; left: 38%; bottom: -2.5rem; transform: rotate(-18deg); }

.dg-hero > * { position: relative; }

.dg-hero .dg-kicker {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .28rem .75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .8rem;
}

.dg-hero h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.3rem); font-weight: 900; letter-spacing: -.03em; margin-bottom: .6rem; }
.dg-hero p { font-size: 1.1rem; max-width: 44ch; color: rgba(255, 255, 255, .92); }
.dg-hero .dg-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; }

.dg-hero .dg-count {
    display: flex;
    gap: 1.6rem;
    flex-wrap: wrap;
    margin-top: 1.6rem;
    font-size: .88rem;
    color: rgba(255, 255, 255, .85);
}

.dg-hero .dg-count strong { display: block; font-size: 1.6rem; font-weight: 900; color: #ffffff; letter-spacing: -.02em; }

@media (max-width: 760px) {
    .dg-hero { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- la polaroid ---------- */

.dg-polaroid {
    position: relative;
    margin: 0 auto;
    max-width: 340px;
    padding: .8rem .8rem 2.6rem;
    background: var(--dg-paper);
    border-radius: 6px;
    box-shadow: 0 22px 44px -18px rgba(20, 8, 40, .55);
    transform: rotate(-3deg);
    transition: transform .25s ease;
}

.dg-polaroid:hover { transform: rotate(0deg) scale(1.02); }

.dg-polaroid img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 3px;
    background: #e9e2f7;
}

.dg-polaroid figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: .6rem;
    text-align: center;
    font-weight: 800;
    font-size: 1.05rem;
    color: #3b2a5c;
    letter-spacing: .01em;
}

.dg-polaroid.tilt-right { transform: rotate(2.5deg); }

/* Il bollino giallo col punto interrogativo, appoggiato sull'angolo. */
.dg-sticker {
    position: absolute;
    top: -14px;
    right: -14px;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--dg-sun);
    color: #3b2200;
    font-size: 1.9rem;
    font-weight: 900;
    transform: rotate(12deg);
    box-shadow: 0 8px 16px -6px rgba(0, 0, 0, .4);
}

/* ---------- l'indizio come fumetto ---------- */

.dg-bubble {
    position: relative;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    border: 2px solid var(--line-strong);
    box-shadow: var(--shadow);
    font-size: 1.08rem;
    font-weight: 600;
}

.dg-bubble::after {
    content: "";
    position: absolute;
    left: 28px;
    bottom: -11px;
    width: 18px;
    height: 18px;
    background: var(--surface);
    border-right: 2px solid var(--line-strong);
    border-bottom: 2px solid var(--line-strong);
    transform: rotate(45deg);
}

.dg-bubble .dg-label {
    display: block;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .2rem;
}

.dg-hero .dg-bubble { margin-top: 1.2rem; max-width: 46ch; }

/* ---------- la scala dei punti ---------- */

.dg-ladder {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .7rem;
    align-items: end;
    padding: 1.25rem 1.25rem 1rem;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.dg-step { display: flex; flex-direction: column; align-items: center; gap: .45rem; }

.dg-step .dg-bar {
    display: grid;
    place-items: start center;
    width: 100%;
    height: calc(52px + var(--h, 0) * 1.1px);
    padding-top: .55rem;
    border-radius: 12px 12px 6px 6px;
    background: linear-gradient(180deg, var(--c, var(--accent)), color-mix(in srgb, var(--c, var(--accent)) 55%, transparent));
    color: #ffffff;
    font-weight: 900;
    font-size: 1.15rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.dg-step:nth-child(1) { --c: var(--dg-sun); }
.dg-step:nth-child(2) { --c: var(--dg-pink); }
.dg-step:nth-child(3) { --c: #a855f7; }
.dg-step:nth-child(4) { --c: var(--dg-sky); }
.dg-step:nth-child(5) { --c: var(--dg-mint); }

.dg-step .dg-step-l { font-size: .8rem; font-weight: 700; color: var(--ink-faint); text-align: center; }

/* ---------- come si gioca, in tre mosse ---------- */

.dg-moves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.dg-move {
    padding: 1.2rem 1.25rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.dg-move .dg-emoji { font-size: 2rem; line-height: 1; display: block; margin-bottom: .5rem; }
.dg-move h3 { margin-bottom: .3rem; }
.dg-move p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* ---------- archivio: una parete di polaroid ---------- */

.dg-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.6rem 1.2rem;
    padding-top: .5rem;
}

.dg-snap {
    display: block;
    padding: .65rem .65rem .85rem;
    background: var(--dg-paper);
    border-radius: 6px;
    box-shadow: 0 14px 30px -16px rgba(20, 8, 40, .5);
    color: #2a1d42;
    text-decoration: none;
    transform: rotate(var(--r, -1.5deg));
    transition: transform .2s ease, box-shadow .2s ease;
}

.dg-snap:nth-child(3n + 2) { --r: 1.5deg; }
.dg-snap:nth-child(3n + 3) { --r: -.5deg; }
.dg-snap:hover { transform: rotate(0deg) translateY(-4px) scale(1.03); box-shadow: 0 22px 40px -18px rgba(20, 8, 40, .6); text-decoration: none; }

.dg-snap img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 3px;
    background: #e9e2f7;
}

.dg-snap .dg-date { display: block; margin-top: .6rem; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8a79a8; }
.dg-snap .dg-name { display: block; font-size: 1.05rem; font-weight: 800; line-height: 1.25; margin: .1rem 0 .55rem; }

/* Quanti l'hanno indovinato, come una barretta: si legge prima del numero. */
.dg-meter {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: #ece6f6;
    overflow: hidden;
}

.dg-meter span {
    display: block;
    height: 100%;
    width: var(--p, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--dg-mint), var(--dg-sky));
}

.dg-snap .dg-meter-l { display: block; margin-top: .35rem; font-size: .8rem; color: #6b5d85; }

/* ---------- il round chiuso ---------- */

.dg-reveal {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 2.25rem;
    align-items: center;
    margin-bottom: 2.25rem;
}

@media (max-width: 760px) {
    .dg-reveal { grid-template-columns: minmax(0, 1fr); }
}

.dg-reveal .dg-was {
    display: inline-block;
    padding: .3rem .8rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--dg-sun), var(--dg-pink));
    color: #ffffff;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: .6rem;
}

.dg-reveal h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); font-weight: 900; letter-spacing: -.03em; }
.dg-reveal .lead { font-size: 1.12rem; }
.dg-credit { margin-top: .9rem; font-size: .8rem; color: var(--ink-faint); text-align: center; }

.dg-clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; counter-reset: clue; }

.dg-clues li {
    position: relative;
    padding: .75rem 1rem .75rem 3.3rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    counter-increment: clue;
}

.dg-clues li::before {
    content: counter(clue);
    position: absolute;
    left: .75rem;
    top: 50%;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    margin-top: -.95rem;
    border-radius: 50%;
    background: var(--c, var(--accent));
    color: #ffffff;
    font-weight: 900;
    font-size: .95rem;
}

.dg-clues li:nth-child(1) { --c: var(--dg-sun); }
.dg-clues li:nth-child(2) { --c: var(--dg-pink); }
.dg-clues li:nth-child(3) { --c: #a855f7; }
.dg-clues li:nth-child(4) { --c: var(--dg-sky); }
.dg-clues li:nth-child(5) { --c: var(--dg-mint); }

.dg-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.dg-tile {
    padding: .9rem 1rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 30%, transparent);
}

.dg-tile:nth-child(1) { --c: var(--dg-sky); }
.dg-tile:nth-child(2) { --c: var(--dg-mint); }
.dg-tile:nth-child(3) { --c: var(--dg-sun); }
.dg-tile:nth-child(4) { --c: var(--dg-pink); }

.dg-tile .n { font-size: 1.7rem; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.dg-tile .l { font-size: .8rem; color: var(--ink-soft); }

/* La discussione, come un fumetto grande: è il punto del gioco. */
.dg-talk {
    margin-top: 1.1rem;
    padding: 1.3rem 1.35rem;
    border-radius: 20px;
    background: linear-gradient(150deg, var(--accent-soft), var(--surface) 80%);
    border: 1px solid var(--line-strong);
}

.dg-talk h3 { display: flex; align-items: center; gap: .45rem; }
.dg-talk p { color: var(--ink-soft); }

.dg-section { margin-top: 2.75rem; }
.dg-section > h2 { display: flex; align-items: center; gap: .5rem; }

/* ---------- classifica: il podio, poi tutti gli altri ---------- */

.dg-podium {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.75rem;
}

.dg-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: 1.1rem .8rem 1rem;
    border-radius: 20px 20px 10px 10px;
    background: color-mix(in srgb, var(--c) 16%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
    text-align: center;
    min-width: 0;
}

.dg-place.p1 { --c: var(--dg-sun); order: 2; padding-top: 1.8rem; }
.dg-place.p2 { --c: #94a3b8; order: 1; }
.dg-place.p3 { --c: #d97706; order: 3; }

.dg-place .dg-medal { font-size: 2.2rem; line-height: 1; }
.dg-place .dg-who { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-place .dg-pts { font-size: 1.35rem; font-weight: 900; letter-spacing: -.02em; }
.dg-place .dg-sub { font-size: .8rem; color: var(--ink-soft); }

@media (max-width: 560px) {
    .dg-podium { gap: .5rem; }
    .dg-place .dg-medal { font-size: 1.7rem; }
}

.dg-initial {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .8rem;
    font-weight: 800;
    flex: none;
}

@media (prefers-reduced-motion: reduce) {
    .dg-polaroid, .dg-polaroid:hover, .dg-snap, .dg-snap:hover, .theme-dg .dg-cta:hover { transform: none; }
}
