:root {
  --bg: #0f1220;
  --panel: #1a1f33;
  --panel2: #232a45;
  --accent: #c8a24a;
  --accent2: #7c5cff;
  --text: #e8e9f0;
  --muted: #9aa0b8;
  --danger: #e25563;
  --good: #4ec17a;
  --wolf: #b8434f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #20264a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

#app { display: flex; flex-direction: column; height: 100vh; }

#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #1b2140, #14182e);
  border-bottom: 1px solid #2c3358;
}
#topbar h1 {
  margin: 0; font-size: 22px; letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(200,162,74,.35);
}
#phaseInfo { display: flex; gap: 10px; align-items: baseline; flex: 1; }
#dayLabel { font-size: 18px; font-weight: 700; }
#phaseLabel { color: var(--muted); font-size: 14px; }
#helpBtn {
  background: transparent; color: var(--muted);
  border: 1px solid #39406a; border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}
#helpBtn:hover { color: var(--text); border-color: var(--accent2); }

#main { display: flex; flex: 1; min-height: 0; }

#players {
  width: 280px; padding: 14px; overflow-y: auto;
  background: #12162a; border-right: 1px solid #262c4a;
  display: flex; flex-direction: column; gap: 10px;
}

.card {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid #2b3358;
  border-radius: 12px; padding: 10px 12px;
  transition: transform .08s, border-color .15s, opacity .2s;
}
.card .avatar { font-size: 28px; line-height: 1; }
.card .meta { flex: 1; min-width: 0; }
.card .name { font-weight: 700; }
.card .tags { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .tag {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  background: #2c335a; margin-right: 4px; color: #c4cae8;
}
.card .tag.co { background: #3a2f5e; color: #d8c8ff; }
.card .tag.you { background: #4a3c12; color: var(--accent); }
.card.dead { opacity: .4; filter: grayscale(.6); }
.card.dead .name::after { content: " ✝"; color: var(--danger); }

.card.selectable { cursor: pointer; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card.selectable:hover { transform: translateY(-1px); background: var(--panel2); }
.card.you-card { border-color: var(--accent); }

#center { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#log {
  flex: 1; overflow-y: auto; padding: 18px 22px;
  display: flex; flex-direction: column; gap: 8px;
}
.line { line-height: 1.5; max-width: 760px; }
.line .who { color: var(--accent); font-weight: 700; }
.line.system { color: var(--muted); font-style: italic; }
.line.event { color: #ffd27a; }
.line.danger { color: var(--danger); font-weight: 700; }
.line.good { color: var(--good); font-weight: 700; }
.line.divider { border-top: 1px dashed #333a5e; padding-top: 8px; margin-top: 4px; color: var(--accent2); font-weight: 700; }
.line.you-cmd { color: #bfe3ff; }
.line.you-cmd::before { content: "👑 絶対指令 ▶ "; color: var(--accent); }
.bubble {
  background: var(--panel); border: 1px solid #2b3358;
  border-radius: 10px; padding: 8px 12px; display: inline-block;
}

#controls {
  border-top: 1px solid #262c4a; background: #12162a;
  padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; min-height: 64px;
}
#controls .prompt { width: 100%; color: var(--muted); margin-bottom: 2px; }
button.action {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid #3a4170; border-radius: 10px;
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  transition: transform .08s, border-color .15s, background .15s;
}
button.action:hover { border-color: var(--accent2); transform: translateY(-1px); }
button.action.primary { background: linear-gradient(180deg, #8a6cff, #6a4cff); border-color: #6a4cff; font-weight: 700; }
button.action.danger { background: linear-gradient(180deg, #d64a58, #b03240); border-color: #b03240; font-weight: 700; }
button.action.ghost { background: transparent; }
button.action:disabled { opacity: .4; cursor: default; transform: none; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel); border: 1px solid #3a4170; border-radius: 16px;
  max-width: 560px; padding: 24px; line-height: 1.6;
}
.modal-box h2 { margin-top: 0; color: var(--accent); }
.modal-box ul { padding-left: 20px; }
.modal-box button { margin-top: 10px; }

#center.night { background: linear-gradient(180deg, #0a0c18, #11142a); }

.banner {
  text-align: center; padding: 30px; margin: 20px auto; max-width: 520px;
  border-radius: 16px; font-size: 22px; font-weight: 800; letter-spacing: 2px;
}
.banner.win { background: linear-gradient(180deg, #1f4a33, #143a28); color: #9af0bd; border: 1px solid #2f7a52; }
.banner.lose { background: linear-gradient(180deg, #4a1f27, #3a141c); color: #ffb3bd; border: 1px solid #7a2f3a; }
