/* ==========================================
   ANXA 2.0 - QUIZ FRENTANO STYLESHEET
   ========================================== */

.quiz-page-wrapper {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 60px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header Sezione */
.quiz-header-section {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
}

.quiz-page-title {
    font-size: 32px;
    font-weight: 900;
    color: #0033A0; /* Blu ANXA */
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

html.rossonero-mode .quiz-page-title {
    color: #FF3D00;
}

.quiz-page-subtitle {
    font-size: 14px;
    color: var(--text-muted, #64748B);
    margin: 0;
    font-weight: 500;
    line-height: 1.4;
}

/* Container Principale */
.quiz-main-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================
   VISTA 1: CORSO DEL GIOCO (GAME VIEW)
   ========================================== */
.quiz-game-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

/* Barra Progresso & Contatore */
.quiz-progress-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main, #1E293B);
}

.quiz-counter-text strong {
    color: #0033A0;
}

html.rossonero-mode .quiz-counter-text strong {
    color: #FFE066;
}

.quiz-score-pill {
    background: rgba(0, 51, 160, 0.08);
    border: 1px solid rgba(0, 51, 160, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    color: #0033A0;
    font-size: 12px;
    font-weight: 800;
}

html.rossonero-mode .quiz-score-pill {
    background: rgba(255, 224, 102, 0.12);
    border-color: rgba(255, 224, 102, 0.3);
    color: #FFE066;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

html.rossonero-mode .progress-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0033A0 0%, #007AFF 50%, #FFE066 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
}

html.rossonero-mode .progress-bar-fill {
    background: linear-gradient(90deg, #CC0000 0%, #FF3D00 50%, #FFE066 100%);
}

/* Card Domanda */
.quiz-card-box {
    width: 100%;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--card-border, rgba(0, 51, 160, 0.12));
    border-radius: 20px;
    padding: 24px 20px;
    box-sizing: border-box;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: background 0.3s, border-color 0.3s;
}

html.rossonero-mode .quiz-card-box {
    background: #121212;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.quiz-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 51, 160, 0.08);
    color: #0033A0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

html.rossonero-mode .quiz-category-tag {
    background: rgba(255, 224, 102, 0.15);
    color: #FFE066;
}

.quiz-question-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main, #0F172A);
    line-height: 1.4;
    margin: 0;
}

/* Griglia Risposte */
.quiz-answers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.quiz-answer-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--card-border, rgba(0, 51, 160, 0.15));
    background: var(--btn-neutral-bg, rgba(0, 51, 160, 0.03));
    color: var(--text-main, #1E293B);
    font-size: 14.5px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

html.rossonero-mode .quiz-answer-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: #F8FAFC;
}

.quiz-answer-btn:hover:not(:disabled) {
    background: rgba(0, 51, 160, 0.08);
    border-color: #0033A0;
    transform: translateY(-1px);
}

html.rossonero-mode .quiz-answer-btn:hover:not(:disabled) {
    background: rgba(255, 224, 102, 0.12);
    border-color: #FFE066;
}

.quiz-answer-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.quiz-answer-btn:disabled {
    cursor: default;
}

/* Stati Risposta Selezionata: Corretta (Verde) / Errata (Rosso) */
.quiz-answer-btn.answer-correct {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%) !important;
    border-color: #4CAF50 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.25);
}

.quiz-answer-btn.answer-wrong {
    background: linear-gradient(135deg, #C62828 0%, #B71C1C 100%) !important;
    border-color: #EF5350 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.25);
}

.quiz-answer-btn.answer-dimmed {
    opacity: 0.55;
}

.answer-badge-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: bold;
}

.quiz-answer-btn.answer-correct .answer-badge-icon {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.quiz-answer-btn.answer-wrong .answer-badge-icon {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Feedback Box */
.quiz-feedback-box {
    padding: 14px 16px;
    border-radius: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 4px;
    animation: fadeInFeedback 0.3s ease;
}

@keyframes fadeInFeedback {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.quiz-feedback-box.feedback-success {
    background: rgba(46, 125, 50, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #2E7D32;
}

html.rossonero-mode .quiz-feedback-box.feedback-success {
    background: rgba(46, 125, 50, 0.2);
    color: #81C784;
}

.quiz-feedback-box.feedback-error {
    background: rgba(198, 40, 40, 0.1);
    border: 1px solid rgba(239, 83, 80, 0.3);
    color: #C62828;
}

html.rossonero-mode .quiz-feedback-box.feedback-error {
    background: rgba(198, 40, 40, 0.2);
    color: #EF5350;
}

.feedback-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.feedback-title {
    font-size: 14px;
    font-weight: 800;
}

.feedback-desc {
    font-size: 12.5px;
    margin-top: 2px;
    opacity: 0.9;
    line-height: 1.35;
}

/* Pulsante Prossima Domanda */
.quiz-next-action-row {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

.btn-quiz-next {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0033A0 0%, #002270 100%);
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 51, 160, 0.3);
    transition: all 0.2s ease;
}

html.rossonero-mode .btn-quiz-next {
    background: linear-gradient(135deg, #FFE066 0%, #FFB300 100%);
    color: #000000;
    box-shadow: 0 4px 14px rgba(255, 224, 102, 0.3);
}

.btn-quiz-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 51, 160, 0.4);
}

.btn-quiz-next:active {
    transform: scale(0.98);
}

/* ==========================================
   VISTA 2: CARD SOCIAL PREMIO 1:1 (RESULT VIEW)
   ========================================== */
.quiz-result-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.quiz-result-card-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Card Quadratina 1:1 Compatta */
.quiz-result-box {
    width: 100%;
    max-width: 385px;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 20px;
    box-sizing: border-box;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
    user-select: none;
    transition: background 0.4s ease, border-color 0.4s ease;
}

/* Effetto Riflesso Vetro Lucido (Pseudo-elementi ::before & ::after) */
.quiz-result-box::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.38) 0%,
        rgba(255, 255, 255, 0.18) 25%,
        rgba(255, 255, 255, 0.05) 45%,
        transparent 65%
    );
    transform: rotate(-28deg);
    pointer-events: none;
    z-index: 10;
    transition: transform 0.6s ease, opacity 0.4s ease;
}

.quiz-result-box::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.25), transparent 70%);
    pointer-events: none;
    z-index: 11;
}

@media (hover: hover) and (pointer: fine) {
    .quiz-result-box:hover::before {
        transform: rotate(-28deg) translate(3%, 3%);
    }
}

/* ==========================================
   4 VARIANTI COLORE CARD SOCIAL
   ========================================== */

/* 1. Variante Verde (WhatsApp Style) */
.quiz-result-box.layout-green {
    background: linear-gradient(135deg, #075E54 0%, #128C7E 50%, #25D366 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

/* 2. Variante Blu (Facebook Style) */
.quiz-result-box.layout-blue {
    background: linear-gradient(135deg, #0A192F 0%, #174EA6 50%, #1877F2 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

/* 3. Variante Gradient (Instagram Style) */
.quiz-result-box.layout-gradient {
    background: linear-gradient(135deg, #833AB4 0%, #FD1D1D 50%, #F56040 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

/* 4. Variante Neon (Muro di Mattoni Scuri + Radial Glow) */
.quiz-result-box.layout-neon {
    background-color: #0D0606;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(255, 61, 0, 0.35) 0%, rgba(0, 0, 0, 0.85) 75%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40' viewBox='0 0 80 40'%3E%3Cpath d='M0 0h80v40H0z' fill='%23120a0a'/%3E%3Cpath d='M0 0h78v18H0zM0 20h38v18H0zM40 20h38v18H40z' fill='%231f1212'/%3E%3Cpath d='M0 18h80v2H0zM0 38h80v2H0zM38 20h2v18h-2zM78 0h2v18h-2z' fill='%23080404'/%3E%3C/svg%3E");
    background-size: cover, 80px 40px;
    color: #FFE066;
    border: 1.5px solid rgba(255, 61, 0, 0.4);
    box-shadow: 0 0 25px rgba(255, 61, 0, 0.25);
}

/* Elementi Interni Card Premio */
.quiz-result-box .card-shape-1 {
    position: absolute;
    bottom: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.quiz-result-box .card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
}

.quiz-result-box .brand-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quiz-result-box .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FFE066;
}

.quiz-result-box .badge-text {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.quiz-result-box .card-category-tag {
    font-size: 11px;
    font-weight: 800;
    opacity: 0.85;
    letter-spacing: 0.3px;
    color: #ffffff;
}

/* Body Centrale Risultato */
.quiz-result-body {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.res-score-badge {
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    color: #ffffff;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.layout-neon .res-score-badge {
    color: #FFE066;
    text-shadow: 0 0 12px #FF3D00, 0 0 24px #FF3D00;
}

.res-pct-pill {
    display: inline-block;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
}

.layout-neon .res-pct-pill {
    background: rgba(255, 61, 0, 0.25);
    border-color: rgba(255, 224, 102, 0.4);
    color: #FFE066;
}

.res-outcome-badge {
    font-size: 17px;
    font-weight: 900;
    margin-top: 14px;
    color: #FFE066;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    line-height: 1.25;
}

.layout-neon .res-outcome-badge {
    color: #FFE066;
    text-shadow: 0 0 10px #FF3D00, 0 0 20px #FF3D00;
}

.res-outcome-msg {
    font-size: 13.5px;
    font-weight: 700;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.35;
    max-width: 90%;
}

.layout-neon .res-outcome-msg {
    color: #ffffff;
    text-shadow: 0 0 6px rgba(255, 61, 0, 0.8);
}

/* Footer Card */
.quiz-result-box .card-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
    padding-top: 10px;
    z-index: 2;
}

.quiz-result-box .footer-brand-tag {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #ffffff;
}

.layout-neon .footer-brand-tag {
    color: #FFE066;
    text-shadow: 0 0 8px #FF3D00;
}

.quiz-result-box .footer-subtext {
    font-size: 10px;
    font-weight: 800;
    opacity: 0.85;
    letter-spacing: 0.5px;
    color: #ffffff;
}

/* ==========================================
   BARRA PULSANTI COMANDI ESTERNI
   ========================================== */
.quiz-action-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 385px;
    margin-top: 16px;
}

.quiz-action-bar button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 12px;
    border-radius: 14px;
    border: none;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quiz-action-bar button:active {
    transform: scale(0.96);
}

.quiz-action-bar .btn-refresh {
    background: #ffffff;
    color: #0033A0;
    border: 1px solid rgba(0, 51, 160, 0.15);
}

html.rossonero-mode .quiz-action-bar .btn-refresh {
    background: #1E293B;
    color: #F8FAFC;
    border-color: rgba(255, 255, 255, 0.15);
}

.quiz-action-bar .btn-color {
    background: rgba(0, 51, 160, 0.08);
    color: #0033A0;
    border: 1px solid rgba(0, 51, 160, 0.15);
}

html.rossonero-mode .quiz-action-bar .btn-color {
    background: rgba(255, 224, 102, 0.15);
    color: #FFE066;
    border-color: rgba(255, 224, 102, 0.3);
}

.quiz-action-bar .btn-share {
    background: linear-gradient(135deg, #0033A0 0%, #002270 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 51, 160, 0.3);
}

html.rossonero-mode .quiz-action-bar .btn-share {
    background: linear-gradient(135deg, #FFE066 0%, #FFB300 100%);
    color: #000000;
    box-shadow: 0 4px 14px rgba(255, 224, 102, 0.3);
}

.quiz-action-bar button:hover {
    transform: translateY(-1.5px);
}

/* Mobile Breakpoints */
@media (max-width: 480px) {
    .quiz-page-wrapper {
        padding: 16px 12px 50px 12px;
    }

    .quiz-page-title {
        font-size: 26px;
    }

    .quiz-card-box {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .quiz-question-title {
        font-size: 16.5px;
    }

    .quiz-answer-btn {
        min-height: 46px;
        font-size: 13.5px;
        padding: 10px 14px;
    }

    .quiz-result-box {
        max-width: 360px;
        padding: 18px 16px;
        border-radius: 18px;
    }

    .res-score-badge {
        font-size: 36px;
    }

    .res-outcome-badge {
        font-size: 15px;
    }

    .res-outcome-msg {
        font-size: 12.5px;
    }

    .quiz-action-bar {
        flex-direction: column;
        width: 100%;
        max-width: 360px;
    }

    .quiz-action-bar button {
        width: 100%;
        padding: 12px;
    }
}


/* ==========================================================================
   QUIZ FRENTANO - FIX TEMA SCURO REALE
   Coerente con la palette di Territori
   ========================================================================== */

html.rossonero-mode .quiz-page-title,
html.rossonero-mode .quiz-question-title {
    color: #FFD54F !important;
}

html.rossonero-mode .quiz-page-subtitle,
html.rossonero-mode .progress-info-row {
    color: #E5E7EB !important;
}

html.rossonero-mode .quiz-card-box {
    background: #121212 !important;
    color: #F5F5F5 !important;
    border: 1.5px solid rgba(255, 213, 79, .28) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.42) !important;
}

html.rossonero-mode .quiz-category-tag,
html.rossonero-mode .quiz-score-pill {
    background: rgba(255, 213, 79, .12) !important;
    color: #FFD54F !important;
    border-color: rgba(255, 213, 79, .22) !important;
}

html.rossonero-mode .quiz-answer-btn {
    background: #1D1D1D !important;
    color: #F5F5F5 !important;
    border: 1.5px solid rgba(255, 213, 79, .22) !important;
    box-shadow: none !important;
}

html.rossonero-mode .quiz-answer-btn:hover:not(:disabled) {
    background: #242424 !important;
    color: #FFD54F !important;
    border-color: rgba(255, 213, 79, .60) !important;
}

html.rossonero-mode .quiz-answer-btn.answer-correct {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%) !important;
    border-color: #4CAF50 !important;
    color: #FFFFFF !important;
}

html.rossonero-mode .quiz-answer-btn.answer-wrong {
    background: linear-gradient(135deg, #C62828 0%, #B71C1C 100%) !important;
    border-color: #EF5350 !important;
    color: #FFFFFF !important;
}

html.rossonero-mode .quiz-answer-btn.answer-dimmed {
    opacity: .58 !important;
}

html.rossonero-mode .progress-bar-bg {
    background: #202020 !important;
    border-color: rgba(255,255,255,.10) !important;
}

html.rossonero-mode .progress-bar-fill {
    background: linear-gradient(90deg, #FFD54F 0%, #F2C94C 100%) !important;
}

html.rossonero-mode .btn-quiz-next {
    background: #FFD54F !important;
    color: #111 !important;
    box-shadow: 0 4px 14px rgba(255, 213, 79, .20) !important;
}

html.rossonero-mode .quiz-feedback-box.feedback-success {
    background: rgba(46,125,50,.20) !important;
    color: #A5D6A7 !important;
    border-color: rgba(76,175,80,.42) !important;
}

html.rossonero-mode .quiz-feedback-box.feedback-error {
    background: rgba(198,40,40,.20) !important;
    color: #FF8A80 !important;
    border-color: rgba(239,83,80,.42) !important;
}
