body:is([data-page="login"], [data-page="register"]) {
  --auth-action: var(--accent);
  --auth-action-foreground: #fff;
  --auth-action-hover: color-mix(in srgb, var(--auth-action) 86%, #000);
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

:root[data-theme="dark"] body:is([data-page="login"], [data-page="register"]) {
  --auth-action-foreground: #242039;
  --auth-action-hover: color-mix(in srgb, var(--auth-action) 86%, #fff);
}

body:is([data-page="login"], [data-page="register"]) .masthead {
  position: static;
  background: var(--surface);
  backdrop-filter: none;
}

body:is([data-page="login"], [data-page="register"]) .masthead-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 64px;
  padding-block: 0;
}

body:is([data-page="login"], [data-page="register"]) .masthead .theme-toggle {
  width: 44px;
  height: 44px;
}

body:is([data-page="login"], [data-page="register"]) :is(.topnav, .masthead-search, .account, .rail, .margin, .ask) {
  display: none;
}

body:is([data-page="login"], [data-page="register"]) .shell:has(.margin:empty) {
  grid-template-columns: minmax(0, 440px);
  justify-content: center;
  align-content: center;
  width: 100%;
  flex: 1;
  padding: 48px 24px 72px;
}

.auth-card {
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-card-header {
  margin-bottom: 28px;
}

.auth-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}

.auth-mark img {
  display: block;
}

.auth-card h1 {
  font-size: clamp(25px, 5vw, 32px);
  letter-spacing: -.04em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.auth-description {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.auth-card .auth-form {
  gap: 16px;
}

.auth-card .auth-form label {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.auth-card .auth-form input:not([type="hidden"]) {
  width: 100%;
  min-height: 46px;
  padding-inline: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
}

.auth-card .auth-form input:not([type="hidden"]):focus {
  border-color: var(--accent);
}

.auth-field-hint {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

.auth-card .auth-submit {
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--auth-action);
  color: var(--auth-action-foreground);
  font-size: 15px;
  font-weight: 700;
  transition: background-color .15s ease;
}

.auth-card .auth-submit:not(:disabled):is(:hover, :active) {
  background: var(--auth-action-hover);
  color: var(--auth-action-foreground);
  opacity: 1;
}

.auth-card .auth-desk-action {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  text-align: center;
}

.auth-desk-action span {
  grid-column: 2;
}

.auth-desk-action svg {
  grid-column: 3;
}

.auth-note {
  margin: 15px 0 0;
  color: var(--text-2);
  text-align: center;
}

.auth-note a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 5px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: .18em;
}

.auth-demo {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
}

.auth-demo summary {
  align-content: center;
  min-height: 44px;
  cursor: pointer;
}

.auth-demo p {
  margin: 0;
}

@media (max-width: 560px) {
  body:is([data-page="login"], [data-page="register"]) .shell:has(.margin:empty) {
    align-content: start;
    padding: 34px 16px 48px;
  }

  .auth-card-header {
    margin-bottom: 24px;
  }
}

@media (max-height: 520px) {
  body:is([data-page="login"], [data-page="register"]) .shell:has(.margin:empty) {
    padding-block: 20px 24px;
  }

  .auth-card {
    padding-block: 24px;
  }

  .auth-card-header {
    margin-bottom: 20px;
  }

  .auth-mark {
    margin-bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card .auth-submit {
    transition: none;
  }
}
