:root{
  --bg-night:#00b050;
  --bg-deep:#5b7720;
  --bg-panel:rgba(255,255,255,.92);
  --bg-panel-soft:rgba(141,255,141,.12);
  --line:rgba(89,182,30,.24);
  --text-main:#1d2a12;
  --text-soft:#49612f;
  --text-muted:#6a7d55;
  --accent-crimson:#8fe41e;
  --accent-crimson-strong:#60bf1f;
  --accent-gold:#fff200;
  --accent-ember:#47611b;
  --success:#8dff8d;
  --warning:#ffe84a;
  --shadow:0 24px 60px rgba(0,0,0,.32);
}

*{box-sizing:border-box}

html{background:var(--bg-night)}

body{
  margin:0;
  min-height:100vh;
  padding:32px 16px 48px;
  font-family:"Trebuchet MS","Gill Sans","Segoe UI",sans-serif;
  color:var(--text-main);
  background:var(--bg-night);
}

body::before{
  content:none;
  position:fixed;
  inset:0;
  pointer-events:none;
  background:none;
  opacity:.8;
}

body>header,
body>section{
  position:relative;
  z-index:1;
  max-width:860px;
  margin-left:auto;
  margin-right:auto;
}

header{
  margin-bottom:18px;
  padding:28px 28px 24px;
  border:1px solid var(--line);
  border-radius:30px;
  background:var(--accent-gold);
  box-shadow:var(--shadow);
  overflow:hidden;
  text-align:center;
}

header::after{
  content:none;
}

h1,h2,h3{
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  letter-spacing:.02em;
}

h1{
  font-size:clamp(2rem,5vw,3.2rem);
  color:var(--accent-ember);
  text-shadow:0 8px 24px rgba(255,255,255,.5);
  text-align:center;
}

.app{max-width:520px;margin:auto;padding:24px}

.card{
  margin-top:20px;
  padding:24px;
  border:1px solid var(--line);
  border-radius:26px;
  background:
    linear-gradient(180deg,rgba(255,255,255,.97),rgba(255,252,241,.93)),
    var(--bg-panel);
  box-shadow:var(--shadow);
  backdrop-filter:blur(14px);
}

#moderator{
  border-color:rgba(216,175,98,.28);
}

#join{
  border-color:rgba(126,207,155,.24);
}

#result{
  border-color:rgba(242,210,162,.25);
}

#night{
  border-color:rgba(120,109,202,.28);
}

#vote{
  border-color:rgba(179,46,71,.35);
}

h2{
  margin-bottom:16px;
  color:var(--accent-ember);
  font-size:1.65rem;
}

h3{
  margin:20px 0 12px;
  color:#1a1a1a;
  font-size:1.18rem;
}

label{
  display:block;
  margin:14px 0;
  color:var(--accent-ember);
  font-weight:700;
  letter-spacing:.02em;
}

.moderator-setup-row{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(150px,.65fr);
  gap:12px;
  align-items:end;
}

.moderator-setup-row label{
  margin-top:0;
}

input,
select{
  display:block;
  width:100%;
  margin-top:8px;
  padding:14px 15px;
  border:1px solid rgba(255,242,0,.34);
  border-radius:16px;
  background:rgba(255,245,170,.78);
  color:#2a1b22;
  font-size:16px;
  font-family:inherit;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.55);
}

input:focus,
select:focus{
  outline:none;
  border-color:var(--accent-gold);
  box-shadow:0 0 0 4px rgba(255,242,0,.24);
}

button{
  width:100%;
  margin:10px 0;
  padding:14px 18px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:16px;
  background:
    linear-gradient(135deg,var(--accent-crimson-strong),#2f6e16);
  color:#faffef;
  font-size:16px;
  font-weight:700;
  letter-spacing:.02em;
  cursor:pointer;
  box-shadow:0 14px 28px rgba(0,0,0,.22);
  transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;
}

button:hover:not(:disabled){
  transform:translateY(-1px);
  filter:brightness(1.05);
  box-shadow:0 18px 32px rgba(0,0,0,.28);
}

button:active:not(:disabled){
  transform:translateY(0);
}

button:disabled{
  opacity:.58;
  cursor:not-allowed;
  box-shadow:none;
}

.secondary{
  background:
    linear-gradient(135deg,rgba(255,242,0,.24),rgba(202,255,168,.1));
  color:var(--text-main);
  border-color:rgba(89,182,30,.12);
}

#declareResultBtn{
  background:
    linear-gradient(135deg,var(--accent-gold),#b3d31d);
  color:#173010;
  border-color:rgba(255,240,214,.22);
}

.hidden{display:none}

html.initial-player-link #moderator{
  display:none;
}

html.initial-player-link #join{
  display:block;
}

#players{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}

#players>.status{
  grid-column:1/-1;
}

.player{
  padding:14px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(141,255,141,.05);
}

.player-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}

.player-top b{
  min-width:0;
  overflow-wrap:anywhere;
}

.status{
  font-size:13px;
  color:var(--text-muted);
}

.pending-submitters{
  color:var(--text-main);
  font-size:14px;
  white-space:nowrap;
}

.status:empty,
.game-status:empty{
  display:none;
}

.warning{
  color:var(--warning);
  font-weight:700;
}

.game-status{
  margin:16px 0 12px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#ffffff;
  color:var(--text-main);
  font-weight:700;
}

.night-progress-row{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:10px;
}

.night-progress-row .game-status{
  margin:0;
  white-space:nowrap;
}

.night-progress-row .status{
  display:flex;
  align-items:center;
  gap:12px;
  overflow-x:auto;
  white-space:nowrap;
}

#gameId{
  color:#111111;
  letter-spacing:.08em;
}

.game-created-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:0 0 12px;
  color:var(--text-soft);
  font-weight:700;
  flex-wrap:wrap;
}

#gameLinkArea{
  margin:12px 0;
  padding:10px 12px;
  border-radius:16px;
  background:var(--bg-panel-soft);
}

.game-link-row{
  display:grid;
  grid-template-columns:auto auto minmax(220px,1fr);
  align-items:center;
  gap:10px;
}

.game-link-row input{
  margin-top:0;
}

.round-action-row{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.round-action-row button{
  margin:10px 0;
}

#gameLinkArea a{
  color:#3a5e11;
  word-break:break-all;
}

.role-hidden{display:none}

.joined-locked #acceptBtn{
  filter:blur(2px);
  opacity:.5;
  pointer-events:none;
  user-select:none;
}

.player-identity{
  margin:0 0 14px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(141,255,141,.14);
  color:var(--accent-ember);
  font-weight:700;
  letter-spacing:.03em;
  text-align:center;
}

.role-message{
  margin-top:12px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(241,222,72,.08);
  color:var(--text-soft);
  font-size:14px;
  text-align:center;
}

.role-peek-area{
  margin:8px 0 14px;
}

.role-peek-card,
.moderator-role-peek{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.role-peek-card{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.58);
}

.role-peek-button,
.moderator-role-btn{
  width:auto;
  margin:0;
  padding:8px 11px;
  border-radius:999px;
  font-size:12px;
  box-shadow:none;
  white-space:nowrap;
}

.role-peek-secret,
.moderator-role-secret{
  padding:7px 10px;
  border-radius:999px;
  background:var(--accent-gold);
  color:#173010;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  white-space:nowrap;
}

.moderator-role-secret{
  display:none;
  margin-left:6px;
  font-size:12px;
}

.moderator-role-peek:active .moderator-role-secret{
  display:inline-block;
}

#roleText{
  padding:18px;
  border-radius:18px;
  background:
    radial-gradient(circle at top,rgba(141,255,141,.2),transparent 65%),
    rgba(255,248,241,.72);
  color:var(--accent-ember);
  text-align:center;
  letter-spacing:.05em;
  text-transform:uppercase;
}

.choice-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:16px;
}

.choice-btn{
  min-height:48px;
  padding:12px 10px;
  background:
    linear-gradient(135deg,rgba(241,222,72,.1),rgba(255,255,255,.9));
  color:var(--text-main);
  border:1px solid rgba(89,182,30,.12);
  line-height:1.2;
  overflow-wrap:anywhere;
}

.choice-btn.selected{
  background:
    linear-gradient(135deg,var(--accent-gold),#7bc81a);
  color:#1a260d;
  border-color:rgba(255,244,233,.28);
}

.summary{
  margin-top:16px;
  padding:16px 16px 8px;
  border-radius:18px;
  background:rgba(255,255,255,.72);
  border:1px solid var(--line);
}

.summary-title{
  margin-top:10px;
  color:var(--accent-ember);
  font-weight:700;
}

.summary-gap{
  padding-top:10px;
}

.vote-detail-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:6px 0;
  border-bottom:1px solid rgba(89,182,30,.12);
  color:var(--text-soft);
  font-size:14px;
}

.vote-detail-row:last-child{
  border-bottom:0;
}

.vote-detail-row span{
  min-width:0;
  overflow-wrap:anywhere;
}

.vote-detail-pending{
  color:var(--text-muted);
  font-style:italic;
}

#nightControls,
#voteControls{
  margin-top:22px;
  padding-top:6px;
}

#joinStatus{
  color:var(--text-soft);
}

@media (max-width:720px){
  body{
    padding:18px 12px 32px;
  }

  header,
  .card{
    border-radius:22px;
    padding:18px;
  }

  h1{
    font-size:2rem;
  }

  h2{
    font-size:1.35rem;
  }

  button{
    padding:13px 16px;
  }

  .moderator-setup-row,
  .game-link-row{
    grid-template-columns:1fr;
  }

  #players{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .role-peek-card{
    align-items:flex-start;
    flex-direction:column;
  }
}
