/* ── Variables (thème top10/classement) ── */
:root {
  --bg: #0b0e14;
  --panel: #111726;
  --line: #1a2236;
  --text: #e8eefc;
  --muted: #9aa3b2;
  --gold: #ffd166;
  --header-height: 58px;
}

/* ── Reset & base ── */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: #0b0e14;
  min-height: 100vh;
  color: var(--text);
  font:
    15px/1.5 Inter,
    system-ui,
    -apple-system,
    sans-serif;
  padding-top: var(--header-height);
}
.badge-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-switcher {
  display: inline-flex !important;
  align-items: center !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
}
.lang-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.35) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 5px !important;
  text-shadow: none !important;
}
.lang-btn.active {
  color: #fff !important;
}
.lang-btn:focus,
.lang-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
.lang-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  pointer-events: none;
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #0b0e14;
  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;
}

/* ── Nav right ── */
.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);
}

.badge-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.badge-elo-standalone {
  width: 64px !important;
  height: 64px !important;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* ── XP Bar ── */
.div-header-stats {
  flex-direction: column;
  align-items: stretch;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.xp-bar-container {
  width: 100%;
}

.xp-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.xp-level {
  font-weight: 700;
  color: #a78bfa;
}

.xp-text {
  color: var(--muted);
}

.xp-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c6aff, #a78bfa);
  border-radius: 99px;
  transition: width 0.6s ease;
}

.xp-next {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.username {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.profile-link,
.stats-button,
.records-button,
.suggest-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;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.profile-link:hover,
.stats-button:hover,
.records-button:hover,
.likes-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.stats-button {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.3);
}
.records-button {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}
.likes-button {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.3);
}
.suggest-button {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.3);
}
.logout-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: border-color 0.15s;
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.login-button-google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  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;
  transition: background 0.15s;
}

.login-button-google:hover {
  background: rgba(255, 255, 255, 0.1);
}

.google-icon {
  width: 18px;
  height: 18px;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: border-color 0.15s;
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.login-button-google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  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;
  transition: background 0.15s;
}

.login-button-google:hover {
  background: rgba(255, 255, 255, 0.1);
}
.google-icon {
  width: 18px;
  height: 18px;
}

/* ── Page layout ── */
.stats-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ── Wrapper deux colonnes ── */
.stats-wrapper {
  display: flex;
  gap: 20px;
  align-items: stretch;
  width: 100%;
  margin-bottom: 40px;
}

/* ── Colonnes ── */
.stats-column,
.history-column {
  flex: 1;
  position: relative;
  background:
    linear-gradient(#141c2e, #0e1420) padding-box,
    linear-gradient(160deg, #4a5568, #2d3748, #1a2236) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.stats-column {
  display: flex;
  flex-direction: column;
}

.stats-column .stats-table {
  flex: 1;
}

/* ── Header stats (avatar + nom) ── */
.div-header-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 16px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid #374151;
}

.div-header-stats h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.profile-image-rect {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ── Tables stats / history / best-game ── */
.stats-table,
.history-table,
.best-game-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  background: #161e2e;
}

.stats-table thead th,
.history-table thead th,
.best-game-table thead th {
  text-align: left;
  font-weight: 600;
  color: #cdd6f4;
  background: #1a2440;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-table thead th:first-child {
  border-radius: 10px 0 0 0;
}
.stats-table thead th:last-child {
  border-radius: 0 10px 0 0;
}

.stats-table tbody td,
.history-table tbody td,
.best-game-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 14px;
  background: #161e2e;
}

/* Alternance */
.stats-table tbody tr:nth-child(even) td,
.history-table tbody tr:nth-child(even) td,
.best-game-table tbody tr:nth-child(even) td {
  background: #1c2438;
}

.stats-table tbody tr:last-child td,
.history-table tbody tr:last-child td,
.best-game-table tbody tr:last-child td {
  border-bottom: 0;
}

.stats-table tbody tr:hover td,
.history-table tbody tr:hover td {
  background: #222e48;
}

/* Valeurs en gras */
.stats-table tbody td:last-child {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.history-table a,
.best-game-table a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.history-table a:hover,
.best-game-table a:hover {
  color: #ffb300;
  text-decoration: underline;
}

/* ── Liens records / likes / wpm ── */
#totalRecords,
#totalLikes,
#bestWpmLink {
  color: var(--gold);
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s;
}

#totalRecords:hover,
#totalLikes:hover,
#bestWpmLink:hover {
  color: #ffb300;
}

/* ── Chanson la plus rapide ── */
tr#fastestTrackContainer td {
  padding: 14px !important;
}

.fastest-track-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

#fastestCover {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.fastest-track-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fastest-track-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 0;
}

p#fastestTrackTitle {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

p#fastestTrackTime {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  margin: 0;
}

/* ── History column ── */
.history-column h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
  text-align: center;
}

.history-container {
  overflow-y: auto;
  border: 1px solid #374151;
  border-radius: 10px;
  margin-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.best-game-container {
  border: 1px solid #374151;
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

/* ── Filtre meilleure partie ── */
.best-game-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.best-game-filter label {
  font-size: 13px;
  color: var(--muted);
}

#bestGameFilter {
  background: #f0f4ff;
  color: #111;
  border: 1.5px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  transition:
    border-color 0.15s,
    background 0.15s;
  min-width: 200px;
}

#bestGameFilter:hover {
  background: #e8eef8;
  border-color: rgba(0, 0, 0, 0.3);
}

#bestGameFilter:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.35);
}

#bestGameFilter option {
  background: #ffffff;
  color: #111;
  padding: 8px;
}

.best-game-filter .chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #fff;
  transition: transform 0.2s ease;
}

.best-game-filter .custom-dropdown.open .chevron {
  transform: rotate(180deg);
}

/* ── Custom dropdown stats ── */
.best-game-filter .custom-dropdown {
  position: relative;
  width: 100%;
  margin-top: 8px;
}

.best-game-filter .dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  background: #f0f4ff;
  color: #111;
  border: 1.5px solid rgba(0, 0, 0, 0.2);
}

.best-game-filter .dropdown-trigger:hover,
.best-game-filter .custom-dropdown.open .dropdown-trigger {
  background: #e8eef8;
  border-color: rgba(0, 0, 0, 0.3);
}

.best-game-filter .chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #111;
  transition: transform 0.2s ease;
}

.best-game-filter .custom-dropdown.open .chevron {
  transform: rotate(180deg);
}

.best-game-filter .dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px;
  z-index: 1000;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  scrollbar-width: thin;
  scrollbar-color: #1a2236 transparent;
}

.best-game-filter .custom-dropdown.open .dropdown-menu {
  display: block;
}

@keyframes ddIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.best-game-filter .dropdown-option {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  color: #e8eefc;
  cursor: pointer;
  transition: background 0.1s;
  font-family: inherit;
}

.best-game-filter .dropdown-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.best-game-filter .dropdown-option.selected {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.1);
  font-weight: 700;
}

/* ── Song count link ── */
.song-count {
  cursor: pointer;
  text-decoration: underline;
  color: var(--gold) !important;
  font-weight: 700;
  transition: color 0.2s;
}

.song-count:hover {
  color: #ffb300;
}

/* ── Commentaires ── */
.section-comments {
  max-width: 680px;
  width: 100%;
  margin: 0 auto 40px;
}

.section-comments h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
  text-align: center;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#commentForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

#commentInput {
  width: 100%;
  min-height: 72px;
  max-height: 140px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.15s;
}

#commentInput:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
}

#commentForm button {
  align-self: center;
  background: #1db954;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 24px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
}

#commentForm button:hover {
  background: #1aa34a;
}
#commentForm button:active {
  transform: scale(0.97);
}

.comment-item {
  position: relative;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15); /* ← plus visible */
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.comment-item:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.comment-item--new {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.2);
  animation: mmqPulse 1.2s ease-out 1;
}

@keyframes mmqPulse {
  0% {
    box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 209, 102, 0);
  }
}

.comment-avatar-link {
  display: inline-block;
  margin-right: 10px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.comment-name:hover {
  color: var(--gold);
}

.comment-date {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

.comment-text {
  margin-top: 8px;
  font-size: 14px;
  color: #ddd;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.15s;
}

.comment-delete::before,
.comment-delete::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.comment-delete::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.comment-delete::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.comment-delete:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-container {
  background: var(--panel);
  border: 1px solid var(--line);
  width: 75%;
  max-width: 820px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #0f1629;
  border-bottom: 1px solid var(--line);
  color: var(--gold);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-header .close-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-header .close-btn:hover {
  color: #fff;
}

/* ── Filtres modal ── */
.modal-filters {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  background: #0f1629;
  border-bottom: 1px solid var(--line);
}

#modalSearch {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(99, 120, 220, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}

#modalSearch::placeholder {
  color: #888;
}

#modalFilter {
  height: 34px;
  padding: 0 10px;
  background: #1a2040;
  color: #fff;
  border: 1px solid rgba(99, 120, 220, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.modal-body {
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
}

/* ── Boutons play/pause modal ── */
.modal-body button[data-action='play'],
.modal-body .play-btn {
  background: #1db954;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.modal-body button[data-action='play']:hover {
  background: #1aa34a;
}

.modal-body button[data-action='pause'],
.modal-body .pause-btn {
  background: #fff;
  color: #e53935;
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s;
}

.modal-body button[data-action='pause']:hover {
  background: #f5f5f5;
}

.song-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #161e2e;
}

.song-table th {
  background: #1a2440;
  color: var(--gold);
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Largeurs colonnes modal */
.song-table th:nth-child(1) {
  width: 22%;
} /* Titre */
.song-table th:nth-child(2) {
  width: 17%;
} /* Artiste */
.song-table th:nth-child(3) {
  width: 15%;
} /* Playlist */
.song-table th:nth-child(4) {
  width: 14%;
  text-align: center;
} /* Statut */
.song-table th:nth-child(5) {
  width: 10%;
  text-align: center;
} /* Temps */
.song-table th:nth-child(6) {
  width: 8%;
  text-align: center;
} /* Coupe */
.song-table th:nth-child(7) {
  width: 14%;
  text-align: center;
} /* Écouter */

.song-table td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #161e2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Colonne Statut : le badge (🟡 Artiste / 🟡 Titre) doit rester entier et
   centré, pas coupé par l'ellipsis générique appliqué aux autres colonnes. */
.song-table td:nth-child(4) {
  text-align: center;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.song-table tbody tr:nth-child(even) td {
  background: #1c2438;
}

.song-table tr:last-child td {
  border-bottom: 0;
}

.song-table tr:hover td {
  background: #222e48;
}

.clickable-song {
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 4px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Animations ── */
.song-table-container {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.3s,
    max-height 0.5s;
}

.song-table-container.active {
  opacity: 1;
  max-height: 600px;
}

/* ── Mobile ── */
@media (max-width: 800px) {
  :root {
    --header-height: 52px;
  }

  body {
    overflow-x: hidden !important;
  }

  .lang-switcher {
    display: none !important;
  }

  .header-bar {
    padding: 0 8px !important;
    gap: 6px !important;
    height: 48px !important;
  }
  .brand {
    font-size: 13px !important;
    white-space: nowrap;
  }
  .header-tabs {
    gap: 4px !important;
  }
  .tab-link {
    font-size: 10px !important;
    padding: 4px 5px !important;
    white-space: nowrap !important;
  }

  .nav-right .records-button,
  .nav-right .likes-button,
  .nav-right .logout-button,
  .nav-right .profile-link {
    display: none !important;
  }

  .profile-img {
    width: 26px !important;
    height: 26px !important;
  }
  .username {
    display: none !important;
  }
  .nav-right .stats-button {
    font-size: 11px !important;
    padding: 4px 7px !important;
  }

  .stats-page {
    padding: 16px 10px 40px;
  }

  .stats-wrapper {
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .stats-column {
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .history-column {
    display: none !important;
  }

  /* Table pleine largeur sans débordement */
  .stats-table {
    width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
  }

  .stats-table thead th,
  .stats-table tbody td {
    padding: 9px 10px !important;
    font-size: 13px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stats-table thead th:first-child,
  .stats-table tbody td:first-child {
    width: 55% !important;
    white-space: normal !important;
  }

  .stats-table tbody td:last-child {
    font-size: 14px !important;
    width: 45% !important;
  }

  #fastestCover {
    width: 56px !important;
    height: 56px !important;
  }
  p#fastestTrackTitle {
    max-width: 140px !important;
    font-size: 13px !important;
  }

  .section-comments {
    max-width: 100%;
    padding: 0 4px;
  }
  #commentInput {
    max-width: none;
  }
  .comment-item {
    max-width: none;
  }
  .modal-container {
    width: 92%;
  }

  .login-button-google {
    font-size: 11px !important;
    padding: 4px 8px !important;
    gap: 5px !important;
  }

  .login-button-google .google-icon {
    width: 14px !important;
    height: 14px !important;
  }

  .login-button-google span {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .header-top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .badge-img {
    width: 60px !important;
    height: 60px !important;
  }
  .badge-elo-standalone {
  width: 52px !important;
  height: 52px !important;
}
  .tab-link {
    font-size: 10px !important;
    padding: 4px 5px !important;
  }

  .stats-column,
  .history-column {
    padding: 14px 12px !important;
  }

  .div-header-stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .div-header-stats h1 {
    font-size: 20px !important;
  }

  .profile-image-rect {
    width: 56px !important;
    height: 56px !important;
  }

  .section-comments h2 {
    font-size: 16px !important;
  }
  .comment-avatar {
    width: 34px !important;
    height: 34px !important;
  }
  .comment-name {
    font-size: 13px !important;
  }
  .comment-text {
    font-size: 13px !important;
  }
}

/* ── 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;
  transition: background 0.15s;
  z-index: 998;
}
.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.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;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}
.hamburger-username {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 12px;
  flex: 1;
}
.hamburger-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  color: #e8eefc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
  transition:
    background 0.15s,
    border-left 0.15s;
}
.hamburger-link:last-child {
  border-bottom: none;
}
.hamburger-link:hover {
  background: rgba(99, 120, 255, 0.08);
  border-left: 3px solid rgba(99, 120, 255, 0.6);
  color: #fff;
}
.hamburger-logout {
  color: #9aa3b2;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  border-left: 3px solid transparent;
}
.hamburger-logout:hover {
  color: #fff;
  background: rgba(255, 80, 80, 0.08);
  border-left: 3px solid rgba(255, 80, 80, 0.5);
}
.hamburger-suggest {
  margin-top: 8px;
}
.hamburger-login {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}
.hamburger-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 20px 0;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }
  .nav-right .profile-link,
  .nav-right .stats-button,
  .nav-right .records-button,
  .nav-right .likes-button,
  .nav-right .suggest-button,
  .nav-right .logout-button,
  .nav-right .login-button-google,
  .nav-right .lang-switcher,
  .nav-right .username,
  .nav-right .profile-img,
  .header-tabs {
    display: none !important;
  }
  .nav-right {
    margin-left: auto;
    display: flex !important;
    align-items: center;
    gap: 8px;
    overflow: visible !important;
  }
  .header-bar {
    height: 56px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }
}

/* ─── Niveau 150 : bordure animée tournante ────────────────────────────────── */
@keyframes rotateLegendaryBorder {
  to { transform: rotate(360deg); }
}

.legendary-border {
  position: relative !important;
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  animation: none !important;
  isolation: isolate;
}

.legendary-border::before {
  content: '';
  position: absolute;
  inset: -150%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 62%,
    #6366f1 70%,
    #a78bfa 75%,
    #818cf8 80%,
    transparent 88%,
    transparent 100%
  );
  animation: rotateLegendaryBorder 3.5s linear infinite;
  z-index: 0;
}

.legendary-border::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: #141c2e;
  border-radius: 10px;
  z-index: 1;
}

.legendary-border > * {
  position: relative;
  z-index: 2;
}

/* ─── Niveau 200 : records légendaires ────────────────────────────────────── */
@keyframes rotateLegendaryGold {
  to { transform: rotate(360deg); }
}

.legendary-records-block {
  position: relative;
  width: fit-content;
  min-width: 380px;
  max-width: 580px;
  margin: 0 auto 32px;
  padding: 20px 24px;
  border: none !important;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Faisceau doré tournant */
.legendary-records-block::before {
  content: '';
  position: absolute;
  inset: -150%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 55%,
    #b8960c 63%,
    #f5d76e 68%,
    #d4af37 72%,
    #f5d76e 76%,
    #b8960c 81%,
    transparent 88%,
    transparent 100%
  );
  animation: rotateLegendaryGold 4s linear infinite;
  z-index: 0;
}

/* Masque intérieur */
.legendary-records-block::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: linear-gradient(135deg, #131a2a, #0e1420);
  border-radius: 12px;
  z-index: 1;
}

.legendary-records-block > * {
  position: relative;
  z-index: 2;
}

.legendary-records-block .legendary-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #d4af37;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 14px;
  justify-content: center;
}

#legendaryRecordsList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Supprimer les anciens coins pseudo */
#legendaryRecordsList::before,
#legendaryRecordsList::after {
  display: none;
}

#legendaryRecordsList li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .legendary-records-block {
    min-width: unset;
    max-width: 100%;
    width: 100%;
    margin: 0 0 24px;
    padding: 16px 14px;
  }

  .legendary-records-block .legendary-title {
    font-size: 14px;
  }

  #legendaryRecordsList li {
    padding: 9px 10px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .legendary-records-block {
    padding: 14px 10px;
  }

  .legendary-records-block .legendary-title {
    font-size: 13px;
    letter-spacing: 0.05em;
  }

  #legendaryRecordsList li {
    padding: 8px 8px;
    font-size: 12px;
    gap: 8px;
  }
}

.survival-streak-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 8px;
  font-size: 13px;
}
.survival-streak-label { flex: 1; color: #9aa3b2; }
.survival-streak-value { font-size: 15px; font-weight: 600; color: #e8eefc; }

@media (max-width: 768px) {
   a.tab-link { display: none !important;}
  .survival-streak-stat { font-size: 12px; gap: 6px; }
  .survival-streak-value { font-size: 14px; }
}

.survie-fire { color: #fff; margin-left: 2px; }

.speedrun-best-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid rgba(99, 120, 255, 0.2);
  margin-top: 8px;
  font-size: 13px;
}
.speedrun-best-label { flex: 1; color: #9aa3b2; }
.speedrun-best-correct { font-size: 14px; font-weight: 600; color: #4ade80; }
.speedrun-best-time { font-size: 14px; font-weight: 600; color: #a78bfa; margin-left: 4px; }

@media (max-width: 768px) {
  .speedrun-best-stat { font-size: 12px; gap: 6px; }
  .speedrun-best-correct, .speedrun-best-time { font-size: 13px; }
}