/* Mr White: componenti riusabili (pulsanti, carte, avatar, campi, interruttori). */

/* ---------- pulsanti: grossi, "premibili" ---------- */
.btn {
  --bg-btn: var(--bg-3); --fg-btn: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 22px; border-radius: 18px;
  border: 3px solid var(--ink); background: var(--bg-btn); color: var(--fg-btn);
  font-weight: 800; font-size: 1.05rem; text-align: center; text-decoration: none;
  box-shadow: 0 5px 0 var(--deep);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--deep); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { --bg-btn: var(--paper); --fg-btn: var(--ink); }
.btn-go { --bg-btn: var(--mint); --fg-btn: var(--ink); }
.btn-sun { --bg-btn: var(--lemon); --fg-btn: var(--ink); }
.btn-bad { --bg-btn: var(--coral); --fg-btn: var(--ink); }
.btn-sky { --bg-btn: var(--sky); --fg-btn: var(--ink); }
.btn-ghost { --bg-btn: transparent; --fg-btn: var(--muted); border-color: transparent; box-shadow: none; min-height: 44px; }
.btn-ghost:active:not(:disabled) { transform: none; background: rgba(255,255,255,0.08); }
.btn-sm { min-height: 42px; padding: 0 14px; font-size: 0.95rem; border-radius: 14px; box-shadow: 0 3px 0 var(--deep); }
.btn-sm:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--deep); }
.btn-icon { min-height: 44px; width: 44px; padding: 0; border-radius: 50%; font-size: 1.2rem; }
.btn-big { min-height: 72px; font-size: 1.25rem; border-radius: 22px; }

/* ---------- carte ---------- */
.card {
  background: var(--bg-2); border: 3px solid var(--ink); border-radius: var(--r);
  padding: 16px; box-shadow: 0 5px 0 var(--deep);
}
.card.flat { box-shadow: none; }
.paper { background: var(--paper); color: var(--ink); }
.paper .muted { color: #6b6690; }
.note { background: rgba(255, 217, 61, 0.12); border: 2px dashed var(--lemon); border-radius: 14px; padding: 12px 14px; font-size: 0.95rem; }

/* ---------- avatar ---------- */
.avatar {
  --s: 48px; width: var(--s); height: var(--s); flex: none; display: block;
  border-radius: 50%; border: 3px solid var(--ink); overflow: hidden; background: var(--bg-3);
}
.avatar svg { display: block; width: 100%; height: 100%; }
.avatar.xl { --s: 96px; border-width: 4px; }
.avatar.lg { --s: 68px; }
.avatar.sm { --s: 34px; border-width: 2px; }
.avatar.dead { filter: grayscale(1) brightness(0.8); }

/* ---------- elenco giocatori ---------- */
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px 10px; border-radius: 16px; border: 3px solid var(--ink);
  background: var(--bg-2); box-shadow: 0 4px 0 var(--deep); text-align: center; min-width: 0;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
button.pick:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.pick .nm { font-weight: 800; font-size: 0.95rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .sub { font-size: 0.75rem; color: var(--muted); min-height: 1.1em; }
.pick.sel { background: var(--lemon); color: var(--ink); transform: translateY(-3px) rotate(-1.5deg); box-shadow: 0 8px 0 var(--deep); }
.pick.sel .sub { color: #5a4d0a; }
.pick.out { opacity: 0.55; }
.pick.me { border-color: var(--sky); }
.pick .tag { position: absolute; top: -9px; right: -6px; font-size: 1.15rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 0 5px; line-height: 1.3; }
.pick .dot { position: absolute; top: 8px; left: 8px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); background: var(--mint); }
.pick .dot.off { background: var(--coral); }
.pick .votes { position: absolute; top: -9px; left: -6px; background: var(--coral); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; font-weight: 900; font-size: 0.85rem; padding: 0 8px; }

.plist { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; background: var(--bg-2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--deep); }
.prow .nm { font-weight: 800; }
.prow.out { opacity: 0.6; }
.prow .ord { width: 28px; text-align: center; font-weight: 900; color: var(--muted); }
.prow.first { background: var(--lemon); color: var(--ink); }
.prow.first .ord { color: var(--ink); }

/* ---------- etichette ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--ink); background: var(--bg-3); font-weight: 800; font-size: 0.85rem; }
.chip.on { background: var(--lemon); color: var(--ink); }
button.chip { min-height: 38px; }
.role { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; border: 3px solid var(--ink); font-weight: 900; color: var(--ink); }
.role.civilian { background: var(--civ); }
.role.undercover { background: var(--und); }
.role.white { background: var(--white); }

/* ---------- campi ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 800; font-size: 0.9rem; color: var(--muted); }
.input, .textarea {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 3px solid var(--ink);
  background: var(--deep); color: var(--text); font-size: 1.05rem; font-weight: 700; min-height: 54px;
}
.input::placeholder, .textarea::placeholder { color: #6e69a8; font-weight: 600; }
.input:focus, .textarea:focus { outline: none; border-color: var(--lemon); }
.input.code { text-transform: uppercase; letter-spacing: 0.35em; text-align: center; font-size: 1.6rem; font-weight: 900; }
.textarea { min-height: 150px; resize: vertical; font-size: 0.98rem; line-height: 1.5; }

/* ---------- selettore numerico e interruttori ---------- */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { min-width: 2ch; text-align: center; font-size: 1.5rem; font-weight: 900; }
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 3px solid var(--ink); background: var(--bg-2); width: 100%; text-align: left; box-shadow: 0 3px 0 var(--deep); }
.opt .ic { font-size: 1.6rem; width: 2rem; text-align: center; }
.opt .tx { flex: 1; min-width: 0; }
.opt .tx b { display: block; }
.opt .tx small { color: var(--muted); display: block; line-height: 1.3; }
.opt .sw { width: 46px; height: 28px; border-radius: 999px; border: 3px solid var(--ink); background: var(--deep); position: relative; flex: none; }
.opt .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.opt.on { background: var(--bg-3); }
.opt.on .sw { background: var(--mint); }
.opt.on .sw::after { transform: translateX(18px); background: var(--ink); }
.opt:disabled { opacity: 0.4; }

/* ---------- avvisi, toast, dock ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 140%); z-index: 50;
  max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 16px; border: 3px solid var(--ink);
  background: var(--coral); color: var(--ink); font-weight: 800; text-align: center;
  box-shadow: 0 5px 0 var(--deep); transition: transform 0.25s cubic-bezier(.3,1.4,.5,1), opacity 0.2s, visibility 0.25s; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.ok { background: var(--mint); }
.dock {
  position: sticky; bottom: 0; margin: auto -16px 0; padding: 18px 16px calc(14px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 62%, rgba(27, 23, 64, 0)); display: flex; flex-direction: column; gap: 10px; z-index: 5;
}
.spacer { flex: 1; min-height: 16px; }
