:root{
  --bg0:#06070b;
  --bg1:#0b0f18;
  --panel:#0f1422;
  --text:#eef2ff;
  --muted:#b2bdd8;
  --line:rgba(255,255,255,.10);
  --shadow:rgba(0,0,0,.55);

  --accent:#b60f2a;     /* mafia red */
  --danger:#ef4444;

  --r:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(182,15,42,.14), transparent 60%),
    radial-gradient(900px 600px at 80% 20%, rgba(255,207,102,.09), transparent 55%),
    radial-gradient(900px 700px at 60% 90%, rgba(255,255,255,.05), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

/* subtle grain */
body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode:overlay;
  opacity:.25;
}

.wrap{
  max-width:560px;
  margin:0 auto;
  padding:18px 14px 28px;
  position:relative;
}

.brand{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  padding:10px 6px 14px;
}
.brand h1{
  margin:0;
  letter-spacing:.12em;
  text-transform:uppercase;
  font-weight:800;
  font-size:28px;
  line-height:1.05;
}
.tag{
  color:var(--muted);
  font-size:13px;
  margin-top:6px;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(0,0,0,.25);
  box-shadow:0 10px 30px var(--shadow);
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}
.dot{
  width:8px; height:8px; border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 3px rgba(182,15,42,.18);
}

.card{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:var(--r);
  padding:16px;
  margin:12px 0;
  box-shadow:0 18px 45px var(--shadow);
  backdrop-filter: blur(6px);
  position:relative;
  overflow:hidden;
}
.card:after{
  content:"";
  position:absolute;
  inset:-1px;
  background:radial-gradient(500px 120px at 20% 0%, rgba(182,15,42,.12), transparent 70%);
  pointer-events:none;
}

.row{display:flex; align-items:center;}
.space{justify-content:space-between;}
.gap{gap:10px;}
.actions{margin-top:12px; flex-wrap:wrap;}

.label{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.10em;
  margin-bottom:6px;
}

.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.25);
  color:var(--text);
  outline:none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.input::placeholder{color:rgba(238,242,255,.45)}

.btn{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
  transition:transform .06s ease, background .12s ease, border-color .12s ease;
  user-select:none;
  font-weight:650;
}
.btn:active{transform:translateY(1px)}
.btn.primary{
  background:linear-gradient(180deg, rgba(182,15,42,.35), rgba(182,15,42,.18));
  border-color:rgba(182,15,42,.45);
}
.btn.ghost{ background:rgba(0,0,0,.18); }
.btn.danger{
  background:linear-gradient(180deg, rgba(239,68,68,.22), rgba(239,68,68,.12));
  border-color:rgba(239,68,68,.45);
}

.msg{
  margin-top:10px;
  min-height:18px;
  color:var(--muted);
  font-size:14px;
}
.msg.err{color:#ffd2d2}
.msg.ok{color:#c8fff6}

.hidden{display:none !important;}

.list{list-style:none; padding:0; margin:12px 0 14px}
.list li{
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  margin:8px 0;
  background:rgba(0,0,0,.18);
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.pill{
  font-size:12px;
  color:rgba(255,255,255,.85);
  border:1px solid rgba(182,15,42,.45);
  background:rgba(182,15,42,.18);
  padding:4px 10px;
  border-radius:999px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.pill.dead{
  border:1px solid rgba(239,68,68,.45);
  background:rgba(239,68,68,.16);
}

details{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(0,0,0,.16);
  padding:10px 10px 12px;
}
details summary{
  cursor:pointer;
  color:var(--muted);
  font-weight:650;
}
details .sub{
  color:var(--muted);
  font-size:13px;
  margin-top:6px;
}
.hostBox{ margin-top:10px; }

.hint{
  margin-top:10px;
  padding:10px 10px;
  border-radius:14px;
  border:1px dashed rgba(255,255,255,.14);
  color:rgba(238,242,255,.68);
  background:rgba(0,0,0,.16);
  font-size:13px;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:12px;
  color:rgba(238,242,255,.85);
}

.roleBox{
  margin-top:12px;
  border-radius:18px;
  border:1px solid var(--line);
  overflow:hidden;
  background:rgba(0,0,0,.28);
  box-shadow:0 18px 45px var(--shadow);
}
.roleBox img{width:100%; height:auto; display:block;}

.foot{
  text-align:center;
  color:rgba(238,242,255,.45);
  padding:14px 0 6px;
  font-size:12px;
  letter-spacing:.06em;
  text-transform:uppercase;
}

/* ===== GLOBAL TIMER ===== */
.timerBar{
  position:sticky;
  top:10px;
  z-index:50;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin:0 0 12px;
  padding:12px 14px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.22));
  box-shadow:0 18px 45px var(--shadow);
  backdrop-filter: blur(6px);
}
.timerLeft{min-width:0}
.timerTitle{
  font-size:12px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:rgba(238,242,255,.70);
}
.timerSub{
  font-size:12px;
  color:rgba(238,242,255,.55);
  margin-top:3px;
}
.timerRight{display:flex;flex-direction:column;align-items:flex-end;gap:6px;}
.timerValue{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:20px;
  font-weight:900;
  letter-spacing:.04em;
  color:#eef2ff;
  text-shadow:0 0 18px rgba(182,15,42,.22);
}
.timerTrack{
  width:120px;
  height:6px;
  border-radius:999px;
  background:rgba(255,255,255,.10);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
}
.timerFill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, rgba(182,15,42,.75), rgba(255,207,102,.55));
}
.timerBar.ended{
  border-color:rgba(239,68,68,.45);
  background:linear-gradient(180deg, rgba(239,68,68,.10), rgba(0,0,0,.24));
}
.timerBar.ended .timerValue{ color:#ffd2d2; }

/* MG timer input layout */
.timerInputBox{
  flex:1 1 220px;
  min-width:220px;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background:rgba(0,0,0,.12);
}

/* ===== MG table (added) ===== */
.mgtable{ margin-top:10px; display:flex; flex-direction:column; gap:8px; }
.mgrow{
  display:grid;
  grid-template-columns: 1.2fr 1fr .8fr .9fr;
  gap:10px;
  align-items:center;
  padding:10px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(0,0,0,.14);
}
.mgrow.head{
  opacity:.8;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.mgc{ min-width:0; }
.alive{ color:#b7f7c8; }
.dead{ color:#ff8896; }
/* opcjonalnie: mocniejszy przycisk koniec gry */
#btnEndGame.btn.danger{
  box-shadow: 0 12px 30px rgba(239,68,68,.25);
}
#btnRules .qmark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.08);
  color:#fff;
  font-weight:900;
  font-size:12px;
  line-height:1;
  margin-right:6px;
}
.mgtable .mgrow:not(.head){
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto auto;
}
.mgtable .mgrow:not(.head) .mgc{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
