/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-deep: #0f0815;
  --bg-medium: #1a0f1f;
  --bg-light: #2a1a35;
  --accent: #c9a14d;
  --accent-bright: #ffd97a;
  --accent-dark: #8b6f2e;
  --danger: #b13e3e;
  --danger-bright: #e85a5a;
  --success: #4a8c5a;
  --success-bright: #6cc97e;
  --text: #e8dccd;
  --text-dim: #a89b8c;
  --text-muted: #6f6457;
  --border: #3d2d4a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(201, 161, 77, 0.3);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Georgia', 'Cambria', serif;
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-medium) 100%);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  position: fixed;
  width: 100%;
  overscroll-behavior: none;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* === ÉCRANS === */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: screenFadeIn 0.4s ease-out;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === HEADER === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-light);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-pseudo {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-bright);
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.05em;
}

.header-role {
  font-size: 12px;
  color: var(--text-dim);
}

.header-btn {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* === TITRES === */
.title {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 12px;
  color: var(--accent-bright);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

.subtitle {
  font-size: 16px;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
}

/* === FORMULAIRES === */
.form-group {
  margin-bottom: 20px;
}

.label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  background: var(--bg-medium);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--accent);
}

/* === BOUTONS === */
.btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--bg-deep);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  background: var(--text-muted);
  color: var(--bg-medium);
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: linear-gradient(180deg, var(--danger-bright) 0%, var(--danger) 100%);
  color: var(--text);
}

.btn-danger-soft {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  opacity: 0.8;
}
.btn-danger-soft:active {
  opacity: 1;
  background: rgba(177, 62, 62, 0.1);
}

.btn-success {
  background: linear-gradient(180deg, var(--success-bright) 0%, var(--success) 100%);
  color: var(--bg-deep);
}

.btn + .btn {
  margin-top: 12px;
}

/* === LISTE DE JOUEURS (cibles) === */
.players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-medium);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.player-card:active {
  transform: scale(0.98);
}

.player-card.selected {
  border-color: var(--accent-bright);
  background: linear-gradient(90deg, var(--accent-dark) 0%, var(--bg-medium) 100%);
  box-shadow: var(--shadow-glow);
}

.player-card.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.player-name {
  font-size: 19px;
  font-weight: bold;
  flex: 1;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.04em;
  color: var(--text-light);
}

.player-num {
  font-size: 13px;
  font-weight: normal;
  color: var(--accent);
  opacity: 0.85;
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
}

.header-number {
  font-size: 13px;
  font-weight: normal;
  color: var(--accent);
  opacity: 0.85;
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
  margin-left: 4px;
}

.player-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--accent-dark);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-tag.maire {
  background: var(--accent);
  color: var(--bg-deep);
}

.player-vote-pastilles {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 80px;
  justify-content: flex-end;
}

.vote-pastille {
  width: 24px;
  height: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  border: 1px solid var(--danger-bright);
  border-radius: 50%;
}

.vote-pastille.validated {
  background: var(--success);
  border-color: var(--success-bright);
}

/* === ÉTATS DE PHASE === */
.phase-indicator {
  text-align: center;
  padding: 30px 20px;
  font-size: 22px;
  color: var(--accent-bright);
  font-style: italic;
}

.sleeping-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}

.sleeping-icon {
  font-size: 100px;
  margin-bottom: 30px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(201, 161, 77, 0.4));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.sleeping-text {
  font-size: 22px;
  color: var(--accent-bright);
  font-style: italic;
  margin-bottom: 12px;
}

.sleeping-subtext {
  font-size: 14px;
  color: var(--text-dim);
}

/* === RÔLE REVEAL === */
.role-card {
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-medium) 100%);
  border: 3px solid var(--accent);
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: var(--shadow-glow);
  margin: 20px 0;
}

.role-icon {
  font-size: 90px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 15px rgba(201, 161, 77, 0.5));
  display: flex;
  justify-content: center;
  align-items: center;
}

.role-icon .role-image {
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(201, 161, 77, 0.6));
}

.role-icon-emoji {
  font-size: 90px;
  line-height: 1;
}

.role-name {
  font-size: 28px;
  font-weight: bold;
  color: var(--accent-bright);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.role-description {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
}

/* === PAUSE === */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  text-align: center;
  padding: 30px;
}

.pause-overlay h2 {
  font-size: 28px;
  margin-bottom: 16px;
  color: var(--accent-bright);
}

.pause-overlay p {
  font-size: 16px;
  color: var(--text-dim);
}

/* === ALERT === */
.alert {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  padding: 14px;
  background: var(--danger);
  color: var(--text);
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  z-index: 10000;
  box-shadow: var(--shadow);
  animation: alertSlideDown 0.3s ease-out;
}

@keyframes alertSlideDown {
  from { transform: translateY(-100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === STATUT BARRE === */
.status-bar {
  background: var(--bg-light);
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.status-bar.alive {
  color: var(--success-bright);
}

.status-bar.dead {
  color: var(--danger-bright);
}

/* === DEAD SCREEN === */
.dead-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dead-icon {
  font-size: 100px;
  margin-bottom: 20px;
  filter: grayscale(0.5);
}

.dead-text {
  font-size: 22px;
  color: var(--danger-bright);
  margin-bottom: 12px;
}

.dead-subtext {
  font-size: 14px;
  color: var(--text-dim);
}

/* === RECONNECT LIST === */
.reconnect-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === UTILITY === */
.spacer {
  flex: 1;
}

.text-center { text-align: center; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* === Timer === */
.timer-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--accent);
  transition: width 0.5s linear;
  z-index: 100;
}

/* === GAME END === */
.game-end-result {
  text-align: center;
  padding: 30px 20px;
}

.game-end-result.winner {
  color: var(--success-bright);
}

.game-end-result.loser {
  color: var(--danger-bright);
}

.game-end-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.game-end-title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 12px;
}

.game-end-subtitle {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 30px;
}

/* === SCROLL FIX === */
.screen-with-header {
  padding-top: 0;
}

.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
