.auth-page {
  background:
    repeating-linear-gradient(90deg, var(--bg-light), var(--bg-light) 4px, var(--bg-dark) 4px, var(--bg-dark) 8px);
}

.auth-page .menu-bar {
  background: var(--accent-sun);
  color: var(--text);
  font-weight: 600;
}

.auth-window {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 4vw, 24px);
  padding: clamp(18px, 5vw, 28px);
}

.auth-card {
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-strong);
  padding: clamp(18px, 4vw, 26px);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-card--intro {
  background: var(--accent-sun);
}

.auth-page--login .auth-card--intro {
  background: var(--accent-sky);
}

.auth-page--signup .auth-card--intro {
  background: var(--accent-rose);
}

.auth-card--form {
  background: #ffffff;
}

.auth-intro-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.auth-form__group input {
  padding: 12px 14px;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-light);
  font: inherit;
  box-shadow: inset 1px 1px var(--highlight), inset -1px -1px var(--shadow);
}

.auth-form__group input:focus {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.auth-fieldset {
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 1px 1px var(--highlight), inset -1px -1px var(--shadow);
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-fieldset legend {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 6px;
}

.auth-avatars {
  display: flex;
  gap: 16px;
}

.auth-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-medium);
  background: #fff;
  cursor: pointer;
}

.auth-avatar input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-avatar img {
  width: 72px;
  height: 72px;
  display: block;
  box-sizing: border-box;
  padding: 4px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  transition: box-shadow 0.1s ease;
}

.auth-avatar input:checked + img {
  box-shadow: 0 0 0 3px var(--text);
  background: var(--accent-sun);
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: var(--border-strong);
  background: var(--accent-rose);
  font-weight: 600;
  display: none;
}

/* Signup-specific adjustments */
body:has(script[src*="signup.js"]) .auth-actions .auth-link[href$="login.html"] {
  position: relative;
  color: transparent !important;
}

body:has(#signupForm) #signupUsername::placeholder,
body:has(#signupForm) input[name="username"]::placeholder,
body:has(#signupForm) input#username::placeholder {
  color: #999 !important;
  opacity: 1 !important;
}

body:has(#signupForm) #signupUsername:placeholder-shown,
body:has(#signupForm) input[name="username"]:placeholder-shown,
body:has(#signupForm) input#username:placeholder-shown {
  background-image: none;
}

body:has(#signupForm) #signupUsername:not(:placeholder-shown),
body:has(#signupForm) input[name="username"]:not(:placeholder-shown),
body:has(#signupForm) input#username:not(:placeholder-shown) {
  background-image: none;
}

body:has(#signupForm) #signupUsername {
  caret-color: #000;
}

body.auth-page input::placeholder,
body.auth-page textarea::placeholder {
  font-size: 14px;
  line-height: 1.25;
  color: #999;
  opacity: 1;
}

.auth-hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: #666;
  line-height: 1.3;
}

@supports (-webkit-touch-callout: none) {
  body.auth-page input,
  body.auth-page select,
  body.auth-page textarea {
    font-size: 16px;
    line-height: 1.25;
  }
}

body.auth-page .auth-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

body.auth-page .auth-actions .auth-submit,
body.auth-page .auth-actions .auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 32px;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--card-shadow-strong);
  background: var(--accent-sun);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.6px;
  text-decoration: none;
  color: #000 !important;
  transition: transform 0.1s ease;
  width: clamp(220px, 60%, 290px);
  white-space: nowrap;
}

body.auth-page .auth-actions .auth-submit:hover,
body.auth-page .auth-actions .auth-link:hover {
  transform: translateY(-1px);
}

body.auth-page .auth-actions .auth-submit:focus,
body.auth-page .auth-actions .auth-link:focus {
  text-decoration: none;
}

body.auth-page:has(#signupForm) .auth-actions a.auth-link[href$="login.html"] {
  position: relative;
  color: transparent !important;
}

body.auth-page:has(#signupForm) .auth-actions a.auth-link[href$="login.html"]::after {
  content: "déjà inscrit ?";
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font: inherit;
  letter-spacing: inherit;
}

body.auth-page.auth-page--login .auth-card--intro,
body.auth-page.auth-page--login .auth-card--intro .auth-intro-text {
  display: none !important;
}

body.auth-page.auth-page--login .window-body .auth-card:first-child {
  display: none !important;
}

body.auth-page.auth-page--login .auth-card--form {
  margin-top: 0 !important;
}

@media (max-width: 640px) {
  .auth-window {
    padding: clamp(16px, 6vw, 22px);
  }

  .auth-card {
    padding: clamp(16px, 6vw, 24px);
  }

  .auth-avatars {
    gap: 12px;
  }

  .auth-avatar img {
    width: 64px;
    height: 64px;
  }
}
