body.auth-modal-open { overflow: hidden; }

.header-login {
  width: 96px;
  min-width: 86px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 4px;
  color: #f3f3f1;
  background: rgba(8, 8, 8, 0.28);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.header-login:hover { border-color: rgba(255, 255, 255, 0.62); background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.header-login[data-authenticated="true"] { border-color: rgba(86, 199, 121, 0.55); }
.header-login svg { width: 17px; height: 17px; }
.header-login > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mobile-auth-trigger {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.mobile-auth-trigger svg { width: 20px; height: 20px; color: #e10600; }

.auth-modal { position: fixed; z-index: 400; inset: 0; display: grid; place-items: center; padding: 24px; }
.auth-modal[hidden] { display: none; }
.auth-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(8px); cursor: default; opacity: 0; transition: opacity 180ms ease; }
.auth-dialog { position: relative; width: min(100%, 480px); max-height: calc(100svh - 48px); overflow: auto; border: 1px solid #34363c; border-top: 4px solid #e10600; border-radius: 8px; color: #f7f7f5; background: #111215; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62); opacity: 0; transform: translateY(16px); transition: opacity 180ms ease, transform 180ms ease; }
.auth-modal.is-open .auth-backdrop, .auth-modal.is-open .auth-dialog { opacity: 1; }
.auth-modal.is-open .auth-dialog { transform: translateY(0); }

.auth-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.auth-dialog-brand { min-width: 0; display: flex; align-items: center; gap: 14px; }
.auth-dialog-brand img { width: 48px; height: 48px; flex: none; border-radius: 8px; }
.auth-dialog-brand div { min-width: 0; }
.auth-dialog-brand span { color: #e10600; font-family: "F1 Wide", sans-serif; font-size: 9px; font-weight: 700; }
.auth-dialog-brand h2 { margin: 5px 0 0; font-size: 23px; line-height: 1.2; }
.auth-close, .auth-icon-button { flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 4px; color: #d8d9dc; background: transparent; cursor: pointer; }
.auth-close { width: 40px; height: 40px; }
.auth-close svg, .auth-icon-button svg { width: 19px; height: 19px; }
.auth-close:hover, .auth-icon-button:hover { border-color: rgba(255, 255, 255, 0.42); color: #fff; }

.auth-form { display: grid; gap: 18px; padding: 24px 26px 28px; }
.auth-form[hidden], .auth-account[hidden] { display: none; }
.auth-field { display: grid; gap: 8px; }
.auth-field > span { color: #b7b8bc; font-size: 12px; font-weight: 700; }
.auth-field input { width: 100%; height: 50px; min-width: 0; padding: 0 14px; border: 1px solid #3b3d43; border-radius: 4px; color: #fff; background: #0a0b0d; font: 14px "F1 Display", "PingFang SC", sans-serif; outline: 0; }
.auth-field input::placeholder { color: #686a70; }
.auth-field input:focus { border-color: #e10600; box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.14); }
.auth-captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px 44px; gap: 8px; }
.auth-captcha-visual { height: 50px; overflow: hidden; padding: 0; border: 1px solid #3b3d43; border-radius: 4px; color: #a7a8ac; background: #fff; font-size: 11px; cursor: pointer; }
.auth-captcha-visual img { width: 100%; height: 100%; object-fit: contain; }
.auth-captcha-visual span { color: #55575d; }
.auth-icon-button { width: 44px; height: 50px; }
.auth-sms-row { display: grid; grid-template-columns: minmax(0, 1fr) 126px; gap: 8px; }
.auth-sms-row button { height: 50px; padding: 0 12px; border: 1px solid #e10600; border-radius: 4px; color: #fff; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.auth-sms-row button:hover { background: rgba(225, 6, 0, 0.12); }
.auth-sms-row button:disabled, .auth-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-agreement { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; color: #92949a; font-size: 11px; line-height: 1.7; }
.auth-agreement input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: #e10600; }
.auth-agreement a { color: #f0f0ed; text-decoration: underline; text-underline-offset: 3px; }
.auth-status { min-height: 18px; margin: -2px 0 0; color: #9da0a6; font-size: 12px; line-height: 1.5; }
.auth-status.error { color: #ff7772; }
.auth-status.success { color: #6ed58b; }
.auth-submit { min-height: 52px; border: 0; border-radius: 4px; color: #fff; background: #e10600; font-size: 15px; font-weight: 700; cursor: pointer; transition: background-color 160ms ease, transform 160ms ease; }
.auth-submit:hover { background: #ff1e16; transform: translateY(-2px); }

.auth-account { padding: 44px 28px 34px; text-align: center; }
.auth-account-mark { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 20px; border: 1px solid rgba(86, 199, 121, 0.45); border-radius: 50%; color: #6ed58b; background: rgba(86, 199, 121, 0.08); }
.auth-account-mark svg { width: 38px; height: 38px; }
.auth-account p { margin: 0; color: #8f9197; font-size: 11px; }
.auth-account strong { display: block; margin-top: 8px; font-size: 23px; overflow-wrap: anywhere; }
.auth-account > span { display: block; margin-top: 8px; color: #8f9197; font-size: 12px; }
.auth-account button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; margin-top: 32px; padding: 0 22px; border: 1px solid #42444a; border-radius: 4px; color: #e2e3e5; background: transparent; font-weight: 700; cursor: pointer; }
.auth-account button:hover { border-color: #777a82; }
.auth-account button svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .header-login { width: 42px; min-width: 42px; padding: 0; }
  .header-login > span { display: none; }
}

@media (max-width: 520px) {
  .auth-modal { align-items: end; padding: 0; }
  .auth-dialog { width: 100%; max-height: calc(100svh - 24px); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 8px 8px 0 0; }
  .auth-dialog-header { padding: 20px; }
  .auth-dialog-brand img { width: 44px; height: 44px; }
  .auth-dialog-brand h2 { font-size: 21px; }
  .auth-form { padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
  .auth-captcha-row { grid-template-columns: minmax(0, 1fr) 104px 44px; }
  .auth-sms-row { grid-template-columns: minmax(0, 1fr) 116px; }
  .auth-account { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .auth-captcha-row { grid-template-columns: minmax(0, 1fr) 96px 42px; gap: 6px; }
  .auth-icon-button { width: 42px; }
  .auth-sms-row { grid-template-columns: minmax(0, 1fr) 108px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-backdrop, .auth-dialog { transition-duration: 0.01ms; }
}
