/* Project Edge v1.15 — fondation exacte (foundation.css + controls + responsive) */

:root {
  color-scheme: dark;
  --background:#020b1f; --surface:#071a36; --border:#24578f; --text:#f7fbff; --muted:#9bb4dc;
  --accent:#0b8cff; --accent-light:#24c8ff; --success:#91e8b8;
  --selection:#7dffa7; --on-selection:#052615;
  --detail-warm:#ffd080; --detail-cool:#99e2c0; --detail-alt:#c4b5ff;
  --warning:#ffb648; --error:#ff8b96;
  --theme-image:url('/assets/welcome-player.webp');
  --accent-contrast:#06101e;
}
[data-theme="football-us"] { --background:#020b1f; --surface:#071a36; --border:#24578f; --text:#f7fbff; --muted:#9bb4dc; --accent:#0b8cff; --accent-light:#24c8ff; --detail-warm:#ffd080; --detail-cool:#99e2c0; --detail-alt:#c4b5ff; --theme-image:url('/assets/welcome-player.webp'); }
[data-theme="judo"]      { --background:#150f12; --surface:#2b1b22; --border:#935765; --text:#fff8f0; --muted:#d1b6b8; --accent:#c83e53; --accent-light:#ff9aa2; --detail-warm:#e9c787; --detail-cool:#a8dcc8; --detail-alt:#cabbe9; --theme-image:url('/assets/theme-judo.webp'); }
[data-theme="marseille"] { --background:#071622; --surface:#0e2b40; --border:#467d9b; --text:#f5fbff; --muted:#afcddd; --accent:#1684d8; --accent-light:#85deff; --detail-warm:#efcb84; --detail-cool:#99ddcb; --detail-alt:#b7c5ff; --theme-image:url('/assets/theme-marseille.webp'); }
[data-theme="nature"]    { --background:#091813; --surface:#133125; --border:#4c8064; --text:#f6fbef; --muted:#b6cbb4; --accent:#148b68; --accent-light:#86dfad; --detail-warm:#eaca83; --detail-cool:#9ad9dd; --detail-alt:#d4b8ee; --theme-image:url('/assets/theme-nature.webp'); }
[data-theme="mer"]       { --background:#041820; --surface:#0b2c38; --border:#377f91; --text:#eefcff; --muted:#a4c9d3; --accent:#0883a4; --accent-light:#68e6ee; --detail-warm:#f4c29b; --detail-cool:#a2dfc7; --detail-alt:#c2bcfa; --theme-image:url('/assets/theme-mer.webp'); }
[data-theme="cheval"]    { --background:#131e18; --surface:#263229; --border:#7e8064; --text:#fbf8ef; --muted:#c8d0bd; --accent:#a47645; --accent-light:#f0d09a; --detail-warm:#eac19a; --detail-cool:#acd4b4; --detail-alt:#bfd6df; --theme-image:url('/assets/theme-cheval.webp'); }

:root, [data-theme] {
  --surface-raised: color-mix(in srgb, var(--surface) 90%, var(--text));
  --surface-soft: color-mix(in srgb, var(--surface) 78%, var(--background));
  --control-border: color-mix(in srgb, var(--muted) 65%, var(--surface));
  --edge-line: color-mix(in srgb, var(--accent-light) 24%, transparent);
  --progress-track: color-mix(in srgb, var(--surface) 83%, var(--muted));
  --progress-fill: linear-gradient(90deg, var(--accent), var(--accent-light));
  --action-fill: linear-gradient(160deg, color-mix(in srgb, var(--accent) 74%, var(--background)), color-mix(in srgb, var(--accent) 60%, var(--background)));
  --action-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 19%, transparent);
  --overlay: color-mix(in srgb, var(--background) 87%, transparent);
  accent-color: var(--selection);
  caret-color: var(--accent-light);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, p { margin-top: 0; }
input:where([type='checkbox'], [type='radio']) { accent-color: var(--selection); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent-light);
  outline-offset: 4px;
}
a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

/* Boutons partagés */
.primary-button, .secondary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 750; line-height: 1.3;
  border-radius: 12px; padding: 12px 20px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent;
}
.primary-button {
  min-height: 52px; color: var(--text);
  border-color: var(--accent-light); background: var(--action-fill);
  box-shadow: var(--action-shadow);
}
.primary-button:hover { filter: brightness(1.12); }
.primary-button:disabled { opacity: 0.55; box-shadow: none; cursor: default; filter: none; }
.secondary-button {
  min-height: 44px; color: var(--text);
  border-color: var(--border); background: var(--surface);
}
.secondary-button:hover { border-color: var(--accent-light); }
.danger-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px; font: inherit; font-weight: 750;
  color: #fff; border: 1px solid #ff8793; background: #9e2437; border-radius: 12px; cursor: pointer;
}
.edge-link { color: var(--accent-light); text-decoration: underline; text-underline-offset: 4px; }

/* Champ coquille v1.15 */
.input-shell {
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 0 12px 0 16px;
  border: 1px solid #6191c171; border-radius: 14px;
  background: linear-gradient(120deg, #0c2948d9, #081c37e8);
  box-shadow: 0 1px 0 #ffffff0a inset, 0 10px 22px #01081733;
}
.input-shell:focus-within {
  border-color: var(--accent-light);
  background: linear-gradient(120deg, #0d3155e8, #09213fe8);
  box-shadow: 0 0 0 3px #24c8ff24, 0 0 24px #0b8cff2b;
}
.input-shell:has([aria-invalid='true']) { border-color: var(--error); }
.input-shell svg { flex: none; width: 20px; height: 20px; color: #b4caee; }
.input-shell input {
  flex: 1; min-width: 0; min-height: 52px;
  border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 16px;
}
.input-shell input::placeholder { color: var(--muted); }
.input-shell input:focus { outline: none; }
.password-toggle {
  flex: 0 0 44px; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-right: -8px;
  border: none; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.password-toggle svg { pointer-events: none; }
.password-toggle[aria-pressed='true'] { color: var(--accent-light); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.field-error { color: var(--error); font-size: 14px; line-height: 1.5; margin: 8px 0 0; }
.field-hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* Carte */
.edge-card {
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--edge-line);
  border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, var(--text)), var(--surface));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

/* Jauge XP v1.15 */
.edge-xp { position: relative; height: 12px; border-radius: 4px; background: var(--progress-track); overflow: hidden; }
.edge-xp-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light) 70%, var(--detail-warm));
  box-shadow: inset 0 1px 0 #ffffff70;
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.edge-xp-cursor {
  position: absolute; top: 50%; width: 6px; height: 18px; border-radius: 2px;
  transform: translate(-50%, -50%);
  background: var(--text); border: 1px solid var(--accent-light);
  box-shadow: 0 0 9px color-mix(in srgb, var(--accent-light) 65%, transparent);
}

.edge-eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; color: var(--accent-light); }
.edge-eyebrow output { font-size: 0.85rem; font-weight: 500; color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* Écran d'accès v1.15, adapté aux grands écrans depuis la version mobile. */
.auth-screen {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: #031333 url('/assets/project-edge-login-bg.webp') center top / cover no-repeat;
}
.auth-screen::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, #00102e0d 0 74%, #00102e8f 100%);
}
/* L'illustration est verticale : conserver son cadrage sur les écrans larges. */
@media (min-width: 768px) {
  .auth-screen { background: #031333; }
  .auth-screen::before {
    inset: -48px;
    background: url('/assets/project-edge-login-bg.webp') center top / cover no-repeat;
    filter: blur(34px) brightness(0.38);
  }
  .auth-screen::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
      linear-gradient(180deg, #00102e00 70%, #00102e85),
      url('/assets/project-edge-login-bg.webp') center top / auto 100% no-repeat;
  }
}
.screen-canvas { position: relative; z-index: 1; width: 100%; max-width: 430px; margin: auto; }
.auth-content { width: 100%; }
.auth-content h1 {
  text-align: center; font-size: clamp(24px, 6vw, 30px); line-height: 1.08;
  font-weight: 800; letter-spacing: -0.025em; margin: 0; text-wrap: balance;
}
.auth-content form { display: grid; gap: 16px; }
.form-field { min-width: 0; position: relative; }
.form-field > span {
  display: block; color: #deebff; font-size: 12px; line-height: 1.4;
  font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase;
  margin: 0 0 6px 2px;
}
.auth-screen .input-shell,
.auth-screen .input-shell input { min-height: 52px; }
.auth-content .primary-button { margin-block: 10px; }
.auth-success p { color: var(--muted); line-height: 1.6; }
.auth-success .primary-button { margin-top: 16px; }

.auth-beta-badge {
  position: absolute; z-index: 2; top: clamp(142px, 20svh, 210px); left: 50%;
  translate: -50% 0; padding: 4px 12px;
  border: 1px solid #c7f7ff; border-radius: 999px; background: #021532b8;
  color: #ecfdff;
  box-shadow: 0 0 18px #24c8ffb8, 0 0 4px #ffffff inset;
  font-size: 10px; line-height: 1.2; font-weight: 900;
  letter-spacing: 0.24em; text-indent: 0.24em;
  pointer-events: none;
  animation: auth-beta-glow 2.8s ease-in-out infinite alternate;
}
@keyframes auth-beta-glow { from { box-shadow: 0 0 10px #24c8ff80, 0 0 4px #ffffff inset; } to { box-shadow: 0 0 22px #24c8ffd0, 0 0 4px #ffffff inset; } }

.auth-portal {
  position: relative; isolation: isolate; overflow: hidden; padding: 24px;
  border: 1px solid transparent; border-radius: 28px;
  background:
    linear-gradient(155deg, #0a2341e8 0%, #06162eed 55%, #041127f2 100%) padding-box,
    linear-gradient(145deg, #83e7ffbd 0%, #24c8ff42 38%, #527cb23d 72%, #ffffff24) border-box;
  box-shadow: 0 30px 80px #010817a6, 0 0 0 1px #ffffff0a inset, 0 0 44px #0b8cff1f;
  backdrop-filter: blur(22px) saturate(132%);
  -webkit-backdrop-filter: blur(22px) saturate(132%);
  animation: auth-portal-arrive 560ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}
@keyframes auth-portal-arrive { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.auth-portal::before {
  position: absolute; z-index: -1; top: -110px; left: 50%; width: 270px; height: 210px;
  translate: -50% 0; border-radius: 50%; content: ''; pointer-events: none;
  background: radial-gradient(circle, #24c8ff42, transparent 69%); filter: blur(12px);
}
.auth-portal::after {
  position: absolute; top: 0; left: 15%; width: 70%; height: 2px; content: '';
  pointer-events: none; background: linear-gradient(90deg, transparent, #94edff, transparent);
  box-shadow: 0 0 16px #24c8ff;
}
.auth-portal-header { position: relative; display: grid; justify-items: center; gap: 14px; margin-bottom: 22px; text-align: center; }

/* Mode connexion : le portail s'efface, seule la carte du formulaire porte le verre. */
.auth-login-panel { padding: 0 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.auth-login-panel::before, .auth-login-panel::after { display: none; }
.auth-login-panel form {
  padding: 18px; border: 1px solid #a8efff85; border-radius: 20px;
  background: linear-gradient(155deg, #02142ee8, #031a39df);
  box-shadow: 0 22px 54px #0010279c, 0 1px 0 #ffffff2e inset;
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
}

/* Étapes d'inscription */
.invite-step { display: grid; gap: 12px; }
.invite-step-header { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.invite-step-header p { margin: 0; color: #a9bfd5; font-size: 13px; font-weight: 650; }
.invite-step-back {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 6px 12px; font: inherit;
  border: 1px solid #3a668d; border-radius: 10px; background: #102239; color: #e9f3ff;
  cursor: pointer; text-decoration: none;
}
.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.auth-toggle { text-align: center; }

/* Compact : écrans bas (interaction-and-responsive.css, sans toucher au badge) */
@media (max-height: 620px) {
  .auth-portal { padding: 16px; border-radius: 22px; }
  .auth-login-panel { padding: 0 8px; }
  .auth-portal-header { gap: 8px; margin-bottom: 12px; }
  .auth-content h1 { font-size: 21px; }
  .form-field { margin-bottom: 10px; }
  .auth-screen .input-shell, .auth-screen .input-shell input { min-height: 46px; }
  .auth-screen .input-shell input { font-size: 16px; }
  .auth-content .primary-button { min-height: 46px; margin-block: 8px; }
}

/* Paysage large : l'inscription passe à deux colonnes, badge masqué */
@media (min-width: 680px) and (max-height: 520px) {
  .auth-screen:not(.auth-screen--login) > .screen-canvas { max-width: 760px; }
  .auth-screen:not(.auth-screen--login) .auth-portal { display: grid; grid-template-columns: minmax(190px, 0.8fr) minmax(320px, 1.2fr); align-items: center; gap: 28px; padding: 18px 26px; }
  .auth-screen:not(.auth-screen--login) .auth-portal-header { margin: 0; }
  .auth-screen:not(.auth-screen--login) .auth-content h1 { font-size: 23px; }
  .auth-beta-badge { display: none; }
}

/* Clavier mobile : l'action en cours prime */
html[data-keyboard='true'] .auth-screen:has(> .screen-canvas) { padding: 8px 12px; }
html[data-keyboard='true'] .auth-portal { padding: 12px 16px; border-radius: 20px; animation: none; }
html[data-keyboard='true'] .auth-beta-badge { display: none; }
html[data-keyboard='true'] .auth-screen:is(.auth-screen--invite, .auth-screen--signup) .auth-portal-header { display: none; }
html[data-keyboard='true'] .auth-portal-header { gap: 0; margin-bottom: 8px; }
html[data-keyboard='true'] .auth-content h1 { font-size: 19px; }
html[data-keyboard='true'] .form-field { margin-bottom: 8px; }
html[data-keyboard='true'] .auth-screen .input-shell,
html[data-keyboard='true'] .auth-screen .input-shell input { min-height: 44px; }
html[data-keyboard='true'] .auth-content .primary-button { min-height: 44px; margin-block: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
