:root {
  --black: #050505;
  --white: #f4f4f2;
  --soft-white: #b7b7b4;
  --blue: #dceff6;
  --red: #ff3b30;
  --line: rgba(255,255,255,.13);
  --mono: "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--black); }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: "Avenir Next", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
[hidden] { display: none !important; }
.is-auth-pending .auth-shell { visibility: hidden; }

.auth-shell {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse at 72% 58%, rgba(26,61,78,.24), transparent 45%), var(--black);
}
.star-field { position: fixed; inset: 0; width: 100%; height: 100%; opacity: .62; pointer-events: none; }

.auth-header {
  position: relative;
  z-index: 5;
  width: min(calc(100% - 40px), 1440px);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 680; letter-spacing: -.025em; }
.wordmark span span { color: #78c9e9; }
.wordmark .brand-icon { width: 25px; height: 25px; flex: 0 0 auto; border-radius: 7px; object-fit: cover; }
.back-home { color: rgba(255,255,255,.5); font-size: 10px; transition: color .18s ease; }
.back-home:hover { color: #fff; }

.auth-main {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 40px), 1440px);
  min-height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: minmax(340px, .78fr) minmax(520px, 1.22fr);
  margin: 0 auto;
}
.auth-panel {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px clamp(30px, 6vw, 96px) 72px 0;
}
.auth-panel h1 { max-width: 650px; margin: 0; font-size: clamp(52px, 6vw, 86px); font-weight: 440; line-height: .94; letter-spacing: -.062em; }
body[data-auth-mode="login"] .auth-panel h1 {
  max-width: none;
  font-size: clamp(50px, 4.2vw, 72px);
  line-height: 1;
  letter-spacing: -.055em;
  white-space: nowrap;
}
.auth-intro { max-width: 46ch; margin: 24px 0 0; color: rgba(255,255,255,.58); font-size: 14px; line-height: 1.65; }
.auth-legal { width: min(100%, 480px); margin: 14px 0 0; color: rgba(255,255,255,.3); font-size: 9.5px; line-height: 1.55; }
.auth-legal a { color: rgba(255,255,255,.58); text-decoration: underline; text-decoration-color: rgba(255,255,255,.2); text-underline-offset: 3px; }

.google-auth {
  width: min(100%, 480px);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 640;
  box-shadow: inset 0 1px rgba(255,255,255,.035);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.google-auth svg { width: 20px; height: 20px; flex: 0 0 auto; }
.google-auth:hover:not(:disabled) { border-color: rgba(255,255,255,.36); background: rgba(255,255,255,.09); transform: translateY(-1px); }
.google-auth:disabled { opacity: .55; cursor: wait; }
.auth-divider { width: min(100%,480px); display: flex; align-items: center; gap: 13px; margin: 22px 0 0; color: rgba(255,255,255,.32); font-size: 9px; letter-spacing: .055em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: rgba(255,255,255,.1); }
.auth-divider span { white-space: nowrap; }
.auth-form { display: grid; gap: 18px; width: min(100%, 480px); margin-top: 22px; }
.auth-form label {
  display: grid;
  gap: 9px;
  color: rgba(255,255,255,.58);
  font-family: "Avenir Next", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.auth-form input {
  width: 100%;
  height: 56px;
  padding: 0 17px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  outline: 0;
  background: rgba(255,255,255,.035);
  color: #fff;
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  caret-color: var(--blue);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.auth-form input::placeholder { color: rgba(255,255,255,.25); }
.auth-form input:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.045); }
.auth-form input:focus {
  border-color: rgba(220,239,246,.72);
  background: rgba(220,239,246,.055);
  box-shadow: 0 0 0 3px rgba(220,239,246,.08);
}
.password-field { position: relative; display: block; }
.password-field input { padding-right: 72px; }
.password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 52px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  color: rgba(255,255,255,.58);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  transform: translateY(-50%);
  transition: color .18s ease, background .18s ease;
}
.password-field button:hover { color: #fff; }
.password-field button:hover { background: rgba(255,255,255,.1); }
.password-note { margin: -8px 0 0; color: rgba(255,255,255,.36); font-size: 10.5px; }
.auth-error { margin: -2px 0 0; padding: 13px 15px; border-left: 2px solid var(--red); background: rgba(255,59,48,.08); color: #ff8781; font-size: 12px; line-height: 1.5; }
.auth-submit {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 17px 0 22px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #080808;
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  transition: transform .18s ease, background .18s ease;
}
.auth-submit:hover:not(:disabled) { background: var(--blue); transform: translateY(-2px); }
.auth-submit:disabled { opacity: .55; cursor: wait; }
.auth-submit svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.auth-switch { margin: 24px 0 0; color: rgba(255,255,255,.46); font-size: 11.5px; }
.auth-switch a { color: #fff; border-bottom: 1px solid rgba(255,255,255,.35); }

.auth-world { position: relative; min-width: 0; overflow: hidden; }
.auth-planet {
  position: absolute;
  z-index: 2;
  width: min(60vw, 780px);
  aspect-ratio: 1;
  left: 51%;
  top: 49%;
  transform: translate(-50%,-50%);
  animation: planetDrift 12s ease-in-out infinite alternate;
}
.auth-planet-layer {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  backface-visibility: hidden;
  filter: saturate(.8) contrast(1.08) brightness(.76) drop-shadow(0 32px 82px rgba(0,0,0,.75));
  transform: scale(calc(var(--planet-scale, 1) * .985)) rotate(var(--planet-entry-rotation, -2deg));
  transform-origin: 50% 50%;
  transition:
    opacity .95s ease-out,
    transform 1.3s cubic-bezier(.22,.72,.24,1),
    filter .95s ease-out;
  will-change: opacity, transform, filter;
  pointer-events: none;
}
.auth-planet-layer.is-active {
  z-index: 2;
  opacity: 1;
  filter: saturate(.86) contrast(1.11) brightness(.86) drop-shadow(0 32px 82px rgba(0,0,0,.75)) drop-shadow(0 0 30px rgba(119,201,247,.12));
  transform: scale(var(--planet-scale, 1)) rotate(0deg);
}
.auth-planet-layer.is-outgoing {
  z-index: 1;
  opacity: 0;
  filter: saturate(.8) contrast(1.07) brightness(.74) drop-shadow(0 32px 82px rgba(0,0,0,.75));
  transform: scale(calc(var(--planet-scale, 1) * 1.015)) rotate(var(--planet-exit-rotation, 2deg));
  transition-duration: .55s, .8s, .55s;
  transition-timing-function: ease-in, cubic-bezier(.4,0,.8,.45), ease-in;
}
@keyframes planetDrift { to { transform: translate(-50%,-52%) rotate(2deg); } }

:where(button, a, input):focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

@media (max-width: 900px) {
  .auth-shell { overflow: auto; }
  .auth-main { display: block; }
  .auth-world { position: absolute; inset: 72px 0 auto; height: 300px; opacity: .72; }
  .auth-planet { width: min(520px, 112vw); top: 35%; left: 76%; }
  .auth-panel { min-height: calc(100dvh - 72px); justify-content: flex-end; padding: 280px 0 56px; border-right: 0; }
  .auth-panel h1 { font-size: clamp(48px, 12vw, 74px); }
  body[data-auth-mode="login"] .auth-panel h1 { font-size: clamp(48px, 12vw, 74px); white-space: normal; }
  .auth-form { width: 100%; }
  .google-auth, .auth-divider { width: 100%; }
}

@media (max-width: 520px) {
  .auth-header, .auth-main { width: calc(100% - 36px); }
  .auth-header { height: 64px; }
  .auth-world { top: 0; height: 230px; opacity: .82; }
  .auth-planet { width: min(300px, 82vw); top: 43%; left: 72%; filter: saturate(.82) contrast(1.1) brightness(.76) drop-shadow(0 24px 58px rgba(0,0,0,.72)); }
  .auth-panel { min-height: calc(100dvh - 64px); justify-content: flex-start; padding: 246px 0 44px; }
  .auth-panel h1 { max-width: 9ch; font-size: clamp(40px, 11.5vw, 46px); line-height: .98; }
  .auth-intro { font-size: 13px; }
  .google-auth { min-height: 54px; margin-top: 25px; }
  .auth-divider { margin-top: 18px; }
  .auth-form { gap: 16px; margin-top: 18px; }
  .auth-form input { height: 54px; border-radius: 11px; }
  .password-field button { height: 34px; }
  .auth-submit { min-height: 56px; margin-top: 4px; }
  .auth-switch { margin-top: 20px; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .auth-planet-layer:not(.is-active) { display: none; }
}
