body.page {
  min-height: 100vh;
  margin: 0;
  padding-top: 72px;
  background:
    linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)),
    url("../img/bg.jpg") center / cover no-repeat fixed;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root{
  --primary:#2563eb;
  --danger:#dc2626;
  --timer:#ffffff;
  --bg:#0b1220;
  --card:#111827cc;
  --text:#e5e7eb;
  --success: #16a34a; /* verde */
}

*{ box-sizing:border-box; font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial; }
body{ margin:0; background:var(--bg); color:var(--text); }

.page{ padding:16px; }
.topbar{ display:flex; justify-content:space-between; align-items:center; padding:12px 16px; }
.brand{ display:flex; gap:12px; align-items:center; }
.logo{ height:60px; }
.logo-floating{ position:absolute; left:16px; top:16px; height:80px; opacity:.95; }

.card{
  max-width:900px; margin:16px auto; padding:16px;
  background:var(--card); border:1px solid #334155; border-radius:14px;
}

.grid2{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px; }
label{ display:flex; flex-direction:column; gap:6px; font-size:14px; }
input, select{ padding:10px; border-radius:10px; border:1px solid #334155; background:#0b1220; color:var(--text); }

.gridPlayers{ display:grid; gap:10px; margin-top:10px; }
.playerRow{ display:grid; grid-template-columns: 120px 1fr 160px; gap:10px; align-items:center; }
.playerRowTitle{ font-weight:800; opacity:.9; }

.btn{padding:12px 14px; border-radius:12px; border:0; cursor:pointer; font-weight:800; color:white; margin-top:12px;}

button.btn {appearance: none; -webkit-appearance: none;}

.btn.primary{ background:var(--primary); }
.btn.danger{ background:var(--danger); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.btn.success {background:var(--success); color: #ffffff;}
.btn.success:hover {background-color: #15803d;}
.btn.success:active {background-color: #166534;}


.link{ color:#93c5fd; text-decoration:none; font-size:14px; margin-left:10px; }
.hint{ opacity:.75; font-size:13px; }

.game{ height:100vh; overflow:hidden; }
.board{
  position:relative; width:100%; height:100%;
  background: radial-gradient(circle at center, #1f2937 0%, #0b1220 70%);
  background-size:cover; background-position:center;
}

.center{
  position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%);
  background:#0b1220cc; border:1px solid #334155;
  padding:14px; border-radius:16px; text-align:center;
  min-width:220px;
}
.tableName{ font-weight:900; margin-bottom:10px; }

/* Player card (slightly smaller than V1) */
.player{
  position:absolute;
  transform:translate(-50%,-50%);
  width:160px; padding:9px;
  background:#0b1220cc; border:1px solid #334155;
  border-radius:14px; text-align:center;
  touch-action:none;
}
.player .header{ display:flex; align-items:center; justify-content:center; gap:8px; margin-bottom:6px; }
.player .dot{ width:12px; height:12px; border-radius:50%; border:1px solid #0b1220; box-shadow:0 0 0 2px #334155; }
.player .name{ font-weight:900; }
.player .time{ font-size:30px; font-weight:900; color:var(--timer); letter-spacing:1px; }
.player .malus{ margin-top:8px; font-weight:900; opacity:.95; color:#dc2626 }
.player.ready{ outline:3px solid #22c55e; }
.player button.btn{ padding:10px 12px; margin-top:10px; }

.overlay{
  position:absolute; inset:0;
  background:#000000aa; display:flex; align-items:center; justify-content:center;
  padding:16px;
}
.hidden{ display:none; }
.overlay .panel{
  background:#0b1220; border:1px solid #334155; border-radius:16px;
  padding:16px; max-width:520px; width:100%;
}

.flash{ padding:10px; border-radius:12px; background:#064e3bcc; border:1px solid #10b981; margin-bottom:12px; }

@keyframes malusFlash {
  0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0.9); }
  50%  { box-shadow: 0 0 0 6px rgba(220,38,38,0.9); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

.player.malus-hit {
  animation: malusFlash 0.6s ease-out;
}
.malus-hit {animation: malusFlash 0.6s ease-out;}
.player .time.low-time {
  color: #f97316;     /* arancione */
}

.player .time.critical-time {
  color: #dc2626;     /* rosso */
}
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.player-card {border: 2px solid #334155; border-radius: 12px; padding: 12px; background: #020617;}

.player-card.ready {border-color: #22c55e;}

.player-card .p-ready-btn {width:100%; margin-top:10px;}

.player-header {display: flex; align-items: center; gap: 8px; margin-bottom: 8px;}

.player-time {font-size: 28px; text-align: center; margin: 8px 0;}

.player-malus,
.player-status {text-align: center;}
.player-card.me {border-color: #22c55e;}
.player-card.me .p-time {font-size: 42px; font-weight: 700;}
.player-card:not(.me) .p-time {font-size: 24px;}

@media (max-width: 768px) {.player-card.me .p-time {font-size: 36px;}}
/* Pulsante Pronto - stato attivo (tempo che scorre) */
.p-ready-btn.ready-false {
  background-color: #dc2626; /* rosso */
  border-color: #dc2626;
  color: #fff;
}

/* Pulsante Pronto - stato pronto */
.p-ready-btn.ready-true {
  background-color: #16a34a; /* verde */
  border-color: #16a34a;
  color: #fff;
}

/* Disabilitato */
.p-ready-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* timer normale */
.p-time {
  font-size: 28px;
  color: #e5e7eb;
}

/* timer in pericolo */
.p-time.danger {
  color: #dc2626;
  font-weight: bold;
}

.logo-floating {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  height: 100px;
  width: auto;
  z-index: 100;
  opacity: 0.95;
  pointer-events: none; /* non blocca click */
}

/* mobile */

@media (max-width: 480px) {
  .logo-floating {
    height: 90px;
    top: 10px;
  }

  body.page {
    padding-top: 60px;
  }
}