/* ── Variables ── */
:root {
  --bg: #0b0e14;
  --panel: #111726;
  --line: #1a2236;
  --text: #e8eefc;
  --muted: #9aa3b2;
  --purple: #7c6aff;
  --purple-light: #a78bfa;
  --gold: #ffd166;
  --green: #22c55e;
  --red: #ef4444;
  --header-height: 58px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  font:
    15px/1.5 Inter,
    system-ui,
    -apple-system,
    sans-serif;
  padding-top: var(--header-height);
  overflow-x: hidden; /* ← ajoute ça */
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-bar {
  max-width: 1200px;
  margin: 0 auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}
.brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.header-tabs {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}
.tab-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.tab-link:hover {
  background: rgba(255, 255, 255, 0.08);
}
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.username {
  font-size: 14px;
  font-weight: 600;
}
.profile-link,
.stats-button,
.suggest-button,
.logout-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.stats-button {
  color: var(--gold);
  border-color: rgba(255, 209, 102, 0.3);
}
.suggest-button {
  color: var(--purple-light);
  border-color: rgba(167, 139, 250, 0.3);
}
.login-button-google {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

/* ── Main layout ── */
.survival-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 16px 60px;
}

/* ══════════════════════════════════════════
   START SCREEN
══════════════════════════════════════════ */
.survival-startscreen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.start-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.start-emoji {
  font-size: 52px;
  margin: 0;
  line-height: 1;
}
.start-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}
.start-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.start-tiers {
  width: 100%;
  background:
    linear-gradient(#141c2e, #0e1420) padding-box,
    linear-gradient(160deg, #4a5568, #2d3748, #1a2236) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 18px 20px;
}
.start-tiers-title {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}
.tiers-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tier-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}
.tier-item.tier-highlight {
  background: rgba(124, 106, 255, 0.07);
  border-color: rgba(124, 106, 255, 0.22);
}
.tier-item.tier-legendary {
  background: rgba(212, 175, 55, 0.07);
  border-color: rgba(212, 175, 55, 0.28);
}
.tier-score {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tier-xp {
  font-size: 13px;
  font-weight: 700;
  color: var(--purple-light);
}
.tier-item.tier-legendary .tier-xp {
  color: var(--gold);
}

/* ══════════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════════ */
.survival-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.survival-top {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.survival-track-card {
  flex: 1;
  display: flex;
  gap: 14px;
  align-items: center;
  background:
    linear-gradient(#141c2e, #0e1420) padding-box,
    linear-gradient(160deg, #4a5568, #2d3748, #1a2236) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
}
#survivalCover {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  filter: blur(8px);
  transition: filter 0.4s ease;
}
#survivalCover.revealed {
  filter: blur(0);
}
.survival-track-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#survivalArtist {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
#survivalTitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.survival-score-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 130px;
}
.score-box,
.reward-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(#141c2e, #0e1420) padding-box,
    linear-gradient(160deg, #4a5568, #2d3748, #1a2236) border-box;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 12px;
}
.score-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#survivalStreak {
  font-size: 28px;
  font-weight: 800;
  color: var(--purple-light);
  line-height: 1.1;
}
#survivalReward {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

.survival-timer-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.survival-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f97316, #ef4444);
  border-radius: 99px;
}

.survival-question {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 4px 0 0;
}

.survival-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.survival-answer-btn {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: #141c2e;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}
.survival-answer-btn:hover:not(:disabled) {
  background: #1a2440;
  border-color: rgba(124, 106, 255, 0.5);
  transform: translateY(-1px);
}
.survival-answer-btn.correct {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--green);
  color: #4ade80;
}
.survival-answer-btn.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: #f87171;
}
.survival-answer-btn:disabled {
  cursor: default;
  transform: none;
}
.survival-loading {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

/* ══════════════════════════════════════════
   GAME OVER
══════════════════════════════════════════ */
.survival-gameover {
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 20px;
}
.gameover-card {
  width: 100%;
  max-width: 500px;
  background:
    linear-gradient(#141c2e, #0e1420) padding-box,
    linear-gradient(160deg, #4a5568, #2d3748, #1a2236) border-box;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.gameover-emoji {
  font-size: 48px;
  margin: 0;
  line-height: 1;
}
.gameover-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin: 4px 0 0;
}
.gameover-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.gameover-streak {
  font-size: 56px;
  font-weight: 900;
  color: var(--purple-light);
  margin: 0;
  line-height: 1;
}
.gameover-reward {
  font-size: 18px;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 8px;
}

.survival-restart-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--purple);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition:
    background 0.15s,
    transform 0.1s;
}
.survival-restart-btn:hover {
  background: #6a57f0;
  transform: translateY(-1px);
}

/* ── Leaderboard game over ── */
.survival-leaderboard {
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.survival-leaderboard h3 {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
}
.lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
.lb-rank {
  font-size: 13px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #9aa3b2;
}
.lb-rank.gold {
  background: #ffd166;
  color: #111;
}
.lb-rank.silver {
  background: #b0b0b0;
  color: #111;
}
.lb-rank.bronze {
  background: #cd7f32;
  color: #111;
}

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.lb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  font-size: 15px;
  font-weight: 700;
  color: var(--purple-light);
}
.lb-loading {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ── Hamburger ── */
.hamburger-btn {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 998;
}
.hamburger-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 999;
}
.hamburger-overlay.open {
  display: block;
}
.hamburger-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: #111827;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 20px 0 32px;
  overflow-y: auto;
}
.hamburger-panel.open {
  transform: translateX(0);
}
.hamburger-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #9aa3b2;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.5;
}
.hamburger-close:hover {
  color: #fff;
  opacity: 1;
}
.hamburger-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 20px;
  border-bottom: 2px solid rgba(99, 120, 255, 0.5);
}
.hamburger-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.hamburger-username {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.hamburger-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 12px;
  flex: 1;
}
.hamburger-link {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  color: #e8eefc;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
}
.hamburger-link:hover {
  background: rgba(99, 120, 255, 0.08);
  border-left-color: rgba(99, 120, 255, 0.6);
}
.hamburger-logout {
  color: #9aa3b2;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.hamburger-login {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: #fff;
}

@media (max-width: 800px) {
  :root {
    --header-height: 52px;
  }

  .header-tabs {
    gap: 4px !important;
  }

  .header-tabs .tab-link {
    font-size: 10px !important;
    padding: 4px 5px !important;
    gap: 3px !important;
    white-space: nowrap;
  }

  .header-bar {
    height: 48px !important;
    padding: 0 8px !important;
    gap: 6px !important;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .brand {
    font-size: 13px !important;
  }

  .tab-link {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  a.tab-link {
    display: none !important;
  }
  .nav-right .records-button,
  .nav-right .likes-button,
  .nav-right .lang-switcher {
    display: none !important;
  }
  .hamburger-btn {
    display: flex;
  }
  .nav-right .profile-link,
  .nav-right .stats-button,
  .nav-right .suggest-button,
  .nav-right .logout-button,
  .nav-right .login-button-google,
  .nav-right .username,
  .nav-right .profile-img,
  .header-tabs {
    display: none !important;
  }
  .nav-right {
    margin-left: auto;
    display: flex !important;
  }
  .header-bar {
    height: 56px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }
  .survival-top {
    flex-direction: column;
  }
  .survival-score-panel {
    flex-direction: row;
    min-width: unset;
  }
  .score-box,
  .reward-box {
    flex: 1;
  }
  #survivalStreak {
    font-size: 22px;
  }
  .survival-answer-btn {
    padding: 14px 16px;
    font-size: 14px;
  }
  .gameover-streak {
    font-size: 44px;
  }
  .start-tiers {
    padding: 14px 14px;
  }
  .tier-item {
    padding: 8px 10px;
  }
  .tier-score,
  .tier-xp {
    font-size: 12px;
  }
}

/* ── Legendary Records ── */
@keyframes rotateLegendaryBorder {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rotateLegendaryGold {
  to {
    transform: rotate(360deg);
  }
}

/* ── Bouton retour classement ── */
.survival-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 7px 20px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  align-self: center;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  cursor: pointer;
  color: #111;
  background: #f0f0f0;
  text-decoration: none;
  width: fit-content;
  align-self: center;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.survival-back-btn:hover {
  background: #e0e0e0;
  transform: translateY(-1px);

  .survival-main {
    padding: 16px 12px 40px;
  }
}

/* ── Lang switcher ── */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.lang-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 5px;
  height: 20px;
  line-height: 20px;
  transition: color 0.2s;
}
.lang-btn.active {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lang-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  pointer-events: none;
}

.records-button,
.likes-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.records-button {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.3);
}
.likes-button {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.3);
}

.hamburger-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 20px 0;
  margin: 0 -12px;
}

/* ── Lang filter survie ── */
.survie-lang-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.survie-lang-btn {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #9aa3b2;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  transition: all 0.15s ease;
}
.survie-lang-btn:hover {
  color: #e8eefc;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}
.survie-lang-btn.active {
  color: #fff;
  background: #7c3aed;
  border-color: #a78bfa;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
  font-weight: 700;
}

.gameover-card {
  position: relative;
}

.gameover-share-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.go-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #9aa3b2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  text-shadow: none;
  box-shadow: none;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.go-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e8eefc;
  border-color: rgba(255, 255, 255, 0.24);
}

.go-icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

@media (max-width: 400px) {
  .go-icon-btn {
    width: 28px;
    height: 28px;
  }
  .go-icon-btn svg {
    width: 14px;
    height: 14px;
  }
  .gameover-share-actions {
    gap: 6px;
    top: 8px;
    right: 8px;
  }
}
