/* Thème commun GameFaceOff (facultatif pour les jeux). */
:root {
  --bg: #0f1220;
  --surface: #191d31;
  --surface-2: #232842;
  --text: #eef0fa;
  --muted: #9aa0bf;
  --accent: #7c6cff;
  --accent-2: #39d0b4;
  --good: #2fbf71;
  --bad: #ef4f5f;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #eceef7;
    --text: #181a2a;
    --muted: #5d6385;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  /* encoches et barres système des téléphones */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -0.01em;
}
.brand img { width: 28px; height: 28px; }
.brand .off { color: var(--accent-2); }
.brand .tld { color: var(--muted); font-weight: 600; font-size: .8em; }
.brand .back { color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; }
/* Tactile : pas de zoom au double-tap, cibles d'au moins 44 px */
button, a, input, select, textarea, [role="button"] { touch-action: manipulation; }
.btn {
  appearance: none; border: 0; border-radius: 10px; cursor: pointer;
  min-height: 44px; padding: 12px 20px; font: inherit; font-weight: 600;
  background: var(--accent); color: #fff;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
/* 16 px minimum : en dessous, iOS zoome sur le champ au focus */
input[type="text"], input[type="email"], select {
  font: inherit; font-size: max(16px, 1em); min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--surface-2); background: var(--surface-2); color: var(--text);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--surface-2); }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.hidden { display: none !important; }

/* Message affiché par le portail / un jeu non prévu pour l'appareil courant */
.device-warning {
  background: var(--surface-2); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
}

/* Badge joueur (#me) et fenêtre « Mon compte » (sdk/account.js) */
.account-btn {
  cursor: pointer; display: inline-block; line-height: 44px; min-height: 44px; padding: 0 12px;
  border-radius: 99px; background: var(--surface-2); color: var(--text); white-space: nowrap;
  max-width: 55vw; overflow: hidden; text-overflow: ellipsis;
}
@media (hover: hover) { .account-btn:hover { outline: 2px solid var(--accent); } }
.account-dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border: 0; border-radius: var(--radius); padding: 20px; background: var(--surface); color: var(--text);
}
.account-dialog::backdrop { background: rgb(0 0 0 / .55); }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-head h2 { margin: 0; font-size: 1.2rem; }
.account-close { min-width: 44px; padding: 0; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.account-tabs .btn { padding: 10px 8px; font-size: .9rem; }
.account-form { display: flex; flex-direction: column; gap: 8px; }
.account-form input { width: 100%; }
.account-code { letter-spacing: .3em; text-align: center; font-size: 1.3rem !important; }
.account-actions { display: flex; gap: 8px; justify-content: flex-end; }
.account-pseudo { margin: 4px 0 12px; }
.account-row { display: flex; gap: 8px; }
.account-row input { flex: 1; min-width: 0; }
.account-row .btn { flex: none; }
.account-msg { min-height: 1.5em; margin: 10px 0 0; color: var(--muted); }
.account-msg.bad { color: var(--bad); }
.small { font-size: .85rem; }
/* Petits écrans : le « .com » du logo laisse la place au badge joueur */
@media (max-width: 400px) { .brand .tld { display: none; } }
@media (max-width: 400px) { .account-btn { padding: 0 8px; font-size: .9rem; } }
/* Niveau d'expérience à côté du pseudo (data-level posé par le SDK) */
#me[data-level] { position: relative; padding-right: 50px; }
#me[data-level]::after {
  content: "Nv " attr(data-level); position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 2px 6px; border-radius: 99px; background: var(--accent-2); color: #0f1220;
  font-size: .7rem; font-weight: 800; line-height: 1.4; white-space: nowrap;
}
.account-xp { margin: 12px 0 4px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.account-xp p { margin: 6px 0 0; }
.xp-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.xp-level { font-weight: 800; font-size: 1.1rem; }
.xp-title { color: var(--accent-2); font-weight: 700; }
.xp-pts { margin-left: auto; }
.xp-bar { height: 8px; border-radius: 99px; background: var(--surface); overflow: hidden; margin-top: 8px; }
.xp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.xp-games { margin-top: 8px; }
.xp-games th, .xp-games td { padding: 5px 4px; }
.xp-games td:not(:first-child), .xp-games th:not(:first-child) { text-align: right; }
