/* DevioGame — thème gaming néon (sombre). Couleurs en variables : changer ici suffit. */
:root {
  --bg: #07060d;
  --bg-2: #0e0c1a;
  --panel: rgba(20, 17, 38, 0.78);
  --panel-solid: #141126;
  --line: rgba(140, 120, 255, 0.18);
  --text: #e9e6ff;
  --muted: #9a93c4;
  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --violet: #8a5cff;
  --lime: #b6ff3b;
  --danger: #ff4d6d;
  --radius: 14px;
  --glow-cyan: 0 0 12px rgba(0, 240, 255, .55), 0 0 32px rgba(0, 240, 255, .25);
  --glow-magenta: 0 0 12px rgba(255, 43, 214, .55), 0 0 32px rgba(255, 43, 214, .25);
  --font-title: 'Orbitron', system-ui, sans-serif;
  --font: 'Rajdhani', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: 17px; color: var(--text); background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(138, 92, 255, .22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(255, 43, 214, .16), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(0, 240, 255, .12), transparent 60%);
  background-attachment: fixed;
}
/* grille rétro en fond */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-shadow: var(--glow-cyan); }
h1, h2, h3 { font-family: var(--font-title); letter-spacing: .04em; margin: 0 0 .6em; }
h2 { font-size: 1.35rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Traduction en cours de chargement (js/i18n.js) : on masque pour ne pas afficher le français une fraction de seconde. */
html.i18n-loading body { visibility: hidden; }

/* ── Barre du haut ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 12px 28px; background: rgba(7, 6, 13, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--font-title); font-weight: 900; font-size: 1.35rem; color: var(--text); letter-spacing: .08em; }
.logo span { color: var(--cyan); text-shadow: var(--glow-cyan); }
.logo b { color: var(--magenta); text-shadow: var(--glow-magenta); font-weight: 900; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a {
  position: relative; padding: 8px 16px; border-radius: 10px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .95rem;
}
.nav a:hover { color: var(--text); text-shadow: none; background: rgba(138, 92, 255, .12); }
.nav a.active { color: var(--cyan); background: rgba(0, 240, 255, .08); box-shadow: inset 0 -2px 0 var(--cyan); }
.nav .badge { position: absolute; top: 2px; right: 2px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.lang-select { width: auto; max-width: 170px; padding: 6px 10px; font-size: .9rem; font-weight: 700; cursor: pointer; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-grid; place-items: center; font-family: var(--font-title); font-size: .85rem; font-weight: 700;
  background: linear-gradient(135deg, var(--violet), var(--magenta)); color: #fff; border: 2px solid rgba(255,255,255,.12);
}
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--magenta); color: #fff;
  font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; box-shadow: var(--glow-magenta);
}

/* ── Boutons / champs ──────────────────────────────────────── */
.btn {
  --c: var(--cyan);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 10px 20px; border-radius: 10px; border: 1px solid var(--c); background: transparent; color: var(--c);
  font-family: var(--font); font-weight: 700; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase;
  transition: .15s ease;
}
.btn:hover { background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); text-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: linear-gradient(90deg, var(--cyan), var(--violet)); color: #07060d; border: 0; }
.btn.primary:hover { box-shadow: var(--glow-cyan); filter: brightness(1.1); }
.btn.magenta { --c: var(--magenta); }
.btn.danger { --c: var(--danger); }
.btn.ghost { --c: var(--muted); }
.btn.small { padding: 5px 12px; font-size: .82rem; }
.btn.google { --c: #fff; width: 100%; text-transform: none; letter-spacing: .02em; }
.btn.google svg { width: 18px; height: 18px; }

input, select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); outline: none;
  background: rgba(7, 6, 13, .7); color: var(--text); font-family: var(--font); font-size: 1rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 240, 255, .15); }
label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 6px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(8px); }

/* ── Mise en page ──────────────────────────────────────────── */
main { max-width: 1400px; margin: 0 auto; padding: 28px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero {
  position: relative; overflow: hidden; padding: 48px 40px; margin-bottom: 32px; border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(0, 240, 255, .10), rgba(138, 92, 255, .14) 50%, rgba(255, 43, 214, .12));
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 900; line-height: 1.1; }
.hero h1 em { font-style: normal; color: var(--cyan); text-shadow: var(--glow-cyan); }
.hero p { max-width: 640px; color: var(--muted); font-size: 1.15rem; }
.hero .stats { display: flex; gap: 28px; margin-top: 18px; }
.hero .stat b { display: block; font-family: var(--font-title); font-size: 1.6rem; color: var(--lime); text-shadow: 0 0 12px rgba(182, 255, 59, .5); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 18px; }

/* ── Cartes de jeux ────────────────────────────────────────── */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.game-card {
  --accent: var(--cyan);
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: 18px;
  background: var(--panel-solid); border: 1px solid var(--line); transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.game-cover {
  aspect-ratio: 16 / 9; display: grid; place-items: center; position: relative; overflow: hidden;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%),
              linear-gradient(135deg, #1a1433, #07060d);
}
.game-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-cover .initial { font-family: var(--font-title); font-weight: 900; font-size: 3.2rem; color: #fff; text-shadow: 0 0 22px var(--accent); }
.game-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-body h3 { margin: 0; font-size: 1.1rem; }
.game-body p { margin: 0; color: var(--muted); flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(138, 92, 255, .15); color: #c7b6ff; }
.tag.live { background: rgba(182, 255, 59, .12); color: var(--lime); }
.tag.soon { background: rgba(255, 43, 214, .14); color: var(--magenta); }
.game-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); margin-right: 6px; }
.game-card.placeholder { border-style: dashed; align-items: center; justify-content: center; min-height: 280px; text-align: center; padding: 24px; color: var(--muted); }

/* ── Amis ──────────────────────────────────────────────────── */
.friends-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.friends-layout .panel { padding: 20px; }
.player-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.player-row:last-child { border-bottom: 0; }
.player-row .name { flex: 1; font-weight: 700; }
.player-row .name small { display: block; font-weight: 500; color: var(--muted); }
.player-row .actions { display: flex; gap: 6px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #4a4666; flex: none; }
.status-dot.on { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.status-dot.play { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }
.empty { color: var(--muted); padding: 12px 0; }

/* ── Profil ────────────────────────────────────────────────── */
.profile-card { max-width: 560px; padding: 28px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 1.4rem; }

/* ── Connexion ─────────────────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; padding: 32px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; }
.auth-tabs button { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-family: var(--font); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; }
.auth-tabs button.active { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 20px 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-error { color: var(--danger); min-height: 1.3em; margin-top: 10px; font-weight: 600; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 14px; }

/* ── Page de jeu ───────────────────────────────────────────── */
.play-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; height: calc(100vh - 110px); }
.play-frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #000; }
.play-side { padding: 18px; overflow-y: auto; }
.room-code { font-family: var(--font-title); font-size: 1.6rem; color: var(--lime); letter-spacing: .15em; text-shadow: 0 0 12px rgba(182, 255, 59, .5); }

/* ── Notifications ─────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 360px; padding: 14px 16px; border-radius: 12px; background: var(--panel-solid);
  border: 1px solid var(--cyan); box-shadow: var(--glow-cyan); animation: fade .2s ease;
}
.toast.magenta { border-color: var(--magenta); box-shadow: var(--glow-magenta); }
.toast .actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Filtres du catalogue ─────────────────────────────────── */
.catalog-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.catalog-tools .search { position: relative; flex: 1; min-width: 220px; }
.catalog-tools .search input { padding-left: 38px; }
.catalog-tools .search::before { content: '⌕'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.2rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { padding: 10px 16px; border: 0; background: transparent; color: var(--muted); font: 700 .9rem var(--font); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: rgba(0, 240, 255, .12); color: var(--cyan); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 700 .85rem var(--font); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--violet); }
.chip.active { color: #07060d; background: var(--magenta); border-color: var(--magenta); box-shadow: var(--glow-magenta); }
.chip small { opacity: .7; margin-left: 4px; }
.games-empty { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--muted); }
.tag.mode { background: rgba(0, 240, 255, .1); color: var(--cyan); }

/* ── Chat flottant (façon Steam) ───────────────────────────── */
.dchat {
  position: fixed; right: 16px; bottom: 0; z-index: 40; width: 380px; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, .55), 0 0 18px rgba(138, 92, 255, .18);
}
.dchat.collapsed { width: 260px; }
.dchat.collapsed .dchat-body { display: none; }
.dchat-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; user-select: none; border-radius: 12px 12px 0 0; background: linear-gradient(90deg, rgba(0, 240, 255, .12), rgba(255, 43, 214, .10)); }
.dchat-bar b { font-family: var(--font-title); font-size: .85rem; letter-spacing: .08em; }
.dchat-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.dchat-sub { color: var(--muted); font-size: .8rem; }
.dchat-bar .badge { margin-left: auto; }
.dchat-chev { margin-left: auto; color: var(--muted); }
.dchat-bar .badge + .dchat-chev { margin-left: 6px; }
.dchat-body { display: flex; flex-direction: column; height: min(460px, 65vh); border-top: 1px solid var(--line); }
.dchat-tabs { display: flex; gap: 2px; padding: 6px 6px 0; overflow-x: auto; flex: none; scrollbar-width: thin; }
.dchat-tab { display: flex; align-items: center; gap: 4px; max-width: 150px; padding: 6px 6px 6px 10px; border-radius: 8px 8px 0 0; background: rgba(255, 255, 255, .04); color: var(--muted); font-size: .82rem; font-weight: 700; cursor: pointer; flex: none; }
.dchat-tab.active { background: rgba(0, 240, 255, .12); color: var(--cyan); }
.dchat-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dchat-x { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.dchat-x:hover { opacity: 1; color: var(--danger); }
.dchat-add { flex: none; width: 30px; border: 0; border-radius: 8px 8px 0 0; background: rgba(255, 255, 255, .04); color: var(--lime); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.dchat-add.active { background: rgba(182, 255, 59, .15); }
.dchat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); }
.dchat-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dchat-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.dchat-lang { width: auto; padding: 3px 6px; font-size: .8rem; }
.dchat-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.dchat-msg { display: flex; gap: 8px; align-items: flex-start; }
.dchat-msg .avatar { font-size: .6rem; }
.dchat-meta { font-size: .75rem; color: var(--muted); }
.dchat-meta b { color: var(--cyan); font-size: .85rem; }
.dchat-msg.mine .dchat-meta b { color: var(--magenta); }
.dchat-text { font-size: .95rem; white-space: pre-wrap; word-break: break-word; }
.dchat-sys { color: var(--muted); font-style: italic; font-size: .85rem; text-align: center; padding: 6px 0; }
.dchat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.dchat-form input { padding: 8px 10px; font-size: .95rem; }
.dchat-picker { overflow-y: auto; padding: 8px 12px; }
.dchat-picker h4 { margin: 10px 0 4px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.dchat-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 600 .95rem var(--font); text-align: left; cursor: pointer; }
.dchat-item:hover { background: rgba(138, 92, 255, .14); }
.dchat-hash { font-family: var(--font-title); color: var(--violet); }
.dchat-item .dchat-sub { margin-left: auto; }
/* la page de jeu laisse de la place au chat réduit */
body.has-chat main { padding-bottom: 60px; }
body.has-chat .toasts { bottom: auto; top: 76px; } /* ne pas recouvrir le chat flottant */
body.has-chat .play-layout { height: calc(100vh - 170px); min-height: 420px; }

@media (max-width: 1000px) {
  .friends-layout, .play-layout { grid-template-columns: 1fr; height: auto; }
  .play-frame { height: 70vh; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .lang-select { max-width: 120px; margin-left: auto; }
  main { padding: 16px; }
  .dchat { right: 0; left: 0; width: auto; border-radius: 12px 12px 0 0; }
  .dchat.collapsed { left: auto; width: 220px; right: 8px; }
}
