:root {
  color-scheme: light dark;
  --page: #f4f1e8;
  --card: #fffdf5;
  --primary: #075446;
  --on-primary: #ffffff;
  --text: #10241f;
  --secondary-text: #5f6f69;
  --input: #ffffff;
  --border: #b7c8c1;
  --focus: #0c8068;
  --error: #b54646;
  --shadow: #10241f14;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #071d18;
    --card: #102a24;
    --primary: #49a884;
    --on-primary: #071d18;
    --text: #f8f5ea;
    --secondary-text: #b7c9c2;
    --input: #17372f;
    --border: #507067;
    --focus: #72c5a6;
    --error: #ff8e8e;
    --shadow: #00000033;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.auth-shell {
  width: min(100% - 2rem, 29rem);
  margin: auto;
  padding-block: clamp(2rem, 9vh, 6rem) 2rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 3vw, 1rem);
  margin-bottom: 1.5rem;
}

.brand img {
  display: block;
  border-radius: 0.65rem;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.45rem, 2vw, 0.75rem);
  line-height: 1;
}

.brand-wordmark strong {
  font-size: clamp(1.75rem, 6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.05em;
}

.brand-byline {
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-card {
  padding: clamp(1.25rem, 5vw, 2rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: 0 0.6rem 2rem var(--shadow);
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.intro {
  margin: 0.55rem 0 1.4rem;
  color: var(--secondary-text);
  overflow-wrap: anywhere;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 0.7rem;
}

input,
button {
  font: inherit;
}

input {
  display: block;
  width: 100%;
  min-height: 2.8rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
}

input[readonly] {
  background: var(--page);
}

.code {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.22em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.primary,
.secondary {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 2.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.secondary {
  background: var(--input);
  color: var(--text);
  border-color: var(--border);
}

.primary:hover:not(:disabled),
.secondary:hover {
  filter: brightness(0.92);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-block: 1rem;
  color: var(--secondary-text);
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.alternatives {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin-top: 1rem;
}

.password-rules {
  margin: -0.25rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--secondary-text);
  font-size: 0.875rem;
}

.password-rules .met {
  color: var(--text);
  list-style-type: "✓  ";
}

.message {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.message:empty {
  margin: 0;
}

.error {
  color: var(--error);
}

#retry {
  margin-top: 0.75rem;
}
