/* =====================================================================
   PANDEMONIO – Stile grafico (mobile-first, responsive desktop)
   ===================================================================== */

:root {
  --bg-1: #1a0c38;
  --bg-2: #0c0620;
  --felt-1: #3b1d83;
  --felt-2: #23105a;
  --felt-3: #150a37;
  --panel: rgba(28, 16, 60, 0.78);
  --panel-solid: #1c1040;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f3ff;
  --muted: #b3a9d6;

  --red: #ff4757;
  --yellow: #ffc531;
  --green: #2ed47a;
  --blue: #3d8bff;
  --pink: #ff3d8b;
  --gold: #ffc531;
  --violet: #8b5cf6;

  --hand-w: 70px;
  --pile-w: 88px;
  --font-title: 'Luckiest Guy', 'Arial Black', sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (min-width: 700px) {
  :root { --hand-w: 92px; --pile-w: 110px; }
}
@media (min-width: 1100px) and (min-height: 760px) {
  :root { --hand-w: 104px; --pile-w: 124px; }
}
@media (max-height: 680px) {
  :root { --hand-w: 62px; --pile-w: 74px; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 700px at 50% -10%, #3a1a7a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 110%, #4a0f4f 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

button, input { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* =====================================================================
   BOTTONI E ELEMENTI BASE
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: 0;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform 0.12s, filter 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 0.85rem; border-radius: 11px; }
.btn.lg { padding: 16px 20px; font-size: 1.08rem; }

.btn.pink {
  background: linear-gradient(180deg, #ff5c9d, #e8226f);
  box-shadow: 0 4px 0 #9e0f49, 0 10px 24px rgba(255, 61, 139, 0.35);
}
.btn.gold {
  background: linear-gradient(180deg, #ffd65c, #ffaa00);
  color: #3a2200;
  box-shadow: 0 4px 0 #b06f00, 0 10px 24px rgba(255, 197, 49, 0.3);
}
.btn.green {
  background: linear-gradient(180deg, #48e08d, #17a85a);
  box-shadow: 0 4px 0 #0b6b37, 0 10px 24px rgba(46, 212, 122, 0.3);
}
.btn.violet {
  background: linear-gradient(180deg, #a07cff, #6d3ff0);
  box-shadow: 0 4px 0 #4420a8, 0 10px 24px rgba(139, 92, 246, 0.35);
}
.btn.pink:active:not(:disabled), .btn.gold:active:not(:disabled),
.btn.green:active:not(:disabled), .btn.violet:active:not(:disabled) {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 0;
  background: rgba(8, 4, 22, 0.6);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  transition: box-shadow 0.15s;
}
.input:focus { box-shadow: inset 0 0 0 2px var(--pink); }
.input.code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-family: var(--font-title); font-size: 1.25rem; }
.input::placeholder { color: rgba(255, 255, 255, 0.35); letter-spacing: 0.1em; }

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 7px 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.12);
}
.badge.easy { background: rgba(46, 212, 122, 0.2); color: #7dffb5; }
.badge.medium { background: rgba(255, 197, 49, 0.2); color: #ffdc7a; }
.badge.hard { background: rgba(255, 71, 87, 0.22); color: #ff9aa4; }
.badge.host { background: rgba(255, 197, 49, 0.22); color: #ffd770; }
.badge.off { color: #aaa; }

.panel {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 20px;
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, 0.5);
  margin-bottom: 14px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* =====================================================================
   LOGO
   ===================================================================== */
.logo {
  font-family: var(--font-title);
  font-size: clamp(2.6rem, 12vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffe680 0%, #ffb300 45%, #ff3d8b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0.02em rgba(42, 15, 92, 0.6);
  filter: drop-shadow(0 4px 0 #2a0f5c) drop-shadow(0 10px 22px rgba(255, 61, 139, 0.4));
  transform: rotate(-3deg);
  padding-top: 0.12em;
  text-align: center;
  position: relative;
  z-index: 3;
}
.logo.sm { font-size: 2.2rem; }
.logo.xs { font-size: 1.35rem; transform: none; filter: drop-shadow(0 2px 0 #2a0f5c); }

.tagline {
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
  margin: 8px 0 18px;
}

/* =====================================================================
   HOME / LOBBY
   ===================================================================== */
.scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-fan {
  position: relative;
  height: 150px;
  width: 260px;
  margin: 6px 0 34px;
}
.hero-fan .card {
  --w: 74px;
  position: absolute;
  left: 50%;
  bottom: 0;
  transform-origin: 50% 130%;
  animation: heroIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  color: #fff;
  transition: transform 0.12s, filter 0.15s;
}
.mode-card:active { transform: scale(0.98); }
.mode-card:hover { filter: brightness(1.08); }
.mode-card .mc-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.mode-card b { display: block; font-size: 1.05rem; font-weight: 900; }
.mode-card small { display: block; opacity: 0.85; font-size: 0.82rem; margin-top: 2px; }
.mode-card.pink { background: linear-gradient(135deg, #ff5c9d, #c2185b); box-shadow: 0 4px 0 #85103e, 0 14px 28px rgba(255, 61, 139, 0.3); }
.mode-card.violet { background: linear-gradient(135deg, #8f6bff, #5a2fd6); box-shadow: 0 4px 0 #391b99, 0 14px 28px rgba(139, 92, 246, 0.3); }

.room-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(8, 4, 22, 0.55);
  box-shadow: inset 0 0 0 2px rgba(255, 197, 49, 0.35);
  margin-bottom: 16px;
}
.room-code {
  font-family: var(--font-title);
  font-size: 2rem;
  letter-spacing: 0.18em;
  color: var(--gold);
  line-height: 1;
  padding-top: 0.1em;
}

.plist { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 18px; }
.pitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: popIn 0.25s ease-out;
}
.pitem .pname { flex: 1; font-weight: 800; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.seg {
  padding: 10px 6px;
  border-radius: 13px;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1.5px var(--line);
  text-align: center;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
}
.seg small { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.seg.active { background: rgba(255, 197, 49, 0.14); box-shadow: inset 0 0 0 2px var(--gold); }
.seg:disabled { cursor: default; }

/* Avatar */
.avatar {
  --c: #8b5cf6;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.95rem;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.85), 0 6px 14px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.avatar.sm { width: 34px; height: 34px; font-size: 0.82rem; }

/* =====================================================================
   CARTE
   ===================================================================== */
.card {
  --w: var(--hand-w);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.5);
  font-size: calc(var(--w) / 6);
  border-radius: 0.95em;
  flex-shrink: 0;
  color: #fff;
  background: var(--cbg, #333);
  box-shadow: inset 0 0 0 0.3em #fff, 0 0.35em 0.9em rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1), box-shadow 0.18s, filter 0.18s, opacity 0.18s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0.3em;
  border-radius: 0.7em;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.28), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 0.45em, transparent 0.45em 0.9em);
  pointer-events: none;
}
.card svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.card .ck {
  position: absolute;
  font-family: var(--font-title);
  font-style: normal;
  font-size: 1.2em;
  line-height: 1;
  z-index: 2;
  text-shadow: 0.05em 0.05em 0 rgba(0, 0, 0, 0.25);
}
.card .ck svg { width: 1em; height: 1em; stroke-width: 3; }
.card .ck.tl { top: 0.5em; left: 0.55em; }
.card .ck.br { bottom: 0.5em; right: 0.55em; transform: rotate(180deg); }

.card .cmid {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3.7em;
  height: 3.7em;
  transform: translate(-50%, -50%) rotate(-8deg);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.17);
  box-shadow: inset 0 0 0 0.16em rgba(255, 255, 255, 0.55), 0 0.2em 0.6em rgba(0, 0, 0, 0.15);
  z-index: 2;
}
.card .cmid b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 2.75em;
  line-height: 1;
  padding-top: 0.12em;
  transform: rotate(8deg);
  text-shadow: 0.05em 0.06em 0 rgba(0, 0, 0, 0.28);
}
.card .cmid svg { width: 2.1em; height: 2.1em; transform: rotate(8deg); }
.card .cmid .p4 { font-size: 1.85em; padding-top: 0.15em; }
.card .cmid .emo { font-size: 2em; transform: rotate(8deg); line-height: 1; }

.card.special .cmid { top: 44%; }
.card.special .ck.br { display: none; }
.card .clabel {
  position: absolute;
  left: 0.3em;
  right: 0.3em;
  bottom: 0.85em;
  text-align: center;
  font-size: 0.6em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.05;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colori */
.card.red { --cbg: linear-gradient(160deg, #ff6b6b 0%, #e8213d 100%); }
.card.green { --cbg: linear-gradient(160deg, #4ee391 0%, #0f9a52 100%); }
.card.blue { --cbg: linear-gradient(160deg, #5aaeff 0%, #1f5fd6 100%); }
.card.yellow { --cbg: linear-gradient(160deg, #ffe066 0%, #f5a000 100%); color: #4a2a00; }
.card.yellow .ck, .card.yellow .cmid b { text-shadow: 0.04em 0.05em 0 rgba(255, 255, 255, 0.45); }

.card.black {
  --cbg: linear-gradient(160deg, #34304a 0%, #0d0b16 100%);
  color: var(--gold);
  box-shadow: inset 0 0 0 0.3em #ffd96b, 0 0.35em 0.9em rgba(0, 0, 0, 0.5);
}
.card.black .cmid { background: rgba(255, 197, 49, 0.1); box-shadow: inset 0 0 0 0.16em rgba(255, 197, 49, 0.6); }
.card.black .bolt { position: absolute; top: 0.6em; left: 50%; transform: translateX(-50%); width: 1.2em; height: 1.2em; z-index: 2; }

.card.multi {
  --cbg: linear-gradient(160deg, #2c1c5c 0%, #120a2c 100%);
  box-shadow: 0 0.35em 0.9em rgba(0, 0, 0, 0.5);
  border: 0.3em solid transparent;
  background:
    var(--cbg) padding-box,
    conic-gradient(from 210deg, #ff4757, #ffc531, #2ed47a, #3d8bff, #ff4757) border-box;
}
.card.multi::before { inset: 0; border-radius: 0.65em; }
.card.multi .cmid {
  background: radial-gradient(circle, #2a1a58 58%, transparent 60%), conic-gradient(from 210deg, #ff4757, #ffc531, #2ed47a, #3d8bff, #ff4757);
  box-shadow: 0 0.2em 0.7em rgba(0, 0, 0, 0.35);
}
.card.multi .ck.tl { top: 0.25em; left: 0.3em; }
.card.multi .ck.br { bottom: 0.25em; right: 0.3em; }
.card.multi .clabel { bottom: 0.6em; }
.card u { text-decoration: underline; text-decoration-thickness: 0.09em; text-underline-offset: 0.08em; }

.card.vaffa {
  --cbg: linear-gradient(160deg, #ffffff 0%, #e9e4f7 100%);
  color: #1b1236;
  box-shadow: inset 0 0 0 0.3em #1b1236, 0 0.35em 0.9em rgba(0, 0, 0, 0.5);
}
.card.vaffa .cmid { background: rgba(255, 71, 87, 0.12); box-shadow: inset 0 0 0 0.16em var(--red); }
.card.vaffa .clabel { color: var(--red); }

/* Retro */
.card.back {
  --cbg: radial-gradient(circle at 50% 50%, #6a35e8 0%, #3a148f 55%, #22095e 100%);
}
.card.back::before {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 0.35em, transparent 0.35em 0.7em),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 0 0.35em, transparent 0.35em 0.7em);
}
.card.back .bk {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  width: 3.6em;
  height: 3.6em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffe680, #ffb300 50%, #ff3d8b);
  box-shadow: 0 0 0 0.18em #fff, 0 0.3em 0.8em rgba(0, 0, 0, 0.4);
  font-family: var(--font-title);
  font-size: 1em;
  color: #2a0f5c;
  z-index: 2;
}
.card.back .bk span { font-size: 2.4em; line-height: 1; padding-top: 0.12em; }
.card.back .bk-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.9em;
  text-align: center;
  font-family: var(--font-title);
  font-style: normal;
  font-size: 0.62em;
  letter-spacing: 0.08em;
  color: rgba(255, 230, 128, 0.85);
  z-index: 2;
}
.card.back.event {
  --cbg: radial-gradient(circle at 50% 40%, #ffffff 0%, #ece6ff 60%, #d6caff 100%);
  color: #3a148f;
  box-shadow: inset 0 0 0 0.3em #3a148f, 0 0.35em 0.9em rgba(0, 0, 0, 0.45);
}
.card.back.event::before {
  background: repeating-linear-gradient(135deg, rgba(58, 20, 143, 0.06) 0 0.45em, transparent 0.45em 0.9em);
}
.card.back.event .bk { background: #3a148f; color: var(--gold); box-shadow: 0 0 0 0.18em var(--gold), 0 0.3em 0.8em rgba(0, 0, 0, 0.3); }
.card.back.event .bk svg { width: 2em; height: 2em; stroke-width: 2.4; }
.card.empty { --cbg: transparent; box-shadow: inset 0 0 0 0.2em rgba(255, 255, 255, 0.15); }
.card.empty::before { display: none; }

/* =====================================================================
   TAVOLO
   ===================================================================== */
.game { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  z-index: 10;
}
.topbar .tb-info { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar .tb-info::-webkit-scrollbar { display: none; }
.topbar .tb-actions { display: flex; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 800;
  font-size: 0.76rem;
  white-space: nowrap;
}
.chip.bomb { background: rgba(255, 71, 87, 0.25); box-shadow: inset 0 0 0 1.5px var(--red); color: #ffb1b8; animation: throb 1s infinite; }
.chip.eye { background: rgba(61, 139, 255, 0.2); box-shadow: inset 0 0 0 1.5px var(--blue); }

.ibtn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s, transform 0.1s;
}
.ibtn:hover { background: rgba(255, 255, 255, 0.16); }
.ibtn:active { transform: scale(0.94); }

/* Avversari */
.opps {
  display: flex;
  gap: 6px;
  padding: 4px 10px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: safe center;
  z-index: 5;
}
.opps::-webkit-scrollbar { display: none; }

.opp {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  padding: 8px 4px 7px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s, transform 0.2s;
}
.opp .avatar { margin-bottom: 2px; }
.opp .avatar .cnt {
  position: absolute;
  right: -8px;
  bottom: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 99px;
  background: #fff;
  color: #1b1236;
  font-size: 0.75rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.opp .avatar .cnt.low { background: var(--red); color: #fff; animation: throb 1s infinite; }
.opp .oname {
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
.opp .opts { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.opp .otags { position: absolute; top: 3px; left: 4px; display: flex; gap: 2px; font-size: 0.8rem; }
.opp .ostop {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%) rotate(-10deg);
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

.opp.turn { background: rgba(255, 197, 49, 0.12); }
.opp.turn .avatar { box-shadow: 0 0 0 2.5px var(--gold), 0 0 0 6px rgba(255, 197, 49, 0.25), 0 0 22px rgba(255, 197, 49, 0.55); animation: throb 1.4s infinite; }
.opp.waiting::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1s infinite;
}
.opp.target { cursor: pointer; background: rgba(255, 61, 139, 0.16); box-shadow: inset 0 0 0 2px var(--pink); animation: throb 1s infinite; }
.opp.target::before {
  content: '🎯';
  position: absolute;
  top: -4px;
  right: 2px;
  font-size: 1rem;
}

.ofan { display: flex; height: 12px; margin-top: 1px; }
.ofan i {
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(160deg, #7a45f0, #3a148f);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  margin-left: -3px;
}
.ofan i:first-child { margin-left: 0; }

.openhand { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 84px; }
.mt {
  font-size: 0.6rem;
  font-weight: 900;
  min-width: 14px;
  padding: 1px 3px;
  border-radius: 4px;
  text-align: center;
  color: #fff;
  line-height: 1.3;
}
.mt.red { background: var(--red); }
.mt.green { background: var(--green); }
.mt.blue { background: var(--blue); }
.mt.yellow { background: var(--yellow); color: #3a2200; }
.mt.black { background: #0d0b16; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.mt.multi { background: linear-gradient(135deg, var(--red), var(--yellow), var(--green), var(--blue)); }
.mt.vaffa { background: #fff; color: #000; }

.emote-pop {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  z-index: 30;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  animation: emote 2.6s ease-out forwards;
  pointer-events: none;
}

/* Centro tavolo con feltro */
.table {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 10px;
}
.table::before {
  content: '';
  position: absolute;
  left: max(14px, 3%);
  right: max(14px, 3%);
  top: 3%;
  bottom: 3%;
  max-width: 900px;
  margin: 0 auto;
  border-radius: clamp(70px, 24vw, 260px);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.08), transparent 55%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 45%, var(--felt-1) 0%, var(--felt-2) 58%, var(--felt-3) 100%);
  box-shadow:
    0 0 0 6px #241052,
    0 0 0 8px rgba(255, 197, 49, 0.28),
    0 18px 50px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 0 90px rgba(0, 0, 0, 0.5);
  z-index: 0;
}
.table > * { position: relative; z-index: 1; }

.piles {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(14px, 5vw, 40px);
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.pile .card { --w: var(--pile-w); }
.pile .plabel { font-size: 0.68rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pile.side .card { --w: calc(var(--pile-w) * 0.8); }

.stack { box-shadow: inset 0 0 0 0.3em #fff, 0.2em 0.2em 0 -0.05em #2a0d6e, 0.4em 0.4em 0 -0.1em #1d0850, 0 1em 1.6em rgba(0, 0, 0, 0.55) !important; }
.card.back.event.stack { box-shadow: inset 0 0 0 0.3em #3a148f, 0.2em 0.2em 0 -0.05em #cfc2f5, 0.4em 0.4em 0 -0.1em #a998e0, 0 1em 1.6em rgba(0, 0, 0, 0.5) !important; }

.deck-btn { cursor: default; }
.deck-btn.can { cursor: pointer; animation: bob 1.3s ease-in-out infinite; }
.deck-btn.can .card { box-shadow: inset 0 0 0 0.3em #fff, 0 0 0 0.25em var(--gold), 0 0 1.8em rgba(255, 197, 49, 0.7) !important; }
.deck-btn .tap {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #3a2200;
  font-weight: 900;
  font-size: 0.68rem;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.discard { position: relative; width: var(--pile-w); height: calc(var(--pile-w) * 1.5); }
.discard .card { position: absolute; inset: 0; --w: var(--pile-w); }
.discard .card.under { filter: brightness(0.7); }
.discard .card.enter { animation: playIn 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.discard.req .card.top { box-shadow: 0 0 0 0.25em var(--rq), 0 0 1.6em var(--rq), 0 0.35em 0.9em rgba(0, 0, 0, 0.5); }
.discard.req .card.top:not(.multi) { box-shadow: inset 0 0 0 0.3em #fff, 0 0 0 0.25em var(--rq), 0 0 1.6em var(--rq); }
.discard .card.vaffa-top {
  z-index: 4;
  transform: translate(22%, 2%) rotate(12deg);
  box-shadow: inset 0 0 0 0.3em #1b1236, 0 0 0 0.2em var(--red), 0 0.6em 1.4em rgba(0, 0, 0, 0.6);
}
.discard .card.vaffa-top.enter { animation: vaffaIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.req-chip.vaffa-chip { font-size: 0.72rem; white-space: normal; text-align: left; max-width: min(92%, 420px); line-height: 1.2; }
.vaffa-chip .dot { flex-shrink: 0; background: #fff; font-size: 0.75rem; }

.req-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 5px;
  border-radius: 99px;
  font-weight: 900;
  font-size: 0.78rem;
  background: rgba(10, 5, 25, 0.75);
  box-shadow: inset 0 0 0 1.5px var(--rq);
  white-space: nowrap;
}
.req-chip .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--rq); display: grid; place-items: center; font-size: 0.7rem; color: #fff; }

.dir-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--pile-w) * 3.5);
  height: calc(var(--pile-w) * 1.85);
  transform: translate(-50%, -56%);
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}
.dir-ring svg { width: 100%; height: 100%; overflow: visible; }
.dir-ring .flow { animation: dashFlow 1.4s linear infinite; }
.dir-ring .arrow { stroke-width: 3.2; stroke: var(--gold); }
/* senso antiorario: specchiando il disegno si capovolgono frecce e scorrimento */
.dir-ring.rev svg { transform: scaleX(-1); }
.dir-ring.changed { animation: dirFlash 1.2s ease-out; }

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: min(94%, 560px);
  padding: 9px 14px;
  border-radius: 16px;
  background: rgba(10, 5, 25, 0.6);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.25;
}
.status.mine { background: rgba(255, 197, 49, 0.14); box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 24px rgba(255, 197, 49, 0.18); }
.status .who { color: var(--gold); }

.ticker {
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Mano */
.handzone {
  position: relative;
  z-index: 8;
  padding: 6px 0 calc(env(safe-area-inset-bottom) * 0.5);
  background: linear-gradient(180deg, transparent, rgba(8, 3, 22, 0.55) 40%);
}
.handbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 12px 0;
  font-size: 0.78rem;
  color: var(--muted);
  position: relative;
}
.handbar .avatar { width: 30px; height: 30px; font-size: 0.75rem; }
.handbar .hinfo { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handbar .hinfo b { color: var(--text); }
.handbar .stopme { color: #ff9aa4; font-weight: 800; }

.hand {
  display: flex;
  align-items: flex-end;
  justify-content: safe center;
  padding: 30px 14px 22px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  min-height: calc(var(--hand-w) * 1.5 + 56px);
}
.hand::-webkit-scrollbar { display: none; }
.hand .card {
  cursor: pointer;
  transform-origin: 50% 130%;
  transform: translateY(calc(var(--arc, 0px) + var(--lift, 0px))) rotate(var(--rot, 0deg));
}
.hand .card.playable { --lift: -14px; box-shadow: inset 0 0 0 0.3em #fff, 0 0 0 0.2em var(--gold), 0 0.6em 1.4em rgba(0, 0, 0, 0.55); }
.hand .card.playable.multi { box-shadow: 0 0 0 0.2em var(--gold), 0 0.6em 1.4em rgba(0, 0, 0, 0.55); }
.hand .card.dim { filter: brightness(0.55) saturate(0.6); }
.hand .card.sel { --lift: -30px; box-shadow: inset 0 0 0 0.3em #fff, 0 0 0 0.25em var(--pink), 0 0 1.6em rgba(255, 61, 139, 0.6); }
.hand .card.sel.multi { box-shadow: 0 0 0 0.25em var(--pink), 0 0 1.6em rgba(255, 61, 139, 0.6); }
.hand .card.dealt { animation: dealIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1) backwards; }
.hand .card.fresh::after {
  content: 'NUOVA';
  position: absolute;
  top: -0.1em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #3a2200;
  font-size: 0.55em;
  font-weight: 900;
  padding: 0.15em 0.6em;
  border-radius: 0 0 0.6em 0.6em;
  z-index: 4;
}
.hand .card .playtag {
  position: absolute;
  left: 50%;
  bottom: 0.4em;
  transform: translateX(-50%);
  background: var(--pink);
  color: #fff;
  font-size: 0.62em;
  font-weight: 900;
  padding: 0.25em 0.7em;
  border-radius: 99px;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 0.2em 0.5em rgba(0, 0, 0, 0.4);
}
@media (hover: hover) {
  .hand .card.playable:hover { --lift: -26px; }
}

.empty-hand { color: var(--muted); font-weight: 700; padding: 30px; text-align: center; }

/* =====================================================================
   BOTTOM SHEET
   ===================================================================== */
.sheet {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  width: min(96vw, 520px);
  max-height: 70vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(44, 26, 92, 0.97), rgba(24, 13, 54, 0.98));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 24px;
  padding: 16px 16px 18px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.16), 0 24px 60px rgba(0, 0, 0, 0.7);
  z-index: 40;
  animation: sheetUp 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.sheet.compact { bottom: calc(env(safe-area-inset-bottom) + var(--hand-w) * 1.5 + 84px); }
/* abbassata: diventa una barretta sopra la mano, che resta tutta visibile */
.sheet.mini {
  bottom: calc(env(safe-area-inset-bottom) + var(--hand-w) * 1.5 + 84px);
  padding: 10px 12px 10px 16px;
  width: min(92vw, 420px);
}
.sheet.mini .timer { margin: 8px 0 0; }
.sheet-min { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.95rem; }
.sheet-hide {
  float: right;
  margin: -4px -4px 6px 8px;
  padding: 6px 10px;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.sheet-hide:hover { background: rgba(255, 255, 255, 0.18); }
.sheet h3 { margin: 0 0 4px; font-family: var(--font-title); font-weight: 400; font-size: 1.3rem; letter-spacing: 0.02em; padding-top: 0.1em; }
.sheet p { margin: 0 0 12px; font-size: 0.88rem; color: var(--muted); line-height: 1.4; }
.sheet p b { color: var(--text); }

.timer { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 0 0 12px; }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transform-origin: left; animation: timer linear forwards; }

.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.cpick {
  aspect-ratio: 1 / 1.05;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 900;
  font-size: 0.82rem;
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85), 0 4px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
  max-height: 96px;
}
.cpick:active { transform: translateY(2px); }
.cpick.red { background: linear-gradient(160deg, #ff6b6b, #e8213d); }
.cpick.green { background: linear-gradient(160deg, #4ee391, #0f9a52); }
.cpick.blue { background: linear-gradient(160deg, #5aaeff, #1f5fd6); }
.cpick.yellow { background: linear-gradient(160deg, #ffe066, #f5a000); color: #4a2a00; }
.nums { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.npick {
  padding: 11px 0;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-family: var(--font-title);
  font-size: 1.15rem;
  cursor: pointer;
  padding-top: 13px;
}
.npick:hover { background: rgba(255, 255, 255, 0.2); }

.tlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.tbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}
.tbtn:hover { box-shadow: inset 0 0 0 2px var(--pink); background: rgba(255, 61, 139, 0.12); }
.tbtn small { display: block; color: var(--muted); font-weight: 600; font-size: 0.74rem; }

.ffrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); margin-bottom: 6px; }
.ffrow .ffname { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ffrow .ffval { font-family: var(--font-title); font-size: 1.3rem; min-width: 24px; text-align: center; padding-top: 3px; }
.ffdots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 12px; }
.ffdots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.ffdots i.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.market { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 6px 0; }
.market .card { --w: 76px; cursor: pointer; }
.market .card:hover { transform: translateY(-6px); }

/* =====================================================================
   MODALI
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 3, 22, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}
.mbox {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #2a1960, #170c3a);
  border-radius: 26px;
  padding: 22px 20px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14), 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.mbox h2 { margin: 0 0 8px; font-family: var(--font-title); font-weight: 400; font-size: 1.7rem; letter-spacing: 0.02em; padding-top: 0.1em; line-height: 1.1; }
.mbox h3 { margin: 18px 0 8px; font-size: 1rem; }
.mbox p { color: var(--muted); line-height: 1.45; }

/* Evento */
.ev-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; cursor: pointer; }
.ev-who { font-weight: 800; color: var(--gold); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.ev-card {
  width: min(78vw, 300px);
  border-radius: 24px;
  padding: 26px 22px 24px;
  text-align: center;
  color: #22095e;
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, #f1ecff 60%, #ddd2ff 100%);
  box-shadow: inset 0 0 0 6px #3a148f, inset 0 0 0 9px var(--gold), 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 80px rgba(255, 197, 49, 0.35);
  animation: flipIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.ev-card .ev-ico { font-size: 4.2rem; line-height: 1; margin-bottom: 8px; }
.ev-card .ev-name { font-family: var(--font-title); font-size: 1.9rem; line-height: 1.05; padding-top: 0.1em; color: #3a148f; }
.ev-card .ev-text { font-size: 1rem; font-weight: 600; line-height: 1.4; margin-top: 10px; color: #3b2a6e; }
.ev-hint { font-size: 0.75rem; color: var(--muted); }
.ev-bar { width: min(78vw, 300px); height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ev-bar i { display: block; height: 100%; background: var(--gold); animation: timer 4.5s linear forwards; transform-origin: left; }

/* Classifica */
.rank { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px var(--line); }
.rrow.first { background: rgba(255, 197, 49, 0.12); box-shadow: inset 0 0 0 1.5px var(--gold); }
.rrow .rpos { font-family: var(--font-title); font-size: 1.2rem; width: 22px; text-align: center; color: var(--muted); padding-top: 3px; }
.rrow.first .rpos { color: var(--gold); }
.rrow .rmain { flex: 1; min-width: 0; }
.rrow .rname { font-weight: 900; display: flex; align-items: center; gap: 6px; }
.rrow .rnotes { font-size: 0.7rem; color: var(--gold); font-weight: 700; }
.rrow .rbar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); margin-top: 6px; overflow: hidden; }
.rrow .rbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); }
.rrow .rhand { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 5px; }
.rrow .rpts { text-align: right; flex-shrink: 0; }
.rrow .rpts b { display: block; font-family: var(--font-title); font-size: 1.25rem; padding-top: 3px; }
.rrow .rpts small { font-size: 0.72rem; color: var(--muted); font-weight: 800; }
.rrow .rpts small.plus { color: #ff9aa4; }
.rrow .rpts small.zero { color: #7dffb5; }

.winner-banner { text-align: center; margin: 4px 0 6px; }
.winner-banner .trophy { font-size: 3.4rem; animation: bob 1.4s ease-in-out infinite; display: inline-block; }

.info-row { padding: 9px 11px; border-radius: 13px; background: rgba(255, 255, 255, 0.05); font-size: 0.86rem; display: flex; gap: 10px; align-items: center; margin-bottom: 7px; }
.info-row .card { --w: 44px; }
.info-row b { display: block; }
.info-row span { color: #d4cbf3; }

.emotes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.emotes button { font-size: 1.9rem; padding: 12px 0; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.07); cursor: pointer; }
.emotes button:active { transform: scale(0.92); }

.logline { padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-size: 0.85rem; margin-bottom: 5px; }
.logline.event { background: rgba(255, 197, 49, 0.1); color: #ffe08a; }
.logline.round { background: rgba(139, 92, 246, 0.2); font-weight: 800; }

/* Toast */
#toasts {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 56px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 90;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.86rem;
  text-align: center;
  background: rgba(30, 18, 66, 0.96);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18), 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease-out;
}
.toast.error { background: rgba(120, 18, 40, 0.96); box-shadow: inset 0 0 0 1.5px var(--red), 0 10px 30px rgba(0, 0, 0, 0.5); }

/* =====================================================================
   ANIMAZIONI
   ===================================================================== */
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheetUp { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dashFlow { to { stroke-dashoffset: -32; } }
@keyframes dirFlash { 0% { opacity: 1; transform: translate(-50%, -56%) scale(1.12); } 100% { opacity: 0.3; transform: translate(-50%, -56%) scale(1); } }
@keyframes vaffaIn {
  0% { opacity: 0; transform: translate(60%, -40%) rotate(40deg) scale(1.3); }
  100% { opacity: 1; transform: translate(22%, 2%) rotate(12deg); }
}
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes playIn {
  0% { transform: translateY(60%) scale(1.25) rotate(var(--r, 0deg)); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: rotate(var(--r, 0deg)); }
}
@keyframes dealIn { from { opacity: 0; transform: translateY(-80px) scale(0.6) rotate(-20deg); } }
@keyframes heroIn { from { opacity: 0; transform: translateY(60px) rotate(0deg) scale(0.6); } }
@keyframes flipIn {
  0% { transform: perspective(800px) rotateY(90deg) scale(0.7); opacity: 0; }
  100% { transform: perspective(800px) rotateY(0) scale(1); opacity: 1; }
}
@keyframes emote {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -14px) scale(1.2); }
  25% { transform: translate(-50%, -10px) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px); }
}

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

/* Desktop */
@media (min-width: 900px) {
  .opp { width: 104px; }
  .avatar { width: 48px; height: 48px; font-size: 1.05rem; }
  .status { font-size: 1rem; }
  .handbar { justify-content: center; }
  .handbar .hinfo { flex: 0 1 auto; }
}

/* =====================================================================
   FINE ROUND (riepilogo) E CLASSIFICA
   ===================================================================== */
.round-over {
  position: absolute !important;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  z-index: 20 !important;
  width: min(90%, 420px);
  padding: 18px 20px 14px;
  border-radius: 22px;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(44, 26, 92, 0.96), rgba(22, 12, 50, 0.97));
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 50px rgba(255, 197, 49, 0.3), 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: roIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes roIn { from { opacity: 0; transform: translate(-50%, 24px) scale(0.95); } }
.ro-kicker { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.ro-title { font-family: var(--font-title); font-size: 1.6rem; line-height: 1.1; margin: 6px 0 8px; padding-top: 0.1em; }
.ro-log { font-size: 0.82rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.ro-log div:last-child { color: var(--text); font-weight: 700; }
.ro-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ro-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transform-origin: left; animation: timer linear forwards; }
.ro-hint { font-size: 0.7rem; color: var(--muted); margin-top: 6px; }

.ibtn.trophy { background: rgba(255, 197, 49, 0.16); box-shadow: inset 0 0 0 1.5px rgba(255, 197, 49, 0.5); }

.score-wrap { overflow-x: auto; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.score-table th, .score-table td { padding: 7px 8px; text-align: center; white-space: nowrap; }
.score-table th { font-size: 0.68rem; font-weight: 900; letter-spacing: 0.06em; color: var(--muted); background: rgba(255, 255, 255, 0.05); }
.score-table td { border-top: 1px solid rgba(255, 255, 255, 0.06); color: #d4cbf3; }
.score-table .nm { text-align: left; max-width: 120px; overflow: hidden; text-overflow: ellipsis; font-weight: 800; color: var(--text); }
.score-table .pos { color: var(--muted); font-weight: 900; width: 1.5em; }
.score-table .tot { font-weight: 900; color: var(--text); background: rgba(255, 255, 255, 0.04); }
.score-table tr.lead td { color: #ffe08a; }
.score-table tr.lead .tot { color: var(--gold); }
.score-table tr.me .nm { color: #ff9ac4; }

.hist { margin: -6px 0 16px; }
.hist summary { cursor: pointer; font-weight: 800; font-size: 0.85rem; color: var(--muted); padding: 6px 2px 10px; }

/* pannello classifica fisso in alto a sinistra (solo schermi larghi) */
.scoreboard { display: none; }
@media (min-width: 1100px) {
  .scoreboard {
    display: block;
    position: absolute;
    top: 58px;
    left: 12px;
    width: 250px;
    z-index: 12;
    padding: 10px;
    border-radius: 18px;
    cursor: pointer;
    background: rgba(18, 9, 42, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, 0.4);
  }
  .scoreboard .sb-head { font-weight: 900; font-size: 0.85rem; margin: 2px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
  .scoreboard .sb-head small { color: var(--muted); font-weight: 700; font-size: 0.68rem; }
  .scoreboard .score-table { font-size: 0.78rem; }
  .scoreboard .score-table th, .scoreboard .score-table td { padding: 5px 5px; }
  .scoreboard .score-table .nm { max-width: 90px; }
}
