/* NightGame — direction artistique : nuit profonde + néon violet/cyan */

:root {
  --bg: #06080f;
  --bg-soft: #0b0e1a;
  --text: #e6e9f5;
  --text-muted: #8a92a8;
  --violet: #7c5cff;
  --violet-deep: #5b3df0;
  --cyan: #38e1ff;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- Fond étoilé --- */
#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* --- Header --- */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 4rem;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
}

.logo {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  text-decoration: none;
  font-size: 1.4rem;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(124, 92, 255, 0.4);
  animation: logoPulse 3.5s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { text-shadow: 0 0 16px rgba(124, 92, 255, 0.45); filter: drop-shadow(0 0 4px rgba(124, 92, 255, 0.3)); }
  50% { text-shadow: 0 0 34px rgba(56, 225, 255, 0.75); filter: drop-shadow(0 0 12px rgba(56, 225, 255, 0.5)); }
}
.logo:hover {
  animation-duration: 1.4s;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--cyan);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown .dropbtn {
  cursor: pointer;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(11, 14, 26, 0.97);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
}

.dropdown-content::before {
  content: "";
  position: absolute;
  top: -0.5rem;
  left: 0;
  right: 0;
  height: 0.5rem;
}

.nav-dropdown:hover .dropdown-content,
.nav-dropdown:focus-within .dropdown-content {
  display: flex;
}

.dropdown-content a {
  display: block;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background: rgba(124, 92, 255, 0.2);
  color: var(--cyan);
}

.nav .account-link {
  padding: 0.5rem 1rem;
  border: 1px solid var(--violet);
  border-radius: 999px;
  color: #e6e9f5;
  line-height: 1;
}
.nav .account-link:hover {
  background: rgba(124, 92, 255, 0.18);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(124, 92, 255, 0.4);
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 0.4rem;
  border-radius: 999px;
  background: #ff4d6d;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.6);
}

/* --- Toast d'invitation à jouer --- */
.invite-toast {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 90;
  width: 340px;
  max-width: calc(100vw - 2rem);
  background: #0e1220;
  border: 1px solid rgba(56, 225, 255, 0.4);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 30px rgba(56, 225, 255, 0.15);
  overflow: hidden;
}
.invite-toast-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
}
.invite-toast-icon { font-size: 1.4rem; flex: 0 0 auto; }
.invite-toast-text { flex: 1; min-width: 0; color: var(--text); font-size: 0.9rem; }
.invite-toast-text b { color: var(--cyan); }
.invite-toast-join { flex: 0 0 auto; padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.invite-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  flex: 0 0 auto;
  padding: 0.2rem;
}
.invite-toast-close:hover { color: #ff4d6d; }
.invite-toast-bar { height: 3px; background: rgba(255, 255, 255, 0.08); }
.invite-toast-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}
html.mode-phone .invite-toast { right: 1rem; left: 1rem; width: auto; }

/* --- Logo (icône) --- */
.logo-img {
  height: 1.65em;
  width: auto;
  vertical-align: middle;
  margin-right: 0.45rem;
  border-radius: 7px;
}

/* --- Compteur de pièces (nav) --- */
.nav-coins {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  background: rgba(255, 215, 0, 0.08);
  color: #ffd700;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  line-height: 1;
}

/* --- Chat global (accueil) --- */
.global-chat {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 50;
  width: 320px;
  max-width: calc(100vw - 2rem);
  background: rgba(10, 14, 27, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: background 0.2s ease;
}
.global-chat:hover { background: rgba(10, 14, 27, 0.95); }
.global-chat-head {
  padding: 0.6rem 0.9rem;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  color: var(--cyan);
  border-bottom: 1px solid var(--glass-border);
}
.global-chat-body { display: flex; flex-direction: column; }
.global-chat.collapsed .global-chat-body { display: none; }
.global-chat-msgs {
  height: 220px;
  overflow-y: auto;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gchat-msg { font-size: 0.85rem; color: var(--text); word-break: break-word; }
.gchat-msg.sys { color: var(--text-muted); font-style: italic; }
.gchat-who { font-weight: 700; color: var(--violet); }
.gchat-msg.me .gchat-who { color: var(--cyan); }
.gchat-msg.me .gchat-text { color: var(--cyan); }
.global-chat-input { display: flex; gap: 0.4rem; padding: 0.5rem 0.8rem; border-top: 1px solid var(--glass-border); }
.global-chat-input input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.9rem;
}
.global-chat-input input:focus { outline: none; border-color: var(--cyan); }
.global-chat-input .btn { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
html.mode-phone .global-chat { left: 0.5rem; right: 0.5rem; width: auto; }

/* --- Cosmétiques visuels (titres, cadres, styles de texte) --- */
.title-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.22);
  border: 1px solid rgba(124, 92, 255, 0.55);
  color: #cdbaff;
  margin-left: 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}
.gchat-title { font-size: 0.6rem; padding: 0.04rem 0.4rem; margin-left: 0.3rem; }

/* Cadres d'avatar — halo multicouche, respiration lumineuse + reflet balayant */
.frame-neon, .frame-gold, .frame-legend, .frame-alpha {
  position: relative;
  overflow: hidden;
}
.frame-neon::before, .frame-gold::before, .frame-legend::before, .frame-alpha::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.55) 48%, transparent 62%);
  background-size: 260% 260%;
  background-position: 200% 0;
  animation: shineSweep 3.4s ease-in-out infinite;
  pointer-events: none;
}
.frame-neon {
  border: 3px solid #38e1ff !important;
  box-shadow:
    0 0 0 4px rgba(124, 92, 255, 0.85),
    0 0 16px 2px rgba(56, 225, 255, 0.75),
    0 0 34px 7px rgba(124, 92, 255, 0.5),
    inset 0 0 16px rgba(56, 225, 255, 0.45);
  animation: neonBreath 2.6s ease-in-out infinite;
}
.frame-gold {
  border: 3px solid #ffd700 !important;
  box-shadow:
    0 0 0 4px rgba(255, 180, 0, 0.55),
    0 0 16px 2px rgba(255, 215, 0, 0.75),
    0 0 32px 6px rgba(255, 170, 0, 0.45),
    inset 0 0 14px rgba(255, 215, 0, 0.4);
  animation: goldBreath 3s ease-in-out infinite;
}
.frame-legend {
  border: 3px solid #f97316 !important;
  box-shadow:
    0 0 0 4px rgba(249, 115, 22, 0.55),
    0 0 18px 2px rgba(255, 215, 0, 0.6),
    0 0 36px 8px rgba(124, 92, 255, 0.5),
    inset 0 0 16px rgba(249, 115, 22, 0.4);
  animation: legendBreath 2.2s ease-in-out infinite;
}
.frame-alpha {
  border: 3px solid #ffb86c !important;
  box-shadow:
    0 0 0 4px rgba(255, 184, 108, 0.55),
    0 0 18px 2px rgba(56, 225, 255, 0.6),
    0 0 36px 8px rgba(255, 184, 108, 0.5),
    inset 0 0 16px rgba(255, 184, 108, 0.4);
  animation: alphaBreath 2.8s ease-in-out infinite;
}
@keyframes shineSweep {
  0% { background-position: 200% 0; }
  55%, 100% { background-position: -100% 0; }
}
@keyframes neonBreath {
  0%, 100% { box-shadow: 0 0 0 4px rgba(124,92,255,0.85), 0 0 16px 2px rgba(56,225,255,0.75), 0 0 34px 7px rgba(124,92,255,0.5), inset 0 0 16px rgba(56,225,255,0.45); }
  50% { box-shadow: 0 0 0 4px rgba(56,225,255,0.9), 0 0 26px 5px rgba(56,225,255,0.9), 0 0 48px 11px rgba(124,92,255,0.65), inset 0 0 22px rgba(56,225,255,0.6); }
}
@keyframes goldBreath {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,180,0,0.55), 0 0 16px 2px rgba(255,215,0,0.75), 0 0 32px 6px rgba(255,170,0,0.45), inset 0 0 14px rgba(255,215,0,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255,215,0,0.75), 0 0 26px 5px rgba(255,215,0,0.9), 0 0 44px 10px rgba(255,180,0,0.6), inset 0 0 20px rgba(255,215,0,0.55); }
}
@keyframes legendBreath {
  0%, 100% { box-shadow: 0 0 0 4px rgba(249,115,22,0.55), 0 0 18px 2px rgba(255,215,0,0.6), 0 0 36px 8px rgba(124,92,255,0.5), inset 0 0 16px rgba(249,115,22,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255,215,0,0.7), 0 0 28px 6px rgba(249,115,22,0.85), 0 0 50px 12px rgba(124,92,255,0.65), inset 0 0 22px rgba(255,215,0,0.5); }
}
@keyframes alphaBreath {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,184,108,0.55), 0 0 18px 2px rgba(56,225,255,0.6), 0 0 36px 8px rgba(255,184,108,0.5), inset 0 0 16px rgba(255,184,108,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(56,225,255,0.7), 0 0 28px 6px rgba(255,184,108,0.85), 0 0 50px 12px rgba(56,225,255,0.6), inset 0 0 22px rgba(255,184,108,0.55); }
}

/* Badge administrateur dans le chat */
.gchat-admin {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 0.1rem 0.35rem;
  margin-right: 0.3rem;
  border-radius: 5px;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1200;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.55);
}

/* Styles de texte du chat */
.chat-neon { color: #38e1ff !important; text-shadow: 0 0 6px rgba(56, 225, 255, 0.85), 0 0 14px rgba(56, 225, 255, 0.4); }
.chat-fire { color: #ff6b3d !important; text-shadow: 0 0 6px rgba(255, 107, 61, 0.85), 0 0 14px rgba(255, 77, 109, 0.5); }
.chat-rainbow {
  background: linear-gradient(90deg, #ff4d6d, #ffb86c, #2ecc71, #38e1ff, #7c5cff, #ff4d6d);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent !important;
  animation: rainbowShift 4s linear infinite;
}
@keyframes rainbowShift { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }

/* Notification « défi terminé » (accueil) */
.home-notif {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 720px;
  margin: 1rem auto 0;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 184, 108, 0.45);
  background: rgba(255, 184, 108, 0.1);
  color: var(--text);
  font-size: 0.92rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.home-notif b { color: #ffb86c; }
.home-notif a { color: var(--cyan); font-weight: 600; }
.home-notif-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem;
}
.home-notif-close:hover { color: #ff4d6d; }
html.mode-phone .home-notif { margin: 0.75rem 1rem 0; font-size: 0.85rem; flex-wrap: wrap; }
html.mode-phone .title-badge { font-size: 0.6rem; }
.nav .admin-hammer {
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
.nav .admin-hammer:hover {
  transform: scale(1.25) rotate(-15deg);
}

/* --- Sections --- */
main {
  position: relative;
  z-index: 1;
}

section {
  padding: 6rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* --- Hero --- */
.hero {
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-eyebrow {
  color: var(--cyan);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.glow {
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(124, 92, 255, 0.45));
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 520px;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- Boutons --- */
.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(90deg, var(--violet-deep), var(--violet));
  color: #fff;
  box-shadow: 0 0 25px rgba(124, 92, 255, 0.5);
}

.btn-primary:hover {
  box-shadow: 0 0 40px rgba(124, 92, 255, 0.75);
}

.btn-ghost {
  border: 1px solid var(--glass-border);
  color: var(--text);
  background: var(--glass);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* --- Titres de section --- */
.section-title {
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  text-align: center;
}

/* --- Cartes --- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--violet);
  box-shadow: 0 10px 40px rgba(124, 92, 255, 0.25);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* --- À propos --- */
.about {
  text-align: center;
}

.about-text {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }
  section {
    padding: 4rem 1.5rem;
  }
}

/* === Sélecteur d'appareil (PC / téléphone) === */
html { background-color: var(--bg); }

.device-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 999;
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  background: rgba(11, 14, 26, 0.94);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.device-btn {
  width: 44px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.device-btn:hover { color: var(--text); }
.device-btn.active {
  background: linear-gradient(90deg, var(--violet-deep), var(--violet));
  color: #fff;
  box-shadow: 0 0 16px rgba(124, 92, 255, 0.5);
}

/* --- Bouton hamburger (menu mobile) --- */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* --- Mode téléphone : cadre + header + sections --- */
html.mode-phone { background-color: #030409; }
html.mode-phone body {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-soft);
  box-shadow: 0 0 0 1px rgba(124, 92, 255, 0.18), 0 0 70px rgba(0, 0, 0, 0.65);
}

html.mode-phone .site-header {
  flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  gap: 0.75rem;
}
html.mode-phone .logo { font-size: 1.2rem; }
html.mode-phone .nav-toggle { display: flex; margin-left: auto; }
html.mode-phone .nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  padding-top: 0.25rem;
}
html.mode-phone .site-header.nav-open .nav { display: flex; }
html.mode-phone .site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
html.mode-phone .site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
html.mode-phone .site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
html.mode-phone .nav a {
  display: block;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 1rem;
}
html.mode-phone .nav a:hover { background: rgba(124, 92, 255, 0.14); }
html.mode-phone .nav .account-link { text-align: center; }

html.mode-phone section { padding: 3.25rem 1.25rem; }
html.mode-phone .hero { min-height: auto; padding-top: 3.5rem; padding-bottom: 3.5rem; }
html.mode-phone .hero-title { font-size: 2.2rem; }
html.mode-phone .hero-sub { font-size: 1rem; }
html.mode-phone .hero-cta { flex-direction: column; }
html.mode-phone .hero-cta .btn { display: block; text-align: center; }
html.mode-phone .section-title { font-size: 1.5rem; }
html.mode-phone .cards { grid-template-columns: 1fr; gap: 1rem; }
html.mode-phone .btn { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
html.mode-phone .site-footer { padding: 1.5rem 1rem; }
