/* Arcade 22 : socle visuel commun (thème sombre, boutons, panneaux, lobby, notifications). */
:root {
  --bg: #0a0c16;
  --bg2: #12162a;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.11);
  --text: #eef0ff;
  --muted: #9aa3c7;
  --accent: #7c5cff;
  --accent-2: #4fd1ff;
  --good: #2ecc71;
  --bad: #ff5d6c;
  --warn: #f5b342;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(124, 92, 255, 0.28), transparent 60%),
    radial-gradient(900px 600px at 105% 10%, rgba(79, 209, 255, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg));
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: auto; animation: fadeIn 0.35s ease-out both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px;
  padding: 10px 18px; font-weight: 600; letter-spacing: 0.01em; transition: transform 0.12s, background 0.15s, box-shadow 0.15s, border-color 0.15s; min-height: 42px;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b8cff); border-color: transparent; box-shadow: 0 8px 24px rgba(124, 92, 255, 0.38); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(124, 92, 255, 0.55); background: linear-gradient(135deg, #8d70ff, #6a98ff); }
.btn.good { background: linear-gradient(135deg, #27ae60, #2ecc71); border-color: transparent; color: #04210f; }
.btn.bad { background: linear-gradient(135deg, #e0364a, #ff5d6c); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 0.9rem; border-radius: 10px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.avatar { border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: #fff; overflow: hidden; flex: none; border: 2px solid rgba(255, 255, 255, 0.25); user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* en-tête */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px clamp(14px, 3vw, 28px); flex: none; }
.brand { font-weight: 800; letter-spacing: 0.04em; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: inline-block; box-shadow: 0 6px 18px rgba(124, 92, 255, 0.5); }
.me { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.me span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* lobby */
.lobby { padding: 0 clamp(14px, 3vw, 28px) 28px; max-width: 1100px; width: 100%; margin: 0 auto; }
.lobby h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 26px 0 12px; font-weight: 700; }
.posters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.poster { position: relative; overflow: hidden; border-radius: 22px; min-height: 230px; padding: 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform 0.25s, box-shadow 0.25s; isolation: isolate; }
.poster:hover { transform: translateY(-4px); box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55); }
.poster .art { position: absolute; inset: 0; z-index: -1; }
.poster h3 { margin: 0; font-size: 1.7rem; letter-spacing: 0.02em; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6); }
.poster p { margin: 0; color: rgba(255, 255, 255, 0.82); max-width: 40ch; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.poster .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; background: rgba(0, 0, 0, 0.38); border: 1px solid rgba(255, 255, 255, 0.18); font-size: 0.82rem; backdrop-filter: blur(6px); }
.rooms { display: grid; gap: 12px; }
.room { padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.room .who { display: flex; align-items: center; margin-left: 6px; }
.room .who .avatar { margin-left: -8px; }
.room .name { font-weight: 700; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* fenêtre modale */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 14, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fadeIn 0.2s both; }
.modal { max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; padding: 24px; background: #151a30; }
.modal h3 { margin: 0 0 10px; font-size: 1.4rem; }
.modal p { line-height: 1.55; color: #cfd5f5; white-space: pre-line; }

/* barre du jeu */
.gamebar { display: flex; align-items: center; gap: 10px; padding: 10px clamp(10px, 2vw, 20px); flex: none; z-index: 5; }
.gamebar .title { font-weight: 800; letter-spacing: 0.03em; }
.timer { --left: 1; position: relative; min-width: 62px; text-align: center; padding: 6px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; font-weight: 700; background: linear-gradient(90deg, rgba(124, 92, 255, 0.55) calc(var(--left) * 100%), rgba(255, 255, 255, 0.08) 0); border: 1px solid var(--line); }
.timer[data-low="1"] { background: linear-gradient(90deg, rgba(255, 93, 108, 0.65) calc(var(--left) * 100%), rgba(255, 255, 255, 0.08) 0); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 93, 108, 0.25); } }

/* notifications */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: #1d2340; border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; text-align: center; }
.toast.error { background: #3a1621; border-color: rgba(255, 93, 108, 0.5); }
.toast.good { background: #10311f; border-color: rgba(46, 204, 113, 0.5); }

.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 90; text-align: center; padding: 8px; background: linear-gradient(90deg, #7a2a00, #b04a00); font-weight: 700; animation: fadeIn 0.2s both; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent-2); animation: spin 0.9s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; text-align: center; gap: 16px; height: 100%; padding: 24px; }

@media (max-width: 640px) {
  .brand span { display: none; }
  .poster { min-height: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
