:root {
  --bg: #0f1226;
  --bg-2: #171a35;
  --card: #1e2244;
  --card-2: #262b52;
  --line: #333a6b;
  --text: #eef0ff;
  --muted: #9aa0d0;
  --accent: #6c7bff;
  --accent-2: #8b5cf6;
  --danger: #ff5d73;
  --good: #37d67a;
  --gold: #ffd166;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, #23285a 0%, var(--bg) 55%);
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- offline (PWA): resta solo la modalità bot ---------- */
.offline-note {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 12px;
  padding: 9px 12px;
  margin: 0 0 14px;
  animation: fade 0.25s ease;
}
.card-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.mode-opt.opt-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- selettore lingua (home, in alto a destra) ---------- */
.lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: -6px;
}
.lang-opt {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  padding: 5px 8px;
  opacity: 0.4;
  filter: saturate(0.4);
  transition: opacity 0.2s, filter 0.2s;
}
.lang-opt.selected {
  opacity: 1;
  filter: none;
  background: var(--card);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.3);
}

/* ---------- screens ---------- */
.screen {
  display: none;
  animation: fade 0.25s ease;
}
.screen.active {
  display: block;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hidden {
  display: none !important;
}

/* ---------- brand / home ---------- */
.brand {
  text-align: center;
  margin: 12px 0 22px;
}
.brand-dice {
  font-size: 54px;
  filter: drop-shadow(0 6px 14px rgba(108, 123, 255, 0.5));
}
.brand h1 {
  margin: 6px 0 2px;
  font-size: 40px;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* ---------- cards & forms ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 6px;
}

input,
select {
  width: 100%;
  padding: 14px;
  font-size: 16px; /* >=16px evita lo zoom su iOS */
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
input:focus,
select:focus {
  border-color: var(--accent);
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 8px;
  font-size: 26px;
  text-align: center;
  font-weight: 700;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 16px;
  color: var(--text);
  transition: transform 0.05s ease, filter 0.15s ease;
}
button:active {
  transform: translateY(1px) scale(0.99);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  width: 100%;
  margin-top: 16px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(108, 123, 255, 0.35);
}
.danger {
  width: 100%;
  background: linear-gradient(90deg, #ff5d73, #ff8a5d);
  box-shadow: 0 8px 20px rgba(255, 93, 115, 0.3);
}
.ghost {
  background: var(--card-2);
  border: 1px solid var(--line);
}

.divider {
  text-align: center;
  color: var(--muted);
  position: relative;
  margin: 6px 0 16px;
  font-size: 13px;
}
.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.divider span {
  background: var(--bg);
  padding: 0 12px;
  position: relative;
}

/* ---------- lobby ---------- */
.lobby-head {
  text-align: center;
  margin-bottom: 8px;
}
.room-code {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 10px;
  color: var(--gold);
  padding-left: 10px;
}
.room-code.small {
  font-size: 22px;
  letter-spacing: 4px;
  padding-left: 4px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.players-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.players-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.players-list li:last-child {
  border-bottom: none;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0b0d1f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}
.p-name {
  font-weight: 600;
}
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge.host {
  color: var(--gold);
  border-color: var(--gold);
}
.badge.off {
  color: var(--danger);
  border-color: var(--danger);
}
.kick {
  margin-left: auto;
  background: transparent;
  color: var(--danger);
  padding: 6px 10px;
  font-size: 13px;
}
.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 0;
  text-align: center;
}

/* ---------- game ---------- */
.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.end-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}
.end-btn:active {
  background: rgba(255, 93, 115, 0.15);
}
.danger-ghost {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.pause-icon {
  font-size: 44px;
}

/* overlay leggero (disconnessione temporanea) */
.light-overlay {
  background: rgba(6, 8, 20, 0.45);
  backdrop-filter: blur(1px);
}
.light-card {
  max-width: 380px;
  border-color: var(--accent);
}
.reconnect-spin {
  display: flex;
  justify-content: center;
}
.spinner.big {
  width: 34px;
  height: 34px;
  border-width: 4px;
}
.pause-code-box {
  background: var(--bg-2);
  border: 1px dashed var(--accent);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pause-code-box .room-code {
  font-size: 40px;
  padding-left: 8px;
}
.round-num {
  font-size: 22px;
  font-weight: 800;
  margin-left: 6px;
}
.players-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.p-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.p-card.turn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(108, 123, 255, 0.4);
}
.p-card.me::after {
  content: "TU";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}
.p-card.out {
  opacity: 0.4;
}
.p-card .p-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.p-card .p-top .avatar {
  width: 26px;
  height: 26px;
  font-size: 13px;
}
.p-card .name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dice-count {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.dot.spent {
  background: var(--card-2);
}
.p-card .starter {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 12px;
}

.current-bid {
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}
.bid-display {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
}
/* Dichiarazione presente: layout compatto su una riga (quantità × dado). */
.bid-display.has-bid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* Nessuna dichiarazione: frase normale, più piccola, che può andare a capo. */
.bid-display.no-bid {
  font-size: 17px;
  font-weight: 600;
}
.bid-display.no-bid strong {
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}
.bid-x {
  font-size: 24px;
}

.my-dice-wrap {
  text-align: center;
  margin-bottom: 16px;
}
.my-dice {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  min-height: 84px;
  flex-wrap: wrap;
}
.my-dice.tap {
  cursor: pointer;
  user-select: none;
}
/* messaggio per l'eliminato (modalità spettatore) */
.spec-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

/* ---------- dado realistico (pallini) ---------- */
.die {
  --die-size: 44px;
  --pip: #23264a;
  width: var(--die-size);
  height: var(--die-size);
  box-sizing: border-box;
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0;
  padding: calc(var(--die-size) * 0.12);
  border-radius: calc(var(--die-size) * 0.22);
  background: linear-gradient(150deg, #ffffff 0%, #e9ebfb 60%, #d5d8f2 100%);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.9),
    inset 0 -4px 6px rgba(60, 66, 120, 0.35), 0 6px 12px rgba(0, 0, 0, 0.35);
  vertical-align: middle;
}
.die .pip {
  display: block;
  width: 100%;
  height: 100%;
  place-self: center;
}
.die .pip.on::after {
  content: "";
  display: block;
  width: 62%;
  height: 62%;
  margin: 19%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4f80, var(--pip) 70%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}
.die.die-lg {
  --die-size: 64px;
}
.die.die-md {
  --die-size: 44px;
}
.die.die-sm {
  --die-size: 34px;
}
.die.die-xs {
  --die-size: 26px;
}
.die.die-xs.inline {
  vertical-align: middle;
  margin: 0 3px;
}
.die.match {
  background: linear-gradient(150deg, #fff2c2 0%, var(--gold) 70%, #e6b53f 100%);
  --pip: #6a4b00;
}

/* animazione di lancio */
.die.rolling {
  animation: tumble 0.28s linear infinite;
}
@keyframes tumble {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(90deg) scale(1.05);
  }
  50% {
    transform: translateY(0) rotate(180deg);
  }
  75% {
    transform: translateY(-6px) rotate(270deg) scale(0.97);
  }
  100% {
    transform: translateY(0) rotate(360deg);
  }
}

/* prompt "tocca per lanciare" */
.tap-roll {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: rgba(108, 123, 255, 0.08);
  animation: pulse 1.6s ease-in-out infinite;
}
.tap-roll .cup {
  font-size: 38px;
  animation: wiggle 1.2s ease-in-out infinite;
}
.tap-roll span {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(108, 123, 255, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(108, 123, 255, 0.12);
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-12deg);
  }
  50% {
    transform: rotate(12deg);
  }
}

/* ---------- controls ---------- */
.controls {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 0 0 2px rgba(108, 123, 255, 0.25);
}
.controls-title {
  margin: 0 0 12px;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
}
.bid-builder {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
}
.stepper button {
  width: 52px;
  height: 52px;
  font-size: 28px;
  background: var(--card-2);
  border-radius: 10px;
}
.stepper-val {
  text-align: center;
}
.stepper-val span {
  font-size: 30px;
  font-weight: 800;
  display: block;
}
.stepper-val small {
  color: var(--muted);
  font-size: 12px;
}
.face-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.face-opt {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
}
.face-opt.selected {
  border-color: var(--accent);
  background: var(--card-2);
  box-shadow: 0 0 0 2px rgba(108, 123, 255, 0.4);
}
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.action-buttons .primary,
.action-buttons .danger {
  margin-top: 0;
}

.waiting {
  text-align: center;
  color: var(--muted);
  padding: 18px;
  font-size: 15px;
}
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 20, 0.82);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.overlay-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  max-height: 90dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.overlay-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}
.overlay-sub {
  color: var(--muted);
  margin: 0;
  line-height: 1.9;
}
#overlay-countdown {
  margin: 0;
  min-height: 18px;
}
#overlay-btn {
  margin-top: 0;
}
.overlay-reveal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.reveal-row.loser {
  border-color: var(--danger);
}
.reveal-row .r-name {
  font-weight: 600;
  min-width: 78px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reveal-dice {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: 90%;
  text-align: center;
  animation: fade 0.2s ease;
}

/* ---------- banner lanci ---------- */
.rolls-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(108, 123, 255, 0.12);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* stato "ha lanciato / sta lanciando" sulle card giocatore */
.p-card .roll-flag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 14px;
  line-height: 1;
}
.p-card .roll-flag.waiting {
  animation: wiggle 1.1s ease-in-out infinite;
}
.p-card.rolled-yes {
  border-color: var(--good);
}

/* ---------- chat ---------- */
.chat-toggle,
.log-toggle {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 45;
  display: grid;
  place-items: center;
}
.chat-toggle {
  right: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(108, 123, 255, 0.45);
}
.log-toggle {
  left: 16px;
  background: var(--card-2);
  border: 1px solid var(--line);
}

/* pannello storico (riusa la struttura della chat, ancorato a sinistra) */
.log-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: min(70dvh, 560px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  z-index: 55;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
}
.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.log-num {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.log-name {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-bid {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 17px;
}
.log-empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 14px;
}
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}

.chat-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: min(70dvh, 560px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  z-index: 55;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from {
    transform: translate(-50%, 100%);
  }
  to {
    transform: translate(-50%, 0);
  }
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.chat-close {
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  padding: 4px 8px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 85%;
}
.chat-msg.mine {
  flex-direction: row-reverse;
  align-self: flex-end;
}
.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: #0b0d1f;
  background: hsl(var(--h, 250), 70%, 65%);
}
.chat-bubble {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-msg.mine .chat-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.chat-name {
  font-size: 11px;
  font-weight: 700;
  color: hsl(var(--h, 250), 70%, 72%);
}
.chat-msg.mine .chat-name {
  color: rgba(255, 255, 255, 0.85);
}
.chat-text {
  font-size: 15px;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.chat-form input {
  flex: 1;
}
.chat-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 0 18px;
  flex: none;
}

/* bolla transitoria per i nuovi messaggi (chat chiusa) */
.chat-pop {
  position: fixed;
  left: 16px;
  right: 84px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 58; /* sopra i pannelli chat/storico (55): il fumetto non deve finirci sotto */
  box-shadow: var(--shadow);
  animation: fade 0.2s ease;
  max-width: 460px;
}
.chat-pop .cp-name {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}
.chat-pop .cp-text {
  display: block;
  font-size: 14px;
  word-break: break-word;
  margin-top: 2px;
}

/* ==================== VARIANTI (Jolly / Palifico / Calza) ==================== */

/* --- selettore modalità (creazione tavolo) --- */
.mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.mode-opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.mode-opt.dev {
  opacity: 0.6;
}
.mode-opt.selected {
  border-color: var(--accent);
  background: var(--card-2);
  box-shadow: 0 0 0 2px rgba(108, 123, 255, 0.35);
}
.mode-name {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mode-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
/* --- versione della Calza (Official / House), visibile solo con Calza scelta --- */
.calza-rule {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 12px;
  background: rgba(255, 209, 102, 0.06);
  animation: fade 0.25s ease;
}
.calza-rule.hidden {
  display: none;
}
.cr-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.cr-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cr-opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.cr-opt.selected {
  border-color: var(--gold);
  background: rgba(255, 209, 102, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.28);
}
.cr-name {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.cr-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cr-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

/* --- lobby: riga specifiche tavolo + aggiungi bot --- */
.lobby-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 6px;
}
.lobby-info-row #lobby-dice-info {
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#btn-add-bot {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  flex: none;
}

/* --- disposizione dei posti intorno al tavolo (lobby locale) --- */
.table-view {
  position: relative;
  height: 200px;
  margin-bottom: 14px;
  animation: fade 0.25s ease;
}
.table-view.hidden {
  display: none;
}
.tv-felt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  height: 56%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, #2e3468 0%, #1c2044 70%);
  border: 9px solid #2a2450;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55), 0 10px 24px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  font-size: 26px;
  opacity: 0.95;
}
.tv-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 66px;
  text-align: center;
}
.tv-seat .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.tv-seat.me .avatar {
  box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0, 0, 0, 0.45);
}
.tv-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  max-width: 64px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(10, 12, 30, 0.75);
  border-radius: 999px;
  padding: 1px 7px;
}
.tv-seat.me .tv-name {
  color: var(--gold);
}

/* maniglia ☰ per trascinare i giocatori (lobby locale, solo host) */
.drag-handle {
  width: 34px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none; /* il dito trascina la riga, non scrolla la pagina */
  opacity: 0.7;
}
/* niente selezione/callout da long-press: su mobile cancellerebbero il drag */
#lobby-players li,
.seating-list li,
.drag-handle {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* --- lobby online: azioni in testata + sotto-schermata disposizione --- */
.lobby-head-actions {
  display: flex;
  gap: 8px;
}
.lobby-head-actions .ghost {
  flex: 1;
  font-size: 13px;
  padding-left: 8px;
  padding-right: 8px;
}
#screen-seating .table-view {
  height: 210px;
}
#btn-seating-close {
  width: 100%;
  margin-top: 14px;
}
.drag-handle::before {
  content: '';
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 -5px 0 #fff, 0 5px 0 #fff;
}
#lobby-players li.dragging {
  position: relative;
  z-index: 5;
  background: var(--card-2);
  border-radius: 12px;
  opacity: 0.95;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  will-change: transform;
}
#lobby-players li.dragging .drag-handle {
  cursor: grabbing;
  opacity: 1;
}

/* --- avversari: amici online o bot --- */
.opp-picker {
  grid-template-columns: 1fr 1fr;
}
.bot-count {
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: fade 0.25s ease;
}
.bot-count.hidden {
  display: none;
}
.bc-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.bot-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bot-stepper button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  padding: 0;
}
.bc-val {
  font-size: 20px;
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

.mode-ico {
  font-size: 13px;
  line-height: 1;
}
.mode-pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8080, #e03131 70%);
  box-shadow: 0 0 4px rgba(224, 49, 49, 0.7);
}
@media (max-width: 460px) {
  .mode-picker { grid-template-columns: 1fr; }
  .mode-opt { flex-direction: row; align-items: center; justify-content: space-between; }
  .mode-desc { text-align: right; }
}

/* --- jolly: l'1 wild ha il pallino centrale grande e rosso --- */
.die.wild .pip.on::after {
  background: radial-gradient(circle at 35% 30%, #ff9a9a, #e03131 70%) !important;
  width: 82%;
  height: 82%;
  margin: 9%;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4), 0 0 3px rgba(224, 49, 49, 0.6);
}

/* --- banner palifico --- */
.palifico-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--gold);
  text-align: center;
}

/* --- pulsante Calza (fuori turno) --- */
.calza-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  animation: fade 0.2s ease;
}
.calza-btn {
  width: 100%;
  max-width: 320px;
  font-size: 18px;
  font-weight: 800;
  padding: 16px;
  background: linear-gradient(90deg, var(--gold), #ffb703);
  color: #3a2b00;
  box-shadow: 0 8px 20px rgba(255, 183, 3, 0.35);
  animation: pulse 1.6s ease-in-out infinite;
}
.calza-hint {
  font-size: 12px;
  color: var(--muted);
}
.calza-hint em {
  color: var(--gold);
  font-style: normal;
  font-weight: 700;
}

/* face-picker: opzione disabilitata */
.face-opt.disabled {
  opacity: 0.28;
  pointer-events: none;
}

.mode-test {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Scelta Palifico (l'apertura con 1 dado decide) */
.palifico-choice {
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.25);
  text-align: center;
}
.palifico-choice .pc-title {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--gold);
}
.palifico-choice .pc-sub {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ==================== REGOLE — STORY VIEWER (stile "storie") ==================== */
.rstory {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 14, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
  padding: 14px;
}
.rstory.hidden {
  display: none;
}
/* card con sfondo visibile tutt'attorno: un tap fuori chiude */
.rstory-frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100%;
  max-height: 780px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(130% 90% at 50% -10%, #2a2f61 0%, #14163266 55%, transparent 100%),
    linear-gradient(180deg, #171a38 0%, #0c0e20 100%);
  border-radius: 26px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  touch-action: none;
}

/* dadi decorativi giganti sullo sfondo */
.rstory-deco {
  position: absolute;
  opacity: 0.07;
  filter: blur(1px);
  pointer-events: none;
  z-index: 0;
}
.rstory-deco-a {
  top: 16%;
  left: -34px;
  animation: rfloat 11s ease-in-out infinite;
}
.rstory-deco-b {
  bottom: 9%;
  right: -30px;
  animation: rfloat 9s ease-in-out 1.2s infinite reverse;
}
.rstory-deco .die {
  --die-size: 130px;
}
@keyframes rfloat {
  0%,
  100% {
    transform: translateY(0) rotate(-14deg);
  }
  50% {
    transform: translateY(-26px) rotate(9deg);
  }
}

/* pallini di avanzamento in basso: evidenziano la slide corrente sul totale */
.rstory-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 0 16px;
  position: relative;
  z-index: 5;
}
.rstory-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.rstory-dots i.done {
  background: rgba(255, 209, 102, 0.45);
}
.rstory-dots i.cur {
  background: var(--gold);
  transform: scale(1.4);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.6);
}

.rstory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 4px;
  position: relative;
  z-index: 5;
}
.rstory-mode {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(255, 209, 102, 0.5);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(255, 209, 102, 0.08);
}
.rstory-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 15px;
  padding: 0;
  display: grid;
  place-items: center;
}
.rstory-close:active {
  background: rgba(255, 255, 255, 0.18);
}

/* zone tap (prev/next) sopra la slide, sotto header e CTA */
.rstory-tap {
  position: absolute;
  top: 72px;
  bottom: 0;
  z-index: 3;
  cursor: pointer;
}
.rstory-tap-left {
  left: 0;
  width: 36%;
}
.rstory-tap-right {
  right: 0;
  width: 64%;
}

/* hint in home: le regole si aprono toccando una modalità */
.mode-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 2px;
}

/* freccette laterali: indicano che si può scorrere (decorative, i tap passano alle zone) */
.rstory-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  pointer-events: none;
  font-size: 34px;
  line-height: 1;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s;
}
.rstory-arrow.off {
  opacity: 0;
}
.rstory-arrow-left {
  left: 10px;
}
.rstory-arrow-right {
  right: 10px;
  animation: rnudge 1.8s ease-in-out infinite;
}
@keyframes rnudge {
  0%,
  100% {
    transform: translateY(-50%) translateX(0);
  }
  50% {
    transform: translateY(-50%) translateX(4px);
  }
}

.rstory-hint {
  position: absolute;
  bottom: 42px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  z-index: 4;
  pointer-events: none;
  animation: rhint 2.2s ease-in-out infinite;
  transition: opacity 0.3s;
}
.rstory-hint.gone {
  opacity: 0 !important;
  animation: none;
}
@keyframes rhint {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- slide ---------- */
/* niente z-index qui: creerebbe uno stacking context che intrappola la CTA sotto le zone tap */
.rstory-stage {
  flex: 1;
  position: relative;
  display: flex;
  min-height: 0;
}
.rslide {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 4px 26px 18px;
  text-align: center;
  animation: rslide-in 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
  min-height: 0;
  overflow: hidden;
}
.rslide.back {
  animation-name: rslide-back;
}
@keyframes rslide-in {
  from {
    opacity: 0;
    transform: translateX(46px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes rslide-back {
  from {
    opacity: 0;
    transform: translateX(-46px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.rs-step {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin: 0;
}
.rs-title {
  font-size: 29px;
  font-weight: 800;
  line-height: 1.12;
  margin: 0;
}
.rs-text {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.55;
  margin: 0;
  max-width: 320px;
}
.rs-text strong {
  color: var(--text);
}
.rs-text em {
  color: var(--gold);
  font-style: normal;
  font-weight: 700;
}
.rs-fig {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* dado inclinato con ingresso "pop" ritardato */
.rs-tilt {
  display: inline-block;
  transform: rotate(var(--r, 0deg));
  animation: rpop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 80ms + 150ms);
}
@keyframes rpop {
  from {
    opacity: 0;
    transform: rotate(var(--r, 0deg)) translateY(18px) scale(0.35);
  }
  to {
    opacity: 1;
    transform: rotate(var(--r, 0deg));
  }
}
.rs-fan {
  display: flex;
  align-items: center;
}
.rs-fan .rs-tilt {
  margin: 0 -3px;
}

/* pill / chip generici — testo che fluisce normalmente: su mobile
   va a capo come una frase, niente colonne flex sballate */
.rs-pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 14px;
  max-width: 100%;
  text-align: center;
}
.rs-pill b {
  color: var(--text);
}

/* chip-dichiarazione (quantità × dado) */
.rs-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 21px;
  font-weight: 800;
  animation: rpop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 140ms + 150ms);
}
.rs-chip.ok {
  border-color: var(--good);
  box-shadow: 0 0 14px rgba(55, 214, 122, 0.18);
}
.rs-chip.base {
  border-color: var(--accent);
}
.rs-chip .rs-note {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rs-chip.ok .rs-note {
  color: var(--good);
}
.rs-ladder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rs-ladder .rs-or {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

/* i tuoi dadi (slide 2) */
.rs-mine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.rs-minelabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* la chiamata al centro (slide 2) */
.rs-call {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.rs-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 11px 18px;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 0 22px rgba(108, 123, 255, 0.35);
}
/* la parte "parlata" della chiamata, piccola accanto ai numeri */
.rs-bsay {
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  color: var(--muted);
  align-self: flex-end;
  padding-bottom: 4px;
}
/* tavolo con dadi nascosti (slide 2) */
.rs-table {
  display: flex;
  gap: 12px;
  max-width: 100%;
}
.rs-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
}
.rs-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.rs-seat .hidden-dice {
  display: flex;
  gap: 2px;
}
.rs-mystery {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), 0 3px 6px rgba(0, 0, 0, 0.35);
}

/* bottone "Dubito!" replica (slide 4) */
.rs-doubt {
  background: var(--danger);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  padding: 12px 30px;
  border-radius: 14px;
  box-shadow: 0 0 26px rgba(255, 93, 115, 0.4);
  animation: rpulse 1.7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes rpulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}
/* rivelazione (slide "Dubito!"): i dadi di ogni giocatore, riga per riga */
.rs-rrows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 290px;
}
.rs-rrow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  animation: rpop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 130ms + 150ms);
}
.rs-rname {
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}
.rs-rdice {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* esiti (slide 5) */
.rs-verdicts {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  max-width: 330px;
}
.rs-verdict {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  animation: rpop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 140ms + 150ms);
}
.rs-verdict .rs-ico {
  font-size: 21px;
  flex: none;
}
.rs-verdict.good {
  border-color: rgba(55, 214, 122, 0.55);
}
.rs-verdict.bad {
  border-color: rgba(255, 93, 115, 0.55);
}
.rs-verdict b {
  color: var(--text);
}
.rs-verdict span {
  color: var(--muted);
}
.rs-minis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* CTA finale — deve stare sopra le zone tap */
.rs-cta {
  position: relative;
  z-index: 4;
  margin-top: 4px;
  width: auto;
  padding: 14px 34px;
  animation: rpop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.45s backwards;
}

@media (max-height: 640px) {
  .rs-fig {
    min-height: 110px;
    gap: 10px;
  }
  .rs-title {
    font-size: 24px;
  }
  .rslide {
    gap: 11px;
  }
}

/* ---------- home: hero (due azioni chiare) ---------- */
.hero {
  text-align: center;
  margin: -6px 0 18px;
}
.hero-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 14px;
}
.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-cta .primary {
  margin-top: 0;
  font-size: 17px;
  padding: 16px;
}
.hero-cta .ghost {
  font-size: 16px;
  padding: 14px;
}
.hero-links {
  margin: 12px 0 0;
  font-size: 14px;
}
.hero-links a,
.foot-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.hero-links a:hover,
.foot-links a:hover {
  color: var(--text);
}

/* ---------- footer della home ---------- */
.site-foot {
  margin-top: 28px;
  text-align: center;
}
.foot-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  margin-bottom: 10px;
}
.foot-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: 0;
  opacity: 0.8;
}

/* ---------- banner consenso analytics ---------- */
.consent {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  z-index: 60;
  animation: fade 0.3s ease;
}
.consent p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
}
.consent-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.consent-btns button {
  width: auto;
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
}

/* ---------- pagine statiche (regole, privacy) ---------- */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  line-height: 1.6;
}
.page-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.page-top .logo {
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-top .lang-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.page h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.page h2 {
  font-size: 21px;
  margin: 30px 0 8px;
}
.page h3 {
  font-size: 16px;
  margin: 20px 0 6px;
}
.page p,
.page li {
  font-size: 16px;
}
.page .lead {
  color: var(--muted);
  font-size: 17px;
}
.page ul,
.page ol {
  padding-left: 22px;
}
.page a {
  color: var(--accent);
}
.page .cta {
  color: var(--text);
  display: block;
  text-align: center;
  text-decoration: none;
  margin: 22px 0;
}
.page .box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
}
.page .box p:last-child {
  margin-bottom: 0;
}
.page details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 8px 0;
}
.page summary {
  cursor: pointer;
  font-weight: 600;
}
.page .foot-note {
  margin-top: 30px;
}

/* ---------- intestazione card "Crea un tavolo" con etichetta regole personalizzate ---------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2 {
  margin: 0;
}
.pill-custom {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
