:root {
  --bg1: #0d1424; --bg2: #1b2440;
  --card: rgba(255,255,255,.06); --card-border: rgba(255,255,255,.1);
  --text: #eef1f8; --muted: #9aa5c0;
  --accent: #e0a64b; --accent-text: #1a1206;
  --danger: #e2595b; --ok: #4fbf8a; --wolf: #c94a4a; --love: #e66fa3;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg1); }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  transition: background .8s;
}
body.phase-day, body.phase-dawn, body.phase-dusk { --bg1: #3a3150; --bg2: #8a5d4a; }
body.phase-day { --bg1: #2e4a6b; --bg2: #6b86a6; }
body.phase-end { --bg1: #1e1530; --bg2: #3b2850; }

.screen { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }

.hero { text-align: center; padding: 28px 0 12px; }
.moon { font-size: 64px; filter: drop-shadow(0 0 24px rgba(255,220,150,.5)); }
h1 { margin: 8px 0 4px; font-size: 2.2rem; letter-spacing: .5px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 14px; margin: 12px 0; backdrop-filter: blur(6px);
}
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: rgba(0,0,0,.25); border: 1px solid var(--card-border); border-radius: 10px; padding: 12px;
}
select { padding: 8px; width: auto; }
.code-input { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; margin-bottom: 10px; }

.btn {
  display: block; width: 100%; font: inherit; font-weight: 600; font-size: 1rem;
  padding: 13px 16px; border-radius: 12px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,.1); color: var(--text); cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.small { display: inline-block; width: auto; padding: 7px 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }
.or { text-align: center; color: var(--muted); margin: 14px 0; }
.error { color: #ff9a9a; text-align: center; min-height: 1.2em; }
.muted { color: var(--muted); }

/* En-tête */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.topbar .phase { font-weight: 700; flex: 1; font-size: 1.1rem; }
.badge { background: rgba(0,0,0,.3); border-radius: 8px; padding: 4px 8px; font-weight: 700; letter-spacing: 2px; font-size: .9rem; }
.icon-btn { background: none; border: none; color: var(--text); font-size: 1.3rem; padding: 4px 6px; cursor: pointer; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }

.narration { white-space: pre-wrap; font-size: 1.08rem; line-height: 1.45; }
.narration.big { font-size: 1.2rem; }

/* Lobby */
.join-box { display: flex; gap: 14px; align-items: center; }
.join-box img { width: 120px; height: 120px; background: #fff; border-radius: 10px; padding: 4px; }
.big-code { font-size: 2.6rem; font-weight: 800; letter-spacing: 8px; }
.roles-edit .role-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--card-border); }
.roles-edit .role-line:last-child { border-bottom: none; }
.role-line .rname { flex: 1; }
.role-line .count { width: 28px; text-align: center; font-weight: 700; font-size: 1.1rem; }
.stepper { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--card-border); background: rgba(255,255,255,.08); color: var(--text); font-size: 1.2rem; }
.opt { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.opt input[type=checkbox] { width: 22px; height: 22px; }

/* Joueurs */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.player {
  position: relative; border-radius: 12px; padding: 10px; background: rgba(255,255,255,.07);
  border: 2px solid transparent; text-align: left; color: var(--text); font: inherit; min-height: 58px;
}
.player .pname { font-weight: 600; word-break: break-word; }
.player .prole { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.player.dead { opacity: .45; }
.player.dead .pname { text-decoration: line-through; }
.player.me { border-color: rgba(224,166,75,.5); }
.player.off .pname::after { content: " 📵"; }
.player.target { cursor: pointer; background: rgba(255,255,255,.12); }
.player.selected { border-color: var(--accent); background: rgba(224,166,75,.25); }
.player .votes { font-size: .8rem; margin-top: 4px; color: #ffd1a1; }
.player .tag { position: absolute; top: 6px; right: 8px; font-size: .9rem; }
.player .kick { position: absolute; top: 4px; right: 4px; background: none; border: none; color: var(--muted); font-size: 1rem; }

/* Rôle */
.rolecard { text-align: center; cursor: pointer; user-select: none; }
.rolecard .remoji { font-size: 56px; }
.rolecard .rtitle { font-size: 1.4rem; font-weight: 800; }
.rolecard .rdesc { color: var(--muted); margin-top: 6px; }
.rolecard.hidden-role .rtitle { letter-spacing: 1px; }
.camp-loups .rtitle { color: #ff8c8c; }
.notes { margin: 10px 0 0; padding: 0; list-style: none; text-align: left; }
.notes li { padding: 6px 0; border-top: 1px solid var(--card-border); }

.action { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(224,166,75,.25); }
.action h2 { font-size: 1.1rem; }
.action .players { margin: 10px 0; }
.sleep { text-align: center; font-size: 1.1rem; color: var(--muted); padding: 20px 0; }
.sleep .zz { font-size: 48px; }
.potion { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.2); margin: 8px 0; }
.potion.on { background: rgba(79,191,138,.25); outline: 2px solid var(--ok); }
.potion.poison.on { background: rgba(226,89,91,.25); outline: 2px solid var(--danger); }

details summary { cursor: pointer; font-weight: 600; }
.log { font-size: .9rem; color: var(--muted); margin-top: 8px; max-height: 260px; overflow: auto; }
.log div { padding: 3px 0; }

.winner { text-align: center; font-size: 1.6rem; font-weight: 800; padding: 10px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222a3f; color: #fff; border: 1px solid var(--card-border); padding: 10px 16px; border-radius: 10px;
  max-width: calc(100% - 32px); z-index: 10; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.toast.err { background: #5a1f24; }

.narr-toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; color: var(--text); font-size: 1rem; }
.narr-toggle input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.narration.narrator { font-size: 1.45rem; line-height: 1.4; }
.timer.huge { display: block; text-align: center; font-size: 3rem; margin: 6px 0; }
