:root {
  --bg: #0f1220;
  --panel: #1b1f36;
  --panel2: #262c4d;
  --accent: #7c5cff;
  --accent2: #ff5c7c;
  --text: #e8eaf6;
  --muted: #9aa0c3;
  --alive: #4ade80;
  --dead: #64748b;
  --wolf: #ff5c5c;
  --human: #4ade80;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}
.app { max-width: 520px; margin: 0 auto; padding: 16px 14px 60px; }
.hidden { display: none !important; }

h1.title { font-size: 22px; margin: 8px 0 4px; text-align: center; }
.subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.card {
  background: var(--panel);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.card h2 { margin: 0 0 12px; font-size: 17px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--panel2);
  background: var(--panel2); color: var(--text); font-size: 16px;
}
input[type=text]::placeholder { color: #6b7099; }

button {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 12px;
  background: var(--accent); color: #fff; transition: transform .05s, opacity .15s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.secondary { background: var(--panel2); color: var(--text); }
button.danger { background: var(--accent2); }
button.ghost { background: transparent; border: 1px solid var(--panel2); color: var(--muted); }

.divider { text-align: center; color: var(--muted); margin: 8px 0; font-size: 12px; }
.error { color: var(--accent2); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* phase badge */
.phase-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px;
}
.phase-bar .room-id { font-size: 12px; color: var(--muted); }
.phase-bar .phase-name { font-size: 15px; font-weight: 700; }
.badge { display:inline-block; padding:2px 10px; border-radius:20px; font-size:12px; font-weight:700; }
.badge.night { background:#312a63; color:#c9b8ff; }
.badge.day { background:#5a4a1e; color:#ffe08a; }
.badge.vote { background:#5a1e33; color:#ff9ab5; }
.badge.lobby { background:#1e4a5a; color:#8ae0ff; }
.badge.end { background:#1e5a37; color:#8affb0; }

/* my role */
.myrole { text-align:center; padding: 16px; border-radius: 14px; background: var(--panel2); margin-bottom: 12px; }
.myrole .role-name { font-size: 24px; font-weight: 800; letter-spacing: 2px; }
.myrole .role-desc { font-size: 13px; color: var(--muted); margin-top: 6px; }
.myrole.dead { opacity: .6; }

/* player list */
.players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.player {
  display:flex; align-items:center; gap:8px; padding:10px 12px; border-radius:12px;
  background: var(--panel2); font-size: 14px;
}
.player .dot { width:9px; height:9px; border-radius:50%; background: var(--alive); flex-shrink:0; }
.player.dead { color: var(--dead); text-decoration: line-through; }
.player.dead .dot { background: var(--dead); }
.player .role-tag { margin-left:auto; font-size:11px; padding:1px 7px; border-radius:10px; background:#111530; }
.player .gm-tag { font-size:10px; color:#ffe08a; }

/* select target list */
.target-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.target {
  display:flex; align-items:center; padding:13px 14px; border-radius:12px;
  background: var(--panel2); cursor:pointer; border: 2px solid transparent; font-size:15px;
}
.target.selected { border-color: var(--accent); background:#2c2465; }
.target .check { margin-left:auto; color: var(--accent); font-weight:800; }

.info-box { background: var(--panel2); border-radius:12px; padding:14px; margin: 10px 0; font-size:14px; }
.result-badge { font-size:20px; font-weight:800; text-align:center; padding:12px; border-radius:12px; margin:10px 0; }
.result-badge.wolf { background:#3a1414; color: var(--wolf); }
.result-badge.human { background:#123020; color: var(--human); }

.waiting { text-align:center; padding: 30px 10px; }
.waiting .spinner {
  width:44px; height:44px; border:4px solid var(--panel2); border-top-color: var(--accent);
  border-radius:50%; margin:0 auto 16px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress { font-size:13px; color: var(--muted); text-align:center; margin-top:8px; }

.logs { max-height: 160px; overflow-y:auto; font-size:12px; color: var(--muted); }
.logs .log { padding: 3px 0; border-bottom:1px solid #232847; }

.winner-box { text-align:center; padding:24px; border-radius:16px; margin-bottom:14px; }
.winner-box.villagers { background: linear-gradient(135deg,#123020,#1e5a37); }
.winner-box.wolves { background: linear-gradient(135deg,#3a1414,#5a1e2e); }
.winner-box .win-title { font-size:26px; font-weight:800; }

.seer-history { font-size:13px; }
.seer-history .row { display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px solid #232847; }

.toast {
  position: fixed; left:50%; bottom:24px; transform: translateX(-50%);
  background:#000a; color:#fff; padding:10px 18px; border-radius:20px; font-size:14px;
  opacity:0; transition:opacity .3s; pointer-events:none; z-index:100;
}
.toast.show { opacity:1; }
.small { font-size:12px; color:var(--muted); }
.center { text-align:center; }
