/* Positive Spin - ruota delle frasi positive. Tutte le classi hanno prefisso .ps- */

.ps-app {
    --ps-glow: #ff4d8d;
    --ps-ink: #f8f7ff;
    --ps-dim: #c9c3f0;
    position: relative;
    max-width: 1180px;
    margin: 12px auto 40px;
    padding: 30px 18px 40px;
    border-radius: 28px;
    overflow: hidden;
    isolation: isolate;
    color: var(--ps-ink);
    background: radial-gradient(120% 90% at 50% 0%, #2d1b69 0%, #160c3d 45%, #090420 100%);
    box-shadow: 0 30px 80px -30px rgba(40, 10, 90, 0.7);
}
.ps-app [hidden] { display: none !important; }
.ps-app button { font-family: inherit; }

/* ---- cielo animato ---- */
.ps-sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ps-blob {
    position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55;
    animation: psFloat 18s ease-in-out infinite alternate;
}
.ps-blob.b1 { width: 460px; height: 460px; background: #ff4d8d; top: -160px; left: -120px; }
.ps-blob.b2 { width: 420px; height: 420px; background: #4361ee; bottom: -160px; right: -100px; animation-duration: 22s; }
.ps-blob.b3 { width: 320px; height: 320px; background: #00f5d4; top: 40%; left: 55%; opacity: 0.25; animation-duration: 26s; }
@keyframes psFloat {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}
.ps-stars {
    position: absolute; inset: -50%;
    background-image:
        radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 90px 120px, #fff, transparent),
        radial-gradient(2px 2px at 160px 60px, #ffe7a3, transparent),
        radial-gradient(1px 1px at 230px 190px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 60px 210px, #c7d2fe, transparent);
    background-size: 260px 260px;
    opacity: 0.55;
    animation: psDrift 90s linear infinite;
}
.ps-stars.s2 { background-size: 380px 380px; opacity: 0.35; animation-duration: 140s; animation-direction: reverse; }
@keyframes psDrift { to { transform: translate(260px, 260px); } }

/* ---- intestazione ---- */
.ps-hero { text-align: center; margin-bottom: 20px; }
.ps-badge {
    display: inline-block; padding: 6px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; color: #ffe7a3;
}
.ps-hero h1 {
    margin: 12px 0 10px;
    font-size: clamp(2rem, 6vw, 3.4rem);
    font-weight: 900; line-height: 1.05; letter-spacing: -0.02em;
    background: linear-gradient(90deg, #ffd60a, #ff8fb8, #b69cff, #7cc6fe, #ffd60a);
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: psShine 8s linear infinite;
}
@keyframes psShine { to { background-position: 300% 0; } }
.ps-hero p { max-width: 640px; margin: 0 auto; color: var(--ps-dim); font-size: 1.05rem; line-height: 1.6; }

/* ---- barra comandi ---- */
.ps-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center;
    margin: 0 auto 18px;
}
.ps-lang {
    display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
}
.ps-lang button {
    min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px;
    background: transparent; color: var(--ps-dim); font-weight: 700; font-size: 0.95rem; cursor: pointer;
    transition: background .2s, color .2s;
}
.ps-lang button.is-active { background: linear-gradient(135deg, #ff4d8d, #9b5de5); color: #fff; box-shadow: 0 6px 18px -6px #ff4d8d; }
.ps-name {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
    border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
}
.ps-name input {
    width: 190px; max-width: 46vw; border: 0; outline: 0; background: transparent;
    color: #fff; font-size: 16px; font-family: inherit;
}
.ps-name input::placeholder { color: rgba(255, 255, 255, 0.5); }
.ps-name:focus-within { border-color: #ffd60a; }
.ps-iconbtn {
    width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 1.25rem; cursor: pointer;
}

/* ---- palco ---- */
.ps-stage {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 28px; align-items: start;
}
.ps-wheelcol { display: flex; flex-direction: column; align-items: center; }
.ps-wheelwrap {
    position: relative; width: 100%; max-width: 560px; aspect-ratio: 1;
    margin-top: 26px;
}
#psWheel { position: relative; z-index: 2; display: block; margin: 0 auto; touch-action: none; cursor: grab; }
.ps-app.is-dragging #psWheel { cursor: grabbing; }

.ps-halo {
    position: absolute; inset: -6%; border-radius: 50%; z-index: 0;
    background: radial-gradient(circle, var(--ps-glow) 0%, transparent 65%);
    opacity: 0.45; filter: blur(20px);
    transition: background .25s;
}
.ps-app.is-spinning .ps-halo { opacity: 0.75; animation: psBreath 0.5s ease-in-out infinite alternate; }
.ps-app.is-won .ps-halo { opacity: 0.8; }
@keyframes psBreath { to { transform: scale(1.06); } }

.ps-rays {
    position: absolute; inset: -22%; z-index: 0; border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 240, 180, 0.16) 0deg 7deg, transparent 7deg 20deg);
    -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%);
    mask: radial-gradient(circle, #000 25%, transparent 70%);
    opacity: 0.35;
    animation: psSpinRays 40s linear infinite;
}
.ps-rays.is-burst { animation: psSpinRays 40s linear infinite, psBurst 1.6s ease-out; }
@keyframes psSpinRays { to { transform: rotate(360deg); } }
@keyframes psBurst {
    0%   { opacity: 0.35; scale: 0.8; }
    25%  { opacity: 1; scale: 1.12; }
    100% { opacity: 0.35; scale: 1; }
}

.ps-pointer {
    position: absolute; z-index: 4; top: -5%; left: 50%;
    width: 12%; height: auto;
    transform: translateX(-50%);
    transform-origin: 50% 31%;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
    pointer-events: none;
}

.ps-hub {
    position: absolute; z-index: 3; top: 50%; left: 50%;
    width: 23%; aspect-ratio: 1; min-width: 72px;
    transform: translate(-50%, -50%);
    border-radius: 50%; border: 4px solid #fff3b0; cursor: pointer;
    background: radial-gradient(circle at 35% 30%, #ff9ec1 0%, #ff4d8d 40%, #9b1f5f 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 -6px 12px rgba(0, 0, 0, 0.25), inset 0 6px 10px rgba(255, 255, 255, 0.35);
    color: #fff; font-weight: 900; font-size: clamp(0.95rem, 3.4vw, 1.35rem); letter-spacing: 0.06em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    transition: transform .15s;
}
.ps-hub::after {
    content: ""; position: absolute; inset: -12px; border-radius: 50%;
    border: 3px solid rgba(255, 214, 10, 0.7);
    animation: psPulse 1.8s ease-out infinite;
}
.ps-hub:hover { transform: translate(-50%, -50%) scale(1.06); }
.ps-hub:active { transform: translate(-50%, -50%) scale(0.95); }
.ps-hub:disabled { cursor: default; }
.ps-hub:disabled::after, .ps-app.is-spinning .ps-hub::after { animation: none; opacity: 0; }
@keyframes psPulse {
    0%   { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1.35); opacity: 0; }
}

.ps-actions-main { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }
.ps-spin, .ps-daily {
    min-height: 56px; padding: 0 28px; border-radius: 999px; border: 0; cursor: pointer;
    font-weight: 800; font-size: 1.1rem; color: #fff;
    transition: transform .15s, box-shadow .2s, opacity .2s;
}
.ps-spin {
    background: linear-gradient(135deg, #ff4d8d, #ff7a18);
    box-shadow: 0 12px 30px -10px #ff4d8d, inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.ps-daily {
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
}
.ps-spin:hover, .ps-daily:hover { transform: translateY(-2px); }
.ps-spin:disabled, .ps-daily:disabled { opacity: 0.55; transform: none; cursor: default; }
.ps-app.is-spinning .ps-daily { opacity: 0.55; pointer-events: none; }
.ps-hint { margin: 12px 0 0; font-size: 0.85rem; color: rgba(255, 255, 255, 0.5); text-align: center; }

/* ---- scheda frase ---- */
.ps-card {
    --c1: #ff4d8d; --c2: #ffd60a;
    position: relative; overflow: hidden;
    min-height: 330px; padding: 28px 26px 22px;
    border-radius: 24px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}
.ps-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none;
    background: linear-gradient(135deg, var(--c1), var(--c2), transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .5s;
}
.ps-card:not(.is-empty)::before { opacity: 1; }
.ps-card-glow {
    position: absolute; width: 280px; height: 280px; right: -90px; top: -110px; border-radius: 50%;
    background: var(--c1); filter: blur(60px); opacity: 0.35; pointer-events: none;
    transition: background .6s;
}
.ps-card-empty { display: none; text-align: center; padding: 40px 10px; color: var(--ps-dim); }
.ps-card.is-empty .ps-card-empty { display: block; }
.ps-card.is-empty .ps-card-body { display: none; }
.ps-empty-emoji { font-size: 3.4rem; animation: psBob 2.4s ease-in-out infinite; }
.ps-card-empty p { font-size: 1.2rem; font-weight: 700; color: #fff; margin: 12px 0 6px; }
@keyframes psBob { 50% { transform: translateY(-8px) rotate(8deg); } }

.ps-card.is-waiting .ps-card-body { opacity: 0.35; filter: blur(3px); transition: opacity .3s, filter .3s; }
.ps-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; position: relative; }
.ps-emoji {
    font-size: 3rem; line-height: 1;
    display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 20px;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    box-shadow: 0 10px 24px -8px var(--c1);
}
.ps-card.is-reveal .ps-emoji { animation: psPop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes psPop { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
.ps-kicker { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: #ffe7a3; font-weight: 700; }
.ps-cat { display: block; font-size: 1.45rem; font-weight: 900; color: #fff; }

.ps-quote {
    position: relative; margin: 0 0 22px; padding: 0;
    font-size: clamp(1.35rem, 3.2vw, 1.9rem); line-height: 1.35; font-weight: 800;
    color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}
.ps-quote::before {
    content: "”"; position: absolute; right: -4px; bottom: -58px;
    font-size: 6rem; line-height: 1; color: var(--c1); opacity: 0.3; font-family: Georgia, serif;
    pointer-events: none;
}
.ps-word { display: inline-block; }
.ps-card.is-reveal .ps-word { animation: psWord .55s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes psWord {
    0%   { opacity: 0; transform: translateY(18px) scale(0.9); filter: blur(6px); }
    100% { opacity: 1; transform: none; filter: blur(0); }
}

.ps-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.ps-tools button {
    min-height: 48px; padding: 0 10px; border-radius: 14px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.08);
    color: #fff; font-weight: 700; font-size: 0.92rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background .2s, transform .15s;
}
.ps-tools button:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.ps-tools button b { font-size: 1.15rem; color: #ffd60a; }
#psFav.is-on { background: rgba(255, 214, 10, 0.18); border-color: rgba(255, 214, 10, 0.5); }

/* ---- statistiche, cronologia, preferite ---- */
.ps-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.ps-stats div {
    text-align: center; padding: 12px 6px; border-radius: 16px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
}
.ps-stats b { display: block; font-size: 1.4rem; font-weight: 900; color: #ffd60a; }
.ps-stats span { font-size: 0.8rem; color: var(--ps-dim); }

.ps-history h3 { margin: 18px 0 8px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ps-dim); }
.ps-chips { display: flex; flex-direction: column; gap: 6px; }
.ps-chip {
    --c1: #fff;
    text-align: left; min-height: 44px; padding: 8px 12px; border-radius: 12px; cursor: pointer;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--c1);
    color: #e9e6ff; font-size: 0.9rem; line-height: 1.35;
}
.ps-chip:hover { background: rgba(255, 255, 255, 0.1); }

.ps-favs { margin-top: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); }
.ps-favs summary { min-height: 48px; display: flex; align-items: center; padding: 0 16px; cursor: pointer; font-weight: 800; }
.ps-favs ul { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.ps-favs li {
    --c1: #fff;
    display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.05); border-left: 4px solid var(--c1); font-size: 0.92rem; line-height: 1.35;
}
.ps-favs li span { flex: 1; }
.ps-favs li.ps-fav-empty { border-left-color: transparent; color: var(--ps-dim); }
.ps-fav-rm {
    flex: none; width: 44px; height: 44px; border-radius: 10px; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, 0.08); color: #fff;
}

/* ---- avvisi ---- */
.ps-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 10001;
    transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
    padding: 12px 22px; border-radius: 999px;
    background: #1f1147; color: #fff; font-weight: 700; border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    transition: transform .3s, opacity .3s;
}
.ps-toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.ps-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ps-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 10000; }

/* ---- testo per Google ---- */
.ps-seo {
    margin-top: 40px; padding: 24px; border-radius: 20px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
}
.ps-seo h2 { font-size: 1.2rem; margin: 0 0 8px; color: #fff; }
.ps-seo h2:not(:first-child) { margin-top: 18px; }
.ps-seo p { margin: 0; color: var(--ps-dim); line-height: 1.7; }

/* ---- telefono ---- */
@media (max-width: 860px) {
    .ps-stage { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .ps-app { border-radius: 0; margin: 0 -2px 30px; padding: 22px 14px 32px; }
    .ps-hero p { font-size: 0.98rem; }
}
@media (max-width: 480px) {
    .ps-tools { grid-template-columns: repeat(2, 1fr); }
    .ps-spin, .ps-daily { width: 100%; }
    .ps-name { flex: 1 1 100%; }
    .ps-name input { width: 100%; max-width: none; }
    .ps-card { padding: 24px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .ps-blob, .ps-stars, .ps-rays, .ps-hero h1, .ps-hub::after, .ps-empty-emoji { animation: none !important; }
}
