
    :root {
        --primary: #4F46E5;
        --primary-hover: #4338CA;
        --secondary: #10B981;
        --danger: #F43F5E;
        --dark: #0F172A;
        --gray-bg: #F8FAFC;
        --gray-border: #E2E8F0;
        --text-muted: #64748B;
    }

    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        -webkit-tap-highlight-color: transparent;
    }

    html, body {
        width: 100%;
        height: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-x: hidden;
    }

    body {
        background: linear-gradient(135deg, #090D16 0%, #111827 50%, #0F172A 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px 14px;
    }

    /* ==========================================================================
       BORDO ANIMATO ROTANTE E GLOW (COMPATIBILE iOS / SAFARI)
       ========================================================================== */
    .glow-box-wrapper {
        position: relative;
        width: 100%;
        max-width: 524px;
        margin: auto;
        border-radius: 28px;
        padding: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: visible;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .glow-border-layer {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        border-radius: 28px;
        overflow: hidden;
        z-index: 1;
        pointer-events: none;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .glow-border-layer::before {
        content: '';
        position: absolute;
        top: -60%;
        left: -60%;
        width: 220%;
        height: 220%;
        background: conic-gradient(
            from 0deg,
            #FF4500 0deg,
            #FF007A 70deg,
            #7928CA 140deg,
            #0070F3 210deg,
            #00DFD8 280deg,
            #10B981 330deg,
            #FF4500 360deg
        );
        animation: spinGlow 4s linear infinite;
        -webkit-animation: spinGlow 4s linear infinite;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .glow-blur-layer {
        position: absolute;
        top: -3px; left: -3px; right: -3px; bottom: -3px;
        border-radius: 28px;
        z-index: 0;
        pointer-events: none;
        filter: blur(20px);
        -webkit-filter: blur(20px);
        opacity: 0.9;
        overflow: hidden;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .glow-blur-layer::before {
        content: '';
        position: absolute;
        top: -60%;
        left: -60%;
        width: 220%;
        height: 220%;
        background: conic-gradient(
            from 0deg,
            #FF4500 0deg,
            #FF007A 70deg,
            #4F46E5 140deg,
            #0070F3 210deg,
            #00DFD8 280deg,
            #10B981 330deg,
            #FF4500 360deg
        );
        animation: spinGlow 4s linear infinite;
        -webkit-animation: spinGlow 4s linear infinite;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    @keyframes spinGlow {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    @-webkit-keyframes spinGlow {
        0% { -webkit-transform: rotate(0deg); }
        100% { -webkit-transform: rotate(360deg); }
    }

    .app-container {
        width: 100%;
        background-color: #FFFFFF;
        border-radius: 22px;
        height: 88vh;
        max-height: 840px;
        min-height: 600px;
        display: flex;
        flex-direction: column;
        position: relative;
        z-index: 2;
        padding: 26px 22px;
        overflow: hidden;
    }

    /* FIX IPHONE E SMARTPHONE (100dvh + BORDO NEON VISIBILE) */
    @media (max-width: 600px) {
        body {
            padding: 8px 6px;
            height: 100dvh;
            max-height: 100dvh;
            overflow: hidden;
        }
        .glow-box-wrapper {
            max-width: 100%;
            height: 100%;
            max-height: 100%;
            border-radius: 22px;
            padding: 4px;
        }
        .glow-border-layer {
            border-radius: 22px;
            display: block !important;
        }
        .glow-blur-layer {
            border-radius: 22px;
            display: block !important;
            filter: blur(14px);
            -webkit-filter: blur(14px);
            opacity: 0.85;
        }
        .app-container {
            height: 100%;
            max-height: 100%;
            min-height: 0;
            border-radius: 18px;
            padding: 16px 14px 10px 14px;
        }
    }

    .header {
        position: relative;
        text-align: center;
        margin-bottom: 8px;
        padding: 0;
        flex-shrink: 0;
    }
    .header h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; color: var(--primary); font-weight: 800; line-height: 1.2; margin-top: 2px; }

    .header-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .badge-location {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #EEF2FF;
        color: var(--primary);
        padding: 5px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
    }

    .badge-separator {
        width: 1px;
        height: 12px;
        background-color: rgba(79, 70, 229, 0.25);
        display: inline-block;
    }

    .badge-steps-inline {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

    .step-dot {
        font-size: 7px;
        color: rgba(79, 70, 229, 0.25);
        transition: all 0.25s ease;
    }
    .step-dot.active {
        color: var(--primary);
        transform: scale(1.3);
    }
    .step-dot.completed {
        color: var(--secondary);
    }

    .language-select {
        background: var(--gray-bg);
        border: 1px solid var(--gray-border);
        border-radius: 12px;
        padding: 4px 8px;
        font-size: 11.5px;
        font-weight: 600;
        color: var(--dark);
        outline: none;
        cursor: pointer;
    }

    .btn-back {
        position: absolute;
        left: -8px;
        top: 18px;
        background: none;
        border: none;
        font-size: 20px;
        color: var(--dark);
        cursor: pointer;
        padding: 6px;
        display: none;
        transition: color 0.2s;
    }
    .btn-back:hover { color: var(--primary); }

    .step-panel {
        display: none;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        animation: fadeIn 0.3s ease-in-out;
        overflow-y: auto;
        padding-bottom: 8px;
    }
    .step-panel.active { display: flex; }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateX(10px); }
        to { opacity: 1; transform: translateX(0); }
    }

    .reward-card { border: 2px solid var(--gray-border); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.2s ease; background: #FFFFFF; }
    .reward-card:hover { border-color: var(--primary); }
    .reward-card.selected { border-color: var(--primary); background: #EEF2FF; }
    .reward-card i.icon { font-size: 22px; color: var(--primary); width: 28px; text-align: center; }
    .reward-card h4 { font-size: 14px; color: var(--dark); font-weight: 700; }
    .reward-card p { font-size: 12px; color: var(--text-muted); }

    .thumbs-grid { display: flex; gap: 14px; margin: 16px 0; }
    .thumb-btn { flex: 1; padding: 18px 10px; border-radius: 18px; border: 2px solid var(--gray-border); background: white; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: all 0.2s ease; }
    .thumb-btn i { font-size: 34px; }
    .thumb-btn.up { color: var(--secondary); }
    .thumb-btn.up.selected, .thumb-btn.up:hover { border-color: var(--secondary); background: #ECFDF5; }
    .thumb-btn.down { color: var(--danger); }
    .thumb-btn.down.selected, .thumb-btn.down:hover { border-color: var(--danger); background: #FFF1F2; }

    /* ==========================================================================
       FIX DEFINITIVO DEI TAG (PILLOLE COMPATTE ORIZZONTALI)
       ========================================================================== */
    .tags-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-content: flex-start !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        margin: 8px 0 !important;
        padding: 4px !important;
        width: 100% !important;
    }

    .tag-chip {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        height: auto !important;
        min-height: unset !important;
        flex: 0 0 auto !important;
        padding: 9px 16px !important;
        border-radius: 9999px !important;
        border: 1.5px solid var(--gray-border) !important;
        background: #FFFFFF !important;
        font-size: 12.5px !important;
        font-weight: 600 !important;
        line-height: 1.25 !important;
        color: var(--dark) !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        user-select: none !important;
        text-align: center !important;
        white-space: normal !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    }

    .tag-chip.selected-pos {
        border-color: var(--secondary) !important;
        background: #ECFDF5 !important;
        color: #047857 !important;
        font-weight: 700 !important;
    }

    .tag-chip.selected-neg {
        border-color: var(--danger) !important;
        background: #FFF1F2 !important;
        color: #9F1239 !important;
        font-weight: 700 !important;
    }

    .feedback-textarea, .review-textarea {
        width: 100%;
        border: 1.5px solid var(--gray-border);
        border-radius: 12px 12px 0 0;
        padding: 12px;
        font-size: 13.5px;
        resize: none;
        outline: none;
        font-family: inherit;
        color: var(--dark);
        transition: border-color 0.2s;
    }
    .feedback-textarea { height: 105px; margin-top: 6px; }
    .feedback-textarea:focus { border-color: var(--danger); }

    .review-textarea { height: 135px; min-height: 110px; background: #FFFFFF; border-color: var(--primary); margin-bottom: 0px; line-height: 1.45; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.05); }
    .review-textarea:focus { border-color: var(--primary-hover); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
    .review-textarea.moderated { border-color: var(--gray-border); box-shadow: none; }
    .review-textarea.moderated:focus { border-color: var(--dark); }

    .bottom-action {
        margin-top: auto;
        padding-top: 10px;
        background: #FFFFFF;
        width: 100%;
        flex-shrink: 0;
    }

    .btn-primary { background: var(--primary); color: white; border: none; border-radius: 14px; padding: 14px; font-size: 15px; font-weight: 700; width: 100%; cursor: pointer; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35); display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; }
    .btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
    .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

    .btn-save-voucher { background: #0F172A; color: white; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25); margin-top: 8px; font-size: 12.5px; padding: 10px; }
    .btn-save-voucher:hover { background: #1E293B; }

    .btn-dark { background: var(--dark); box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25); }
    .btn-dark:hover { background: #1E293B; }

    .btn-split { display: flex; gap: 10px; }
    .btn-split .btn-primary { flex: 1; padding: 12px 8px; font-size: 13.5px; }

    .reward-badge-box { border: 2px dashed var(--secondary); background: #ECFDF5; padding: 10px 12px; border-radius: 14px; text-align: center; margin-bottom: 10px; }
    .reward-badge-box h3 { font-size: 22px; color: var(--dark); font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; letter-spacing: 1px; }

    .modal-overlay {
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(15, 23, 42, 0.75);
        backdrop-filter: blur(5px);
        z-index: 2000;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 16px;
    }
    .modal-overlay.active { display: flex; animation: fadeIn 0.2s ease-out; }
    .modal-card {
        background: #FFFFFF;
        width: 100%;
        max-width: 420px;
        border-radius: 22px;
        padding: 24px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        text-align: center;
    }
    .modal-icon-circle {
        width: 58px; height: 58px;
        border-radius: 50%;
        background: #ECFDF5;
        color: var(--secondary);
        font-size: 26px;
        display: flex; align-items: center; justify-content: center;
        margin: 0 auto 12px;
    }

    .out-of-credits-box {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        flex: 1;
        padding: 20px 10px;
    }
    .out-of-credits-icon { font-size: 54px; color: #F59E0B; margin-bottom: 16px; }
    .out-of-credits-title { font-size: 19px; font-weight: 800; color: var(--dark); font-family: 'Plus Jakarta Sans', sans-serif; margin-bottom: 12px; line-height: 1.3; }
    .out-of-credits-text { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; }
    .out-of-credits-badge { background: #FEF3C7; color: #92400E; font-weight: 700; font-size: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid #FCD34D; display: inline-flex; align-items: center; gap: 6px; }

    .google-icon-wrapper { display: flex; justify-content: center; margin-bottom: 8px; }
    .google-icon-circle { width: 44px; height: 44px; border-radius: 50%; background: #FFFFFF; border: 1px solid var(--gray-border); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); display: flex; align-items: center; justify-content: center; }

    #qr-temp-container { display: none; width: 200px; height: 200px; }
