:root {
  --bg: #000000;
  --panel: #000000;
  --panel-soft: #18181b;
  --text: #ffffff;
  --muted: #a1a1aa;
  --line: #27272a;
  --primary: #fafafa;
  --primary-text: #09090b;
  --primary-hover: #e4e4e7;
  --focus: rgba(255, 255, 255, 0.16);
  --error: #f87171;
  --success: #86efac;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a,
button,
input {
  font: inherit;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 32px 24px 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.back-link:hover,
.back-link:focus-visible,
.helper-link:hover,
.helper-link:focus-visible,
.inline-action:hover,
.inline-action:focus-visible {
  color: var(--text);
}

.back-arrow {
  font-size: 0.95rem;
}

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 72px;
}

.auth-card {
  width: min(100%, 28rem);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 16px;
}

.brand-block {
  text-align: center;
}

.logo {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto;
}

h1 {
  margin: 24px 0 0;
  font-size: 1.875rem;
  line-height: 1.15;
  font-weight: 700;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode,
.primary,
.secondary {
  min-height: 40px;
  border-radius: 6px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.mode {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mode.active {
  background: var(--panel-soft);
  color: var(--text);
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.status.success {
  color: var(--success);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.helper-link,
.inline-action {
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.helper-link {
  font-size: 0.875rem;
}

input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #18181b;
  color: var(--text);
}

input::placeholder {
  color: #71717a;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.primary {
  border: 0;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
  cursor: pointer;
}

.primary:hover,
.primary:focus-visible {
  background: var(--primary-hover);
}

.secondary {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.secondary:hover,
.secondary:focus-visible,
.mode:hover,
.mode:focus-visible {
  background: #111114;
}

.divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: var(--line);
}

.divider span {
  position: relative;
  z-index: 1;
  padding: 0 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.875rem;
}

.switch-copy {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.inline-action {
  color: var(--text);
}

.details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.details summary {
  cursor: pointer;
  user-select: none;
}

.details p {
  margin: 10px 0 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .topbar {
    padding: 24px 16px 0;
  }

  .auth-wrap {
    padding: 36px 8px 56px;
  }

  .auth-card {
    padding: 0 8px;
  }
}
