:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --card: #1c2230;
  --line: #2a3242;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #7c5cff;
  --accent2: #a78bfa;
  --wolf: #ef4444;
  --village: #22c55e;
  --gold: #f0b429;
  --danger: #f85149;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2235 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 1.8rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

.logo { font-size: 3rem; text-align: center; margin: 10px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

button, .btn {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform .05s, filter .15s, background .15s;
  width: 100%;
}
button:hover { filter: brightness(1.1); }
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: var(--bg2); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.small { width: auto; padding: 7px 12px; font-size: .85rem; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

input[type=text], input[type=number] {
  font: inherit;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
}
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

.code-badge {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 6px;
  text-align: center;
  color: var(--gold);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.qr { display: block; margin: 12px auto; border-radius: 10px; background: #fff; padding: 8px; }

.players { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.player-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.player-item.dead { opacity: .5; }
.player-item .nm { flex: 1; font-weight: 600; }
.player-item .nm .role { color: var(--accent2); font-weight: 500; font-size: .85rem; }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.tag.alive { background: rgba(34,197,94,.15); color: var(--village); }
.tag.dead { background: rgba(248,81,73,.15); color: var(--danger); }
.tag.off { background: rgba(240,180,41,.12); color: var(--gold); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--village); }
.dot.off { background: var(--muted); }

.role-config { display: grid; gap: 10px; }
.role-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.role-row .emoji { font-size: 1.5rem; }
.role-row .info { flex: 1; }
.role-row .info .n { font-weight: 600; }
.role-row .info .d { font-size: .78rem; color: var(--muted); }
.role-row .team { font-size: .7rem; padding: 2px 8px; border-radius: 999px; }
.team.wolf { background: rgba(239,68,68,.15); color: var(--wolf); }
.team.village { background: rgba(34,197,94,.15); color: var(--village); }
.counter { display: flex; align-items: center; gap: 8px; }
.counter button { width: 34px; height: 34px; padding: 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.counter .val { width: 24px; text-align: center; font-weight: 700; }

.banner {
  text-align: center; padding: 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 700;
}
.banner.night { background: linear-gradient(135deg,#1e2a4a,#11162a); }
.banner.day { background: linear-gradient(135deg,#3a3416,#2a2410); color: var(--gold); }
.banner.wolf { background: linear-gradient(135deg,#4a1414,#2a0e0e); color: #fda4a4; }
.banner.village { background: linear-gradient(135deg,#143a1e,#0e2a14); color: #86efac; }

.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.log li { font-size: .85rem; padding: 8px 10px; border-radius: 8px; background: var(--bg2); border-left: 3px solid var(--line); }
.log li.night { border-color: var(--accent); }
.log li.day { border-color: var(--gold); }
.log li.system { border-color: var(--village); }

.role-reveal {
  text-align: center; padding: 30px 20px;
  border-radius: 18px; border: 2px solid var(--line);
  background: linear-gradient(160deg, var(--card), var(--bg2));
}
.role-reveal .emoji { font-size: 5rem; }
.role-reveal .rn { font-size: 2rem; font-weight: 800; margin: 8px 0; }
.role-reveal .team-line { font-size: .9rem; margin-bottom: 12px; }
.role-reveal .rd { color: var(--muted); font-size: .95rem; line-height: 1.5; }

.pick-list { display: grid; gap: 8px; margin: 12px 0; }
.pick {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; cursor: pointer; width: 100%;
  color: var(--text); font: inherit; text-align: left;
}
.pick.selected { border-color: var(--accent); background: rgba(124,92,255,.12); }
.pick:disabled { opacity: .4; }

.hint { background: rgba(124,92,255,.1); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .9rem; margin-bottom: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.hidden { display: none !important; }
a { color: var(--accent2); }
.step-progress { font-size: .8rem; color: var(--muted); text-align: center; margin-bottom: 8px; }
