.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px;
}

.card {
  width: 100%;
  max-width: 368px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px 24px 22px;
  animation: slideUp var(--dur-med) var(--ease-out) both;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.brand-mark .brand-spark,
.brand-mark img {
  flex: none;
  width: 40px;
  height: 40px;
}

.brand h1 {
  margin: 0;
  text-transform: uppercase;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: var(--space);
}

.field:first-child {
  margin-top: 0;
}

.field > label,
.choice-field legend {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin: 0;
}

.field-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-faint);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 11px 12px;
  outline: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-faint);
}

input[type="text"]:hover,
input[type="password"]:hover,
select:hover {
  border-color: var(--text-faint);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.form-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color var(--dur-fast) var(--ease-out);
}

.link-btn:hover {
  color: var(--text);
}

.auth-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.auth-footer a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.auth-footer a:hover {
  border-bottom-color: var(--text-muted);
}

.totp-hint {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.totp-input {
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.45em;
  font-variant-numeric: tabular-nums;
  padding: 12px 8px 12px 16px;
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.qr-wrap img {
  width: 152px;
  height: 152px;
  display: block;
  background: #fff; /* QR codes need a white backing to stay scannable in dark mode */
  border: 1px solid var(--border);
}

.secret-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}

.secret-line {
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
  text-align: left;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.45;
  flex: 1;
}

.turnstile-host {
  width: 100%;
  margin-top: 10px;
  line-height: 0;
}

.turnstile-host:empty {
  margin-top: 0;
  min-height: 0;
}

.choice-field {
  margin: var(--space) 0 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.choice-field legend {
  margin: 0 0 6px;
  padding: 0;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}

.choice {
  position: relative;
  margin: 0;
  display: block;
  cursor: pointer;
}

.choice + .choice {
  border-left: 1px solid var(--border);
}

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  user-select: none;
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.choice:hover span {
  color: var(--text);
  background: var(--surface-2);
}

.choice input:checked + span {
  color: var(--accent-text);
  background: var(--accent);
  font-weight: var(--fw-semi);
}

.choice input:focus-visible + span {
  outline: 1px solid var(--focus);
  outline-offset: -1px;
}

.done-block {
  padding: 4px 0 2px;
}

.done-msg {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
