/* Hai Cagato? — stile di produzione, dai token di docs/mockups/concept-v3/style-tokens.json */
/* ============ TEMI ============ */
  :root {
    --bg: #F2F5F9;
    --card: #FFFFFF;
    --card-border: rgba(15, 23, 42, 0.05);
    --text: #0F172A;
    --subtext: #64748B;
    --primary: #0284C7;
    --primary-grad: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    --primary-glow: rgba(2, 132, 199, 0.45);
    --bowl-outer: #FFFFFF;
    --bowl-rim: #E2E8F0;
    --seat: #F8FAFC;
    --water: #BAE6FD;
    --water-deep: #38BDF8;
    --shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.10);
    --row-bg: #F8FAFC;
    --you-bg: #E0F2FE;
    --you-border: rgba(14, 165, 233, 0.35);
    --gold: #F59E0B;
    --danger: #EF4444;
    --success: #10B981;
    --sheet: #FFFFFF;
    /* Durometro (docs/mockups/durometro/style-tokens.json) */
    --lv1: #94A3B8; --lv2: #F59E0B; --lv3: #FACC15; --lv4: #F9A8D4; --lv5: #38BDF8;
    --dial: #FFFFFF; --dial-ink: #334155; --bezel-a: #E2E8F0; --bezel-b: #94A3B8; --needle: #EF4444;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  body.theme-glass {
    --bg: linear-gradient(145deg, #E0F2FE 0%, #F3E8FF 50%, #DCFCE7 100%);
    --card: rgba(255, 255, 255, 0.68);
    --card-border: rgba(255, 255, 255, 0.85);
    --text: #1E293B;
    --subtext: #475569;
    --primary: #6366F1;
    --primary-grad: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
    --primary-glow: rgba(99, 102, 241, 0.4);
    --shadow: 0 16px 40px -10px rgba(99, 102, 241, 0.16);
    --row-bg: rgba(255, 255, 255, 0.6);
    --you-bg: rgba(224, 231, 255, 0.9);
    --you-border: rgba(99, 102, 241, 0.35);
    --sheet: rgba(255, 255, 255, 0.92);
    --dial: rgba(255, 255, 255, 0.85);
  }
  body.theme-dark {
    --bg: #0B1120;
    --card: #1E293B;
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #F8FAFC;
    --subtext: #94A3B8;
    --primary: #38BDF8;
    --primary-grad: linear-gradient(135deg, #38BDF8 0%, #2563EB 100%);
    --primary-glow: rgba(56, 189, 248, 0.35);
    --bowl-outer: #F1F5F9;
    --bowl-rim: #CBD5E1;
    --seat: #E2E8F0;
    --shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
    --row-bg: #0F172A;
    --you-bg: rgba(56, 189, 248, 0.16);
    --you-border: rgba(56, 189, 248, 0.4);
    --sheet: #1E293B;
    --dial: #0F172A; --dial-ink: #CBD5E1; --bezel-a: #475569; --bezel-b: #1E293B; --needle: #F87171;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
  [hidden] { display: none !important; }

  body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 12px 32px;
    transition: background 0.35s ease, color 0.35s ease;
  }
  button { font-family: inherit; color: inherit; }
  :focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 12px; }

  /* ============ CONTENITORE APP ============ */
  .app {
    width: 100%; max-width: 390px;
    background: var(--bg);
    border-radius: 40px;
    padding: 20px 18px 24px;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.22), 0 0 0 8px rgba(15,23,42,0.08);
    position: relative;
    overflow: hidden;
    display: flex; flex-direction: column; gap: 14px;
  }
  @media (max-width: 480px) {
    body { padding: 0; }
    .app { max-width: none; border-radius: 0; box-shadow: none; min-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  }

  /* ============ TESTATA ============ */
  .top-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .top-actions { display: flex; gap: 6px; }
  .pill {
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    padding: 8px 13px;
    border-radius: 99px;
    font-size: 12.5px; font-weight: 700;
    display: flex; align-items: center; gap: 6px;
    box-shadow: var(--shadow);
  }
  button.pill { cursor: pointer; }
  .recap-trigger { background: linear-gradient(135deg, #F59E0B, #EA580C); color: #fff; border: none; }
  .sound-btn { padding: 8px 10px; }

  .app-header { text-align: center; margin-top: 2px; }
  .app-title { font-size: 28px; font-weight: 800; letter-spacing: -0.8px; }
  .app-title .q { color: var(--primary); display: inline-block; transform-origin: bottom center; animation: tilt 3s ease-in-out infinite; }
  @keyframes tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(12deg); } }
  .app-subtitle { font-size: 13px; color: var(--subtext); font-weight: 500; }

  /* ============ CARD DEL TRONO ============ */
  .throne-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(18px);
    border-radius: 30px;
    padding: 20px 18px 18px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center;
    position: relative;
    overflow: hidden;
  }
  .today-counter {
    position: absolute; top: 14px; right: 16px;
    background: var(--row-bg);
    padding: 5px 11px; border-radius: 99px;
    font-size: 12px; font-weight: 700; color: var(--subtext);
    z-index: 3;
  }
  .today-counter span { color: var(--primary); font-weight: 800; display: inline-block; }
  .today-counter span.bump { animation: bump 0.55s var(--spring); }
  @keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.7) rotate(-10deg); } 100% { transform: scale(1); } }

  .gap-chip {
    position: absolute; top: 14px; left: 16px;
    font-size: 11.5px; font-weight: 700; color: var(--subtext);
    background: var(--row-bg);
    padding: 5px 10px; border-radius: 99px;
    z-index: 3;
  }
  .gap-chip b { color: var(--danger); }
  .gap-chip.lead b { color: var(--gold); }

  /* Water */
  .toilet-stage {
    width: 200px; height: 210px;
    position: relative;
    margin: 18px 0 6px;
  }
  .toilet-svg { width: 100%; height: 100%; overflow: visible; }
  .s-outer { fill: var(--bowl-outer); stroke: var(--bowl-rim); }
  .s-seat { fill: var(--seat); stroke: var(--bowl-rim); }
  .s-water { fill: var(--water); transition: fill 0.35s ease; }
  .s-drain { fill: var(--water-deep); }
  .s-shadow { fill: rgba(15, 23, 42, 0.10); }
  body.theme-dark .s-shadow { fill: rgba(0, 0, 0, 0.45); }

  #flush-handle { transform-origin: 40px 43.5px; transition: transform 0.25s var(--spring); }
  .flushing #flush-handle { transform: rotate(32deg); }
  .flushing .s-water { fill: var(--water-deep); }

  .ripple { fill: none; stroke: #fff; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: ripple 3.6s ease-out infinite; }
  .ripple.r2 { animation-delay: 1.8s; }
  @keyframes ripple { 0% { transform: scale(0.3); opacity: 0.7; } 100% { transform: scale(1.25); opacity: 0; } }
  .flushing .ripple { animation-play-state: paused; opacity: 0; }

  #vortex-group { opacity: 0; transform-origin: 100px 130px; transition: opacity 0.25s ease; }
  .flushing #vortex-group { opacity: 1; animation: spinVortex 0.5s linear infinite; }
  @keyframes spinVortex { from { transform: rotate(0deg) scale(1); } to { transform: rotate(-360deg) scale(0.9); } }

  /* Cacca: il contenitore esterno si muove (JS), l'interno respira */
  .poop {
    position: absolute; left: 0; top: 0;
    width: 60px; height: 60px;
    display: grid; place-items: center;
    font-size: 52px; line-height: 1;
    cursor: pointer;
    user-select: none;
    background: none; border: 0;
    transform: translate(70px, 58px);
    z-index: 2;
  }
  .poop-inner {
    display: block;
    transform-origin: 50% 90%;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.2));
  }
  .poop-inner.idle { animation: floatIdle 2.4s ease-in-out infinite; }
  @keyframes floatIdle {
    0%, 100% { transform: translateY(0) rotate(-3deg) scale(1, 1); }
    50% { transform: translateY(-7px) rotate(4deg) scale(0.97, 1.04); }
  }

  .bubble {
    position: absolute; left: 112px; top: 0;
    background: var(--text); color: var(--bg);
    font-size: 12.5px; font-weight: 800; line-height: 1.25;
    padding: 7px 11px; border-radius: 14px 14px 14px 4px;
    width: max-content; max-width: 140px; text-wrap: balance; /* le frasi lunghe vanno a capo, non escono dalla card */
    transform-origin: bottom left;
    z-index: 4;
    pointer-events: none;
  }
  body.theme-glass .bubble { color: #fff; }
  .bubble.show { animation: bubbleIn 0.4s var(--spring) both; }
  .bubble.hide { animation: bubbleOut 0.25s ease forwards; }
  @keyframes bubbleIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  @keyframes bubbleOut { to { transform: scale(0.6); opacity: 0; } }

  .fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
  .drop { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--water-deep); box-shadow: inset -2px -2px 0 rgba(0,0,0,0.08); }
  .drop.light { background: #fff; border: 2px solid var(--water-deep); }
  .ring {
    position: absolute; left: 100px; top: 130px;
    width: 24px; height: 18px; margin: -9px 0 0 -12px;
    border: 3px solid var(--water-deep); border-radius: 50%;
  }

  .fly {
    position: fixed; z-index: 60; pointer-events: none;
    font-weight: 800; font-size: 22px; color: var(--primary);
  }

  /* Pulsante */
  .cta-btn {
    position: relative; overflow: hidden;
    width: 100%;
    border: none;
    background: var(--primary-grad);
    color: #FFFFFF;
    font-size: 18px; font-weight: 800; letter-spacing: 0.3px;
    padding: 17px 24px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 10px 24px -6px var(--primary-glow);
    transition: transform 0.15s var(--spring), filter 0.2s ease;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 6px;
  }
  .cta-btn:active { transform: scale(0.95); }
  .cta-btn:disabled { filter: saturate(0.6) brightness(0.95); cursor: default; }
  .cta-btn .roll { font-size: 20px; display: inline-block; }
  .cta-btn:not(:disabled):hover .roll { animation: unroll 0.6s var(--spring); }
  @keyframes unroll { 50% { transform: rotate(-25deg) scale(1.2); } }
  .cta-ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.45); transform: scale(0); pointer-events: none; }

  /* Annulla (5 secondi) */
  .undo-bar {
    width: 100%;
    margin-top: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--row-bg);
    border-radius: 14px;
    padding: 9px 9px 9px 14px;
    font-size: 13px; font-weight: 700;
    position: relative; overflow: hidden;
    animation: slideUp 0.35s var(--ease-out);
  }
  .undo-bar button {
    flex: none; white-space: nowrap;
    border: none; cursor: pointer;
    background: var(--card); color: var(--text);
    font-size: 12.5px; font-weight: 800;
    padding: 7px 12px; border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  }
  .undo-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--primary); transform-origin: left; }
  .undo-progress.run { animation: drain 5s linear forwards; }
  @keyframes drain { to { transform: scaleX(0); } }
  @keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* Consistenza */
  .c-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, 0.45); touch-action: none; animation: fadeIn .25s ease; }
  .c-sheet {
    position: fixed; z-index: 56; left: 50%; bottom: 0;
    width: 100%; max-width: 390px; transform: translateX(-50%);
    max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--sheet); backdrop-filter: blur(20px);
    border: 1px solid var(--card-border); border-bottom: none;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -18px 40px -12px rgba(0,0,0,0.35);
    padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
    animation: sheetUp .35s var(--ease-out);
  }
  .c-sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--subtext); opacity: .35; margin: 0 auto 10px; }
  .c-sheet .undo-bar { margin: 0 0 10px; }
  @keyframes sheetUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
  @keyframes fadeIn { from { opacity: 0; } }
  .consistency p { font-size: 13px; font-weight: 800; text-align: center; }
  .consistency p small { display: block; font-weight: 600; color: var(--subtext); font-size: 11.5px; }
  .c-actions { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 12px; }
  .c-skip { background: none; border: none; padding: 12px 18px; font-size: 14px; font-weight: 800; color: var(--subtext); cursor: pointer; }
  .c-done { border: none; border-radius: 16px; padding: 12px 22px; min-width: 130px; font-size: 14.5px; font-weight: 800; color: #fff; background: var(--primary-grad); box-shadow: 0 10px 20px -8px var(--primary-glow); cursor: pointer; transition: transform .2s var(--spring), opacity .2s; }
  .c-done:active { transform: scale(.94); }
  .c-done:disabled { opacity: .35; box-shadow: none; cursor: default; }

  /* Durometro: la lancetta segue il dito, poi scatta sul livello con un rimbalzo */
  .gauge-wrap { margin: 6px auto 0; max-width: 300px; touch-action: none; user-select: none; -webkit-user-select: none; }
  .durometer { width: 100%; height: auto; display: block; overflow: visible; cursor: grab; }
  .durometer.dragging { cursor: grabbing; }
  .durometer:focus, .durometer:focus-visible { outline: none; }
  .durometer:focus-visible .dm-hub { stroke: var(--primary); stroke-width: 4; }
  .dm-face { fill: var(--dial); }
  .dm-bezel { fill: none; stroke: url(#dm-chrome); stroke-width: 9; }
  .dm-band { fill: none; stroke-width: 7; stroke-linecap: round; }
  .dm-tick { stroke: var(--dial-ink); stroke-width: 1.4; opacity: .5; }
  .dm-tick.major { stroke-width: 2.6; opacity: .9; }
  .dm-brand { font: 800 7.5px 'Plus Jakarta Sans', sans-serif; letter-spacing: 1.6px; fill: var(--dial-ink); opacity: .55; text-anchor: middle; }
  .dm-mark { font-size: 22px; cursor: pointer; transition: transform .35s var(--spring), opacity .25s; transform-box: fill-box; transform-origin: center; }
  .dm-mark.on { transform: scale(1.45); }
  .durometer:not(.unset) .dm-mark:not(.on) { opacity: .45; }
  .dm-needle { transform-origin: 150px 150px; transition: transform .55s var(--spring); fill: var(--needle); }
  .dragging .dm-needle { transition: transform .06s linear; }
  .dm-hub { fill: url(#dm-chrome); stroke: var(--bezel-b); stroke-width: 1; }
  .durometer.unset .dm-needle { opacity: .35; }
  .durometer.unset .dm-needle-g { animation: dmHint 2.4s ease-in-out infinite; transform-origin: 150px 150px; }
  @keyframes dmHint { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 60% { transform: rotate(10deg); } }
  .durometer.lv-1 .dm-needle-g { animation: dmStrain .18s linear infinite; transform-origin: 150px 150px; }
  @keyframes dmStrain { 50% { transform: rotate(1.4deg); } }

  .verdict { display: flex; align-items: center; gap: 12px; margin: 6px auto 0; max-width: 300px; min-height: 62px; padding: 10px 14px; border-radius: 18px; background: var(--row-bg); border: 1px solid transparent; text-align: left; transition: background .3s, border-color .3s; }
  .v-emoji { font-size: 32px; }
  .verdict.pop .v-emoji { animation: dmPop .4s var(--spring); }
  @keyframes dmPop { 0% { transform: scale(.5) rotate(-12deg); } 100% { transform: scale(1); } }
  .v-text b { display: block; font-size: 14px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
  .v-text small { display: block; font-size: 12.5px; font-weight: 600; color: var(--subtext); line-height: 1.35; }
  .verdict.lv-3 { border-color: rgba(250, 204, 21, .7); background: linear-gradient(135deg, rgba(250,204,21,.18), rgba(245,158,11,.10)); }
  .verdict.lv-3 .v-emoji { animation: dmShine 1.6s ease-in-out infinite; }
  @keyframes dmShine { 50% { filter: drop-shadow(0 0 8px rgba(250, 204, 21, .9)); transform: rotate(-8deg) scale(1.08); } }
  .verdict.lv-5 .v-emoji { animation: dmDrip 1.2s ease-in-out infinite; }
  @keyframes dmDrip { 50% { transform: translateY(3px); } }

  /* Messaggio */
  .toast-msg {
    min-height: 20px;
    font-size: 13.5px; font-weight: 700; color: var(--primary);
    text-align: center;
    opacity: 0; transform: translateY(4px);
    transition: all 0.25s ease;
  }
  .toast-msg.show { opacity: 1; transform: none; }

  /* ============ CLASSIFICA ============ */
  .leaderboard-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(18px);
    border-radius: 26px;
    padding: 14px;
    box-shadow: var(--shadow);
  }
  .lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
  .seg { display: flex; background: var(--row-bg); border-radius: 12px; padding: 3px; }
  .seg button {
    border: none; background: transparent; cursor: pointer;
    font-size: 12.5px; font-weight: 800; color: var(--subtext);
    padding: 6px 12px; border-radius: 9px;
    transition: all 0.2s ease;
  }
  .seg button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
  .lb-live-dot { font-size: 11px; font-weight: 800; color: var(--success); display: flex; align-items: center; gap: 5px; }
  .lb-live-dot::before { content: ""; width: 7px; height: 7px; background: var(--success); border-radius: 50%; animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.3; transform: scale(0.7); } }

  .lb-list { display: flex; flex-direction: column; gap: 7px; }
  .lb-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--row-bg);
    padding: 9px 12px;
    border-radius: 16px;
    border: 1px solid transparent;
    position: relative;
  }
  .lb-row.is-you { background: var(--you-bg); border-color: var(--you-border); }
  .lb-row.flash { animation: flash 0.9s ease; }
  @keyframes flash { 30% { box-shadow: 0 0 0 4px var(--you-border); } }
  .lb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .lb-rank { font-size: 15px; font-weight: 800; width: 24px; text-align: center; flex: none; }
  .lb-name { font-size: 14.5px; font-weight: 700; }
  .lb-status { font-size: 11px; font-weight: 600; color: var(--subtext); display: block; }
  .lb-right { display: flex; align-items: center; gap: 8px; flex: none; }
  .lb-poops { font-size: 13px; letter-spacing: -3px; }
  .lb-count {
    background: var(--card);
    min-width: 30px; height: 28px; padding: 0 6px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
  }
  .lb-row.tappo .lb-status { color: var(--danger); }
  .lb-foot { font-size: 11.5px; color: var(--subtext); font-weight: 600; text-align: center; margin-top: 10px; }

  /* Banner sorpasso e coriandoli */
  .confetti { position: fixed; z-index: 70; pointer-events: none; font-size: 22px; }

  /* ============ NOTIFICA PUSH SIMULATA ============ */
  .push {
    position: absolute; left: 10px; right: 10px; top: 10px;
    z-index: 40;
    display: flex; gap: 10px; align-items: center;
    background: var(--sheet);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 11px 13px;
    box-shadow: 0 18px 40px -10px rgba(0,0,0,0.35);
    cursor: pointer;
    transform: translateY(-140%);
    transition: transform 0.5s var(--spring);
    text-align: left;
    width: auto;
  }
  .push.open { transform: none; }
  .push-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-grad); display: grid; place-items: center; font-size: 22px; flex: none; }
  .push-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .push-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--subtext); font-weight: 700; }
  .push-title { font-size: 13.5px; font-weight: 800; }
  .push-text { font-size: 13px; color: var(--subtext); font-weight: 600; }

  /* ============ STORIA DEL BOLLETTINO ============ */
  .story {
    position: absolute; inset: 0; z-index: 50;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    display: flex; flex-direction: column;
    padding: 14px 14px 18px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .story.open { opacity: 1; pointer-events: auto; }
  .story-bars { display: flex; gap: 4px; }
  .story-bars span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.25); overflow: hidden; }
  .story-bars i { display: block; height: 100%; width: 0; background: #fff; }
  .story-top { display: flex; justify-content: space-between; align-items: center; margin: 10px 2px 0; color: #fff; }
  .story-from { font-size: 12.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
  .story-from small { font-weight: 600; color: #94A3B8; }
  .story-close { background: rgba(255,255,255,0.12); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer; }
  .story-stage { flex: 1; position: relative; display: grid; place-items: center; }
  #slide-host { width: 100%; }
  .story-tap { position: absolute; top: 0; bottom: 0; width: 35%; z-index: 2; background: none; border: none; cursor: pointer; }
  .story-tap.prev { left: 0; } .story-tap.next { right: 0; width: 65%; }

  .slide {
    width: 100%;
    color: #fff;
    border-radius: 30px;
    padding: 26px 20px 22px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: slideIn 0.45s var(--ease-out);
  }
  @keyframes slideIn { from { transform: translateY(16px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
  .slide.king { background: linear-gradient(160deg, #1E1B4B 0%, #0F172A 100%); }
  .slide.plug { background: linear-gradient(160deg, #450A0A 0%, #1C1917 100%); }
  .slide.season { background: linear-gradient(160deg, #082F49 0%, #0F172A 100%); }
  .badge { display: inline-block; background: rgba(245, 158, 11, 0.2); color: #FBBF24; font-size: 11px; font-weight: 800; padding: 5px 12px; border-radius: 99px; margin-bottom: 10px; }
  .slide h2 { font-size: 22px; font-weight: 800; }
  .big-emoji { font-size: 64px; margin: 10px 0 6px; display: inline-block; animation: hop 1.4s var(--spring) infinite; }
  @keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px) rotate(-6deg); } }
  .hero-line { font-size: 19px; font-weight: 800; color: #FBBF24; }
  .slide.plug .hero-line { color: #F87171; }
  .sub-line { font-size: 13px; color: #94A3B8; margin-top: 3px; }
  .stat-box { background: rgba(255,255,255,0.07); border-radius: 18px; padding: 12px 14px; margin-top: 16px; text-align: left; font-size: 13px; line-height: 1.75; }
  .stat-box .row { display: flex; justify-content: space-between; gap: 8px; }
  .stat-box .row span:last-child { font-weight: 800; }
  .stat-box .sep { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.1); }
  .pintus { font-size: 26px; font-weight: 800; margin-top: 14px; }
  .season-bar { height: 8px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; margin-top: 14px; }
  .season-bar i { display: block; height: 100%; width: 82%; background: linear-gradient(90deg, #38BDF8, #FBBF24); border-radius: 4px; }
  .close-modal-btn {
    width: 100%; padding: 14px; border-radius: 16px; border: none;
    background: #fff; color: #0F172A; font-weight: 800; font-size: 14px;
    cursor: pointer; margin-top: 16px; position: relative; z-index: 3;
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  }

/* Installata sulla Home: sempre a tutto schermo */
@media (display-mode: standalone) {
  body { padding: 0; }
  .app { max-width: none; border-radius: 0; box-shadow: none; min-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
}

/* Viste semplici (accesso, guida, messaggi) */
.view-center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; text-align: center; padding: 24px 4px; }
.view-center .big-emoji { font-size: 72px; }
.view-center h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.view-center p { color: var(--subtext); font-weight: 600; font-size: 14.5px; line-height: 1.5; }
.card { background: var(--card); border: 1px solid var(--card-border); backdrop-filter: blur(18px); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); }

/* Accesso con invito */
.join .join-avatar { display: inline-block; }
.join-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--subtext); }
.field input {
  font: inherit; font-size: 16px; font-weight: 700; color: var(--text);
  background: var(--row-bg); border: 1px solid var(--card-border);
  border-radius: 14px; padding: 12px 14px;
}
.avatar-grid { border: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-opt {
  font-size: 26px; line-height: 1; aspect-ratio: 1; cursor: pointer;
  background: var(--row-bg); border: 2px solid transparent; border-radius: 14px;
  transition: transform .15s var(--spring);
}
.avatar-opt:active { transform: scale(.9); }
.avatar-opt.selected { border-color: var(--primary); background: var(--you-bg); }
.form-error { color: var(--danger); font-weight: 700; font-size: 13px; }
.muted { color: var(--subtext); font-weight: 600; font-size: 13px; }

/* Pagine interne */
.page-head { display: flex; align-items: center; gap: 10px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; flex: 1; }
.back { text-decoration: none; color: var(--subtext); font-weight: 800; font-size: 20px; padding: 4px 8px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--subtext); margin: 0 2px 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; font-weight: 700; color: var(--text);
  background: var(--row-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 11px 14px;
}
.btn-small { border: none; cursor: pointer; background: var(--primary-grad); color: #fff; font-weight: 800; font-size: 13.5px; padding: 10px 14px; border-radius: 14px; white-space: nowrap; text-decoration: none; display: inline-block; }
.btn-ghost { border: 1px solid var(--card-border); cursor: pointer; background: var(--row-bg); color: var(--text); font-weight: 700; font-size: 12.5px; padding: 8px 12px; border-radius: 11px; white-space: nowrap; text-decoration: none; display: inline-block; }
.btn-ghost.danger { color: var(--danger); }
.view-center .btn-ghost { align-self: center; }
.user-row { display: flex; align-items: center; gap: 10px; background: var(--row-bg); border-radius: 16px; padding: 10px 12px; }
.user-row + .user-row { margin-top: 7px; }
.user-row .who { flex: 1; min-width: 0; }
.user-row .who b { display: block; font-size: 14.5px; }
.user-row .who small { color: var(--subtext); font-weight: 600; font-size: 11.5px; }
.user-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-avatar { font-size: 24px; width: 34px; text-align: center; }
.link-box { margin-top: 12px; background: var(--you-bg); border: 1px solid var(--you-border); border-radius: 16px; padding: 12px; font-size: 13px; font-weight: 600; }
.link-box code { display: block; word-break: break-all; font-size: 12px; margin: 6px 0 10px; color: var(--text); }
.link-box .acts { display: flex; gap: 8px; align-items: center; }
a.pill { text-decoration: none; color: inherit; }
.last-link { margin-top: 10px; background: none; border: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--subtext); text-decoration: underline; text-underline-offset: 3px; }
.score-field { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 800; color: var(--subtext); text-transform: uppercase; }
.score-field input { width: 64px; font: inherit; font-size: 15px; font-weight: 800; text-align: center; color: var(--text); background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; padding: 5px 4px; }
.score-field input.saved { border-color: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.score-field input.error { border-color: var(--danger); }
.user-row { flex-wrap: wrap; }
.lb-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--subtext); }
.lb-avatar { font-size: 20px; width: 26px; text-align: center; flex: none; }

/* Admin: registrazioni */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { font: inherit; font-size: 15px; font-weight: 700; color: var(--text); background: var(--row-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.filters select { flex: 1; }
.add-log .filters select { flex: 1 1 100%; }
.add-log .filters input { flex: 1; }
.admin-logs { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.log-row { display: flex; align-items: center; gap: 10px; background: var(--row-bg); border-radius: 14px; padding: 8px 10px; }
.log-row .who { flex: 1; min-width: 0; }
.log-row .who b { display: block; font-size: 14px; }
.log-row .who small { color: var(--subtext); font-weight: 600; font-size: 11px; }
.log-row.deleted { opacity: .55; }
.log-row.inquiry-row { flex-wrap: wrap; }
.inquiry-row .acts { flex: 1 1 100%; display: flex; gap: 8px; justify-content: flex-end; }
.log-row.deleted b { text-decoration: line-through; }
.log-time { font-weight: 800; font-variant-numeric: tabular-nums; width: 44px; }
.add-log { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--card-border); padding-top: 12px; }
.user-row .acts { flex-basis: 100%; justify-content: flex-end; }

/* Guida all'installazione */
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.step-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-grad); color: #fff; font-weight: 800; }
.ios-share { width: 18px; height: 18px; vertical-align: -3px; color: var(--primary); }

/* Impostazioni */
.page-head .pill { display: block; flex: 0 1 auto; min-width: 0; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; background: var(--row-bg); border: 2px solid transparent; font: inherit; color: var(--text); }
.theme-opt[aria-checked="true"] { border-color: var(--primary); }
.theme-opt b { font-size: 12.5px; }
.theme-opt small { font-size: 10.5px; color: var(--subtext); font-weight: 600; }
.theme-swatch { width: 100%; height: 44px; border-radius: 10px; }
.theme-prev-clean .theme-swatch { background: linear-gradient(135deg, #F2F5F9 50%, #0284C7 50%); }
.theme-prev-glass .theme-swatch { background: linear-gradient(145deg, #E0F2FE, #F3E8FF, #DCFCE7); box-shadow: inset 0 0 0 2px #6366F1; }
.theme-prev-dark .theme-swatch { background: linear-gradient(135deg, #0B1120 50%, #38BDF8 50%); }
.settings-link { margin-top: 10px; }

/* Notifiche */
.notify-cta { margin: 4px 0 6px; font-size: 15px; padding: 14px 18px; }
.notify-acts { display: flex; gap: 8px; margin: 8px 0 4px; }
.prefs { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--card-border); cursor: pointer; }
.pref b { display: block; font-size: 14px; }
.pref small { display: block; color: var(--subtext); font-weight: 600; font-size: 11.5px; }
.switch { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--bowl-rim); position: relative; cursor: pointer; transition: background .2s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .25s var(--spring); }
.switch:checked { background: var(--success); }
.switch:checked::after { transform: translateX(18px); }
/* Bollettino come pagina */
.bulletin-page { position: absolute; }
.app:has(.bulletin-page) { min-height: min(100dvh, 860px); }
@media (max-width: 480px) { .app:has(.bulletin-page) { min-height: 100dvh; } }

/* Collegamenti rapidi in Home */
.quick-links { display: flex; justify-content: center; gap: 8px; margin-top: -4px; }

/* Bacheca */
.feed { display: flex; flex-direction: column; gap: 10px; }
.post { background: var(--card); border: 1px solid var(--card-border); border-radius: 22px; padding: 12px 14px; box-shadow: var(--shadow); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-avatar { font-size: 26px; }
.post-who { flex: 1; min-width: 0; }
.post-who b { display: block; font-size: 14.5px; }
.post-who small { color: var(--subtext); font-weight: 600; font-size: 12px; }
.post-emoji { font-size: 22px; }
.post-tag { font-size: 10.5px; font-weight: 800; color: var(--subtext); background: var(--row-bg); padding: 2px 7px; border-radius: 99px; margin-left: 4px; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.react { border: 1px solid var(--card-border); background: var(--row-bg); color: var(--text); font: inherit; font-size: 13px; font-weight: 800; padding: 5px 9px; border-radius: 99px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: transform .15s var(--spring); }
.react:active { transform: scale(.9); }
.react.mine { background: var(--you-bg); border-color: var(--you-border); }
.react .n { font-size: 12px; }
.react.add { opacity: .8; }
.react-picker { display: flex; gap: 4px; margin-top: 8px; }
.react-picker[hidden] { display: none; }
.comments { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.comment { background: var(--row-bg); border-radius: 14px; padding: 7px 10px; font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.comment b { font-weight: 800; }
.comment .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment .del { border: none; background: none; color: var(--subtext); cursor: pointer; font-size: 13px; padding: 0 2px; }
.comment-form { display: flex; gap: 6px; margin-top: 8px; }
.comment-form input { flex: 1; min-width: 0; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); background: var(--row-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 8px 11px; }
.comment-form button { border: none; background: var(--primary-grad); color: #fff; font-weight: 800; border-radius: 12px; padding: 0 12px; cursor: pointer; }
.feed-more { align-self: center; }
.feed-empty { text-align: center; padding: 30px 10px; }

/* Dubito e inchiesta */
.react.doubt { margin-left: auto; }
.doubt-count { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--subtext); align-self: center; }
.post.inquiry { background: linear-gradient(160deg, #FEF3C7, var(--card) 60%); border-color: #FBBF24; }
body.theme-dark .post.inquiry { background: linear-gradient(160deg, rgba(251,191,36,.18), var(--card) 60%); }
.inquiry-badge { display: inline-block; margin-bottom: 8px; font-size: 12px; font-weight: 800; color: #92400E; background: #FDE68A; padding: 4px 10px; border-radius: 99px; }

/* Statistiche */
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.05; }
.tile span { font-size: 11.5px; color: var(--subtext); font-weight: 700; }
.stat-note { text-align: center; }
.chart-sub { margin: -4px 2px 6px; font-size: 12px; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--card-border); stroke-width: 1; }
body:not(.theme-dark) .chart .grid { stroke: rgba(15, 23, 42, 0.08); }
.chart .axis { stroke: var(--subtext); stroke-width: 1; opacity: .5; }
.chart .tick { fill: var(--subtext); font-size: 10px; font-weight: 700; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .dot { fill: var(--primary); stroke: var(--card); stroke-width: 2; }
.chart .bar { fill: var(--primary); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cross { stroke: var(--subtext); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; padding: 6px 9px; border-radius: 10px; pointer-events: none; white-space: nowrap; text-align: center; z-index: 5; }
body.theme-glass .chart-tip { color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Titoli */
.lb-badges { font-size: 13px; letter-spacing: 1px; }
.titles { display: flex; flex-direction: column; gap: 7px; }
.title-row { display: flex; align-items: center; gap: 10px; background: var(--row-bg); border-radius: 16px; padding: 10px 12px; border: 1px solid transparent; }
.title-row.mine { background: var(--you-bg); border-color: var(--you-border); }
.title-emoji { font-size: 24px; }
.title-row .who { flex: 1; min-width: 0; }
.title-row .who b { display: block; font-size: 14px; }
.title-row .who small { color: var(--subtext); font-weight: 600; font-size: 11px; }
.title-holder { text-align: right; font-weight: 800; font-size: 13px; white-space: nowrap; }
.title-holder small { display: block; color: var(--subtext); font-weight: 600; font-size: 11px; }

/* Campione della Stagione */
.champion { text-align: center; color: #1f1300; border-radius: 30px; padding: 20px 18px; background: linear-gradient(160deg, #FDE68A 0%, #F59E0B 60%, #D97706 100%); box-shadow: 0 16px 40px -10px rgba(217, 119, 6, .45); }
.champion .badge { background: rgba(255,255,255,.4); color: #78350F; }
.champ-emoji { font-size: 54px; margin: 4px 0; animation: hop 1.4s var(--spring) infinite; }
.champion h2 { font-size: 22px; font-weight: 800; }
.champ-sub { font-size: 13.5px; font-weight: 700; opacity: .8; margin-top: 2px; }
.champ-list { list-style: none; margin-top: 12px; background: rgba(255,255,255,.35); border-radius: 18px; padding: 8px 14px; text-align: left; font-weight: 700; font-size: 14px; }
.champ-list li { display: flex; justify-content: space-between; padding: 3px 0; }
.champ-list li.sep { border-top: 1px solid rgba(0,0,0,.12); margin-top: 4px; padding-top: 7px; }
