:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --text: #e8eaed;
  --muted: #9aa0ab;
  --accent: #4f8cff;
  --danger: #ef4444;
  --pink: #3a1f2a;
  --pink-text: #ff9db3;
  --green: #123a24;
  --green-text: #5be08a;
  --border: #2a2e38;
  --role-p: #f5a623;
  --role-d: #2ecc71;
  --role-c: #29b6f6;
  --role-a: #e74c3c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 32px; max-width: 360px; width: 100%; text-align: center;
}
.login-box h1 { margin: 0 0 8px; font-size: 24px; }
.login-box p { color: var(--muted); margin: 0 0 20px; }
.login-box select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 15px; margin-bottom: 14px;
}
.who-select-wrap { position: relative; margin-bottom: 14px; }
.who-select-display {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 15px; text-align: left; cursor: pointer; font-family: inherit;
}
.who-select-display.placeholder { color: var(--muted); }
.who-dropdown-item {
  padding: 10px 12px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.who-dropdown-item:hover, .who-dropdown-item.active { background: var(--panel); }
.who-taken-badge {
  font-size: 10px; font-weight: 700; color: var(--pink-text); background: var(--pink);
  border-radius: 20px; padding: 2px 8px;
}
.who-enter-btn { width: 100%; }
.who-enter-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.who-rename-box { margin: -6px 0 14px; text-align: left; }
.who-rename-hint { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.who-rename-box input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px;
}
.who-rename-save { width: 100%; padding: 10px; font-size: 14px; }

.app { padding: 12px 12px 40px; max-width: 100%; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; row-gap: 8px; padding: 8px 4px 14px;
  position: sticky; top: 0; background: var(--bg); z-index: 30;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; text-align: center; line-height: 1.15; font-weight: 800; }
/* Le azioni vanno sempre sulla propria riga intera (order+flex-basis), sotto
   titolo e "me": con 7 bottoni + etichette non c'è più spazio su una riga sola. */
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 8px; flex-basis: 100%; order: 3; }
.action-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.action-label { font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.1; max-width: 48px; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  font-size: 18px; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; flex-shrink: 0;
  /* alcune azioni sono <a>, non <button>: servono queste per allinearle alle altre */
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; }

.players-updated-at {
  color: var(--muted); font-size: 11px; text-align: center; margin: 0 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.refresh-listone-btn {
  background: none; border: 1px solid var(--border); color: var(--accent);
  border-radius: 20px; padding: 3px 10px; font-size: 11px; cursor: pointer;
}
.refresh-listone-btn:hover { border-color: var(--accent); }
.refresh-listone-btn:disabled { opacity: 0.5; cursor: default; }

.active-role-banner {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 12px; font-weight: 600; text-align: center;
}
.active-role-banner.done { background: var(--green); color: var(--green-text); }

.pick-form {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin-bottom: 16px;
}
@media (min-width: 640px) {
  .pick-form { grid-template-columns: 1fr 2fr 1fr auto; align-items: end; }
}
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field label { font-size: 12px; color: var(--muted); }
.field select, .field input {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; width: 100%;
}
.field select:focus, .field input:focus { outline: 2px solid var(--accent); }
.submit-btn {
  background: var(--accent); color: white; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.submit-btn:active { opacity: 0.85; }
.error-text { color: var(--danger); font-size: 13px; margin: 4px 0 0; min-height: 1em; }

.dropdown {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  max-height: 260px; overflow-y: auto; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.dropdown-item { padding: 10px 12px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dropdown-item:hover, .dropdown-item.active { background: var(--panel); }
.dropdown-item-left { display: flex; align-items: center; gap: 8px; }
.dropdown-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.dropdown-add { padding: 10px 12px; cursor: pointer; font-size: 13px; color: var(--accent); border-top: 1px solid var(--border); }
.dropdown-add:hover { background: var(--panel); }

.team-badge { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; vertical-align: middle; }
.role-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: white; flex-shrink: 0; margin-right: 4px;
}
.role-dot-p { background: var(--role-p); }
.role-dot-d { background: var(--role-d); }
.role-dot-c { background: var(--role-c); }
.role-dot-a { background: var(--role-a); }

.board-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 14px; max-height: 70vh; }
.board { border-collapse: collapse; width: 100%; min-width: 100%; }
.board th, .board td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 8px 10px; text-align: left; white-space: nowrap; vertical-align: top; }
.board thead th { position: sticky; top: 0; background: var(--panel); z-index: 10; }
/* top reale calcolato via JS ad ogni render (renderBoard), questo è solo il fallback iniziale */
.board thead tr.row-badges th { top: 58px; padding-top: 4px; padding-bottom: 8px; }
.owner-head { display: flex; flex-direction: column; gap: 2px; }
.owner-head .owner-name { font-weight: 700; font-size: 14px; }
.owner-name-clickable { cursor: pointer; }
.owner-name-clickable:hover { color: var(--accent); }
.owner-head .owner-remaining { font-size: 13px; color: var(--accent); font-weight: 600; }
.owner-team-name {
  font-size: 11px; color: var(--muted); font-style: italic; cursor: pointer;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.owner-team-name.empty { color: var(--border); font-style: normal; }
.owner-team-name:hover { color: var(--accent); }
.role-badges { display: flex; gap: 4px; }
.role-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 3px 6px 3px 3px; border-radius: 6px;
  background: var(--pink); color: var(--pink-text); font-weight: 600;
}
.role-badge.done { background: var(--green); color: var(--green-text); }
.role-badge .role-dot { width: 15px; height: 15px; font-size: 8px; margin-right: 0; }
.player-cell { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.player-cell .pname { font-size: 13px; display: inline-flex; align-items: center; flex: 1; min-width: 0; }
.player-cell .pname-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-cell .pcredits { font-size: 13px; color: var(--muted); font-weight: 600; min-width: 26px; text-align: right; flex-shrink: 0; }
.del-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; width: 22px; height: 22px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.del-btn.confirm1 { border-color: var(--danger); color: var(--danger); }
.del-btn.confirm2 { background: var(--danger); color: white; border-color: var(--danger); }
.empty-cell { color: var(--border); }
.board td[colspan] { text-align: center; padding: 24px; color: var(--muted); }
.board td.role-sep { border-top: 2px solid var(--accent); }

.log-panel { position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; z-index: 100; }
.log-backdrop { position: fixed; top: 0; right: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; z-index: 90; background: rgba(0,0,0,0.5); }
.log-panel { width: min(420px, 92vw); background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.log-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.log-panel-header h2 { font-size: 16px; margin: 0; }
.log-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 14px; flex: 1 1 auto; min-height: 0; }
.log-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-item .log-detail { margin: 0 0 3px; }
.log-item .log-meta { color: var(--muted); font-size: 11px; }

.confirm-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 20px; }
.confirm-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; max-width: 320px; width: 100%; text-align: center; }
.confirm-box p { margin: 0 0 16px; font-size: 15px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.danger-btn { background: var(--danger); color: white; border: none; border-radius: 10px; padding: 10px 18px; cursor: pointer; font-weight: 600; }

.add-player-box { text-align: left; max-width: 340px; }
.add-player-box h3 { margin: 0 0 4px; font-size: 17px; }
.add-player-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.add-player-box .field { margin-bottom: 10px; }
.add-player-box .confirm-actions { justify-content: flex-start; margin-top: 4px; }
.danger-link-btn {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 13px; padding: 0; margin-top: 14px; text-decoration: underline;
}

.league-title-btn {
  font-size: 18px; margin: 0; flex: 1; text-align: center; line-height: 1.15; font-weight: 800;
  background: none; border: none; color: var(--text); cursor: pointer; font-family: inherit; padding: 4px;
}
.league-title-btn:hover { color: var(--accent); }

.rules-panel-footer { padding: 12px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.rules-panel-footer .submit-btn {
  width: 100%;
  /* nel registro il bottone è un <a>: serve per allinearlo come un vero bottone */
  display: block; text-align: center; text-decoration: none;
}

.rules-list { font-size: 14px; line-height: 1.5; }
.rules-note { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.rules-list h3 { font-size: 14px; margin: 18px 0 8px; color: var(--accent); }
.rules-list h3:first-of-type { margin-top: 0; }
.rules-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.rules-item-text { flex: 1; }
.rules-edit-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; width: 26px; height: 26px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.rules-edit-btn:hover { color: var(--accent); border-color: var(--accent); }
.rules-edit-credits-btn, .rules-edit-team-count-btn {
  background: none; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 6px; width: 26px; height: 26px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}

.add-player-box textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; width: 100%; font-family: inherit; resize: vertical;
}

.iban-line { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iban-line b { font-weight: 700; }
.iban-copy-icon-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; width: 26px; height: 26px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.iban-copy-icon-btn:hover { border-color: var(--accent); }
.iban-copy-feedback { color: var(--green-text); font-size: 12px; margin: 0 0 8px; min-height: 1em; }

.listone-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; flex-shrink: 0; }
.listone-filters select {
  flex: 1; min-width: 90px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.listone-search {
  flex-basis: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.listone-search:focus { outline: 2px solid var(--accent); }
.listone-count { color: var(--muted); font-size: 12px; margin: 8px 14px 0; flex-shrink: 0; }
.listone-list { padding-top: 4px; }
.listone-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.listone-item .pname-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listone-item .psquadra { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.listone-item .listone-owner {
  color: var(--accent); font-size: 11px; font-weight: 600; flex-shrink: 0;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listone-item .listone-credits { color: var(--muted); font-weight: 700; font-size: 12px; min-width: 22px; text-align: right; flex-shrink: 0; }

/* Nel pannello Listone i già presi restano visibili ma "spenti": sbiaditi e
   col nome barrato, così a colpo d'occhio si vede su chi si può ancora puntare. */
.listone-item.preso { opacity: 0.45; }
.listone-item.preso .pname-text { text-decoration: line-through; }

.fav-btn {
  background: none; border: none; color: var(--border); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 0 2px 4px; flex-shrink: 0;
}
.fav-btn.on { color: #f5c518; }
.fav-filter-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.fav-filter-btn.on { border-color: #f5c518; color: #f5c518; }

/* macOS nasconde le scrollbar finché non scorri: sulla board (colonne quasi
   sempre fuori schermo) la barra deve VEDERSI sempre, o da Mac non si capisce
   nemmeno che a destra c'è altro. Lo stile webkit la forza visibile su
   Chrome/Safari; scrollbar-color copre Firefox (lì resta a scomparsa). */
.board-wrap { scrollbar-color: #4a5160 var(--panel); }
.board-wrap::-webkit-scrollbar { height: 12px; width: 12px; }
.board-wrap::-webkit-scrollbar-track { background: var(--panel); border-radius: 8px; }
.board-wrap::-webkit-scrollbar-thumb { background: #4a5160; border-radius: 8px; border: 2px solid var(--panel); }
.board-wrap::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Sondaggi sulle regole (/sondaggi.html) ---------- */
.polls-wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 60px; }
.polls-back {
  position: fixed; top: 12px; right: 12px; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.polls-back:hover { border-color: var(--accent); color: var(--accent); }
.polls-head { margin-bottom: 6px; padding-right: 48px; }
.polls-head h1 { font-size: 22px; margin: 0 0 6px; font-weight: 800; }
.polls-sub { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.45; }
.polls-me { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.polls-me b { color: var(--text); }
.polls-who { display: flex; gap: 8px; margin-top: 8px; }
.polls-who select {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 15px;
}
.polls-progress { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.polls-cat { font-size: 12px; color: var(--accent); margin: 22px 0 8px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.poll-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.poll-card.closed { opacity: 0.8; }
.poll-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.poll-head h3 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.25; }
.poll-badges { display: flex; gap: 4px; flex-shrink: 0; }
.poll-badge { font-size: 10px; font-weight: 700; border-radius: 20px; padding: 3px 8px; white-space: nowrap; }
.poll-badge.closed { background: var(--pink); color: var(--pink-text); }
.poll-badge.applied { background: var(--green); color: var(--green-text); }
.poll-hint { color: var(--muted); font-size: 11.5px; margin: 4px 0 8px; }
.poll-opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); padding: 8px 0; cursor: pointer; font-family: inherit;
}
.poll-opt:disabled { cursor: default; }
.poll-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
  color: transparent; margin-top: 1px;
}
.poll-opt.mine .poll-check { background: var(--green-text); border-color: var(--green-text); color: #0f1115; }
.poll-opt-body { flex: 1; min-width: 0; }
.poll-opt-text { display: block; font-size: 15px; line-height: 1.3; }
.poll-bar { display: block; height: 6px; border-radius: 4px; background: var(--panel-2); margin: 7px 0 4px; overflow: hidden; }
.poll-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.poll-opt.leader .poll-bar > span { background: var(--green-text); }
.poll-voters { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; min-height: 1em; }
.poll-count { font-size: 14px; font-weight: 700; color: var(--muted); min-width: 18px; text-align: right; margin-top: 2px; flex-shrink: 0; }
.poll-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border);
}
.poll-total { color: var(--muted); font-size: 12px; }
.poll-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.poll-mini-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.poll-mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.poll-mini-btn.primary { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.poll-mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.poll-mini-btn:disabled { opacity: 0.4; cursor: default; }
.poll-tie { flex-basis: 100%; font-size: 12px; color: var(--pink-text); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.poll-error { flex-basis: 100%; color: var(--danger); font-size: 12px; margin: 0; }
.polls-footer { margin-top: 18px; }
.polls-footer .submit-btn { width: 100%; }
.rules-panel-footer .submit-btn + .submit-btn { margin-top: 8px; }
/* Numero di versione in faccia all'utente (Regola 60): piccolo e tenue, mai nascosto. */
.app-version { color: var(--muted); opacity: 0.6; font-size: 10.5px; text-align: center; margin: 14px 0 0; }
/* Scelta multipla + opzioni aggiungibili (03/09) */
.poll-add-opt { display: flex; gap: 6px; margin-top: 8px; }
.poll-add-opt input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px dashed var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; font-family: inherit;
}
.poll-add-opt input:focus { outline: none; border-color: var(--accent); border-style: solid; }
.poll-add-opt button { flex-shrink: 0; }
.poll-opt-del {
  background: none; border: none; color: var(--border); font-size: 14px; line-height: 1; cursor: pointer;
  padding: 2px 4px; flex-shrink: 0; margin-top: 2px;
}
.poll-opt-del:hover { color: var(--danger); }
.poll-opt-row { display: flex; align-items: flex-start; }
.poll-opt-row .poll-opt { flex: 1; min-width: 0; }
/* Nella scatola "Chi sei?" la versione stava incollata al bottone Entra (segnalato da Dante 03/09). */
.login-box .app-version { margin-top: 26px; }
/* Achievement "la partita del regolamento" (03/09, richiesta di Dante: che sembri un gioco) */
.ach {
  background: linear-gradient(135deg, var(--panel), var(--panel-2)); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin: 12px 0 4px;
}
.ach-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ach-title { font-weight: 800; font-size: 15px; }
.ach-count { font-weight: 800; font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.ach-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,0.06); margin: 8px 0 6px; overflow: hidden; }
.ach-bar > span {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #7bb0ff); transition: width 0.5s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 10px rgba(79,140,255,0.45);
}
.ach-level { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.ach-steps { display: flex; justify-content: space-between; margin-top: 8px; font-size: 15px; }
.ach-step { opacity: 0.25; filter: grayscale(1); transition: opacity 0.3s, filter 0.3s, transform 0.3s; }
.ach-step.on { opacity: 1; filter: none; transform: scale(1.15); }
.ach-done { border-color: #f5c518; background: linear-gradient(135deg, #2a2410, var(--panel)); }
.ach-done .ach-count { color: #f5c518; }
.ach-done .ach-bar > span { background: linear-gradient(90deg, #f5c518, #ffe680); box-shadow: 0 0 12px rgba(245,197,24,0.55); }

/* Filtri a scelta multipla (03/09): pallini ruolo, tendine con spunte e stemmi */
.role-chips { display: flex; gap: 6px; align-items: center; }
.role-chip {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0.4; padding: 0;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.role-chip .role-dot { margin: 0; }
.role-chip.on { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,140,255,0.25); }
.ms-wrap { position: relative; flex: 1; min-width: 120px; }
.ms-btn {
  width: 100%; min-height: 36px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 6px 10px; font-size: 13px; text-align: left; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ms-btn.active { border-color: var(--accent); }
.ms-btn::after { content: '\25BE'; margin-left: auto; color: var(--muted); font-size: 12px; }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; }
.ms-btn .team-badge { width: 16px; height: 16px; }
.ms-pop { max-height: 300px; }
.ms-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 14px; }
.ms-item:hover { background: var(--panel); }
.ms-item .ms-check { width: 16px; color: var(--green-text); font-weight: 800; flex-shrink: 0; }
.ms-item.reset { border-bottom: 1px solid var(--border); }
.ms-item-body { display: inline-flex; align-items: center; gap: 8px; }
.ms-item .team-badge { width: 18px; height: 18px; }
.fav-mark { color: #f5c518; }

/* Titolo lega centrato rispetto ai bottoni (Dante 03/09): griglia a 3 colonne, il nome sta
   nella colonna centrale, "chi sei" a destra, i bottoni su tutta la riga sotto. */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 12px; row-gap: 8px; }
.topbar-actions { grid-column: 1 / -1; grid-row: 2; }
.league-title-btn, .topbar h1 { grid-column: 2; grid-row: 1; }
.me { grid-column: 3; grid-row: 1; justify-self: end; }

/* Achievement fissa in alto mentre scorri + pallini numerati (Dante 03/09 sera) */
.ach { position: sticky; top: 6px; z-index: 20; box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.ach-dots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ach-dot {
  width: 26px; height: 26px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  font-size: 11px; font-weight: 800; color: #fff; background: #c0392b; font-family: inherit;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25); transition: background 0.25s, transform 0.15s;
}
.ach-dot:hover { transform: scale(1.12); }
.ach-dot.ok { background: #27ae60; }
.ach-done .ach-dot.ok { background: #f5c518; color: #2a2410; }
.poll-num { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 2px; }

/* Chi ha lasciato la Serie A: resta in archivio, ma si vede a colpo d'occhio (06/09) */
.listone-item.fuori-serie-a .pname-text { opacity: 0.55; }
.fuori-tag {
  font-size: 10px; font-weight: 700; color: var(--pink-text); background: var(--pink);
  border-radius: 20px; padding: 2px 7px; margin-left: 6px; white-space: nowrap;
}


/* Avviso di connessione (07/09): sta sopra a tutto e su TUTTE le schermate,
   perche' il caso peggiore e' proprio quello in cui l'app non e' ancora partita
   e non ha nessun posto dove scrivere un errore. */
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 14px; box-sizing: border-box;
  background: #b3261e; color: #fff;
  font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.conn-banner-retry {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.55); border-radius: 20px;
  padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.conn-banner-retry:hover { background: rgba(255,255,255,.3); }
.who-dropdown-empty { padding: 12px; text-align: center; opacity: .7; font-size: 14px; }


/* ===================== Asta live: il banditore digitale (08/09) ===================== */
.asta-body { padding-bottom: 0; }
.asta-wrap { max-width: 1100px; }
.asta-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.asta-head h1 { margin: 0; }
.asta-head-tools { display: flex; gap: 8px; }
.asta-head .polls-me, .asta-head .polls-who { grid-column: 1 / -1; }
.asta-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 12px; }
/* min-width: 0 sulle colonne, o un contenuto largo (il numero dell'offerta, la riga dei
   rapidi) allarga la colonna oltre lo schermo del telefono: visto a 390px il 08/09 */
.asta-main, .asta-side, .asta-card { min-width: 0; }
@media (min-width: 900px) {
  .asta-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}
.asta-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.asta-details > summary { cursor: pointer; font-weight: 800; font-size: 15px; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.asta-details > summary::-webkit-details-marker { display: none; }
.asta-details > summary::before { content: '▸'; color: var(--muted); font-size: 12px; }
.asta-details[open] > summary::before { content: '▾'; }
.asta-details[open] > summary { margin-bottom: 10px; }
.asta-summary-sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.asta-h3 { margin: 0 0 8px; font-size: 15px; }

/* --- chiamata in corso --- */
.asta-live-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.asta-pill { background: var(--danger); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 0.6px; border-radius: 20px; padding: 3px 9px; animation: asta-pulse 1.4s ease-in-out infinite; }
@keyframes asta-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.asta-chiamato { font-size: 12px; color: var(--muted); }
.asta-player { display: flex; align-items: center; gap: 14px; margin: 14px 0 8px; }
.asta-badge { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.asta-player-name { font-size: 30px; font-weight: 900; line-height: 1.05; letter-spacing: -0.3px; }
.asta-player-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.asta-offer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: stretch; margin: 10px 0; }
.asta-offer { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.asta-offer-label, .asta-timer-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.asta-offer-value { font-size: 64px; font-weight: 900; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; margin: 4px 0; }
.asta-offer-by { font-size: 14px; color: var(--muted); }
.asta-offer-by b { color: var(--text); }
.asta-me { color: var(--green-text) !important; }
.asta-timer { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; min-width: 110px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.asta-timer-value { font-size: 48px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.asta-timer-bar { height: 8px; border-radius: 5px; background: rgba(255,255,255,0.08); margin-top: 8px; overflow: hidden; }
.asta-timer-bar > span { display: block; height: 100%; background: var(--green-text); width: 100%; transition: width 0.1s linear; }
body.asta-ultimi .asta-timer-value { color: var(--danger); }
body.asta-ultimi .asta-timer-bar > span { background: var(--danger); }
.asta-battuta { height: 0; overflow: hidden; text-align: center; font-size: 44px; font-weight: 900; letter-spacing: 4px; color: var(--danger); transition: height 0.15s; }
.asta-battuta.on { height: 56px; }

/* --- il bottone gigante --- */
.asta-buzz-wrap { margin: 10px 0; }
.asta-buzz {
  width: 100%; min-height: 96px; border: none; border-radius: 18px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 26px; font-weight: 900; letter-spacing: 0.5px;
  box-shadow: 0 6px 0 #2c5fc4, 0 12px 28px rgba(79,140,255,0.35); transition: transform 0.05s, box-shadow 0.05s;
  -webkit-tap-highlight-color: transparent; user-select: none; touch-action: manipulation;
}
.asta-buzz:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 #2c5fc4, 0 4px 12px rgba(79,140,255,0.35); }
.asta-buzz:disabled { background: var(--panel-2); color: var(--muted); box-shadow: none; cursor: default; font-size: 18px; border: 1px solid var(--border); }
.asta-buzz.asta-buzz-mio { background: var(--green); color: var(--green-text); border: 1px solid var(--green-text); box-shadow: none; }
@media (max-width: 899px) {
  body.asta-in-corso { padding-bottom: 130px; }
  body.asta-in-corso .asta-buzz-wrap { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 60; }
}
.asta-quick-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.asta-quick { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; font-weight: 700; cursor: pointer; font-size: 14px; }
.asta-quick:disabled { opacity: 0.4; cursor: default; }
.asta-custom { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.asta-custom input { width: 96px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 10px; font-size: 15px; }
.asta-banditore { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.asta-banditore .link-btn.danger { color: var(--pink-text); }
.asta-banditore .link-btn:disabled { opacity: 0.4; cursor: default; }
.asta-offerte-list { margin: 0; padding-left: 22px; font-size: 14px; }
.asta-offerte-list li { padding: 3px 0; color: var(--muted); }
.asta-offerte-list li.top { color: var(--text); }
.asta-offerte-list b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.asta-ts { font-size: 11px; margin-left: 6px; opacity: 0.7; }

/* --- in attesa di una chiamata --- */
.asta-idle-head { margin-bottom: 12px; }
.asta-turno { font-size: 16px; }
.asta-idle-hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; line-height: 1.45; }
.asta-chiama { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 640px) { .asta-chiama { grid-template-columns: 2fr 90px auto auto; align-items: end; } .asta-chiama .error-text { grid-column: 1 / -1; } }
.asta-chiama .field-credits input { width: 100%; }
.asta-chiama-btn:disabled { opacity: 0.45; cursor: default; }
.asta-scelto { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.asta-scelto .role-dot { margin: 0; }

/* --- tavolo --- */
/* la tabella scorre DENTRO la sua scheda: su un telefono da 390px le quattro colonne
   non ci stanno e senza questo spingevano tutta la pagina in orizzontale (08/09) */
#asta-tavolo { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.asta-tav { width: 100%; border-collapse: collapse; font-size: 13px; }
@media (max-width: 480px) {
  .asta-tav { font-size: 12px; }
  .asta-tav th, .asta-tav td { padding: 5px 4px; }
  .asta-tav-slots { white-space: normal; }
}
.asta-tav th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.asta-tav td { padding: 7px 6px; border-bottom: 1px solid var(--border); }
.asta-tav .num { text-align: right; font-variant-numeric: tabular-nums; }
.asta-tav tr.top td { background: rgba(79,140,255,0.12); }
.asta-tav tr.me .asta-tav-name { color: var(--green-text); font-weight: 800; }
.asta-tav tr.fuori td { opacity: 0.45; }
.asta-tav-max { font-weight: 700; }
.asta-turno-tag { font-size: 10px; background: var(--accent); color: #fff; border-radius: 20px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
.asta-tav-slots { white-space: nowrap; }
.asta-slot { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; border-radius: 6px; padding: 2px 5px; margin-right: 3px; }
.asta-slot-p { background: var(--role-p); } .asta-slot-d { background: var(--role-d); } .asta-slot-c { background: var(--role-c); } .asta-slot-a { background: var(--role-a); }
.asta-slot.pieno { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.asta-ultime-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.asta-ultime-list li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.asta-ultime-list li:last-child { border-bottom: none; }
.asta-ultime-list .role-dot { margin: 0; }
.asta-ult-nome { font-weight: 700; }
.asta-ult-esito { margin-left: auto; color: var(--muted); font-size: 13px; }
.asta-ult-esito b { color: var(--text); }
.asta-ult-esito.vuota { font-style: italic; }


/* Chip del calciatore selezionato, DENTRO il campo (07/09): ruolo + stemma + sigla,
   cosi' con gli omonimi si vede chi si sta comprando. Sta a destra, sopra il testo. */
.player-selected {
  position: absolute; right: 10px; bottom: 9px; display: inline-flex; align-items: center; gap: 6px;
  pointer-events: none; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.3px;
}
.player-selected .role-dot { margin: 0; width: 18px; height: 18px; font-size: 9px; }
.field-player.has-selected input { padding-right: 96px; }
