/* =========================================================
   Pages de connexion, d'inscription et d'administration
   ========================================================= */
body.auth-page, body.admin-page {
  overflow: auto; min-height: 100%;
  background:
    linear-gradient(135deg, #ffffff06 25%, transparent 25%) 0 0 / 120px 120px,
    linear-gradient(225deg, #00000030 25%, transparent 25%) 0 0 / 120px 120px,
    linear-gradient(315deg, #ffffff05 25%, transparent 25%) 0 0 / 120px 120px,
    radial-gradient(ellipse at 50% 0%, #5a1426 0%, #1a0710 60%, #0d0408 100%) fixed;
}
html.scrollable, html.scrollable body { height: auto; min-height: 100%; overflow: auto; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card {
  width: min(420px, 100%); padding: 34px 32px 28px; border-radius: 22px;
  background: linear-gradient(160deg, #1f0b14f2, #12060cf2);
  border: 1px solid #d4af3766; box-shadow: 0 30px 80px #000c, inset 0 1px 0 #ffffff10;
}
.auth-brand { font-family: var(--serif); font-size: 34px; font-weight: 800; color: var(--gold2); text-align: center; line-height: 1.1; }
.auth-brand span { color: #fff; }
.auth-sub { text-align: center; color: #f5ecd7b0; margin: 8px 0 26px; font-size: 15px; }
.auth-chips { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.auth-chips i { width: 26px; height: 26px; border-radius: 50%; display: block;
  background: radial-gradient(circle, var(--c) 0 50%, transparent 51%), repeating-conic-gradient(var(--c) 0 22.5deg, #fff 22.5deg 45deg); box-shadow: 0 3px 8px #0008; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: #f5ecd7d0; }
.field input, .field select {
  font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; color: var(--ink);
  background: #00000060; border: 1px solid #ffffff26; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--gold2); box-shadow: 0 0 0 3px #f3d27a33; }
.field .field-hint { font-size: 12.5px; color: #f5ecd780; }
/* œil pour afficher / masquer le mot de passe */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; min-width: 0; padding-right: 48px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; background: none; border: none; color: #f5ecd7a0; cursor: pointer;
}
.pw-eye:hover { color: var(--gold2); background: #ffffff10; }
.pw-eye:focus-visible { outline: 2px solid var(--gold2); }
.pw-eye svg { width: 22px; height: 22px; }
.pw-eye .eye-off { display: none; }
.pw-eye[aria-pressed="true"] .eye-on { display: none; }
.pw-eye[aria-pressed="true"] .eye-off { display: block; }
.field input[readonly] { opacity: .7; }

.auth-card .btn.primary { width: 100%; padding: 14px; font-size: 16px; margin-top: 4px; }
.auth-error { min-height: 22px; color: #ff9a9a; font-size: 14px; font-weight: 600; margin: 4px 0 10px; text-align: center; }
.auth-ok { color: #a8ffb0; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: #f5ecd780; }
.btn:focus-visible { outline: 3px solid var(--gold2); outline-offset: 2px; }

.meter { height: 6px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: #e05252; transition: width .2s, background .2s; }

/* ---------- Entrée 3D (page de connexion) : façade, videur, bulle ---------- */
#scene, #ext-ui, #fade, .entrance-loader, .bouncer-line, .back-link { display: none; }
html:has(body.entrance), html:has(body.entrance-loading) { overflow: hidden; height: 100%; }
body.entrance, body.entrance-loading { overflow: hidden; height: 100%; min-height: 0; background: #0b0a1f; }
body.entrance #scene, body.entrance-loading #scene { display: block; position: fixed; inset: 0; width: 100%; height: 100%; }
body.entrance-loading .auth-wrap { display: none; }
body.entrance-loading .entrance-loader { display: grid; position: fixed; inset: 0; place-items: center; z-index: 5; }

body.entrance #ext-ui {
  display: flex; position: fixed; left: 0; right: 0; bottom: 34px; z-index: 10;
  flex-direction: column; align-items: center; gap: 12px; transition: opacity .5s; animation: extIn 1s ease 1.6s both;
}
@keyframes extIn { from { opacity: 0; transform: translateY(12px); } }
body.entrance.approaching #ext-ui, body.entrance.at-door #ext-ui, body.entrance.entering #ext-ui { opacity: 0; pointer-events: none; }
.ext-hint { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: #f5ecd7d8; text-shadow: 0 2px 8px #000; }
.ext-enter { padding: 13px 46px !important; font-size: 17px; }
.ext-disc { font-size: 11px; color: #f5ecd780; text-shadow: 0 1px 3px #000; }

body.entrance .auth-wrap {
  position: fixed; inset: 0; min-height: 0; z-index: 12; display: block; padding: 0;
  pointer-events: none; opacity: 0; transform: translateX(-24px); transition: opacity .45s, transform .45s;
}
body.entrance.at-door .auth-wrap { opacity: 1; transform: none; }
body.entrance.at-door .auth-card { pointer-events: auto; }
body.entrance.entering .auth-wrap { opacity: 0; transition-delay: .5s; }
body.entrance.entering .auth-card { pointer-events: none; }
body.entrance .auth-chips, body.entrance .auth-brand, body.entrance .auth-sub, body.entrance .auth-foot { display: none; }
/* la bulle est placée par le script juste à gauche de la tête du videur */
body.entrance .auth-card { position: absolute; left: 6vw; top: 26vh; width: min(360px, calc(100vw - 28px)); padding: 22px 24px 16px; }
body.entrance .auth-card::after {        /* pointe de la bulle, vers la bouche du videur */
  content: ''; position: absolute; right: -15px; top: var(--tail-y, 46px); border: 15px solid transparent; border-right: 0; border-left-color: #1c0a12;
  filter: drop-shadow(1px 0 0 #d4af3766);
}
body.entrance .bouncer-line {
  display: block; font-family: var(--serif); font-size: 21px; font-weight: 800; line-height: 1.3; color: #fff; margin-bottom: 18px;
}
.bouncer-line.refuse { color: #ff9a9a; }
.bouncer-line.welcome { color: #a8ffb0; }
body.entrance .back-link {
  display: block; margin: 12px auto 0; background: none; border: none; color: #f5ecd7a0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
}
body.entrance .back-link:hover { color: var(--gold2); }
/* nouveau membre (compte tout juste créé) : le videur le reconnaît, pas de formulaire */
body.entrance.known .field, body.entrance.known #submit, body.entrance.known .auth-error, body.entrance.known .back-link { display: none; }
body.entrance.known .bouncer-line { margin-bottom: 4px; }
body.entrance #fade { display: block; position: fixed; inset: 0; z-index: 30; background: #000; opacity: 0; pointer-events: none; transition: opacity .8s ease-in; }
body.entrance #fade.on { opacity: 1; }
@media (max-aspect-ratio: 9/10) {
  body.entrance .auth-wrap { display: flex; align-items: flex-end; justify-content: center; padding: 0 14px 20px; transform: translateY(24px); }
  body.entrance .auth-card { position: relative; left: auto !important; top: auto !important; }
  body.entrance .auth-card::after { right: auto; left: 50%; top: -15px; margin-left: -15px; border: 15px solid transparent; border-top: 0; border-bottom-color: #1f0b14; }
  body.entrance .bouncer-line { font-size: 18px; margin-bottom: 12px; }
}

/* ---------- Administration ---------- */
.admin-page .admin-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px max(4vw, 16px); background: #0d0408e8; border-bottom: 1px solid #d4af3740; backdrop-filter: blur(6px);
}
.admin-head .brand { font-size: 24px; margin-right: auto; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 26px max(4vw, 16px) 60px; display: grid; gap: 22px; }
.panel { background: #12060ce6; border: 1px solid #d4af3740; border-radius: 18px; padding: 22px; box-shadow: 0 14px 40px #0008; }
.panel h2 { font-family: var(--serif); color: var(--gold2); font-size: 24px; margin-bottom: 4px; }
.panel .lead { color: #f5ecd7a0; font-size: 14px; margin-bottom: 16px; }
.invite-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.invite-form .field { margin: 0; }
.link-box { display: none; margin-top: 16px; padding: 14px; border-radius: 12px; background: #0b3d22; border: 1px solid #a8ffb060; }
.link-box.show { display: block; }
.link-box p { font-size: 13px; color: #d8ffdc; margin-bottom: 8px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font: 13px ui-monospace, Consolas, monospace; padding: 10px 12px; border-radius: 10px; border: 1px solid #ffffff30; background: #00000060; color: #fff; }

.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-weight: 600; color: #f5ecd790; padding: 8px 10px; border-bottom: 1px solid #ffffff20; white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid #ffffff10; vertical-align: middle; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr.off td { opacity: .5; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.admin { background: var(--gold2); color: #2b1700; }
.pill.player { background: #ffffff1c; }
.pill.off { background: #9e1f1f; color: #fff; }
.pill.on { background: #2e7d32; color: #fff; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .btn { padding: 6px 10px; font-size: 12.5px; }
.btn.danger { border-color: #ff8a8a80; color: #ffb0b0; }
.bal-input { width: 110px; font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid #ffffff26; background: #00000060; color: var(--ink); text-align: right; }
.empty { color: #f5ecd780; font-size: 14px; padding: 10px 0; }
.audit { font-size: 13px; color: #f5ecd7b0; display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.audit div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 4px 0; border-bottom: 1px solid #ffffff0c; }
.audit time { color: #f5ecd770; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .invite-form { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 26px 20px; }
}
