/* ===== Oracolo di Belline — carte, mazzo e area consiglio =====
   Regole delle carte: NON MODIFICATE (vincolo restyling).
   Caricato dalle pagine di lettura (stesa, narrativa). */

.advice-cards-box {
    background: var(--panel-strong);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.advice-card-item {
    padding: 0.85rem 0;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.35);
    text-align: left;
}

.advice-card-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.gold-separator {
    color: var(--gold);
    font-size: 1.4rem;
    letter-spacing: 0.9rem;
    padding-left: 0.9rem;
    text-shadow: 0 0 18px rgba(212, 175, 55, 0.7);
}

#belline-speak-btn.playing {
    background: linear-gradient(45deg, var(--rich-burgundy), var(--mystic-purple));
    color: var(--soft-cream);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.belline-card {
    background: linear-gradient(180deg, rgba(41, 24, 74, 0.82), rgba(22, 13, 40, 0.88));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 26px 70px -18px rgba(0, 0, 0, 0.8), 0 4px 16px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    overflow: hidden;
}

.belline-card:hover {
    transform: translateY(-8px) scale(1.04);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.85), 0 0 30px rgba(212, 175, 55, 0.28), 0 4px 16px rgba(0, 0, 0, 0.55);
}

.belline-card.revealed {
    cursor: default;
}

.card-image {
    width: 100%;
    border-bottom: 1px solid rgba(212, 175, 55, 0.35);
    object-fit: cover;
}

/* Rituale "mescola il mazzo": pulsazione mentre i gesti caricano l'entropia */
.belline-card.shuffling {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.55), 0 16px 40px -10px rgba(0, 0, 0, 0.6);
    animation: bellinePulse 0.9s ease-in-out infinite;
}

@keyframes bellinePulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.04); }
}

.belline-shuffle-track {
    width: min(18rem, 80vw);
    height: 8px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    overflow: hidden;
}

.belline-shuffle-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold));
    transition: width 0.15s ease;
}

/* Alone halo dietro la carta (stesa): stessa immagine, leggermente più
   grande, sfocata e dorata. Il box è posizionato via JS sul box della carta. */
.belline-grid-item.min {
    position: relative;
    padding-bottom: 0;
}

.belline-card-reflection {
    position: absolute;
    z-index: 0;
    overflow: hidden;
    border-radius: 16px;
    pointer-events: none;
    transform: scale(1.30);
    transform-origin: 50% 50%;
    filter: blur(9px) saturate(1.3) sepia(0.55) hue-rotate(-18deg) brightness(1.1);
    opacity: 0.5;
}

.belline-card-reflection img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.95) 55%, rgba(0, 0, 0, 0.3) 80%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.95) 55%, rgba(0, 0, 0, 0.3) 80%, transparent 100%);
}

/* ---- Rollover "presa in mano" sulle carte estratte (stesa) ---- */
.belline-grid-item.min .belline-card {
    position: relative;
    transform-origin: 50% 100%;
    will-change: transform;
    z-index: 1;
}

.belline-grid-item.min .belline-card:hover {
    z-index: 40;
    border-color: rgba(212, 175, 55, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
                0 30px 70px -16px rgba(0, 0, 0, 0.9),
                0 0 34px rgba(212, 175, 55, 0.45);
    animation: bellineCardInHand 1.1s ease-in-out 1 forwards;
}

/* Estrazioni: il deck cliccabile condivide lo stesso rollover "in mano" */
#belline-deck {
    position: relative;
    z-index: 1;
}

/* Flip 3D retro/fronte delle carte estratte (immagine) */
.belline-card.flip-ready {
    perspective: 1400px;
    overflow: visible;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.belline-card.flip-ready .card-flip {
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
}

.belline-card.flip-ready .card-back,
.belline-card.flip-ready .card-front {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
}

.belline-card.flip-ready .card-back {
    position: relative;
    display: block;
}

.belline-card.flip-ready .card-front {
    position: absolute;
    top: 0;
    left: 0;
    border: 1px solid rgba(212, 175, 55, 0.35);
    transform: rotateY(180deg);
}

/* Hint suspence: invito a toccare le carte coperte (nasce coperto) */
.belline-cover-hint {
    text-align: center;
    color: rgba(241, 212, 137, 0.95);
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    margin: -0.5rem 0 1.5rem;
    animation: coverHintPulse 2.4s ease-in-out infinite;
}

.belline-cover-hint::before {
    content: "✦ ";
}
.belline-cover-hint::after {
    content: " ✦";
}

@keyframes coverHintPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .belline-cover-hint { animation: none; opacity: 0.9; }
}

#belline-deck:hover {
    z-index: 40;
    border-color: rgba(212, 175, 55, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
                0 30px 70px -16px rgba(0, 0, 0, 0.9),
                0 0 34px rgba(212, 175, 55, 0.45);
    animation: bellineCardInHand 1.1s ease-in-out 1 forwards;
}

@keyframes bellineCardInHand {
    0%   { transform: translateY(-16px) scale(1.5) rotate(0deg); }
    30%  { transform: translateY(-22px) scale(1.5) rotate(-7deg); }
    65%  { transform: translateY(-16px) scale(1.5) rotate(5deg); }
    100% { transform: translateY(-16px) scale(1.5) rotate(-4deg); }
}

/* Scintille magiche sulle carte estratte */
.card-magic {
    position: relative;
}

.card-sparkle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #fff 0 30%, #F1D489 55%, rgba(212, 175, 55, 0) 72%);
    filter: drop-shadow(0 0 4px #F1D489) drop-shadow(0 0 12px rgba(212, 175, 55, 0.8));
    transform: rotate(45deg);
    pointer-events: none;
    z-index: 3;
    animation: twinkleSparkle 2.2s ease-in-out infinite;
}

.card-sparkle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    margin: -1.5px 0 0 -1.5px;
    background: #fff;
    border-radius: 1px;
}

@keyframes twinkleSparkle {
    0%, 100% { opacity: 0.2; transform: rotate(45deg) scale(0.5); }
    30% { opacity: 1; transform: rotate(45deg) scale(1.15); }
    60% { opacity: 0.55; transform: rotate(45deg) scale(0.85); }
}

/* Scia luminosa unica sotto le carte estratte */
.belline-row-sweep {
    grid-column: 1 / -1;
    position: relative;
    width: 100%;
    height: 2px;
    margin: 0.5rem auto 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, transparent,
                rgba(212, 175, 55, 0.42) 18%, rgba(212, 175, 55, 0.42) 82%, transparent);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.55));
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    pointer-events: none;
    opacity: 0;
    animation: sweepLife 8s ease-in-out infinite;
}

.belline-row-sweep::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 45%;
    border-radius: 9999px;
    background: linear-gradient(90deg, transparent 0%,
                rgba(241, 212, 137, 0.65) 55%, #F1D489 85%, #fff 100%);
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.85));
    animation: sweepAcross 6s ease-in-out infinite;
}

@keyframes sweepAcross {
    from { transform: translateX(-20%); }
    to { transform: translateX(222%); }
}

@keyframes sweepLife {
    0% { opacity: 0; }
    4% { opacity: 1; }
    70% { opacity: 1; }
    82% { opacity: 0; }
    100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .card-sparkle { animation: none; opacity: 0.6; }
    .belline-row-sweep { animation: none; opacity: 0.7; }
    .belline-row-sweep::before { animation: none; left: 25%; }
    .belline-grid-item.min .belline-card:hover {
        animation: none;
        transform: translateY(-16px) scale(1.35) rotate(-3deg);
    }
    #belline-deck:hover {
        animation: none;
        transform: translateY(-16px) scale(1.35) rotate(-3deg);
    }
}

@media (hover: none) and (pointer: coarse) {
    .belline-card:hover, .mystical-button:hover {
        transform: none;
    }
    .belline-grid-item.min .belline-card {
        animation: none;
    }
    #belline-deck {
        animation: none;
    }
}

/* ===== Wallet crediti ===== */

.belline-wallet-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--panel-strong);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 999px;
    color: var(--soft-cream);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.belline-wallet-chip strong {
    color: var(--gold);
    font-weight: 700;
}

.belline-wallet-chip .belline-wallet-coin {
    font-size: 1rem;
    line-height: 1;
}

.belline-wallet-chip .belline-wallet-cost {
    opacity: 0.75;
    font-size: 0.78rem;
}

.belline-wallet-chip.is-empty {
    border-color: rgba(128, 0, 32, 0.7);
    box-shadow: 0 0 18px rgba(128, 0, 32, 0.35);
}

/* ===== Account (Fase B.2, magic link email) ===== */

.belline-account-host {
    display: block;
    margin: 0 0 1.5rem;
}

.belline-account-bar {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(24, 15, 45, 0.55);
    border: 1px dashed rgba(212, 175, 55, 0.35);
    border-radius: 14px;
}

.belline-account-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--soft-cream);
    background: linear-gradient(135deg, rgba(128, 0, 32, 0.85), rgba(80, 0, 24, 0.9));
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.belline-account-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}

.belline-account-btn.is-secondary {
    background: rgba(45, 27, 69, 0.7);
    border-color: rgba(212, 175, 55, 0.3);
}

.belline-account-hint,
.belline-account-email,
.belline-account-sending {
    color: var(--soft-cream);
    font-size: 0.82rem;
    opacity: 0.9;
    letter-spacing: 0.02em;
}

.belline-account-error {
    color: #ff9a9a;
    font-size: 0.82rem;
}

.belline-account-form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.belline-account-label {
    color: var(--gold);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.belline-account-input {
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--cream);
    background: rgba(255, 252, 245, 0.07);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    min-width: 15rem;
    max-width: 100%;
}

.belline-account-input:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.8);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

/* ===== Azioni in navbar: crediti + account ===== */

.nav-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    min-height: 44px;
}

.nav-actions .belline-wallet-chip {
    margin-bottom: 0;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: rgba(24, 15, 45, 0.55);
}

.nav-actions .belline-account-host {
    margin: 0;
    display: inline-flex;
}

.nav-actions .belline-account-bar {
    padding: 0.35rem 0.8rem;
    background: rgba(24, 15, 45, 0.55);
    border-style: solid;
    border-radius: 999px;
}

.nav-actions .belline-account-hint {
    display: none;
}

.nav-actions .belline-account-input {
    min-width: 12rem;
}

/* Seconda riga dedicata su mobile (nav già piena di link) */
@media (max-width: 768px) {
    .nav-actions {
        flex-basis: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 0.4rem;
        order: 5;
    }
    .site-nav:has(.nav-actions) + main {
        padding-top: 12.5rem;
    }
}

/* ===== Storico letture (Fase A) ===== */

.belline-history-section {
    margin-bottom: 2rem;
}

.belline-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.belline-history-item {
    padding: 0.85rem 1rem;
    background: rgba(45, 27, 69, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 12px;
    text-align: left;
}

.belline-history-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin-bottom: 0.25rem;
}

.belline-history-date {
    color: var(--gold);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.belline-history-cards {
    color: var(--soft-cream);
    font-size: 0.9rem;
}

.belline-history-blue {
    font-size: 0.72rem;
    color: #9AD1FF;
    border: 1px solid rgba(154, 209, 255, 0.4);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.belline-history-q {
    display: block;
    color: var(--soft-cream);
    font-size: 0.88rem;
    margin: 0.25rem 0;
}

.belline-history-q.is-muted {
    opacity: 0.6;
}

.belline-history-toggle {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 0.82rem;
    padding: 0.25rem 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.belline-history-advice {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(212, 175, 55, 0.3);
    color: var(--soft-cream);
    font-size: 0.85rem;
    line-height: 1.55;
    max-height: 14rem;
    overflow-y: auto;
}

.belline-account-teaser {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(45, 27, 69, 0.6), rgba(128, 0, 32, 0.35));
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 14px;
}

.belline-account-teaser-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.belline-account-teaser-text {
    color: var(--soft-cream);
    font-size: 0.85rem;
    line-height: 1.55;
    opacity: 0.9;
}