* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #14181f;
  color: #e8e6e3;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}

.screen { display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }

h1 { font-size: 2rem; text-align: center; }
.subtitle { text-align: center; color: #9aa3b2; }

label { font-size: 0.85rem; color: #9aa3b2; }

input, select, button {
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2c3442;
}

input, select { background: #1d232e; color: #e8e6e3; width: 100%; }
input:focus, select:focus { outline: 2px solid #5b8def; border-color: transparent; }

button {
  background: #2c3442;
  color: #e8e6e3;
  cursor: pointer;
  font-weight: 600;
}
button:active { transform: scale(0.98); }
button.primary { background: #5b8def; color: #fff; }
button.danger { background: #b9483f; color: #fff; }

.join-row { display: flex; gap: 8px; }
.join-row input { width: 40%; text-transform: uppercase; text-align: center; letter-spacing: 0.2em; }
.join-row button { flex: 1; }

.error { color: #ff8a80; text-align: center; min-height: 1.2em; }
.hint { color: #9aa3b2; text-align: center; font-size: 0.9rem; }

.room-code {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-align: center;
  color: #5b8def;
}

.players { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.players li { background: #1d232e; padding: 10px 14px; border-radius: 10px; }

.timer { font-size: 2.4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.timer.urgent { color: #ff8a80; }

.card {
  background: #1d232e;
  border: 1px solid #2c3442;
  border-radius: 14px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}
.card-cover {
  width: 100%;
  min-height: 180px;
  background: #5b8def;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  line-height: 1.6;
}
#card-content { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.card-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: #9aa3b2; }
.card-title { font-size: 1.7rem; font-weight: 800; }
.card-title.spy { color: #ffb74d; }
.card-role { font-size: 1.3rem; font-weight: 600; color: #5b8def; }

.locations summary { cursor: pointer; padding: 10px; color: #9aa3b2; }

.loc-group { margin-bottom: 10px; }
.loc-theme {
  width: 100%;
  text-align: left;
  background: #232b38;
  font-size: 0.95rem;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.loc-theme span { color: #9aa3b2; font-weight: 400; }
.loc-group ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.loc-item {
  background: #1d232e;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.eliminated { opacity: 0.35; text-decoration: line-through; }

.reveal-line { text-align: center; font-size: 1.2rem; }
.reveal-line strong { color: #5b8def; }

/* --- Éditeur de lieux & rôles ------------------------------------------- */

button.ghost {
  background: transparent;
  border: 1px solid #2c3442;
  color: #c7d0de;
}

.editor-top { display: flex; align-items: center; gap: 10px; }
.editor-top h1 { font-size: 1.5rem; text-align: left; flex: 1; }
#btn-editor-back { flex: 0 0 auto; padding: 10px 12px; }

.pack-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.pack-tab {
  flex: 0 0 auto;
  background: #1d232e;
  font-size: 0.9rem;
  padding: 10px 12px;
  white-space: nowrap;
}
.pack-tab.active { background: #5b8def; color: #fff; }
.pack-tab span { opacity: 0.7; font-weight: 400; }

.ed-loc {
  background: #1d232e;
  border: 1px solid #2c3442;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ed-loc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ed-loc-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-loc-name { font-size: 1.15rem; font-weight: 700; word-break: break-word; }
.ed-loc-theme { font-size: 0.8rem; color: #9aa3b2; }
.ed-del-loc {
  flex: 0 0 auto;
  background: #2a1f22;
  border: 1px solid #5a2e2e;
  font-size: 1.1rem;
  padding: 8px 10px;
}

.ed-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #232b38;
  border-radius: 999px;
  padding: 6px 6px 6px 12px;
  font-size: 0.9rem;
}
.ed-del-role {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: #3a4456;
  color: #e8e6e3;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ed-del-role:active { background: #b9483f; }

.ed-addrole { display: flex; gap: 8px; }
.ed-role-input { flex: 1; font-size: 0.95rem; padding: 10px 12px; }
.ed-add-role { flex: 0 0 auto; background: #2c3442; padding: 10px 14px; }

.add-loc {
  margin-top: 18px;
  padding: 14px;
  background: #161b23;
  border: 1px dashed #2c3442;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.add-title { font-size: 1.1rem; }

/* --- Améliorations : salon, jeu, vote, score, QR ------------------------ */

.net-banner {
  position: fixed; top: 0; left: 0; right: 0;
  background: #5a3a12; color: #ffe0a3; text-align: center;
  padding: 8px; font-size: 0.9rem; z-index: 50;
}

button.danger-ghost { background: transparent; border: 1px solid #5a2e2e; color: #d99; }

.code-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.icon-btn { padding: 10px 12px; font-size: 1.2rem; min-width: 48px; }

.qr-box { display: flex; justify-content: center; }
.qr-box svg { border-radius: 10px; border: 4px solid #fff; background: #fff; max-width: 180px; height: auto; }

.you-tag { color: #5b8def; font-size: 0.85rem; }

.duration-presets { display: flex; gap: 8px; align-items: center; }
.duration-presets button { flex: 0 0 auto; padding: 10px 14px; }
.duration-presets input { flex: 1; min-width: 64px; }

.scoreboard { margin-top: 4px; }
.sb-title { font-size: 1.05rem; text-align: center; margin-bottom: 6px; }
.sb-list { list-style: none; counter-reset: rank; display: flex; flex-direction: column; gap: 4px; }
.sb-list li { display: flex; justify-content: space-between; align-items: center; background: #1d232e; padding: 8px 12px; border-radius: 8px; }
.sb-list li::before { counter-increment: rank; content: counter(rank) ". "; color: #9aa3b2; margin-right: 6px; }
.sb-list li span { flex: 1; }
.sb-list li strong { color: #e6c87a; font-variant-numeric: tabular-nums; }
.sb-list li:first-child strong { color: #ffd54a; }

.first-player { text-align: center; color: #9aa3b2; font-size: 0.95rem; min-height: 1.2em; }

.role-help summary { cursor: pointer; color: #9aa3b2; font-size: 0.85rem; margin-top: 6px; }
.role-help ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.role-help li { background: #232b38; border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; }

.actions { background: #1d232e; border: 1px solid #2c3442; border-radius: 12px; padding: 4px 12px; }
.actions summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.picker { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.pick-btn { background: #2c3442; padding: 12px 14px; flex: 1 1 calc(50% - 8px); min-height: 44px; }

.vote-panel { background: #2a2212; border: 1px solid #6b5318; border-radius: 12px; padding: 14px; text-align: center; }
.vote-q { font-size: 1.05rem; margin-bottom: 10px; }
.vote-btns { display: flex; gap: 10px; }
.vote-btns button { flex: 1; min-height: 48px; }

.reveal-verdict { text-align: center; font-size: 1.2rem; font-weight: 700; padding: 14px; border-radius: 12px; }
.reveal-verdict.win-innocents { background: #15301d; color: #aef0c4; border: 1px solid #2e6e44; }
.reveal-verdict.win-spy { background: #301515; color: #f0aeae; border: 1px solid #6e2e2e; }
