:root {
  --bg: #07070d;
  --card: rgba(255, 255, 255, .055);
  --card-2: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .09);
  --text: #f4f4fb;
  --muted: #9a9ab3;
  --leo: #38d6ff;
  --ali: #ff4fa3;
  --good: #3ef0a0;
  --bad: #ff5a6a;
  --warn: #ff9b42;
  --blood: #ff1f3d;
  --gold: #ffd166;
  --r: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ───────── Sfondo animato ───────── */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: .28; animation: drift 26s ease-in-out infinite alternate; }
.bg i:nth-child(1) { background: var(--leo); left: -30vmax; top: -25vmax; }
.bg i:nth-child(2) { background: var(--ali); right: -30vmax; bottom: -30vmax; animation-delay: -9s; }
.bg i:nth-child(3) { background: #7a5cff; left: 20vmax; top: 40vh; width: 40vmax; height: 40vmax; opacity: .16; animation-delay: -15s; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

body[data-mood="t2"] .bg i:nth-child(3) { background: var(--warn); opacity: .25; }
body[data-mood="t3"] .bg i, body[data-mood="lite"] .bg i { background: var(--blood) !important; }
body[data-mood="lite"] .bg i { opacity: .22; animation-duration: 6s; }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity .6s;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 60, .55) 100%); }
body[data-mood="t2"] #vignette { opacity: .35; background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 140, 40, .5) 100%); animation: throb 2.6s ease-in-out infinite; }
body[data-mood="t3"] #vignette { opacity: .7; animation: heartbeat 1.1s ease-in-out infinite; }
body[data-mood="lite"] #vignette { opacity: .9; background: radial-gradient(ellipse at center, transparent 35%, rgba(120, 0, 15, .85) 100%); }
@keyframes throb { 50% { opacity: .15; } }
@keyframes heartbeat { 0%, 100% { opacity: .45; } 15% { opacity: .85; } 30% { opacity: .5; } 45% { opacity: .8; } }

/* ───────── Layout ───────── */
#app { max-width: 540px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px calc(100px + var(--safe-b)); }
.view { animation: viewIn .45s cubic-bezier(.2, .8, .2, 1) both; }
.view.out { animation: viewOut .2s ease-in both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-8px); } }

.topbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; min-height: 40px; }
.topbar h1 { font-size: 22px; margin: 0; flex: 1; letter-spacing: -.02em; }
.back { width: 40px; height: 40px; border-radius: 14px; background: var(--card); display: grid; place-items: center; font-size: 20px; }
.logo { font-weight: 900; font-size: 24px; letter-spacing: -.03em; flex: 1; }
.logo b { background: linear-gradient(90deg, var(--leo), #b77dff, var(--ali)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 26px 4px 10px; font-weight: 800; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--card-2); font-weight: 800; font-size: 14px; white-space: nowrap; }
.pts { font-weight: 900; font-variant-numeric: tabular-nums; }
.pts.plus { color: var(--good); }
.pts.minus { color: var(--bad); }
.pts.zero { color: var(--muted); }

/* ───────── Bottoni ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 18px; border-radius: 18px; font-weight: 800; font-size: 16px;
  background: var(--card-2); border: 1px solid var(--line); transition: transform .12s, filter .2s; position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.good { background: linear-gradient(135deg, #1fd98a, #10a86b); border-color: transparent; color: #04140c; }
.btn.bad { background: linear-gradient(135deg, #ff5a6a, #d8264a); border-color: transparent; }
.btn.warn { background: linear-gradient(135deg, #ffb347, #ff7a2f); border-color: transparent; color: #1d0d00; }
.btn.ghost { background: transparent; }
.btn.primary { background: linear-gradient(135deg, #7a5cff, #4b7bff); border-color: transparent; }
.btn .fill { position: absolute; inset: 0; background: rgba(255, 255, 255, .28); transform-origin: left; transform: scaleX(var(--p, 0)); pointer-events: none; }
.btn.blood { background: repeating-linear-gradient(-45deg, #2a0007 0 12px, #4a000e 12px 24px); border: 1px solid var(--blood); color: #ffd6dc; box-shadow: 0 0 24px rgba(255, 31, 61, .45); animation: tape 1s linear infinite; background-size: 34px 34px; }

.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-btn { text-decoration: none; color: inherit; border-radius: 26px; padding: 18px 14px; text-align: left; position: relative; overflow: hidden; min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); transition: transform .15s; }
.big-btn:active { transform: scale(.96); }
.big-btn .ico { font-size: 34px; }
.big-btn .lbl { font-weight: 900; font-size: 18px; line-height: 1.1; }
.big-btn .sub { font-size: 12px; opacity: .8; font-weight: 700; margin-top: 4px; }
.big-btn.pos { background: linear-gradient(150deg, rgba(62, 240, 160, .28), rgba(62, 240, 160, .06)); }
.big-btn.neg { background: linear-gradient(150deg, rgba(255, 90, 106, .28), rgba(255, 90, 106, .06)); }
.big-btn.locked { filter: saturate(.3); }
.big-btn.locked::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.big-btn .lock { position: absolute; right: 12px; top: 12px; z-index: 1; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, .5); padding: 5px 9px; border-radius: 999px; }

/* ───────── Tabbar ───────── */
#tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 30; display: flex; gap: 4px; padding: 6px;
  background: rgba(20, 20, 32, .78); border: 1px solid var(--line); border-radius: 24px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
#tabs a { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 18px; border-radius: 18px; font-size: 11px; font-weight: 800; color: var(--muted); position: relative; transition: background .2s, color .2s; }
#tabs a span { font-size: 20px; }
#tabs a.on { background: rgba(255, 255, 255, .1); color: var(--text); }
#tabs .badge { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; animation: pop .4s; }

/* ───────── Scoreboard ───────── */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.player { border-radius: 26px; padding: 16px 10px 14px; text-align: center; position: relative; background: var(--card); border: 1px solid var(--line); overflow: visible; }
.player::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 50% 0%, var(--c) 0%, transparent 70%); opacity: .22; pointer-events: none; }
.player.me { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.avatar { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; position: relative;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--c) 55%, #fff 0%), color-mix(in srgb, var(--c) 30%, #000)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 50%, transparent), 0 8px 30px color-mix(in srgb, var(--c) 45%, transparent); }
.player .name { font-weight: 900; font-size: 15px; }
.player .score { font-size: 44px; font-weight: 900; line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.player .score.minus { color: var(--bad); text-shadow: 0 0 22px rgba(255, 90, 106, .5); }
.player .score.plus { color: var(--good); text-shadow: 0 0 22px rgba(62, 240, 160, .4); }
.player .tag { font-size: 11px; font-weight: 800; margin-top: 8px; padding: 4px 8px; border-radius: 999px; display: inline-block; }
.player .tag.danger { background: rgba(255, 90, 106, .18); color: var(--bad); animation: throb 1.6s infinite; }
.player .tag.safe { background: rgba(62, 240, 160, .14); color: var(--good); }
.crown { position: absolute; top: -18px; left: 50%; font-size: 30px; transform: translateX(-50%) rotate(-8deg); animation: crownIn .9s cubic-bezier(.3, 1.6, .5, 1) both, bob 3s ease-in-out .9s infinite; filter: drop-shadow(0 4px 10px rgba(255, 209, 102, .6)); z-index: 2; }
@keyframes crownIn { from { transform: translate(-50%, -60px) rotate(-40deg); opacity: 0; } }
@keyframes bob { 50% { transform: translate(-50%, -4px) rotate(6deg); } }
.vs { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 900; color: var(--muted); font-size: 13px; }
.flame { font-size: 28px; display: inline-block; animation: flicker 1.4s ease-in-out infinite; transform-origin: 50% 90%; }
.flame.off { filter: grayscale(1); opacity: .45; animation: none; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 25% { transform: scale(1.08, .95) rotate(2deg); } 50% { transform: scale(.95, 1.08) rotate(-1deg); } 75% { transform: scale(1.05) rotate(3deg); } }
.streak-n { font-size: 20px; color: var(--text); }

.countdown { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 10px 14px; border-radius: 16px; background: var(--card); font-size: 13px; font-weight: 700; color: var(--muted); }
.countdown b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ───────── Carte azione (segnalazioni attive) ───────── */
.action-card { display: block; text-decoration: none; border-radius: 22px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); position: relative; overflow: hidden; animation: viewIn .5s both; }
.action-card + .action-card { margin-top: 10px; }
.action-card .ttl { font-weight: 900; font-size: 16px; }
.action-card .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.action-card .em { font-size: 30px; }
.action-card.mine { border-color: rgba(255, 90, 106, .6); box-shadow: 0 0 0 1px rgba(255, 90, 106, .25), 0 10px 30px rgba(255, 90, 106, .15); }
.action-card.mine::after { content: "TOCCA A TE"; position: absolute; right: 12px; top: 10px; font-size: 10px; font-weight: 900; letter-spacing: .1em; background: var(--bad); padding: 3px 7px; border-radius: 6px; animation: throb 1.4s infinite; }
.action-card.r2 { background: linear-gradient(135deg, rgba(255, 155, 66, .18), var(--card)); border-color: rgba(255, 155, 66, .5); }
.action-card.r3 { background: linear-gradient(135deg, rgba(255, 31, 61, .25), rgba(40, 0, 6, .5)); border-color: var(--blood); animation: viewIn .5s both, redPulse 1.2s ease-in-out infinite; }
@keyframes redPulse { 50% { box-shadow: 0 0 26px rgba(255, 31, 61, .45); } }

.pips { display: flex; gap: 5px; margin-top: 10px; }
.pips i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.pips i.on { background: var(--muted); }
.pips.r2 i.on { background: var(--warn); }
.pips.r3 i.on { background: var(--blood); box-shadow: 0 0 10px var(--blood); }

/* ───────── Feed ───────── */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; animation: viewIn .4s both; }
.feed li:last-child { border-bottom: 0; }
.feed .fi { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 20px; background: var(--card-2); }
.feed .fi.pos { background: rgba(62, 240, 160, .14); }
.feed .fi.neg { background: rgba(255, 90, 106, .14); }
.feed .fi.lite { background: rgba(255, 31, 61, .35); }
.feed .ft { font-size: 14px; line-height: 1.35; }
.feed .ft b { font-weight: 900; }
.feed .fq { font-size: 13px; color: var(--muted); margin-top: 3px; font-style: italic; overflow-wrap: anywhere; }
.feed .fw { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 700; }
.feed a { text-decoration: none; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 14px; }
.empty .e { font-size: 40px; display: block; margin-bottom: 6px; }

/* ───────── Login ───────── */
.login { text-align: center; padding-top: 6vh; }
.login .hero { font-size: 52px; font-weight: 900; letter-spacing: -.04em; margin: 0; }
.login .hero b { background: linear-gradient(90deg, var(--leo), #b77dff, var(--ali)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .tagline { color: var(--muted); margin: 4px 0 34px; font-weight: 700; }
.who { display: flex; justify-content: center; gap: 22px; margin-bottom: 18px; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 900; transition: transform .25s, opacity .25s; }
.who button .avatar { width: 88px; height: 88px; font-size: 46px; transition: transform .3s; }
.who button.sel .avatar { transform: scale(1.12); animation: glow 1.8s ease-in-out infinite; }
.who.picked button:not(.sel) { opacity: .35; transform: scale(.9); }
@keyframes glow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 60%, transparent), 0 0 40px var(--c); } }
.parent-link { font-size: 13px; color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 26px 0 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); transition: all .15s; }
.pin-dots i.on { background: var(--text); border-color: var(--text); transform: scale(1.15); }
.pin-err { color: var(--bad); font-weight: 800; min-height: 22px; font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 14px; justify-content: center; margin-top: 8px; }
.keypad button { height: 78px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); font-size: 28px; font-weight: 700; transition: background .1s, transform .1s; }
.keypad button:active { background: rgba(255, 255, 255, .2); transform: scale(.92); }
.keypad button.ghost { background: transparent; border: 0; font-size: 22px; }

/* ───────── Patto ───────── */
.pact-intro { font-size: 15px; line-height: 1.5; color: #d7d7e6; }
.beh-list { display: grid; gap: 8px; }
.beh-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); animation: viewIn .5s both; }
.beh-row .em { font-size: 26px; width: 34px; text-align: center; }
.beh-row .t { font-weight: 800; }
.beh-row .d { font-size: 12px; color: var(--muted); }
.x2 { font-size: 11px; font-weight: 900; background: var(--bad); color: #fff; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rules-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.rules-table td:last-child { text-align: right; white-space: nowrap; }
.sign-zone { text-align: center; padding: 22px 0 10px; }
.signed-by { display: flex; justify-content: center; gap: 14px; margin-top: 14px; font-weight: 800; font-size: 14px; }
.stamp { position: fixed; left: 50%; top: 45%; z-index: 80; pointer-events: none; font-weight: 900; font-size: 44px; padding: 10px 22px; border: 5px solid currentColor; border-radius: 14px; letter-spacing: .06em;
  transform: translate(-50%, -50%) rotate(-12deg); animation: stamp .55s cubic-bezier(.2, 1.6, .4, 1) both; text-transform: uppercase; white-space: nowrap; background: rgba(0, 0, 0, .35); }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-12deg) scale(3); opacity: 0; } }
.stamp.fade { transition: opacity .5s, transform .5s; opacity: 0; transform: translate(-50%, -60%) rotate(-12deg) scale(.9); }

/* ───────── Composer ───────── */
.target { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.target .avatar { width: 48px; height: 48px; font-size: 26px; margin: 0; }
.beh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.beh-card { border-radius: 20px; padding: 14px 12px; text-align: left; background: var(--card); border: 1px solid var(--line); transition: transform .2s, background .2s, border-color .2s, box-shadow .2s; position: relative; animation: viewIn .45s both; }
.beh-card .em { font-size: 30px; display: inline-block; transform-origin: 30% 70%; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.beh-card .t { font-weight: 900; font-size: 14px; margin-top: 8px; line-height: 1.15; }
.beh-card .d { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.beh-card .x2 { position: absolute; right: 10px; top: 10px; }
.beh-grid.neg .beh-card.sel { border-color: var(--bad); background: rgba(255, 90, 106, .16); box-shadow: 0 0 24px rgba(255, 90, 106, .3); }
.beh-grid.pos .beh-card.sel { border-color: var(--good); background: rgba(62, 240, 160, .14); box-shadow: 0 0 24px rgba(62, 240, 160, .3); }
.beh-card.sel .em { transform: scale(1.25) rotate(-8deg); }
.beh-grid.has-sel .beh-card:not(.sel) { opacity: .55; }
.rating { display: flex; gap: 8px; }
.rating button { flex: 1; padding: 12px 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 13px; transition: all .2s; }
.rating button .s { display: block; font-size: 20px; margin-bottom: 2px; letter-spacing: -2px; }
.rating button.sel { background: var(--card-2); border-color: var(--text); transform: translateY(-2px); }
textarea, input.field { width: 100%; border-radius: 18px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); padding: 14px 16px; font-size: 16px; resize: none; outline: none; transition: border-color .2s; }
textarea:focus, input.field:focus { border-color: rgba(255, 255, 255, .4); }
textarea { min-height: 96px; }
.preview { font-size: 13px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .04); line-height: 1.5; }
.preview b { color: var(--text); }
.locked-panel { text-align: center; padding: 32px 16px; }
.ring { width: 140px; height: 140px; margin: 0 auto 16px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; }

/* Respiro */
.breath { position: fixed; inset: 0; z-index: 70; background: rgba(5, 5, 12, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 30px; animation: viewIn .4s both; text-align: center; }
.breath .orb { width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #9fe8ff, #4b7bff 55%, #2a1a7a); box-shadow: 0 0 80px #4b7bff; animation: breathe 8s ease-in-out infinite; display: grid; place-items: center; font-weight: 900; font-size: 40px; }
@keyframes breathe { 0%, 100% { transform: scale(.6); } 50% { transform: scale(1.1); } }
.breath .say { font-size: 24px; font-weight: 900; min-height: 30px; }
.breath .q { color: var(--muted); font-weight: 700; max-width: 300px; }
.breath .btns { display: grid; gap: 10px; width: 100%; max-width: 320px; }

/* ───────── Thread ───────── */
.threat-band { margin: 0 -16px 16px; padding: 12px 16px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; font-size: 14px; text-align: center; }
.threat-band.r1 { background: rgba(255, 255, 255, .05); color: var(--muted); }
.threat-band.r2 { background: linear-gradient(90deg, rgba(255, 155, 66, .1), rgba(255, 155, 66, .35), rgba(255, 155, 66, .1)); color: var(--warn); animation: throb 2s infinite; }
.threat-band.r3, .threat-band.lite { background: repeating-linear-gradient(-45deg, var(--blood) 0 16px, #120004 16px 32px); background-size: 45px 45px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 12px #000; animation: tape 1.2s linear infinite; }
.threat-band.lite { background: repeating-linear-gradient(-45deg, #ffd000 0 16px, #120004 16px 32px); background-size: 45px 45px; font-size: 18px; }
.threat-band.done { background: rgba(62, 240, 160, .1); color: var(--good); }
.threat-band.wd { background: rgba(255, 255, 255, .05); color: var(--muted); }
@keyframes tape { to { background-position: 45px 0; } }

.case { text-align: center; position: relative; overflow: hidden; }
.case .em { font-size: 64px; display: block; animation: pop .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.case .t { font-size: 22px; font-weight: 900; margin-top: 6px; }
.case .d { color: var(--muted); font-size: 13px; margin-top: 4px; }
.case .parties { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; font-weight: 800; font-size: 14px; }
.case.r2 { border-color: rgba(255, 155, 66, .6); box-shadow: 0 0 30px rgba(255, 155, 66, .2); }
.case.r3 { border-color: var(--blood); box-shadow: 0 0 40px rgba(255, 31, 61, .35); animation: redPulse 1.1s infinite; }
.case.r3 .em { animation: pop .6s both, jitter .25s linear infinite; }
.case.lite { border-color: var(--blood); background: linear-gradient(180deg, rgba(90, 0, 14, .7), rgba(20, 0, 4, .8)); }
.case.lite .t { animation: glitch 2.2s infinite; }
.case .cracks { position: absolute; inset: 0; pointer-events: none; opacity: .55; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes jitter { 25% { transform: translate(1px, -1px) rotate(-2deg); } 75% { transform: translate(-1px, 1px) rotate(2deg); } }
@keyframes glitch {
  0%, 86%, 100% { text-shadow: none; transform: none; }
  88% { text-shadow: -3px 0 var(--blood), 3px 0 var(--leo); transform: translateX(2px); }
  90% { text-shadow: 3px 0 var(--blood), -3px 0 var(--leo); transform: translateX(-3px) skewX(8deg); }
  92% { text-shadow: -2px 0 var(--blood), 2px 0 var(--leo); transform: none; }
}

.sev { display: inline-flex; gap: 2px; margin-top: 8px; font-size: 16px; }
.sev .off { filter: grayscale(1); opacity: .3; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 84%; padding: 11px 14px; border-radius: 20px; font-size: 15px; line-height: 1.4; animation: viewIn .4s both; overflow-wrap: anywhere; }
.bubble .who { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 3px; }
.bubble.left { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 6px; }
.bubble.right { align-self: flex-end; background: color-mix(in srgb, var(--c) 28%, #14141f); border-bottom-right-radius: 6px; }
.bubble .kind { font-size: 12px; font-weight: 800; margin-top: 5px; opacity: .85; }
.sysmsg { align-self: center; font-size: 12px; font-weight: 800; color: var(--muted); background: rgba(255, 255, 255, .05); padding: 6px 12px; border-radius: 999px; text-align: center; animation: viewIn .4s both; }
.sysmsg.lite { background: var(--blood); color: #fff; font-size: 14px; padding: 8px 16px; }

.stakes { border-radius: 20px; padding: 6px 14px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.stakes .h { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; color: var(--muted); padding: 10px 0 4px; }
.stake { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.stake:last-child { border-bottom: 0; }
.stake .i { font-size: 20px; width: 26px; text-align: center; }
.stake .v { margin-left: auto; font-size: 18px; }
.stake.hot { color: #ffc2c9; }
.stakes.r2 { border-color: rgba(255, 155, 66, .45); }
.stakes.r3 { border-color: var(--blood); background: rgba(60, 0, 10, .45); }
.deadline { text-align: center; font-weight: 800; font-size: 13px; color: var(--muted); }
.deadline b { color: var(--text); font-variant-numeric: tabular-nums; }
.warning-msg { font-weight: 800; font-size: 15px; line-height: 1.45; text-align: center; padding: 4px 6px; }
.warning-msg.r2 { color: var(--warn); }
.warning-msg.r3 { color: #ff8a98; }

/* Modal */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .25s both; }
.modal { width: 100%; max-width: 540px; background: #13131e; border: 1px solid var(--line); border-radius: 28px 28px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); animation: sheetUp .35s cubic-bezier(.2, .9, .3, 1) both; }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal.danger { background: linear-gradient(180deg, #2a0008, #12020a); border-color: var(--blood); box-shadow: 0 -10px 60px rgba(255, 31, 61, .4); }
.modal.danger h2 { color: #ff6b7d; animation: glitch 1.8s infinite; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ───────── Settimana ───────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-col { border-radius: 20px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); }
.stat-col .h { font-weight: 900; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.stat { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: #cfcfe0; font-weight: 700; }
.stat b { font-variant-numeric: tabular-nums; }
.titles { display: grid; gap: 8px; }
.title-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); animation: viewIn .5s both; }
.title-card .em { font-size: 30px; }
.title-card .n { font-weight: 900; }
.title-card .d { font-size: 12px; color: var(--muted); }
.title-card.good { background: linear-gradient(120deg, rgba(255, 209, 102, .14), var(--card)); border-color: rgba(255, 209, 102, .3); }
.title-card.bad { background: linear-gradient(120deg, rgba(255, 90, 106, .14), var(--card)); }
.title-card .who { margin-left: auto; font-size: 26px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-weight: 700; font-family: var(--font); }
.ledger-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .em { font-size: 20px; }
.ledger-row .v { margin-left: auto; }

/* ───────── Recap (stile "wrapped") ───────── */
.recap { position: fixed; inset: 0; z-index: 50; background: rgba(7, 7, 13, .82); display: flex; flex-direction: column; padding: calc(14px + var(--safe-t)) 18px calc(20px + var(--safe-b)); }
.recap .bars { display: flex; gap: 4px; }
.recap .bars i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.recap .bars i b { display: block; height: 100%; width: 0; background: #fff; }
.recap .bars i.done b { width: 100%; }
.recap .bars i.cur b { animation: bar 6s linear forwards; }
@keyframes bar { to { width: 100%; } }
.recap .close { position: absolute; right: 14px; top: calc(26px + var(--safe-t)); font-size: 22px; width: 40px; height: 40px; z-index: 2; }
.slide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; animation: slideIn .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slideIn { from { opacity: 0; transform: scale(.92) translateY(20px); } }
.slide .kicker { text-transform: uppercase; letter-spacing: .2em; font-weight: 900; color: var(--muted); font-size: 13px; }
.slide .huge { font-size: 96px; font-weight: 900; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.slide .big { font-size: 34px; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.slide .em { font-size: 90px; animation: pop .7s cubic-bezier(.3, 1.8, .5, 1) both; }
.slide .tap { color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 20px; }
.slide.bad { background: radial-gradient(circle at 50% 40%, rgba(255, 31, 61, .25), transparent 60%); }
.slide.good { background: radial-gradient(circle at 50% 40%, rgba(62, 240, 160, .18), transparent 60%); }

/* ───────── Toast / fx ───────── */
#toasts { position: fixed; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: 13px 16px; border-radius: 18px; background: rgba(28, 28, 44, .95); border: 1px solid var(--line); font-weight: 800; font-size: 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); animation: toastIn .45s cubic-bezier(.2, 1.4, .4, 1) both; pointer-events: auto; }
.toast .i { font-size: 22px; }
.toast.good { border-color: rgba(62, 240, 160, .5); }
.toast.bad { border-color: rgba(255, 90, 106, .6); }
.toast.lite { background: #3a0009; border-color: var(--blood); }
.toast.out { animation: toastOut .3s ease-in both; }
@keyframes toastIn { from { transform: translateY(-30px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 85; width: 100vw; height: 100vh; }
.flash { position: fixed; inset: 0; z-index: 84; pointer-events: none; animation: flash .6s ease-out both; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
.shake { animation: shake .55s cubic-bezier(.36, .07, .19, .97) both; }
.shake-hard { animation: shakeHard .8s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes shakeHard { 10%, 90% { transform: translate(-4px, 2px) rotate(-.5deg); } 20%, 80% { transform: translate(8px, -3px) rotate(.6deg); } 30%, 50%, 70% { transform: translate(-12px, 4px) rotate(-1deg); } 40%, 60% { transform: translate(12px, -2px) rotate(1deg); } }
.crack-overlay { position: fixed; inset: 0; z-index: 83; pointer-events: none; }
.crack-overlay path { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawCrack .5s ease-out forwards; filter: drop-shadow(0 0 3px rgba(255, 31, 61, .9)); }
@keyframes drawCrack { to { stroke-dashoffset: 0; } }
.crack-overlay.fade { transition: opacity 1.2s; opacity: 0; }

.form-row { display: grid; gap: 8px; }
.form-row label { font-size: 13px; font-weight: 800; color: var(--muted); }
.seg { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 16px; }
.seg button { flex: 1; padding: 10px; border-radius: 12px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card-2); color: var(--text); }
.penalty-banner { border-radius: 22px; padding: 16px; text-align: center; font-weight: 900; }
.penalty-banner.bad { background: repeating-linear-gradient(-45deg, rgba(255, 31, 61, .25) 0 14px, rgba(255, 31, 61, .12) 14px 28px); border: 1px solid var(--blood); }
.penalty-banner.good { background: rgba(62, 240, 160, .12); border: 1px solid rgba(62, 240, 160, .4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 370px) {
  .player .score { font-size: 36px; }
  .keypad { grid-template-columns: repeat(3, 68px); }
  .keypad button { height: 68px; }
}
