/* ════════════════════════════════════════════════════════
   CAMPUSPLAY — Design System
   ════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────── */
:root {
  --bg:         #09090b;   /* zinc-950 */
  --surface:    #18181b;   /* zinc-900 */
  --raised:     #27272a;   /* zinc-800 */
  --overlay:    #3f3f46;   /* zinc-700 */

  --text:       #fafafa;
  --text-2:     #a1a1aa;   /* zinc-400 */
  --text-3:     #71717a;   /* zinc-500 */

  --line:       #27272a;
  --line-2:     #3f3f46;

  --accent:     #fafafa;   /* monochrome : blanc sur fond noir */
  --accent-fg:  #09090b;   /* texte sur bouton accent */

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

[data-theme="light"] {
  --bg:         #ffffff;
  --surface:    #fafafa;
  --raised:     #f4f4f5;
  --overlay:    #e4e4e7;

  --text:       #09090b;
  --text-2:     #52525b;
  --text-3:     #a1a1aa;

  --line:       #e4e4e7;
  --line-2:     #d4d4d8;

  --accent:     #09090b;
  --accent-fg:  #fafafa;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

/* ════════════════════════════════════════════════════════
   AUTH LAYOUT (login + register)
   ════════════════════════════════════════════════════════ */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 420px 1fr;
}

/* Panneau gauche — branding */
.auth-brand {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 48px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-fg);
  letter-spacing: -0.5px;
  margin-bottom: 48px;
}

.brand-heading {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.brand-sub {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 48px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: auto;
}

.brand-feat {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.feat-icon {
  width: 34px;
  height: 34px;
  background: var(--raised);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.feat-text strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.feat-text span {
  font-size: 0.78rem;
  color: var(--text-3);
}

/* Panneau droit — formulaire */
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  overflow-y: auto;
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 36px;
}

/* ── Form components ──────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
}

.label-link {
  font-size: 0.76rem;
  color: var(--text-3);
  transition: color 0.15s;
}

.label-link:hover { color: var(--text); }

.input-wrap { position: relative; }

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder { color: var(--text-3); }
input:focus, select:focus { border-color: var(--text-3); }

select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select option { background: var(--raised); }

.show-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.show-pw:hover { color: var(--text); }
.show-pw svg { width: 15px; height: 15px; }

/* ── Error / success alerts ───────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  line-height: 1.4;
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.alert-success {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: #34d399;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  width: 100%;
  padding: 11px;
  margin-top: 4px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-ghost {
  background: none;
  color: var(--text-2);
  border-color: transparent;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 500;
}

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

/* ── Auth footer ──────────────────────────────────────── */
.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-3);
}

.auth-footer a {
  color: var(--text-2);
  font-weight: 500;
  border-bottom: 1px solid var(--line-2);
  transition: color 0.15s, border-color 0.15s;
}

.auth-footer a:hover { color: var(--text); border-color: var(--text); }

/* ── Responsive auth ──────────────────────────────────── */
@media (max-width: 800px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* ════════════════════════════════════════════════════════
   APP LAYOUT (dashboard)
   ════════════════════════════════════════════════════════ */

.app-wrap { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 72px;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-fg);
  letter-spacing: -0.5px;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nav-link {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: color 0.15s, background 0.15s;
}

.nav-link svg { width: 20px; height: 20px; }

.nav-link:hover { color: var(--text); background: var(--raised); }

.nav-link.active {
  color: var(--text);
  background: var(--raised);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--raised);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.avatar-btn:hover { color: var(--text); background: var(--overlay); }

/* ── Theme toggle ─────────────────────────────────────── */
.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.theme-btn svg { width: 17px; height: 17px; }
.theme-btn:hover { color: var(--text); background: var(--raised); }

/* ── Main content ─────────────────────────────────────── */
.main { flex: 1; margin-left: 72px; overflow-y: auto; }

/* ════════════════════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════════════════════ */

.dashboard { padding: 48px 52px; max-width: 1400px; margin: 0 auto; }

/* ── Page header ──────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
  gap: 24px;
}

.greeting {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.greeting-sub {
  font-size: 0.88rem;
  color: var(--text-2);
  font-weight: 500;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  flex-shrink: 0;
}

.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

.stat-n {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-l {
  font-size: 0.68rem;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stat-sep { width: 1px; height: 32px; background: var(--line); }

/* ── Grid ─────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 24px;
}

.col { display: flex; flex-direction: column; gap: 24px; }

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chip-live {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line-2);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.count-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--raised);
  padding: 2px 10px;
  border-radius: 20px;
}

/* ── Rankings ─────────────────────────────────────────── */
.rankings { display: flex; flex-direction: column; gap: 10px; }

.rank-row {
  display: grid;
  grid-template-columns: 20px 1fr 80px 72px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}

.rank-row.is-mine {
  background: var(--raised);
  border: 1px solid var(--line-2);
}

.rank-pos { font-size: 0.72rem; color: var(--text-3); font-weight: 700; }
.rank-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rank-row.is-mine .rank-name { color: var(--text); }

.rank-bar { height: 3px; background: var(--overlay); border-radius: 2px; overflow: hidden; }
.rank-bar-fill { height: 100%; background: var(--text-3); border-radius: 2px; opacity: 0.6; }
.rank-row.is-mine .rank-bar-fill { background: var(--text); opacity: 1; }

.rank-pts { font-size: 0.75rem; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* ── Tournaments ──────────────────────────────────────── */
.t-list { display: flex; flex-direction: column; }

.t-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.t-row:first-child { padding-top: 0; }
.t-row:last-child { border-bottom: none; padding-bottom: 0; }

.t-name {
  font-size: 0.88rem;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-meta { font-size: 0.75rem; color: var(--text-2); }

.t-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }

.t-players { font-size: 0.7rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

.chip {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  color: var(--text-2);
}

.chip-active { background: var(--text); color: var(--accent-fg); border-color: var(--text); }

/* ── Games grid ───────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 22px 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color 0.15s, transform 0.15s;
}

.game-card:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
}

.game-emoji { font-size: 1.75rem; line-height: 1; filter: grayscale(0.2); transition: filter 0.15s; }
.game-card:hover .game-emoji { filter: none; }

.game-name { font-size: 0.85rem; font-weight: 700; letter-spacing: -0.01em; }
.game-count { font-size: 0.72rem; color: var(--text-3); }

.game-card-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Spectate ─────────────────────────────────────────── */
.spectate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.spectate-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 3px; }
.spectate-sub { font-size: 0.76rem; color: var(--text-2); }

.btn-sm {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: opacity 0.15s;
}

.btn-sm:hover { opacity: 0.9; }

/* ── Players ──────────────────────────────────────────── */
.p-list { list-style: none; display: flex; flex-direction: column; }

.p-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.p-row:first-child { padding-top: 0; }
.p-row:last-child { border-bottom: none; padding-bottom: 0; }

.p-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  filter: saturate(0.7);
}

.p-info { flex: 1; overflow: hidden; }

.p-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.p-sub { font-size: 0.73rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.p-actions { display: flex; gap: 5px; opacity: 0; transition: opacity 0.15s; }
.p-row:hover .p-actions { opacity: 1; }

.icon-btn {
  width: 30px;
  height: 30px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.15s;
}

.icon-btn svg { width: 13px; height: 13px; }
.icon-btn:hover { color: var(--text); border-color: var(--text-3); }

/* ── Activity ─────────────────────────────────────────── */
.a-list { list-style: none; display: flex; flex-direction: column; }

.a-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.a-row:first-child { padding-top: 0; }
.a-row:last-child { border-bottom: none; padding-bottom: 0; }

.a-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--accent);
  opacity: 0.5;
}

.a-text {
  font-size: 0.83rem;
  line-height: 1.5;
  margin-bottom: 3px;
}

.a-time { font-size: 0.7rem; color: var(--text-3); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .col-games { grid-column: 1 / -1; }
  .games-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
  .dashboard { padding: 32px 20px; }
  .grid { grid-template-columns: 1fr; }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 28px; }
  .stats-bar { width: 100%; }
}

/* ════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════ */

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.empty-msg {
  color: var(--text-3);
  font-size: 0.82rem;
  text-align: center;
  padding: 20px 0;
  list-style: none;
}

/* ── Spinner (form submit loading state) ─────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--accent-fg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════
   PROFILE PAGE
   ════════════════════════════════════════════════════════ */

.profile-page {
  padding: 48px 52px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Hero header ─────────────────────────────────────── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 32px 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 32px;
}

.profile-hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  filter: saturate(0.8);
  position: relative;
}

.profile-hero-avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--r-lg) + 3px);
  background: conic-gradient(from 180deg, transparent 60%, currentColor 100%);
  opacity: 0.15;
  pointer-events: none;
}

.profile-hero-info {
  flex: 1;
  min-width: 0;
}

.profile-username {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
  line-height: 1.1;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  background: var(--raised);
  letter-spacing: 0.01em;
}

.profile-tag-rank { color: #fbbf24; border-color: rgba(251,191,36,0.25); background: rgba(251,191,36,0.06); }
.profile-tag-school { color: #60a5fa; border-color: rgba(96,165,250,0.25); background: rgba(96,165,250,0.06); }
.profile-tag-major { color: #a78bfa; border-color: rgba(167,139,250,0.25); background: rgba(167,139,250,0.06); }

.profile-hero-stats { flex-shrink: 0; }

/* ── Profile grid ────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

.profile-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Trophy showcase ─────────────────────────────────── */
.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.trophy-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}

.trophy-card:hover {
  border-color: rgba(251, 191, 36, 0.4);
  transform: translateY(-3px);
}

.trophy-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(251,191,36,0.08) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.trophy-card:hover .trophy-glow { opacity: 1; }

.trophy-pixel-svg {
  width: 56px;
  height: 70px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 8px rgba(251,191,36,0.3));
}

.trophy-card:hover .trophy-pixel-svg {
  animation: trophy-float 1.8s ease-in-out infinite;
}

@keyframes trophy-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

.trophy-game {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.trophy-label {
  font-size: 0.65rem;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.trophy-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.83rem;
}

.trophy-empty .trophy-pixel-svg {
  opacity: 0.4;
}

/* ── Game stats ──────────────────────────────────────── */
.gstat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gstat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gstat-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }

.gstat-info { flex: 1; min-width: 0; }

.gstat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.gstat-name {
  font-size: 0.83rem;
  font-weight: 600;
}

.gstat-nums {
  font-size: 0.72rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.gstat-nums strong { color: var(--text); }

.gstat-best {
  display: block;
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 4px;
}

.gstat-bar-track {
  height: 4px;
  background: var(--raised);
  border-radius: 2px;
  overflow: hidden;
}

.gstat-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  min-width: 2px;
  transition: width 0.4s ease;
  opacity: 0.7;
}

/* ── Danger zone ─────────────────────────────────────── */
.card-danger {
  border-color: rgba(239, 68, 68, 0.15);
}

.card-label-danger { color: #f87171; }

.danger-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.btn-danger {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.1); }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive profile ──────────────────────────────── */
@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .profile-page { padding: 32px 20px; }
  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .profile-hero-stats { width: 100%; }
  .trophy-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ════════════════════════════════════════════════════════
   CHAT PANEL
   ════════════════════════════════════════════════════════ */

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.25);
}

.chat-panel.open { transform: translateX(0); }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 10px;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.chat-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

.chat-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.chat-close:hover { background: var(--raised); color: var(--text); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-loading {
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
  padding: 24px 0;
}

.chat-msg {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  filter: saturate(0.75);
}

.chat-msg-body { flex: 1; min-width: 0; }

.chat-msg-header {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 2px;
}

.chat-msg-name {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.chat-msg-name.is-me { color: var(--accent); opacity: 0.85; }

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-msg-text {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
  word-break: break-word;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input-bar input:focus { border-color: var(--text-3); }
.chat-input-bar input::placeholder { color: var(--text-3); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover { opacity: 0.85; }

/* Chat toggle active state */
#chat-toggle.active { color: var(--text); background: var(--raised); }

/* ════════════════════════════════════════════════════════
   MESSAGES PRIVÉS (messages.php)
   ════════════════════════════════════════════════════════ */

.dm-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── Left panel ── */
.dm-left {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}

.dm-left-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}

.dm-left-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dm-new-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.dm-new-btn:hover { background: var(--overlay); color: var(--text); }

/* Search */
.dm-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.dm-search-input {
  width: 100%;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--text);
  padding: 0 10px;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.dm-search-input:focus { border-color: var(--text-3); }
.dm-search-input::placeholder { color: var(--text-3); }

.dm-search-results {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
}

.dm-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
}

.dm-search-item:hover { background: var(--raised); }

/* Conversation list */
.dm-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.dm-conv-empty {
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
  padding: 24px 16px;
}

.dm-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.dm-conv-item:hover { background: var(--raised); }
.dm-conv-item.active { background: var(--raised); }

.dm-conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: saturate(0.75);
}

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

.dm-conv-row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
}

.dm-conv-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-conv-time {
  font-size: 0.65rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.dm-conv-preview {
  font-size: 0.73rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-conv-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Right panel ── */
.dm-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

.dm-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 0.85rem;
  text-align: center;
  padding: 32px;
}

.dm-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surface);
}

.dm-view-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: saturate(0.75);
}

.dm-view-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
}

.dm-view-school {
  display: block;
  font-size: 0.72rem;
  color: var(--text-3);
}

/* Messages feed */
.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.dm-msg-loading {
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
  padding: 24px 0;
}

.dm-msg {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 2px;
}

.dm-msg.dm-msg-me {
  justify-content: flex-end;
}

.dm-bubble {
  max-width: 70%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dm-bubble-text {
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.83rem;
  line-height: 1.5;
  word-break: break-word;
  border-bottom-left-radius: 4px;
}

.dm-msg-me .dm-bubble-text {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 14px;
}

.dm-bubble-time {
  font-size: 0.63rem;
  color: var(--text-3);
  align-self: flex-end;
  padding: 0 4px;
}

/* Input bar */
.dm-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surface);
}

.dm-input-bar input {
  flex: 1;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--text);
  padding: 0 14px;
  font-size: 0.83rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.dm-input-bar input:focus { border-color: var(--text-3); }
.dm-input-bar input::placeholder { color: var(--text-3); }

.dm-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.dm-send-btn:hover { opacity: 0.85; }

@media (max-width: 700px) {
  .dm-left { width: 220px; }
}
