    :root {
      --bg-light: #f8f9fa;
      --bg-dark: #121212;
      --text-light: #212529;
      --text-dark: #e9ecef;
      --primary: #4361ee;
      --success: #34a853;
      --danger: #ea4335;
      --warning: #f9c74f;
      --timer: #4361ee;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Inter', 'Segoe UI', sans-serif;
    }

    body {
      background: var(--bg-light);
      color: var(--text-light);
      height: 100vh;
      overflow: hidden;
      scroll-snap-type: y mandatory;
      transition: background 0.4s;
      position: relative;
    }

    body.dark {
      background: var(--bg-dark);
      color: var(--text-dark);
    }

    .app {
      height: 100vh;
      overflow-y: scroll;
      scroll-snap-type: y mandatory;
      -webkit-overflow-scrolling: touch;
    }

    .page {
      height: 100dvh;
      scroll-snap-align: start;
      display: flex;
      flex-direction: column;
    }

    /* HEADER */
    header {
      height: 10dvh;
      background: rgba(255, 255, 255, 0.9);
      backdrop-filter: blur(10px);
      color: #1a1a1a;
      padding: 1dvh 2vw;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid rgba(0,0,0,0.1);
      z-index: 10;
      position: sticky;
      top: 0;
    }

    body.dark header {
      background: rgba(30, 30, 30, 0.9);
      color: #fff;
      border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .logo {
      font-weight: 800;
      font-size: 1.6rem;
      background: linear-gradient(135deg, #4361ee, #3f37c9);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      display: flex;
      align-items: center;
      max-width: 40vw;
      height: 100%;
    }

    .logo img {
      max-height: 7dvh;
      max-width: 40vw;
      height: auto;
      width: auto;
      object-fit: contain;
      filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(224deg) brightness(91%) contrast(93%);
      transition: filter 0.3s;
    }

    body.dark .logo img {
      filter: brightness(0) invert(1);
    }

    .sponsored {
      font-size: 1.6dvh;
      opacity: 0.8;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5dvh;
      max-width: 40vw;
      height: 100%;
      justify-content: center;
    }

    .sponsor-rotate {
      position: relative;
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .sponsor-header-logo {
      max-height: 7dvh;
      max-width: 40vw;
      height: auto;
      width: auto;
      object-fit: contain;
      cursor: pointer;
    }

    .sponsored img {
      max-height: 7dvh;
      max-width: 40vw;
      height: auto;
      width: auto;
      object-fit: contain;
    }
    /* PAGE 1: QUIZ */
    .quiz-content {
      height: 83dvh;
      padding: 2dvh 3vw;
      display: flex;
      flex-direction: column;
      gap: 2dvh;
      max-width: 600px;
      margin: 0 auto;
      width: 100%;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .info-box {
      display: flex;
      align-items: center;
      gap: 1rem;
      justify-content: center;
      margin-bottom: 0.5rem;
      width: 100%;
    }

    .question-number,
    .round-number {
      flex: 1;
      text-align: center;
      background: rgba(255, 255, 255, 0.9);
      padding: 0.6rem 1rem;
      border-radius: 12px;
      font-size: 0.9rem;
      font-weight: 600;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transition: background 0.3s, box-shadow 0.3s;
    }

    body.dark .question-number,
    body.dark .round-number {
      background: rgba(255, 255, 255, 0.15);
      color: var(--text-dark);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .instruction {
      text-align: center;
      font-size: 1rem;
      font-weight: 500;
      line-height: 1.2;
      opacity: 0.9;
      padding: 0 1rem;
    }

    .options-grid {
      flex: 1;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      min-height: 0;
    }

    .option {
      border-radius: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2.8rem;
      font-weight: 900;
      color: white;
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 8px 25px rgba(0,0,0,0.15);
      position: relative;
      overflow: hidden;
    }

    .option::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
      opacity: 0;
      transition: opacity 0.3s;
    }

    .option:hover::before { opacity: 1; }
    .option:active { transform: scale(0.96); }

    .option.selected {
      transform: scale(0.94);
      box-shadow: 0 0 0 4px white, 0 12px 30px rgba(0,0,0,0.3);
    }

    .option.disabled {
      opacity: 0.5;
      cursor: not-allowed;
      pointer-events: none;
    }

    .option[data-answer="A"] { background: linear-gradient(135deg, #4285f4, #1a73e8); }
    .option[data-answer="B"] { background: linear-gradient(135deg, #34a853, #1e8e3e); }
    .option[data-answer="C"] { background: linear-gradient(135deg, #fbbc05, #f9a825); }
    .option[data-answer="D"] { background: linear-gradient(135deg, #ea4335, #d93025); }

    .timer-container {
      height: 10px;
      background: rgba(0,0,0,0.08);
      border-radius: 6px;
      overflow: hidden;
      margin-top: auto;
      position: relative;
    }

    body.dark .timer-container { background: rgba(255,255,255,0.1); }

    .timer-countdown {
      position: absolute;
      top: -25px;
      right: 0;
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--timer);
    }

    .timer-bar {
      height: 100%;
      width: 100%;
      position: relative;
      border-radius: 6px;
    }

    .timer-bar-fill {
      height: 100%;
      width: 100%;
      background: var(--timer);
      border-radius: 6px;
      transform-origin: left;
      box-shadow: 0 0 15px rgba(67, 97, 238, 0.4);
      transition: width 0.3s linear;
    }

    /* PAGE 2: ANSWER */
    .answer-content {
      height: 83dvh;
      padding: 2dvh 4vw;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 2dvh;
      max-width: 600px;
      margin: 0 auto;
      width: 100%;
      position: relative;
      overflow-y: auto;
      overflow-x: hidden;
    }

    /* PAGE 3: SPONSOR */
    .sponsor-content {
      height: 83dvh;
      padding: 1dvh 3vw;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1dvh;
      max-width: 600px;
      margin: 0 auto;
      width: 100%;
      position: relative;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .ranking-content {
      height: 83dvh;
      padding: 2dvh 4vw;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 2dvh;
      max-width: 600px;
      margin: 0 auto;
      width: 100%;
    }

    .sponsors-slider {
      flex: 1;
      width: 100%;
      min-height: 0;
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
    }

    .sponsors-slide {
      display: none;
      width: 100%;
      height: 100%;
      min-height: 0;
      animation: fadeIn 0.5s ease-out;
    }

    .sponsors-slide.active {
      display: block;
    }

    .sponsors-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: repeat(2, minmax(0, 1fr));
      gap: 2vw;
      width: 100%;
      height: 100%;
      align-items: stretch;
      justify-items: stretch;
      padding: 1vw;
    }

    .sponsors-grid-single {
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;
      max-width: 60%;
      margin: 0 auto;
    }

    .sponsor-logo {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
      transition: transform 0.3s;
      border-radius: 12px;
      cursor: pointer;
      background: rgba(255,255,255,0.95);
      padding: 8%;
    }
    body.dark .sponsor-logo {
      background: rgba(50,50,50,0.95);
    }

    .sponsor-logo:hover {
      transform: scale(1.05);
    }

    .slider-dots {
      display: flex;
      gap: 0.5rem;
      justify-content: center;
    }

    .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.3);
      cursor: pointer;
      transition: all 0.3s;
    }

    body.dark .dot {
      background: rgba(255, 255, 255, 0.3);
    }

    .dot.active {
      background: #4361ee;
      width: 24px;
      border-radius: 4px;
    }

    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    /* BOX RISULTATO UNICO */
    .result-box {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      position: relative;
      padding: 1rem 1rem 0.8rem;
      border-radius: 24px;
      backdrop-filter: blur(12px);
      animation: fadeUp 0.6s ease-out;
      z-index: 5;
      width: 100%;
      background: rgba(255, 255, 255, 0.8);
      box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    }

    body.dark .result-box {
      background: rgba(30, 30, 30, 0.9);
      box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    }

    /* Card corretta — verde */
    .result-box.correct {
      background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.05));
      border: 2px solid rgba(76, 175, 80, 0.4);
    }
    body.dark .result-box.correct {
      background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.08));
      border-color: rgba(76, 175, 80, 0.5);
    }

    /* Card sbagliata — rossa */
    .result-box.wrong {
      background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(244, 67, 54, 0.05));
      border: 2px solid rgba(244, 67, 54, 0.4);
    }
    body.dark .result-box.wrong {
      background: linear-gradient(135deg, rgba(244, 67, 54, 0.2), rgba(244, 67, 54, 0.08));
      border-color: rgba(244, 67, 54, 0.5);
    }

    /* Card non risposto — grigia */
    .result-box.unanswered {
      background: linear-gradient(135deg, rgba(158, 158, 158, 0.15), rgba(158, 158, 158, 0.05));
      border: 2px solid rgba(158, 158, 158, 0.3);
    }
    body.dark .result-box.unanswered {
      background: linear-gradient(135deg, rgba(158, 158, 158, 0.2), rgba(158, 158, 158, 0.08));
      border-color: rgba(158, 158, 158, 0.4);
    }

    /* Header: icona + punti affiancati */
    .result-header {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .result-icon {
      font-size: 2.5rem;
      animation: pop 0.6s ease-out;
    }
    .result-box.correct .result-icon { color: #4CAF50; }
    .result-box.wrong .result-icon { color: #F44336; }
    .result-box.unanswered .result-icon { color: #9E9E9E; }

    .result-text {
      font-size: 1.15rem;
      font-weight: 700;
      margin: 0;
    }

    .result-points-total {
      font-size: 2.2rem;
      font-weight: 900;
      line-height: 1;
    }
    .result-box.correct .result-points-total {
      background: linear-gradient(135deg, #4CAF50, #2E7D32);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .result-box.wrong .result-points-total {
      background: linear-gradient(135deg, #F44336, #C62828);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .result-details {
      font-size: 0.95rem;
      font-weight: 600;
      color: #FF9800;
    }
    .result-details:empty { display: none; }
    .result-details .fa-stopwatch { color: #757575; }
    body.dark .result-details .fa-stopwatch { color: #BDBDBD; }
    .detail-sep { color: #9E9E9E; margin: 0 2px; }

    .result-stats {
      font-size: 0.85rem;
      color: #757575;
      text-align: center;
    }
    body.dark .result-stats { color: #BDBDBD; }

    .info-box {
      margin-top: 6px;
    }
    .result-stats:empty { display: none; }

    /* ═══════════════════════════════════════════
       RANKING BOX (round_ranking, final_ranking)
       ═══════════════════════════════════════════ */
    .ranking-box {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      width: 100%;
      border-radius: 24px;
      padding: 1rem 1rem 0.8rem;
      box-shadow: 0 15px 40px rgba(0,0,0,0.08);
      border: 2px solid rgba(255, 193, 7, 0.4);
      background: linear-gradient(135deg, rgba(255, 193, 7, 0.12), rgba(255, 152, 0, 0.05));
      backdrop-filter: blur(12px);
      animation: fadeUp 0.6s ease-out;
    }
    body.dark .ranking-box {
      background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.08));
      box-shadow: 0 15px 40px rgba(0,0,0,0.3);
      border-color: rgba(255, 193, 7, 0.5);
    }

    /* Final ranking — colore più intenso */
    .ranking-box.final {
      border-color: rgba(255, 152, 0, 0.5);
      background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 193, 7, 0.05));
    }
    body.dark .ranking-box.final {
      background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 193, 7, 0.08));
      border-color: rgba(255, 152, 0, 0.6);
    }

    /* Ranking non in classifica — neutro */
    .ranking-box.not-ranked {
      border-color: rgba(158, 158, 158, 0.3);
      background: linear-gradient(135deg, rgba(158, 158, 158, 0.1), rgba(158, 158, 158, 0.03));
    }
    body.dark .ranking-box.not-ranked {
      background: linear-gradient(135deg, rgba(158, 158, 158, 0.15), rgba(158, 158, 158, 0.06));
      border-color: rgba(158, 158, 158, 0.4);
    }

    .ranking-label {
      font-size: 1.15rem;
      font-weight: 700;
    }

    .ranking-header {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .ranking-icon {
      font-size: 2.5rem;
    }
    /* Medaglie: oro, argento, bronzo */
    .ranking-icon.gold { color: #FFD700; }
    .ranking-icon.silver { color: #C0C0C0; }
    .ranking-icon.bronze { color: #CD7F32; }
    .ranking-icon.default { color: #FFC107; }

    .ranking-position {
      font-size: 2.2rem;
      font-weight: 900;
      line-height: 1;
      background: linear-gradient(135deg, #FFC107, #FF9800);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .ranking-points {
      font-size: 0.95rem;
      font-weight: 600;
      color: #757575;
    }
    body.dark .ranking-points {
      color: #BDBDBD;
    }

    /* Sponsor section sotto la card */
    .sponsors-section {
      margin-top: 16px;
      text-align: center;
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-height: 0;
      width: 100%;
    }
    .sponsors-section .sponsors-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      width: 100%;
    }
    .sponsors-label {
      font-size: 0.85rem;
      color: #9E9E9E;
      margin-bottom: 8px;
    }

    /* CONFETTI NEL BOX (solo qui) */
    .confetti-box {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      pointer-events: none;
      overflow: hidden;
      border-radius: 24px;
    }

    .confetti-particle {
      position: absolute;
      width: 8px;
      height: 8px;
      background: #4361ee;
      border-radius: 50%;
      pointer-events: none;
      animation: confettiFall 2s ease-out forwards;
    }

    @keyframes confettiFall {
      0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
      100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
    }

    .cta-box {
      background: linear-gradient(135deg, #4361ee, #3f37c9);
      color: white;
      padding: 1rem;
      border-radius: 20px;
      width: 100%;
      text-align: center;
      box-shadow: 0 10px 30px rgba(67, 97, 238, 0.3);
      animation: fadeUp 0.6s ease-out 0.2s both;
      z-index: 5;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }    

    .cta-title {
      font-size: 1.2rem;
      font-weight: 700;
    }

    .cta-text {
      font-size: 1rem;
      line-height: 1.4;
      opacity: 0.9;
    }

    .cta-buttons {
      display: flex;
      gap: 10px;
      width: 100%;
    }

    .cta-btn {
      background: white;
      color: #4361ee;
      border: none;
      padding: 0.9rem 1.8rem;
      border-radius: 50px;
      font-weight: 700;
      font-size: 1rem;
      cursor: pointer;
      transition: all 0.3s;
      flex: 1;
    }

    .cta-btn-secondary {
      background: transparent;
      color: white;
      border: 2px solid white;
    }

    .cta-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    }

    .cta-btn-secondary:hover {
      background: rgba(255, 255, 255, 0.1);
      box-shadow: 0 8px 20px rgba(255, 255, 255, 0.2);
    }

    .reactions {
      display: flex;
      gap: 1.2rem;
      animation: fadeUp 0.6s ease-out 0.4s both;
      position: relative;
      z-index: 10;
    }

    .reaction {
      font-size: 2.5rem;
      cursor: pointer;
      transition: transform 0.2s;
      position: relative;
    }

    .reaction:hover {
      transform: scale(1.2);
    }

    .reaction.liked {
      filter: drop-shadow(0 0 10px gold);
      animation: heartBeat 0.6s ease-out;
    }

    /* FLY EMOJI (full page + fade) */
    .fly-emoji {
      position: fixed;
      font-size: 2rem;
      pointer-events: none;
      z-index: 999;
      animation: flyAndFade 2s ease-out forwards;
    }

    @keyframes flyAndFade {
      0% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
      }
      100% { 
        transform: translateY(-120vh) rotate(720deg) scale(0.3); 
        opacity: 0; 
      }
    }

    .plus-one {
      position: absolute;
      top: -20px;
      left: 50%;
      transform: translateX(-50%);
      font-weight: bold;
      color: #4361ee;
      font-size: 1.2rem;
      pointer-events: none;
      z-index: 15;
      animation: plusUp 1s ease-out forwards;
    }

    @keyframes plusUp {
      to { 
        transform: translate(-50%, -60px); 
        opacity: 0; 
      }
    }

    /* PARTICELLE AL CLICK SU REACTION */
    .reaction-particle {
      position: absolute;
      width: 6px;
      height: 6px;
      background: #4361ee;
      border-radius: 50%;
      pointer-events: none;
      z-index: 15;
      animation: particleBurst 1s ease-out forwards;
    }

    @keyframes particleBurst {
      0% { transform: translateY(0) scale(1); opacity: 1; }
      100% { transform: translateY(-60px) scale(0.4); opacity: 0; }
    }

    /* FOOTER */
    footer {
      height: 7dvh;
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(10px);
      padding: 1dvh 2vw;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-top: 1px solid rgba(0,0,0,0.1);
      position: sticky;
      bottom: 0;
      z-index: 10;
    }

    body.dark footer {
      background: rgba(30, 30, 30, 0.95);
      border-top: 1px solid rgba(255,255,255,0.1);
    }

    .username {
      font-weight: 600;
      font-size: 1.8dvh;
      cursor: pointer;
      transition: color 0.3s;
      line-height: 1.3;
    }

    .username .real-name {
      font-size: 1.2dvh;
      font-weight: normal;
      opacity: 0.7;
    }

    .username:hover {
      color: #4361ee;
    }

    body.dark .username:hover {
      color: #5e7cee;
    }

    /* Dark Mode Toggle - Modern CSS with :has() */
    :root {
      --toggle-switch-pos: 2px;
    }

    :root:has(.dark-mode-toggle-input:checked) {
      --toggle-switch-pos: 24px;
    }

    .toggle-container {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .toggle-label {
      font-size: 0.9rem;
      white-space: nowrap;
    }

    /* Hide checkbox accessibly (non con display:none) */
    .toggle-container input[type="checkbox"] {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border-width: 0;
    }

    .toggle {
      position: relative;
      width: 48px;
      height: 24px;
      background: #ccc;
      border-radius: 50px;
      cursor: pointer;
      transition: background 0.3s ease;
      flex-shrink: 0;
    }

    .toggle:has(input[type="checkbox"]:checked) {
      background: #4361ee;
    }

    .toggle::after {
      content: '';
      position: absolute;
      width: 20px;
      height: 20px;
      background: white;
      border-radius: 50%;
      top: 2px;
      left: var(--toggle-switch-pos);
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Responsive toggle per schermi piccoli */
    @media (max-width: 768px) {
      :root:has(.dark-mode-toggle-input:checked) {
        --toggle-switch-pos: 20px;
      }

      .toggle {
        width: 40px;
        height: 20px;
      }

      .toggle::after {
        width: 16px;
        height: 16px;
      }

      .toggle-label {
        font-size: 0.8rem;
      }
    }

    /* ========== READY STATE - Countdown ========== */
    .ready-content {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
    }

    .ready-text {
      position: absolute;
      z-index: 2;
      font-size: 1.4rem;
      font-weight: 700;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.15em;
      text-shadow: 0 2px 8px rgba(255,255,255,0.5);
    }

    body.dark .ready-text {
      color: var(--text-dark);
      text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    }

    .ready-countdown-number {
      position: absolute;
      z-index: 1;
      font-weight: 800;
      line-height: 1;
      color: var(--primary);
      opacity: 0.25;
      transition: opacity 0.15s ease-out;
      /* Dimensione default (numeri > 3) */
      font-size: 12vh;
    }

    /* Dimensioni crescenti per 3, 2, 1 */
    .ready-countdown-number.countdown-3 {
      font-size: 18vh;
      color: #4361ee;
    }

    .ready-countdown-number.countdown-2 {
      font-size: 28vh;
      color: #7c3aed;
    }

    .ready-countdown-number.countdown-1 {
      font-size: 40vh;
      color: #e040fb;
    }

    body.dark .ready-countdown-number.countdown-3 { color: #5e7cee; }
    body.dark .ready-countdown-number.countdown-2 { color: #a78bfa; }
    body.dark .ready-countdown-number.countdown-1 { color: #e879f9; }

    /* Animazione dissolvenza tra numeri */
    .ready-countdown-number.countdown-fade-in {
      animation: countdownFadeIn 0.4s ease-out forwards;
    }

    @keyframes countdownFadeIn {
      0% { opacity: 0; transform: scale(0.7); }
      60% { opacity: 0.25; transform: scale(1.05); }
      100% { opacity: 0.25; transform: scale(1); }
    }

    /* ANIMATIONS */
    @keyframes pop {
      0% { transform: scale(0); opacity: 0; }
      50% { transform: scale(1.2); }
      100% { transform: scale(1); opacity: 1; }
    }

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

    @keyframes heartBeat {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.1); }
    }

    /* MODAL */
    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0; top: 0;
      width: 100%; height: 100%;
      background: rgba(0,0,0,0.5);
      backdrop-filter: blur(5px);
    }

    .modal-content {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      background: white;
      margin: 5vh auto;
      padding: 2rem;
      border-radius: 20px;
      width: 90vw;
      max-width: 600px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 20px 50px rgba(0,0,0,0.2);
      color: #1a1a1a;
    }

    body.dark .modal-content { background: #1e1e1e; color: #e9ecef; }

    /* Responsive modali per schermi piccoli */
    @media (max-width: 768px) {
      .modal-content {
        width: 95vw;
        padding: 1.5rem;
      }
    }

    .sponsor-modal-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin-bottom: 1.5rem;
    }

    .sponsor-modal-logo {
      max-height: 120px;
      width: auto;
      object-fit: contain;
    }

    .sponsor-modal-title {
      font-size: 1.5rem;
      font-weight: 700;
      margin: 0;
    }

    .sponsor-video-container {
      position: relative;
      width: 100%;
      max-height: 200px;
      border-radius: 12px;
    }

    .sponsor-video-container iframe {
      width: 100%;
      height: 200px;
      border: none;
    }

    .sponsor-modal-description {
      font-size: 0.95rem;
      line-height: 1.5;
      color: #555;
      margin-bottom: 1rem;
    }
    body.dark .sponsor-modal-description {
      color: #bbb;
    }

    .sponsor-media-gallery {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
      margin-top: 1rem;
    }

    .sponsor-media-item {
      width: 100%;
      border-radius: 8px;
      object-fit: cover;
    }

    .close {
      position: absolute;
      top: 1rem;
      right: 1rem;
      font-size: 1.8rem;
      font-weight: bold;
      cursor: pointer;
      color: #aaa;
    }

    .close:hover { color: #000; }
    body.dark .close:hover { color: #fff; }

    .modal input, .modal button {
      width: 100%;
      padding: 0.9rem;
      margin: 0.8rem 0;
      border: 1px solid #ddd;
      border-radius: 12px;
      font-size: 1rem;
    }

    .modal input[readonly] {
      background: #f0f0f0;
      color: #666;
      cursor: not-allowed;
    }

    body.dark .modal input { background: #333; border: 1px solid #555; color: #fff; }
    body.dark .modal input[readonly] { background: #2a2a2a; color: #999; }

    .modal-subtitle {
      text-align: center;
      margin-bottom: 1.5rem;
      color: #666;
    }
    body.dark .modal-subtitle { color: #aaa; }

    .modal-content .cta-btn {
      background: linear-gradient(135deg, #4361ee, #3f37c9);
      color: white;
    }
    .modal-content .cta-btn-secondary {
      background: transparent;
      color: #4361ee;
      border: 2px solid #4361ee;
    }
    body.dark .modal-content .cta-btn-secondary {
      color: #7c8aff;
      border-color: #7c8aff;
    }

    .modal-btn {
      background: linear-gradient(135deg, #4361ee, #3f37c9);
      color: white;
      border: none;
      font-weight: 700;
      cursor: pointer;
      transition: 0.3s;
    }

    .modal-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(67,97,238,0.4);
    }

    .checkbox-label {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.9rem;
      margin: 1rem 0;
    }

    .checkbox-label input[type="checkbox"] {
        width: auto;
        display: inline-block;
        margin-right: 0.5rem;
    }

    #privacy-label.hidden {
        display: none;
    }

    .modal-link {
        color: #4361ee !important;
        text-decoration: underline;
        cursor: pointer;
    }

    .modal-text-scroll {
        max-height: 60vh;
        overflow-y: auto;
        padding: 1rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        margin-top: 1rem;
    }

    body.dark .modal-text-scroll {
        border-color: rgba(255, 255, 255, 0.2);
    }

    /* UNMAPPED STATE (fallback) */
    .unmapped-content {
        height: 83dvh;
        padding: 2dvh 3vw;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2dvh;
    }
