:root {
  --ink: #12212B;
  --night: #16303D;
  --night-2: #1E4457;
  --gold: #E8A33D;
  --gold-soft: #F3C57C;
  --coral: #D9564A;
  --cream: #F6EFE1;
  --cream-dim: #C9C0AC;
  --line: rgba(246, 239, 225, 0.14);

  --font-display: 'Fraunces', serif;
  --font-body: 'Work Sans', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
}

.hidden { display: none !important; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
}

/* ---------- Boutons ---------- */
.btn {
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--primary {
  background: var(--gold);
  color: var(--ink);
}
.btn--primary:hover:not(:disabled) { background: var(--gold-soft); }

.btn--secondary {
  background: var(--night-2);
  color: var(--cream);
}
.btn--secondary:hover { background: #285870; }

.btn--danger {
  background: transparent;
  color: var(--coral);
  border: 1.5px solid var(--coral);
}
.btn--danger:hover { background: rgba(217, 86, 74, 0.12); }

.btn--ghost {
  background: transparent;
  color: var(--cream-dim);
  border: 1.5px solid var(--line);
}
.btn--ghost:hover { border-color: var(--cream-dim); }

.btn--send { padding: 12px 18px; }

/* ---------- Brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
}
.brand-mark {
  color: var(--gold);
  font-size: 1.4rem;
}
.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand--small .brand-name { font-size: 1.05rem; }

/* ---------- Écran commun ---------- */
.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------- Gate ---------- */
.gate-card {
  max-width: 460px;
  width: 100%;
  background: linear-gradient(180deg, var(--night) 0%, var(--ink) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px;
}
.gate-card h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 22px 0 10px;
  font-weight: 700;
}
.lede {
  color: var(--cream-dim);
  font-size: 0.98rem;
  line-height: 1.5;
  margin-bottom: 24px;
}
.rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0,0,0,0.18);
  border-radius: 14px;
}
.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--cream-dim);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--cream-dim);
  margin-bottom: 20px;
  cursor: pointer;
  line-height: 1.4;
}
.check input { margin-top: 3px; accent-color: var(--gold); }

.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--cream-dim);
}
.field select {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--night);
  color: var(--cream);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

#startBtn { width: 100%; font-size: 1rem; padding: 14px; }

.fine-print {
  font-size: 0.72rem;
  color: var(--cream-dim);
  opacity: 0.7;
  margin-top: 16px;
  line-height: 1.4;
}

/* ---------- Waiting ---------- */
.screen--waiting {
  flex-direction: column;
  gap: 28px;
}
.pulse-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  animation: pulse 2.2s ease-out infinite;
  opacity: 0;
}
.pulse-ring--delay { animation-delay: 1.1s; }
@keyframes pulse {
  0% { transform: scale(0.4); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}
.pulse-core {
  font-size: 2.4rem;
  color: var(--gold);
}
.waiting-label {
  color: var(--cream-dim);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

/* ---------- Chat ---------- */
.screen--chat {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  min-height: 100vh;
}
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.topbar-actions {
  display: flex;
  gap: 10px;
}
.chat-body {
  flex: 1;
  display: flex;
  gap: 1px;
  background: var(--line);
  min-height: 0;
}
.video-pane {
  flex: 2;
  position: relative;
  background: #0A171F;
  min-height: 60vh;
}
#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0A171F;
}
.local-video {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 150px;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--gold);
}
.video-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--cream-dim);
  font-family: var(--font-display);
  font-size: 1rem;
  text-align: center;
}
.chat-pane {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--night);
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.msg--me {
  align-self: flex-end;
  background: var(--gold);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
.msg--them {
  align-self: flex-start;
  background: var(--night-2);
  border-bottom-left-radius: 4px;
}
.msg--system {
  align-self: center;
  color: var(--cream-dim);
  font-size: 0.78rem;
  font-style: italic;
}
.message-form {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.message-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.message-form input:focus { outline: 1.5px solid var(--gold); }

/* ---------- Modale signalement ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 17, 22, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  max-width: 380px;
  width: 100%;
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
}
.modal-card h2 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.modal-card p {
  color: var(--cream-dim);
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.reason-btn {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  border: 1px solid var(--line);
  text-align: left;
  font-size: 0.88rem;
}
.reason-btn:hover { border-color: var(--coral); color: var(--coral); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .chat-body { flex-direction: column; }
  .video-pane { min-height: 42vh; }
  .chat-pane { min-width: 0; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}
