/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --purple:       #7c3aed;
  --purple-light: #9d5ff5;
  --pink:         #ec4899;
  --pink-light:   #f472b6;
  --green:        #10b981;
  --red:          #ef4444;
  --bg-from:      #0a0a1a;
  --bg-to:        #1a0a2e;
  --glass-bg:     rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.10);
  --text:         #f1f5f9;
  --text-muted:   rgba(255, 255, 255, 0.50);
  --radius:       16px;
  --radius-sm:    10px;
  --shadow:       0 8px 32px rgba(0, 0, 0, 0.4);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════════════════════════════ */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px;
  overflow-y: auto;
  gap: 16px;
  scroll-behavior: smooth;
}

.screen.active {
  display: flex;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.65);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: #fff;
  backdrop-filter: blur(10px);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.btn-xl { padding: 16px 36px; font-size: 1.1rem; width: 100%; max-width: 360px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; width: 100%; max-width: 360px; }
.btn-icon { font-size: 1.2em; }

/* ═══════════════════════════════════════════════════════════════════════════
   GLASSMORPHISM CARD
═══════════════════════════════════════════════════════════════════════════ */
.glass-card, .dilemma-card, .result-card, .proposal-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 480px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-card {
  background: linear-gradient(160deg, rgba(30, 15, 60, 0.95) 0%, rgba(20, 10, 40, 0.98) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 58, 237, 0.3);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions .btn { flex: 1; }

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-input::placeholder { color: rgba(255, 255, 255, 0.30); font-weight: 400; }
.form-input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.join-error {
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 20px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-home {
  justify-content: center;
  gap: 40px;
}

.home-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 480px;
}

.logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: min(187px, 53vw);
  height: auto;
  filter: drop-shadow(0 0 24px rgba(124, 58, 237, 0.6)) drop-shadow(0 0 48px rgba(236, 72, 153, 0.35));
  animation: logoPulse 3s ease-in-out infinite;
}

.logo-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.67rem, 14.67vw, 4.67rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-align: center;
  background: linear-gradient(135deg, #fff 0%, var(--purple-light) 40%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(124, 58, 237, 0.55)) drop-shadow(0 0 56px rgba(236, 72, 153, 0.30));
  animation: logoPulse 3s ease-in-out infinite;
}

.logo-title-half {
  font-size: clamp(3.33rem, 18.67vw, 6rem);
  display: block;
  background: linear-gradient(135deg, var(--purple-light) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 24px rgba(124, 58, 237, 0.6)) drop-shadow(0 0 48px rgba(236, 72, 153, 0.35)); }
  50%       { filter: drop-shadow(0 0 36px rgba(124, 58, 237, 0.9)) drop-shadow(0 0 64px rgba(236, 72, 153, 0.55)); }
}

.logo-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  font-style: italic;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOBBY SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-lobby {
  gap: 18px;
}

.lobby-header { text-align: center; }

.screen-title {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lobby-code-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 480px;
  flex-wrap: wrap;
}

.lobby-code-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.code-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.btn-copy {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.btn-copy:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.btn-copy:active { transform: scale(0.95); }
.btn-copy.copied { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.5); color: #34d399; }

.code-display {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  line-height: 1.1;
}

.code-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.lobby-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lobby-qr canvas {
  border-radius: 8px;
  display: block;
}

.lobby-players-section {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  max-width: 480px;
}

.players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.players-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.players-count {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--purple-light);
  background: rgba(124, 58, 237, 0.15);
  padding: 3px 10px;
  border-radius: 50px;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  animation: chipIn 0.25s ease;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.player-chip.host-chip {
  border-color: rgba(255, 196, 0, 0.6);
  background: rgba(255, 196, 0, 0.10);
}

.host-crown { font-size: 0.9em; }

.lobby-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}

.lobby-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE HEADER (shared)
═══════════════════════════════════════════════════════════════════════════ */
.phase-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding-top: 4px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  background: rgba(124, 58, 237, 0.20);
  border: 1px solid rgba(124, 58, 237, 0.40);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--purple-light);
  letter-spacing: 0.04em;
}

.phase-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 300px;
}

.screen-title-sm {
  font-size: 1.2rem;
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════════════════════
   COUNTDOWN SVG
═══════════════════════════════════════════════════════════════════════════ */
.countdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.countdown-svg { display: block; overflow: visible; }

.countdown-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.countdown-ring {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 0;
  transform-origin: 60px 60px;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.9s linear;
}

.countdown-number {
  position: absolute;
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DILEMMA CARD
═══════════════════════════════════════════════════════════════════════════ */
.dilemma-card {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  color: #fff;
  padding: 18px 22px;
  max-width: 480px;
  width: 100%;
  border-left: 3px solid var(--purple);
}

.dilemma-card.small {
  font-size: 0.92rem;
  padding: 12px 18px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WRITING SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-writing { gap: 14px; }

.btn-reroll {
  font-size: 0.85rem;
  padding: 8px 20px;
  color: var(--text-muted);
  border-color: rgba(255,255,255,0.15);
}
.btn-reroll:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

.answer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

.answer-textarea {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.answer-textarea::placeholder { color: rgba(255,255,255,0.30); }
.answer-textarea:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}
.answer-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.char-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: flex-end;
  padding-right: 4px;
}

.progress-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  min-height: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VOTING SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-voting { gap: 12px; }

.proposals-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 4px;
}

.proposal-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideIn 0.3s ease both;
}

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

.proposal-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.proposal-author {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple-light);
}

.proposal-text {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
}

.vote-buttons {
  display: flex;
  gap: 8px;
}

.vote-btn {
  flex: 1;
  padding: 9px 0;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
}
.vote-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

.vote-btn.vote-yes.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}

.vote-btn.vote-no.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45);
}

.voting-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  flex-shrink: 0;
  padding-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESULTS SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-results {
  gap: 12px;
  justify-content: flex-start;
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  max-width: 480px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.result-counter {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: right;
}

.result-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-answer {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--purple);
}

.stats-section { display: flex; flex-direction: column; gap: 8px; }

.stats-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stats-label-yes { color: var(--green); }
.stats-label-no  { color: var(--red); }

.stats-bar-track {
  display: flex;
  height: 18px;
  border-radius: 50px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.stats-bar-yes {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #34d399);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 50px 0 0 50px;
}

.stats-bar-no {
  height: 100%;
  background: linear-gradient(90deg, #f87171, var(--red));
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 0 50px 50px 0;
}

.stats-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.result-score-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius-sm);
}

.result-score-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-score-value {
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}



/* ═══════════════════════════════════════════════════════════════════════════
   RANKING SCREEN
═══════════════════════════════════════════════════════════════════════════ */
#screen-ranking { gap: 16px; }

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  flex: 1;
  overflow-y: auto;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  opacity: 0;
  animation: rankSlideIn 0.4s ease forwards;
}

@keyframes rankSlideIn {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ranking-item.rank-1 {
  border-color: rgba(255, 196, 0, 0.4);
  background: rgba(255, 196, 0, 0.07);
  box-shadow: 0 0 24px rgba(255, 196, 0, 0.20);
}
.ranking-item.rank-2 {
  border-color: rgba(192, 192, 192, 0.35);
  background: rgba(192, 192, 192, 0.05);
}
.ranking-item.rank-3 {
  border-color: rgba(205, 127, 50, 0.35);
  background: rgba(205, 127, 50, 0.05);
}

.rank-medal {
  font-size: 1.7rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.rank-number {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.rank-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.rank-pseudo {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-stat {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--purple-light);
  letter-spacing: 0.02em;
}

.rank-stat-default {
  color: var(--text-muted);
  font-weight: 600;
}

.rank-answer {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-score {
  font-size: 1.3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.ranking-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  flex-shrink: 0;
  padding-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOUTON LANGUE
═══════════════════════════════════════════════════════════════════════════ */
.lang-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 2000;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}
.lang-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL RÈGLES (plein écran)
═══════════════════════════════════════════════════════════════════════════ */
.modal-rules-overlay {
  align-items: flex-start !important;
  padding: 0 !important;
}

.modal-rules-card {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  background: linear-gradient(160deg, rgba(20, 10, 50, 0.98) 0%, rgba(10, 5, 30, 1) 100%);
  border-radius: 0;
  padding: 48px 24px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  box-shadow: none;
  animation: modalIn 0.25s ease;
}

.modal-rules-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-rules-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.modal-rules-title {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-top: 8px;
}

.rules-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 480px;
}

.rule-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
}

.rule-step-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.rule-step-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-step-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.rule-step-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.rule-step-example {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.75);
  font-style: italic;
  background: rgba(124, 58, 237, 0.12);
  border-left: 3px solid var(--purple);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR STYLING
═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .code-display { font-size: 2.2rem; letter-spacing: 0.12em; }
  .logo-img { width: 220px; }
  .dilemma-card { font-size: 0.97rem; }
  .btn-xl { font-size: 1rem; padding: 14px 28px; }
}

@media (max-height: 700px) {
  #screen-writing .countdown-wrapper { display: none; }
  #screen-voting .countdown-wrapper  { display: none; }
  #screen-results .countdown-wrapper { display: none; }
}

@media (max-width: 767px) and (max-height: 750px) {
  .logo-img       { width: min(110px, 30vw); }
  .logo-title     { font-size: clamp(1.8rem, 10vw, 2.8rem); }
  .logo-title-half{ font-size: clamp(2.2rem, 12vw, 3.5rem); }
  .logo-tagline   { display: none; }
  .logo-wrapper   { gap: 6px; }
  .home-inner     { gap: 20px; }
}

@media (max-height: 600px) {
  .phase-subtitle { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADS
═══════════════════════════════════════════════════════════════════════════ */

/* Tous cachés par défaut */
.ad-top,
.ad-sidebar-left,
.ad-sidebar-right,
.ad-bottom-mobile { display: none; }

/* Largeurs fixes pour AdSense (même si le conteneur est caché) */
.ad-top ins            { display: block; width: 728px; max-width: 100%; }
.ad-sidebar-left ins,
.ad-sidebar-right ins  { display: block; width: 160px; }
.ad-bottom-mobile ins  { display: block; width: 320px; max-width: 100%; }

/* ── Mobile : bannière (≤767px) ── */
@media (max-width: 767px) {
  .ad-bottom-mobile {
    display: flex;
    justify-content: center;
    margin-top: 16px;
  }
}

/* ── Desktop header (≥1024px) ── */
@media (min-width: 1024px) {
  .ad-top {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 90px;
    z-index: 50;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.96);
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .ad-top ins { width: 100%; max-width: 728px; }
  .ad-top::before {
    content: 'Annonce';
    position: absolute;
    bottom: 3px; left: 50%; transform: translateX(-50%);
    font-size: 0.55rem;
    color: rgba(255,255,255,0.18);
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .screen        { top: 90px; }
  .modal-overlay { top: 90px; }
  .lang-btn      { top: calc(90px + 14px); }
}

/* ── Desktop sidebars (≥1380px) ── */
@media (min-width: 1380px) {
  .ad-sidebar-left,
  .ad-sidebar-right {
    display: flex;
    position: fixed;
    top: 90px; bottom: 0;
    width: 160px;
    z-index: 50;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.6);
  }
  .ad-sidebar-left  { left: 0;  border-right: 1px solid rgba(255,255,255,0.06); }
  .ad-sidebar-right { right: 0; border-left:  1px solid rgba(255,255,255,0.06); }
  .ad-sidebar-left ins,
  .ad-sidebar-right ins { width: 160px; }
  .ad-sidebar-left::before,
  .ad-sidebar-right::before {
    content: 'Annonce';
    position: absolute;
    top: 10px;
    font-size: 0.55rem;
    color: rgba(255,255,255,0.15);
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .screen        { left: 160px; right: 160px; }
  .modal-overlay { left: 160px; right: 160px; }
  .lang-btn      { left: calc(160px + 14px); }
}
