.auth-email-fields {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.auth-email-fields label {
  font-size: 14px;
  font-weight: 600;
}

.auth-email-fields label small {
  font-size: 12px;
  font-weight: 400;
  opacity: .75;
}

.auth-email-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.auth-email-row input {
  flex: 1 1 0;
  min-width: 0;
}

.auth-email-row button {
  flex: 0 0 auto;
  max-width: 48%;
}

.auth-email-link {
  justify-self: center;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--accent-color);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.auth-email-link:hover {
  text-decoration: underline;
}

.auth-email-code-button {
  padding: 8px 12px;
  border: 1px solid #c5b6de;
  border-radius: 11px;
  background: #f3edf9;
  color: #51267c;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-email-status {
  margin: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.auth-email-status:empty {
  display: none;
}

#email-reset-form [data-email-proof] {
  margin-top: 8px;
}

#email-link-dialog input {
  min-height: 42px;
  border: 1px solid var(--theme-border, #5c506e);
  border-radius: 11px;
  background: var(--theme-surface, #21192f);
  color: var(--theme-text, #f8f3ff);
}

#email-link-current {
  overflow-wrap: anywhere;
}

#email-link-close {
  margin-top: 14px;
}

.auth-shell {
  --auth-text: #f7f3ff;
  --auth-muted: #beb5d2;
  --auth-accent: #d5baff;
  --auth-border: #413653;
  --auth-input: #171327;
  --auth-error: #ffb3c8;
  min-height: 100dvh;
  align-content: center;
  row-gap: 12px;
  padding: clamp(22px, 5vh, 58px) 20px;
  color-scheme: dark;
}

.auth-service-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  color: var(--auth-text);
  text-align: center;
  text-shadow: 0 1px 4px #07040e, 0 1px 8px #07040e;
}

.auth-shell .auth-card {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  width: min(100%, 940px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #6c55818c;
  border-radius: 30px;
  background: #100d1d;
  color: var(--auth-text);
  box-shadow: 0 30px 95px #04020bc9, 0 0 50px #6d2baa29;
}

.auth-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-width: 0;
  padding: clamp(22px, 3vw, 40px);
  border-inline-end: 1px solid #6853837d;
  background: #100d1d;
}

.auth-visual::before,
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-visual::before {
  bottom: -8%;
  z-index: -2;
  background: var(--site-background);
}

.auth-visual::after {
  z-index: -1;
  background: linear-gradient(180deg, #10091d66 0%, #140b2b0d 28%, #170a3873 56%, #110b22fa 100%);
}

.auth-visual-top {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #e0c6ff42;
  border-radius: 99px;
  background: #140d2ddd;
  color: #f2e7ff;
  font-size: 12px;
  font-weight: 650;
}

.auth-visual-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #92eff4;
  box-shadow: 0 0 10px #92eff4b3;
}

.auth-visual-label,
.auth-eyebrow {
  display: block;
  color: var(--auth-accent);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .17em;
}

.auth-visual-name {
  display: block;
  margin-top: 7px;
  font-size: clamp(36px, 4vw, 55px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.065em;
}

.auth-visual-caption p {
  max-width: 230px;
  margin: 12px 0 0;
  color: #e1d4f3;
  font-size: 14px;
  line-height: 1.55;
}

.auth-content {
  min-width: 0;
  padding: clamp(26px, 4vw, 45px);
  background: radial-gradient(ellipse at 100% 0%, #39204e61, transparent 53%), #100d1d;
}

#email-reset-open { justify-self: end; }

.auth-shell .auth-panel,
.auth-shell .auth-panel form {
  display: grid;
  gap: 17px;
  min-width: 0;
}

.auth-shell .auth-heading h1 {
  margin: 5px 0 0;
  text-align: start;
  font-size: clamp(29px, 4vw, 39px);
  font-weight: 780;
  line-height: 1.13;
  letter-spacing: -.045em;
}

.auth-heading p,
.auth-field-hint {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-shell .auth-panel :is(.field, .registration-field) {
  min-width: 0;
  gap: 7px;
}

.auth-shell .auth-panel label {
  color: var(--auth-text);
  font-size: 14px;
  font-weight: 640;
}

.auth-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.auth-shell .auth-panel :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: var(--auth-input);
  color: var(--auth-text);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.auth-shell .auth-panel :is(input, select):focus {
  border-color: #ba94ff;
  box-shadow: 0 0 0 3px #b28aff30;
}

.auth-shell .auth-panel :is(input, select)[aria-invalid="true"] {
  border-color: #ed9bb9;
}

.auth-shell #registration-gender {
  appearance: none;
  padding-inline: 12px 31px;
  color-scheme: dark;
  color: var(--auth-text);
  background: var(--auth-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23d5baff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 11px center / 16px no-repeat;
}

.auth-shell input::placeholder,
.auth-shell #registration-gender:invalid {
  color: #ada2c1;
  opacity: 1;
}

.auth-shell input:-webkit-autofill {
  -webkit-text-fill-color: var(--auth-text);
  box-shadow: 0 0 0 100px var(--auth-input) inset;
  caret-color: var(--auth-text);
}

.auth-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px 12px;
}

.auth-shell #registration-email-fields {
  gap: 8px;
  padding: 13px;
  border: 1px solid #514069;
  border-radius: 15px;
  background: #221932;
}

.auth-required {
  color: #e0c7ff;
  font-size: 11px;
  font-weight: 720;
}

.auth-field-hint {
  margin: 0;
  font-size: 12px;
}

.auth-shell .auth-email-code-button {
  min-height: 46px;
  border-color: #655083;
  background: #36264c;
  color: #f2e5ff;
  font-size: 13px;
  font-weight: 660;
}

.auth-shell .auth-email-code-button:hover:not(:disabled) {
  background: #493465;
}

.auth-shell .auth-otp {
  max-width: 190px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .16em;
}

.auth-shell .auth-otp::placeholder {
  letter-spacing: normal;
}

.auth-recovery-proof {
  display: grid;
  gap: 12px;
}

.auth-shell .auth-panel .submit-button {
  width: 100%;
  min-width: 0;
  min-height: 47px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #a387f88a;
  border-radius: 13px;
  background: linear-gradient(105deg, #7147d1, #5731a3);
  color: #fff;
  font-size: 15px;
  font-weight: 720;
  box-shadow: 0 8px 24px #4b21a048;
}

.auth-shell .auth-panel .submit-button:hover:not(:disabled) {
  filter: brightness(1.15);
}

.auth-shell :is(.submit-button, .auth-email-code-button):disabled {
  cursor: default;
  opacity: .72;
  filter: none;
  transform: none;
}

.auth-shell :is(.auth-email-link, .register-link, .back-to-login) {
  color: var(--auth-accent);
  font-size: 14px;
  font-weight: 640;
  text-underline-offset: 3px;
}

.auth-shell .auth-email-link {
  padding: 0;
}

.auth-shell :is(a, button):focus-visible {
  outline: 2px solid #d4b5ff;
  outline-offset: 3px;
}

.auth-shell .registration-actions {
  gap: 14px;
  margin: 0;
}

.auth-shell .bottom-actions {
  flex-wrap: wrap;
  gap: 5px 9px;
  margin: 2px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-muted);
  font-size: 14px;
  text-align: center;
}

.auth-shell :is(.field-error, .form-message, .registration-message, .auth-email-status) {
  min-height: 0;
  margin: 0;
  color: var(--auth-error);
  font-size: 13px;
  text-align: start;
  overflow-wrap: anywhere;
}

.auth-shell :is(.field-error, .form-message, .registration-message, .auth-email-status):empty {
  margin: -7px 0 0;
}

.auth-shell :is(.form-message, .registration-message, .auth-email-status):empty {
  display: none;
}

.auth-shell :is(.form-message, .auth-email-status)[data-state="success"] { color: #a9e7ce; }
.auth-shell .auth-email-status[data-state="pending"] { color: var(--auth-muted); }

@media (max-width: 720px) {
  .auth-shell .auth-card { grid-template-columns: minmax(0, 1fr); max-width: 490px; }
  .auth-visual { display: none; }
}

@media (max-width: 425px) {
  .auth-shell { padding: 14px 12px; }
  .auth-shell .auth-card { border-radius: 22px; }
  .auth-content { padding: 22px 18px; }
  .auth-fields-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 350px) {
  .auth-shell .auth-email-row { flex-wrap: wrap; }
  .auth-shell .auth-email-row > * { flex-basis: 100%; max-width: none; }
}

html.pixel-night-android main.auth-shell {
  grid-template-rows: minmax(min-content, 1fr) auto;
  row-gap: 0;
  padding: 0;
  background: #100d1d;
}
html.pixel-night-android .auth-shell .auth-card {
  align-self: stretch;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at 100% 0%, #39204e61, transparent 53%), #100d1d;
  box-shadow: none;
}
html.pixel-night-android .auth-service-links {
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
}
html.pixel-night-android .auth-visual { display: none; }
html.pixel-night-android .auth-content {
  width: min(100%, 540px);
  margin: auto;
  padding: max(28px, env(safe-area-inset-top)) clamp(18px, 6vw, 42px) max(24px, env(safe-area-inset-bottom));
  background: none;
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell :is(input, button, a) { transition: none; }
}
