:root {
  --login-bg-0: oklch(16% 0.020 168);
  --login-bg-1: oklch(19% 0.022 168);
  --login-line: oklch(36% 0.018 168);
  --login-line-soft: oklch(94% 0.012 85 / 0.14);
  --login-ink: oklch(94% 0.012 85);
  --login-ink-80: oklch(94% 0.012 85 / 0.80);
  --login-ink-64: oklch(94% 0.012 85 / 0.64);
  --login-ink-56: oklch(94% 0.012 85 / 0.56);
  --login-ink-50: oklch(94% 0.012 85 / 0.50);
  --login-ink-40: oklch(94% 0.012 85 / 0.40);
  --login-ink-36: oklch(94% 0.012 85 / 0.36);
  --login-em: oklch(76% 0.165 158);
  --login-em-deep: oklch(70% 0.175 158);
  --login-amber: oklch(78% 0.14 80);
  --login-danger: oklch(62% 0.19 25);
  --login-google-bg: oklch(96% 0.008 85);
  --login-google-ink: oklch(18% 0.02 168);
  --login-hue-store: oklch(76% 0.165 158);
  --login-hue-jade: oklch(70% 0.11 168);
  --login-hue-mint: oklch(80% 0.12 165);
  --login-hue-teal: oklch(70% 0.10 182);
  --login-hue-forest: oklch(58% 0.12 152);
  --font-display: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --t-meta: 11px;
  --ok: var(--login-em);
  --danger: var(--login-danger);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html.login-emerald,
.login-emerald body {
  min-height: 100%;
  margin: 0;
  background: var(--login-bg-0);
  color: var(--login-ink);
  color-scheme: dark;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.login-shell {
  min-height: 100svh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 76px;
  overflow: hidden;
  background: var(--login-bg-0);
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, oklch(19% 0.022 168 / 0.42), transparent 36%),
    linear-gradient(0deg, oklch(12% 0.018 168 / 0.48), transparent 48%);
}

.login-column {
  width: 360px;
  max-width: calc(100vw - 48px);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginRise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-screen[hidden],
.verdict-variant[hidden],
.password-row[hidden] {
  display: none !important;
}

.wordmark,
.screen-title,
.home-greeting,
.sphere-name {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}

.wordmark {
  font-size: 28px;
  line-height: 1.05;
}

.screen-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.hairline {
  width: 24px;
  height: 1px;
  margin-top: 12px;
  background: var(--login-em);
  transform-origin: left center;
  animation: loginDraw 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hairline.is-amber {
  background: var(--login-amber);
}

.hairline.is-neutral {
  background: var(--login-line);
}

.hairline.is-danger {
  background: var(--login-danger);
}

.hairline.is-breathing,
.verify-line {
  animation: loginBreathe 1.6s ease-in-out infinite;
}

.key-chip {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 7px 14px;
  border: 1px solid var(--login-line-soft);
  border-radius: 999px;
  color: var(--login-ink-64);
  font: 400 11px/1 var(--font-mono);
  white-space: nowrap;
}

.key-chip svg {
  width: 14px;
  height: 14px;
  color: var(--login-amber);
  flex: none;
}

.primary-gap {
  height: 56px;
}

.google-button,
.submit-button {
  width: 100%;
  height: 52px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  font: 600 15px/1 var(--font-body);
  transition:
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.google-button {
  border: 0;
  background: var(--login-google-bg);
  color: var(--login-google-ink);
  cursor: pointer;
  box-shadow: none;
}

.google-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px oklch(76% 0.165 158 / 0.22);
}

.google-button:active {
  transform: scale(0.985);
}

.google-button svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.ghost-button,
.back-link,
.tiny-action,
.resend-button,
.change-button,
.verdict-action {
  border: 0;
  background: none;
  color: var(--login-ink-64);
  cursor: pointer;
  font-family: var(--font-body);
  text-decoration: none;
}

.ghost-button,
.verdict-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  font-size: 14px;
  line-height: 1;
}

.ghost-button svg {
  width: 14px;
  height: 14px;
  color: var(--login-ink-50);
  flex: none;
}

.ghost-button::after,
.verdict-action::after,
.back-link::after,
.change-button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--login-em);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.ghost-button:hover::after,
.verdict-action:hover::after,
.back-link:hover::after,
.change-button:hover::after {
  transform: scaleX(1);
}

.back-link {
  position: relative;
  align-self: flex-start;
  margin-bottom: 28px;
  padding: 0 0 4px;
  font: 400 13px/1 var(--font-mono);
  color: var(--login-ink-56);
}

.login-form {
  width: 100%;
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.email-field {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--login-line);
  position: relative;
  text-align: left;
}

.email-field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--login-em);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.email-field:focus-within::after,
.email-field.is-valid::after {
  transform: scaleX(1);
}

.email-field.is-invalid {
  border-color: var(--login-danger);
  animation: loginShake 0.24s ease-in-out 2;
}

.email-field.is-invalid::after {
  background: var(--login-danger);
  transform: scaleX(1);
}

.field-icon {
  display: inline-flex;
  color: var(--login-ink-50);
  transition: color 0.2s ease, transform 0.2s ease;
  flex: none;
}

.email-field.is-valid .field-icon {
  color: var(--login-em);
  transform: scale(1.1);
}

.email-field input,
.password-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--login-ink);
  caret-color: var(--login-em);
  font: 400 16px/1.3 var(--font-body);
}

.email-field input::placeholder,
.password-row input::placeholder {
  color: var(--login-ink-36);
}

.field-help {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--login-danger);
  font: 400 12px/1.4 var(--font-body);
  text-align: left;
}

.password-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.tiny-action {
  position: relative;
  padding: 4px 0;
  color: var(--login-ink-56);
  font: 400 12px/1 var(--font-mono);
}

.password-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--login-line);
  text-align: left;
}

.password-note {
  color: var(--login-ink-40);
  font: 400 11px/1.4 var(--font-mono);
}

.submit-button {
  margin-top: 24px;
  border: 1px solid var(--login-line);
  background: var(--login-bg-1);
  color: var(--login-em);
  cursor: pointer;
  font-weight: 500;
}

.submit-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.submit-button:not(:disabled):hover {
  border-color: oklch(76% 0.165 158 / 0.50);
  transform: translateY(-1px);
}

.auth-msg {
  margin: 12px 0 0 !important;
  min-height: 18px;
  text-align: left;
}

.state-glyph {
  width: 40px;
  height: 40px;
  color: var(--login-em);
}

.state-glyph.is-amber {
  color: var(--login-amber);
}

.state-glyph.is-danger {
  color: var(--login-danger);
}

.state-glyph.is-muted {
  color: var(--login-ink-56);
}

.state-glyph path,
.state-glyph rect,
.state-glyph circle,
.state-glyph line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: loginStroke 0.6s ease-out 0.12s both;
}

.sent-title,
.verdict-title {
  margin-top: 20px;
}

.address-echo,
.ttl-line,
.count-line,
.verdict-code,
.sphere-status {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.address-echo {
  margin-top: 24px;
  color: var(--login-ink-80);
  font-size: 14px;
  word-break: break-word;
}

.ttl-line {
  margin-top: 8px;
  color: var(--login-ink-40);
  font-size: 11px;
}

.resend-button {
  margin-top: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--login-ink-40);
  font-size: 14px;
}

.change-button {
  position: relative;
  margin-top: 16px;
  padding: 0 0 4px;
  color: var(--login-ink-56);
  font-size: 13px;
}

.verify-line {
  width: 24px;
  height: 1px;
  background: var(--login-em);
}

.home-preview {
  width: min(100%, 720px);
  display: grid;
  gap: 24px;
}

.home-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.home-greeting {
  font-size: 28px;
}

.date-whisper {
  color: var(--login-ink-40);
  font: 400 12px/1.3 var(--font-mono);
}

.horizon {
  height: 1px;
  background: var(--login-em);
  transform-origin: center;
  animation: loginDrawCenter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sphere-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.sphere-card {
  --sphere: var(--login-hue-store);
  min-height: 132px;
  border: 1px solid var(--login-line);
  border-radius: 14px;
  background: var(--login-bg-1);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.sphere-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--sphere) 50%, transparent);
}

.sphere-icon {
  width: 38px;
  height: 38px;
  border: 2px solid var(--sphere);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--sphere);
}

.sphere-name {
  font-size: 18px;
}

.sphere-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--login-ink-40);
  font-size: 11px;
}

.dev-chip {
  border: 1px solid var(--login-line-soft);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--login-ink-56);
  font-size: 10px;
}

.masked {
  color: var(--login-ink-56);
  letter-spacing: 0.18em;
}

.verdict-body {
  margin-top: 22px;
  color: var(--login-ink-64);
  font: 400 14px/1.5 var(--font-body);
}

.verdict-code {
  margin-top: 18px;
  color: var(--login-ink-40);
  font-size: 11px;
}

.verdict-action {
  margin-top: 30px;
}

.verdict-action.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.footer-whisper {
  position: absolute;
  z-index: 1;
  left: 24px;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--login-ink-40);
  font: 400 11px/1.4 var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--login-em);
  outline-offset: 3px;
  border-radius: 8px;
}

@keyframes loginDraw {
  from {
    transform: scaleX(0);
  }
}

@keyframes loginDrawCenter {
  from {
    transform: scaleX(0.02);
  }
}

@keyframes loginRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes loginBreathe {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes loginStroke {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes loginShake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-3px);
  }
  70% {
    transform: translateX(3px);
  }
}

@media (max-width: 720px) {
  .login-shell {
    align-items: flex-start;
    padding-top: 24svh;
  }

  .login-shell[data-state="email"] {
    padding-top: 14svh;
  }

  .home-row {
    flex-direction: column;
    gap: 8px;
  }

  .home-greeting {
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .login-column {
    max-width: calc(100vw - 48px);
  }

  .key-chip {
    white-space: normal;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .state-glyph path,
  .state-glyph rect,
  .state-glyph circle,
  .state-glyph line {
    stroke-dashoffset: 0;
  }
}
