/* ===================================================== TrifiRank — stile pop */
:root {
  --bg1: #fff3fb; --bg2: #e9f3ff;
  --ink: #2a1b4d; --ink2: #6b5b95; --line: rgba(124, 77, 255, .14);
  --purple: #7c4dff; --purple-d: #5b34d6;
  --pink: #ff4fa3; --pink-d: #d92f82;
  --yellow: #ffc933; --yellow-d: #e0a400;
  --green: #22c55e; --green-d: #15993f;
  --red: #ef4444; --red-d: #c42a2a;
  --blue: #38bdf8;
  --card: #fff;
  --r: 22px;
  --shadow: 0 10px 28px rgba(124, 77, 255, .13);
  --shadow-s: 0 4px 12px rgba(124, 77, 255, .12);
  --font: "Fredoka", ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); font-size: 16px; line-height: 1.4;
  background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed;
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden; max-width: 100%; overscroll-behavior-y: contain;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, .card, .row, .pod, .day, .mole, .pick, .who, .chip, .react { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
img { max-width: 100%; }

/* sfondo animato */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .5; animation: float 14s ease-in-out infinite; }
.b1 { width: 280px; height: 280px; background: #ffb3dd; top: -80px; left: -60px; }
.b2 { width: 320px; height: 320px; background: #b9a4ff; bottom: -100px; right: -80px; animation-delay: -5s; }
.b3 { width: 220px; height: 220px; background: #ffe58a; top: 40%; left: 55%; animation-delay: -9s; opacity: .35; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(30px, -40px) scale(1.12); } }

/* layout mobile-first nativo (360-430px, centrato su desktop in 480px) */
.app {
  width: 100%; max-width: 480px; min-height: 100vh; min-height: 100dvh;
  margin: 0 auto; padding: 0 12px; position: relative; overflow-x: hidden;
}
@media (min-width: 500px) {
  .app {
    border-left: 1px solid var(--line); border-right: 1px solid var(--line);
    box-shadow: 0 0 42px rgba(124, 77, 255, .13);
    background: rgba(255, 255, 255, .24);
  }
}
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 2px 10px;
  background: linear-gradient(180deg, rgba(255, 243, 251, .96) 70%, rgba(255, 243, 251, 0));
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { font-size: 34px; filter: drop-shadow(0 4px 6px rgba(255, 170, 0, .4)); animation: wobble 4s ease-in-out infinite; display: inline-block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 24px; font-weight: 700; letter-spacing: -.5px; line-height: 1; }
.brand-name b { color: var(--purple); }
.brand-sub { font-size: 12px; color: var(--ink2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes wobble { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-14deg) scale(1.1); } 96% { transform: rotate(12deg) scale(1.1); } }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.me-chip {
  display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 99px; padding: 4px 12px 4px 6px;
  min-height: 44px; box-shadow: var(--shadow-s); font-weight: 600; font-size: 14px; max-width: 155px; transition: transform .2s var(--pop);
}
.me-chip:active { transform: scale(.94); }
.me-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 82px; }
.me-chip.empty { padding: 8px 14px; background: var(--yellow); }
.crown-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .7); font-size: 19px; opacity: .6; transition: all .25s var(--pop); filter: grayscale(.6); display: grid; place-items: center; }
.crown-btn:hover { opacity: 1; filter: none; }
.crown-btn.on { opacity: 1; filter: none; background: linear-gradient(135deg, #fff1b8, var(--yellow)); box-shadow: 0 0 0 3px rgba(255, 201, 51, .35); animation: glow 2.5s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 7px rgba(255, 201, 51, .12); } }

/* navigazione: dock fissa in basso mobile-first (centrata su 480px anche su desktop) */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: center;
  padding: 6px 6px calc(8px + var(--safe-b)); background: rgba(255, 255, 255, .95); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(42, 27, 77, .09); border-radius: 22px 22px 0 0;
}
.tab {
  flex: 1; min-width: 44px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px 8px; border-radius: 14px;
  font-size: 10.5px; font-weight: 600; color: rgba(42, 27, 77, .46); position: relative; transition: color .2s, transform .2s;
}
.tab .tab-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab .ico { display: grid; place-items: center; width: 32px; height: 28px; border-radius: 99px; transition: transform .25s var(--pop), background .2s, color .2s; }
.nav-svg { width: 21px; height: 21px; display: block; }
.tab.active { color: var(--purple); }
.tab.active .ico { transform: translateY(-1px) scale(1.08); }
.tab.active::after {
  content: ""; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 3px; border-radius: 99px; background: var(--purple);
}
.tab:active .ico { transform: scale(.88); }

/* Pulsante centrale Ruota della Fortuna */
.tab.tab-wheel { color: rgba(91, 52, 214, .78); }
.tab.tab-wheel .ico {
  width: 40px; height: 32px; background: rgba(124, 77, 255, .12); color: var(--purple);
  box-shadow: inset 0 0 0 1px rgba(124, 77, 255, .18);
}
.tab.tab-wheel.active .ico {
  background: var(--purple); color: #fff; box-shadow: 0 4px 12px rgba(124, 77, 255, .32);
}

.tab .dot { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 9px; background: var(--pink); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; animation: pulse 1.6s infinite; }

.view { padding: 6px 0 calc(var(--nav-h) + 44px + var(--safe-b)); outline: none; min-height: calc(100dvh - 70px); }
.view.enter > * { animation: slideIn .45s var(--pop) both; }
.view.enter > *:nth-child(2) { animation-delay: .05s; } .view.enter > *:nth-child(3) { animation-delay: .1s; }
.view.enter > *:nth-child(4) { animation-delay: .15s; } .view.enter > *:nth-child(5) { animation-delay: .2s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

/* componenti base */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; border: 2px solid rgba(255, 255, 255, .8); }
.card + .card, .stack > * + * { margin-top: 12px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; margin: 8px 2px 12px; }
.section-sub { color: #55467f; font-size: 14px; margin: -6px 2px 14px; }
.muted { color: var(--ink2); }
.empty { text-align: center; padding: 30px 16px; color: var(--ink2); }
.empty .big { font-size: 54px; display: block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 20px; border-radius: 16px;
  font-weight: 700; font-size: 16px; color: #fff; background: var(--purple); box-shadow: 0 4px 0 var(--purple-d);
  transition: transform .12s, box-shadow .12s, filter .2s; user-select: none; -webkit-user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--purple-d); }
.btn.pink { background: var(--pink); box-shadow: 0 4px 0 var(--pink-d); } .btn.pink:active { box-shadow: 0 1px 0 var(--pink-d); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-d); } .btn.green:active { box-shadow: 0 1px 0 var(--green-d); }
.btn.red { background: var(--red); box-shadow: 0 4px 0 var(--red-d); } .btn.red:active { box-shadow: 0 1px 0 var(--red-d); }
.btn.yellow { background: var(--yellow); color: var(--ink); box-shadow: 0 4px 0 var(--yellow-d); } .btn.yellow:active { box-shadow: 0 1px 0 var(--yellow-d); }
.btn.ghost { background: #fff; color: var(--purple); box-shadow: 0 4px 0 var(--line), inset 0 0 0 2px var(--line); }
.btn.sm { min-height: 44px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.big { font-size: 19px; min-height: 52px; padding: 14px 22px; border-radius: 20px; }

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; min-height: 46px; padding: 11px 14px; font-size: max(16px, 1rem); border-radius: 14px; border: 2px solid var(--line); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(124, 77, 255, .15); }
textarea { resize: vertical; min-height: 84px; }
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin: 12px 2px 6px; }

.seg { display: flex; background: rgba(124, 77, 255, .09); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 44px; padding: 10px 6px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--ink2); transition: all .25s var(--pop); }
.seg button.on { background: #fff; color: var(--purple); box-shadow: var(--shadow-s); transform: scale(1.03); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; border-radius: 99px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); font-weight: 600; font-size: 14px; transition: all .2s var(--pop); }
.chip.on { background: var(--purple); color: #fff; box-shadow: none; transform: scale(1.06); }
.chip:active { transform: scale(.93); }

/* avatar */
.avatar {
  --s: 48px; width: var(--s); height: var(--s); flex: 0 0 var(--s); border-radius: 50%; display: grid; place-items: center;
  font-size: calc(var(--s) * .55); background: linear-gradient(135deg, #fff, #f0e9ff); border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(124, 77, 255, .22); overflow: hidden; line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* badge titolo */
.title-badge {
  display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--purple), #a07bff); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.title-badge.t1 { background: linear-gradient(135deg, #ffb300, #ff8a00); }
.title-badge.t3 { background: linear-gradient(135deg, #7c4dff, #a07bff); }
.title-badge.tmid { background: linear-gradient(135deg, #38bdf8, #6ad1ff); }
.title-badge.tneg { background: linear-gradient(135deg, #ff7a45, #ef4444); }
.title-badge.tlast { background: linear-gradient(135deg, #ef4444, #b91c1c); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ===================================================== PODIO */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; padding: 22px 6px 0; margin-bottom: 14px; }
.pod { flex: 1; max-width: 220px; display: flex; flex-direction: column; align-items: center; cursor: pointer; min-width: 0; }
.pod-who { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 6px; position: relative; width: 100%; animation: dropIn .7s var(--pop) both; }
.pod.p1 .pod-who { animation-delay: .9s; } .pod.p2 .pod-who { animation-delay: .6s; } .pod.p3 .pod-who { animation-delay: .3s; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-60px) scale(.6); } to { opacity: 1; transform: none; } }
.pod .avatar { --s: 64px; animation: bob 3s ease-in-out infinite; }
.pod.p1 .avatar { --s: 86px; border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 201, 51, .3), 0 8px 18px rgba(255, 170, 0, .35); }
.pod.p2 .avatar { border-color: #c5ccd8; } .pod.p3 .avatar { border-color: #e0a370; }
.pod .crown { position: absolute; top: -26px; font-size: 32px; animation: wobble 2.4s ease-in-out infinite; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2)); z-index: 2; }
.pod .nm { font-weight: 700; font-size: 16px; margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .tt { font-size: 10.5px; font-weight: 600; color: var(--ink2); line-height: 1.1; margin-top: 2px; min-height: 24px; }
.pod-block {
  width: 100%; border-radius: 18px 18px 6px 6px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; color: #fff;
  transform-origin: bottom; animation: rise .8s var(--pop) both; position: relative; overflow: hidden;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 8px 18px rgba(0, 0, 0, .12);
}
.pod-block::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%); transform: translateX(-120%); animation: shine 3.5s 1.5s infinite; }
@keyframes shine { 60%, 100% { transform: translateX(120%); } }
.pod.p1 .pod-block { height: 150px; background: linear-gradient(180deg, #ffd84d, #ff9d00); animation-delay: .5s; }
.pod.p2 .pod-block { height: 112px; background: linear-gradient(180deg, #d8dee9, #98a3b8); animation-delay: .3s; }
.pod.p3 .pod-block { height: 88px; background: linear-gradient(180deg, #f0b27f, #c47a3d); animation-delay: .1s; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.pod-block .pos { font-size: 34px; font-weight: 700; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); line-height: 1; }
.pod-block .pts { font-size: 18px; font-weight: 700; margin-top: 4px; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.pod .trend { position: absolute; right: 2px; top: 0; font-size: 20px; animation: pulse 1s infinite; }
@media (max-width: 380px) { .pod .avatar { --s: 54px; } .pod.p1 .avatar { --s: 72px; } .pod .nm { font-size: 14px; } }

/* lista classifica */
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-s);
  cursor: pointer; transition: transform .2s var(--pop), box-shadow .2s; border: 2px solid transparent; position: relative; width: 100%; text-align: left;
}
.row + .row { margin-top: 10px; }
.row:active { transform: scale(.975); }
.row .rk { width: 30px; text-align: center; font-weight: 700; font-size: 20px; color: var(--ink2); flex: 0 0 30px; }
.row .mid { flex: 1; min-width: 0; }
.row .nm { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.row .gap { font-size: 12px; color: var(--ink2); margin-top: 3px; }
.row .score { font-size: 26px; font-weight: 700; text-align: right; }
.row .score.neg { color: var(--red); }
.row.me { border-color: var(--purple); }
.me-tag { font-size: 10px; background: var(--purple); color: #fff; border-radius: 99px; padding: 1px 7px; font-weight: 600; }
.row.relegation {
  background: repeating-linear-gradient(135deg, #fff1f1 0 14px, #ffe3e3 14px 28px); border: 2px dashed var(--red);
  animation: alarm 2s ease-in-out infinite;
}
@keyframes alarm { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, .15), var(--shadow-s); } }
.relegation .zone-tag { position: absolute; top: -10px; right: 14px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 99px; display: flex; gap: 4px; align-items: center; }
.slug { display: inline-block; animation: crawl 3s ease-in-out infinite; }
@keyframes crawl { 50% { transform: translateX(6px); } }
.list-stagger .row { animation: slideIn .5s var(--pop) both; }

/* ===================================================== MODALE */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(42, 27, 77, .55); backdrop-filter: blur(5px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .25s both; overscroll-behavior: contain;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: #fff;
  border-radius: 28px 28px 0 0; padding: 20px 18px calc(22px + var(--safe-b)); position: relative; animation: sheetUp .4s var(--pop) both;
  -webkit-overflow-scrolling: touch;
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -8px auto 12px; }
.overlay.closing { animation: fadeOut .2s both; } .overlay.closing .sheet { animation: sheetDown .25s both; }
@keyframes fadeOut { to { opacity: 0; } } @keyframes sheetDown { to { transform: translateY(100%); } }
@media (min-width: 500px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 28px; }
  .sheet::before { display: none; }
  @keyframes sheetUp { from { transform: translateY(40px) scale(.9); opacity: 0; } }
}
.sheet .x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; background: rgba(124, 77, 255, .1); font-size: 17px; z-index: 3; display: grid; place-items: center; }
.sheet h2 { font-size: 24px; margin-bottom: 4px; text-align: center; }
.sheet .lead { text-align: center; color: var(--ink2); margin: 0 0 14px; font-size: 14px; }

/* Chi sei */
.who-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.who {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 18px; background: #faf7ff;
  font-weight: 700; font-size: 14px; border: 2px solid transparent; transition: all .25s var(--pop); animation: slideIn .5s var(--pop) both;
}
.who:hover { background: #f0e9ff; transform: translateY(-3px) rotate(-2deg); }
.who:active { transform: scale(.9); }
.who.sel { border-color: var(--purple); background: #efe7ff; transform: scale(1.06); }
.who .avatar { --s: 56px; }
.who .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* profilo giocatore */
.prof-head { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.prof-head .avatar { --s: 84px; }
.prof-score { font-size: 46px; font-weight: 700; line-height: 1; margin-top: 6px; }
.prof-score.neg { color: var(--red); }
.chart { width: 100%; height: 130px; margin: 12px 0 4px; background: #faf7ff; border-radius: 18px; padding: 6px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .line { fill: none; stroke: var(--purple); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s .2s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .area { opacity: 0; animation: fade2 .8s 1s forwards; } @keyframes fade2 { to { opacity: 1; } }
.chart .last { animation: pulseDot 1.4s 1.2s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulseDot { 50% { transform: scale(1.5); } }
.hist { max-height: 36vh; overflow-y: auto; margin-top: 8px; }
.hist-item { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.hist-item:last-child { border-bottom: 0; }
.pts-pill { flex: 0 0 auto; min-width: 54px; text-align: center; padding: 4px 8px; border-radius: 12px; font-weight: 700; font-size: 16px; }
.pts-pill.pos { background: #dcfce7; color: var(--green-d); } .pts-pill.neg { background: #fee2e2; color: var(--red-d); }
.when { font-size: 12px; color: var(--ink2); }

/* ===================================================== FEED */
.verdict { padding: 14px; }
.verdict + .verdict { margin-top: 12px; }
.v-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.v-head .who-nm { font-weight: 700; font-size: 17px; }
.v-head .grow { flex: 1; min-width: 0; }
.big-pts { font-size: 28px; font-weight: 700; padding: 2px 14px; border-radius: 16px; }
.big-pts.pos { color: var(--green-d); background: #dcfce7; animation: pop .6s var(--pop) both; }
.big-pts.neg { color: var(--red-d); background: #fee2e2; animation: pop .6s var(--pop) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.v-reason { margin: 10px 0 10px; padding: 10px 14px; background: #faf7ff; border-radius: 16px; border-top-left-radius: 4px; position: relative; font-size: 16px; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; }
.react { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 44px; min-height: 44px; padding: 4px 10px; border-radius: 99px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); font-size: 18px; transition: transform .2s var(--pop), background .2s; }
.react .c { font-size: 13px; font-weight: 700; color: var(--ink2); min-width: 8px; }
.react.on { background: #efe7ff; box-shadow: inset 0 0 0 2px var(--purple); }
.react.on .c { color: var(--purple); }
.react:active { transform: scale(.85); }
.react.bump { animation: bump .45s var(--pop); }
@keyframes bump { 40% { transform: scale(1.4) rotate(-8deg); } }
.v-del { font-size: 18px; opacity: .6; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.new-flash { animation: flash 1.2s ease; } @keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(124, 77, 255, .6); } 100% { box-shadow: 0 0 0 16px rgba(124, 77, 255, 0); } }

/* ===================================================== TRIBUNALE */
.court-hero { text-align: center; background: linear-gradient(135deg, #7c4dff, #b06cff); color: #fff; }
.court-hero h2 { font-size: 22px; } .court-hero p { margin: 6px 0 0; opacity: .92; font-size: 14px; }
.court-hero .gavel { font-size: 46px; display: inline-block; animation: gavel 2.4s ease-in-out infinite; transform-origin: 80% 80%; }
@keyframes gavel { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-35deg); } 80% { transform: rotate(10deg); } }
.pts-input { display: flex; align-items: center; gap: 8px; }
.pts-input input { text-align: center; font-weight: 700; font-size: 20px; width: 90px; }
.stepper { width: 44px; height: 44px; border-radius: 14px; background: #efe7ff; color: var(--purple); font-size: 24px; font-weight: 700; flex: 0 0 auto; }
.stepper:active { transform: scale(.88); }
.req { padding: 14px; border-left: 6px solid var(--yellow); }
.req + .req { margin-top: 10px; }
.req.approved { border-left-color: var(--green); } .req.rejected { border-left-color: #9ca3af; } .req.dishonor { border-left-color: var(--red); }
.req-top { display: flex; align-items: center; gap: 10px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.tag.richiesta { background: #fff3c4; color: #8a6200; } .tag.ricorso { background: #e0e7ff; color: #3730a3; }
.stamp { display: inline-block; padding: 3px 10px; border-radius: 10px; font-weight: 700; font-size: 13px; border: 2px solid; transform: rotate(-3deg); }
.stamp.approved { color: var(--green-d); border-color: var(--green); background: #f0fdf4; }
.stamp.rejected { color: #6b7280; border-color: #9ca3af; background: #f9fafb; }
.stamp.dishonor { color: var(--red-d); border-color: var(--red); background: #fef2f2; }
.stamp.pending { color: #8a6200; border-color: var(--yellow); background: #fffbeb; }
.hourglass { display: inline-block; animation: flip 2.4s ease-in-out infinite; } @keyframes flip { 50% { transform: rotate(180deg); } 100% { transform: rotate(180deg); } }
.req-reason { margin: 8px 0 0; font-size: 15px; }
.contested { margin-top: 8px; font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: 12px; color: var(--red-d); }

/* ===================================================== AVVENTO */
.advent-banner { text-align: center; background: linear-gradient(135deg, #c8102e, #e8434f 55%, #1f8a4c); color: #fff; position: relative; overflow: hidden; }
.advent-banner h2 { font-size: 22px; } .advent-banner p { margin: 4px 0 0; font-size: 14px; opacity: .95; }
.snow { position: absolute; inset: 0; pointer-events: none; }
.snow i { position: absolute; top: -20px; font-style: normal; animation: fall linear infinite; opacity: .8; }
@keyframes fall { to { transform: translateY(260px) rotate(360deg); } }
.advent-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .advent-grid { grid-template-columns: repeat(6, 1fr); } }
.day {
  aspect-ratio: 1; border-radius: 20px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: 26px; overflow: hidden; box-shadow: var(--shadow-s), inset 0 3px 0 rgba(255, 255, 255, .35), inset 0 -4px 0 rgba(0, 0, 0, .15);
  transition: transform .2s var(--pop); animation: slideIn .5s var(--pop) both; user-select: none; -webkit-user-select: none;
}
.day.c0 { background: linear-gradient(135deg, #e8434f, #b8102a); } .day.c1 { background: linear-gradient(135deg, #2fb86b, #14773f); } .day.c2 { background: linear-gradient(135deg, #ffcf3f, #f2a000); color: #5a3b00; }
.day:active { transform: scale(.9); }
.day .st { font-size: 16px; margin-top: 2px; }
.day.locked { background: linear-gradient(135deg, #aeb4c4, #8a91a5); color: #fff; }
.day.locked .num { opacity: .6; }
.day.avail { animation: slideIn .5s var(--pop) both, ping 2.2s 1s infinite; }
@keyframes ping { 0%, 100% { box-shadow: var(--shadow-s), 0 0 0 0 rgba(255, 201, 51, .8); } 50% { box-shadow: var(--shadow-s), 0 0 0 9px rgba(255, 201, 51, 0); } }
.day.done { filter: saturate(.55) brightness(1.05); }
.day.today::after { content: "OGGI"; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); font-size: 9px; background: #fff; color: var(--red); border-radius: 99px; padding: 0 6px; }
.day.shake { animation: shake .5s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px) rotate(-4deg); } 40% { transform: translateX(8px) rotate(4deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.preview-banner { background: #fff7d6; border: 2px dashed var(--yellow-d); border-radius: 16px; padding: 8px 12px; margin-top: 10px; font-size: 13px; text-align: center; font-weight: 600; }

/* gratta e vinci */
.scratch-title { font-size: 20px; text-align: center; margin: 0 0 12px; }
.scratch-wrap {
  position: relative; width: 100%; max-width: 360px; aspect-ratio: 16 / 11; margin: 0 auto; border-radius: 20px; overflow: hidden;
  background: linear-gradient(135deg, #fff7d6, #ffe9a8); border: 4px solid #e0a400; box-shadow: 0 10px 24px rgba(224, 164, 0, .3);
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
.scratch-prize { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px 18px; font-weight: 600; font-size: 16.5px; line-height: 1.3; color: #5a3b00; overflow-y: auto; }
.scratch-prize.long { font-size: 14px; }
.scratch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .7s ease, transform .7s ease; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.scratch-canvas.revealed { opacity: 0; pointer-events: none; transform: scale(1.08); }
.scratch-meter { height: 8px; border-radius: 4px; background: rgba(124, 77, 255, .12); margin: 14px auto 0; max-width: 360px; overflow: hidden; }
.scratch-meter i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: 4px; transition: width .15s; }
.scratch-hint { text-align: center; font-size: 13px; color: var(--ink2); margin-top: 8px; }
.revealed-glow { animation: glowGold 1.2s ease 2; } @keyframes glowGold { 50% { box-shadow: 0 0 0 10px rgba(255, 201, 51, .4), 0 10px 24px rgba(224, 164, 0, .3); } }

/* ===================================================== GIOCO */
.game-hud { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.hud-box { flex: 1; text-align: center; background: #fff; border-radius: 16px; padding: 6px 8px; box-shadow: var(--shadow-s); }
.hud-box .l { font-size: 11px; color: var(--ink2); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.hud-box .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.hud-box .v.pulse { animation: pop .3s var(--pop); }
.hud-box .v.neg { color: var(--red); }
.time-bar { height: 8px; border-radius: 4px; background: rgba(124, 77, 255, .12); margin: 8px 0 10px; overflow: hidden; }
.time-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--yellow), var(--red)); background-size: 300% 100%; transform-origin: left; }
.board {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: min(100%, 44dvh); margin: 0 auto;
  user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; overscroll-behavior: contain;
}
.board.shake { animation: shakeScreen .45s; }
@keyframes shakeScreen { 0%, 100% { transform: none; } 15% { transform: translate(-10px, 4px) rotate(-1.5deg); } 30% { transform: translate(9px, -5px) rotate(1.5deg); } 45% { transform: translate(-8px, 3px); } 60% { transform: translate(6px, -3px); } 80% { transform: translate(-3px, 1px); } }
.hole { position: relative; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 40%, #6b4a2c, #3b2616 70%); box-shadow: inset 0 10px 18px rgba(0, 0, 0, .55), 0 6px 0 #d9c6ff; touch-action: none; }
.hole::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%; background: linear-gradient(180deg, #7ac74f, #4a9a2d); border-radius: 0 0 50% 50% / 0 0 100% 100%; z-index: 2; pointer-events: none; }
.mole {
  position: absolute; left: 12%; right: 12%; bottom: 0; top: 8%; display: grid; place-items: center; border-radius: 50%; font-size: min(14vw, 64px); transform: translateY(108%) scale(.88);
  transition: transform .18s var(--pop); z-index: 1; cursor: pointer; touch-action: none;
}
.mole.up { transform: translateY(0) scale(1); }
.mole.hit { transform: translateY(40%) scale(.78) rotate(12deg); transition: transform .12s; }
.mole .face { width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #ffe0b8; border: 4px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); pointer-events: none; }
.mole .face img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.mole.trifi .face { background: #dcfce7; border: 4px solid #22c55e; box-shadow: 0 0 0 3px #ffc933, 0 6px 14px rgba(34, 197, 94, .4); }
.mole.bad .face { background: #fee2e2; border: 4px solid #ef4444; animation: enemyBlink .35s ease-in-out infinite alternate; }
@keyframes enemyBlink {
  from { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, .35), 0 4px 10px rgba(0, 0, 0, .3); }
  to { border-color: #fca5a5; box-shadow: 0 0 0 6px rgba(239, 68, 68, .75), 0 4px 14px rgba(239, 68, 68, .5); }
}

/* ===================================================== RUOTA DELLA FORTUNA */
.wheel-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; }
.wheel-card.shake { animation: shakeScreen .45s; }
.wheel-head h2 { font-size: 22px; }
.wheel-head p { margin: 2px 0 0; font-size: 13px; }
.wheel-stage {
  position: relative; width: clamp(200px, min(70vw, 37dvh), 285px); aspect-ratio: 1; margin: 4px auto 0;
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: contain;
}
.wheel-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 12px 24px rgba(42, 27, 77, .22)); touch-action: none; }
.wheel-pointer {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 34px; height: 40px; z-index: 4;
  transform-origin: 50% 10px; filter: drop-shadow(0 4px 6px rgba(42, 27, 77, .28));
}
.wheel-pointer svg { width: 100%; height: 100%; display: block; }
.wheel-pointer.tick { animation: pegTick .11s ease-out; }
@keyframes pegTick { 35% { transform: translateX(-50%) rotate(-18deg); } }
.wheel-result { width: 100%; border-radius: 18px; padding: 12px 14px; background: #faf7ff; border: 2px solid var(--line); }
.wheel-result.pos { background: #f0fdf4; border-color: #86efac; }
.wheel-result.neg { background: #fef2f2; border-color: #fca5a5; }
.wheel-result.zero { background: #f8fafc; border-color: #cbd5e1; }
.wheel-result.pop { animation: pop .45s var(--pop); }
.wheel-result .wr-pts { font-size: 32px; font-weight: 700; line-height: 1.05; }
.wheel-result.pos .wr-pts { color: var(--green-d); }
.wheel-result.neg .wr-pts { color: var(--red-d); }
.wheel-result.zero .wr-pts { color: #475569; }
.wheel-result .wr-msg { font-size: 15px; font-weight: 600; margin-top: 4px; }
.wheel-result .wr-next { font-size: 13px; color: var(--ink2); margin-top: 6px; }
.wheel-cd { font-variant-numeric: tabular-nums; color: var(--purple); font-size: 15px; }
.floaty { position: absolute; z-index: 5; font-weight: 700; font-size: 30px; pointer-events: none; animation: floatUp .8s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; transform: translate(-50%, -50%); }
.floaty.pos { color: var(--green-d); } .floaty.neg { color: var(--red); }
@keyframes floatUp { 0% { transform: translate(-50%, -30%) scale(.5); opacity: 0; } 20% { transform: translate(-50%, -80%) scale(1.3); opacity: 1; } 100% { transform: translate(-50%, -220%) scale(1); opacity: 0; } }
.game-cover { position: absolute; inset: -6px; z-index: 10; border-radius: 28px; background: rgba(255, 255, 255, .93); backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; gap: 10px; animation: fade .3s both; }
.game-cover h3 { font-size: 26px; } .game-cover .final { font-size: 64px; font-weight: 700; line-height: 1; }
.game-cover .final.neg { color: var(--red); }
.rules { font-size: 13px; color: var(--ink2); max-width: 290px; }
.rules b { color: var(--ink); }
.hof-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.hof-row:last-child { border-bottom: 0; }
.hof-row .pos { width: 32px; text-align: center; font-size: 22px; font-weight: 700; }
.hof-row .grow { flex: 1; min-width: 0; font-weight: 600; }
.hof-row .sc { font-weight: 700; font-size: 20px; }
.hof-row.me { background: #f4eeff; border-radius: 14px; padding-left: 8px; padding-right: 8px; }
.hof-row .avatar { --s: 40px; }

/* ===================================================== ADMIN */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -2px; scrollbar-width: none; position: sticky; top: 58px; z-index: 20; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button { flex: 0 0 auto; min-height: 44px; padding: 10px 14px; border-radius: 99px; background: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-s); position: relative; transition: all .25s var(--pop); }
.admin-tabs button.on { background: var(--purple); color: #fff; transform: scale(1.06); }
.admin-tabs .dot { background: var(--pink); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; margin-left: 4px; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .pick-grid { grid-template-columns: repeat(4, 1fr); } }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; background: #faf7ff; border: 2px solid transparent; font-weight: 600; font-size: 14px; transition: all .2s var(--pop); }
.pick .avatar { --s: 44px; }
.pick .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.on { border-color: var(--purple); background: #efe7ff; transform: scale(1.06); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.q { padding: 14px 0; border-radius: 16px; font-size: 22px; font-weight: 700; transition: all .15s var(--pop); border: 3px solid transparent; }
.q.pos { background: #dcfce7; color: var(--green-d); } .q.neg { background: #fee2e2; color: var(--red-d); }
.q.on { transform: scale(1.08); border-color: currentColor; }
.q:active { transform: scale(.9); }
.reason-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.reason-chips::-webkit-scrollbar { display: none; }
.reason-chips .chip { flex: 0 0 auto; font-size: 13px; padding: 6px 12px; }
.player-edit { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.player-edit .fields { display: grid; grid-template-columns: 1fr 70px; gap: 6px; }
.player-edit .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-btn { position: relative; }
.avatar-btn .avatar { --s: 60px; }
.avatar-btn::after { content: "📷"; position: absolute; right: -4px; bottom: -4px; background: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; box-shadow: var(--shadow-s); }
.switch { position: relative; width: 62px; height: 34px; border-radius: 17px; background: #cfc6e6; transition: background .25s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .3s var(--pop); }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(28px); }
.line-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.adv-edit { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: start; }
.adv-edit + .adv-edit { margin-top: 10px; }
.adv-edit .d { width: 44px; height: 44px; border-radius: 14px; background: var(--red); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 18px; }
.adv-edit textarea { min-height: 62px; }
.adv-edit .try { margin-top: 6px; }
.target-prev { display: grid; place-items: center; }
.target-prev .avatar { --s: 120px; font-size: 64px; }
.save-bar { position: sticky; bottom: calc(var(--nav-h) + 10px + var(--safe-b)); z-index: 15; margin-top: 12px; }

/* toast */
#toast-root { position: fixed; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; bottom: calc(var(--nav-h) + 18px + var(--safe-b)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 18px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); animation: toastIn .4s var(--pop) both; max-width: 420px; text-align: center; font-size: 15px; }
.toast.ok { background: var(--green-d); } .toast.err { background: var(--red-d); }
.toast.out { animation: toastOut .3s both; }
@keyframes toastIn { from { transform: translateY(30px) scale(.8); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

.loader { display: grid; place-items: center; padding: 50px 0; font-size: 44px; }
.loader span { display: inline-block; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 70px; border-radius: 20px; background: linear-gradient(90deg, #f1eaff 25%, #fbf8ff 50%, #f1eaff 75%); background-size: 200% 100%; animation: sk 1.3s infinite; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

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