:root {
  --ag-earth-ease: cubic-bezier(.22, 1, .36, 1);
  --ag-space: #020712;
  --ag-space-soft: #07162a;
  --ag-orbit: rgba(123, 176, 255, .36);
}

#login {
  isolation: isolate;
  overflow: hidden;
  justify-content: center;
  padding: clamp(24px, 5vw, 76px);
  background-color: #000 !important;
  transition: background-color .38s ease 1.52s;
}

#login::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: none;
  backdrop-filter: none;
}

#login .card {
  position: relative;
  z-index: 6;
  width: min(380px, 100%);
  padding: 36px 34px 32px;
  border: 1px solid rgba(172, 205, 255, .30);
  border-radius: 26px;
  color: #f7faff;
  background: linear-gradient(145deg, rgba(5, 10, 23, .84), rgba(8, 15, 31, .74));
  box-shadow: 0 32px 90px rgba(0, 0, 0, .56), inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: opacity .55s ease, transform .85s var(--ag-earth-ease), filter .55s ease;
}

#login .card::before {
  content: "SECURE FLEET ACCESS";
  display: block;
  margin-bottom: 19px;
  color: #9bb9dc;
  font: 700 9px/1.2 "JetBrains Mono", monospace;
  letter-spacing: .19em;
  text-align: center;
}

#login .logo {
  color: #8ec6ff;
  background: rgba(39, 103, 203, .24);
  border: 1px solid rgba(139, 194, 255, .24);
  box-shadow: 0 12px 34px rgba(0, 79, 190, .30);
}

#login h1 { color: #f8fbff; }
#login .sub { color: #aebed3; }
#login label { color: #b7c6d9; }
#login .err { color: #ff8b91; }
#login .lang-pick span { color: #9fb0c7; }
#login .lang-pick span.on { color: #dcecff; background: rgba(48, 126, 246, .24); }

#login input {
  color: #172238;
  border-color: rgba(173, 202, 238, .34);
  background: rgba(249, 252, 255, .96);
  box-shadow: inset 0 1px 2px rgba(9, 27, 54, .06);
}

#login button {
  position: relative;
  overflow: hidden;
  min-height: 45px;
  background: linear-gradient(135deg, #347df0, #315dcc 56%, #644ee8);
  box-shadow: 0 11px 26px rgba(48, 91, 205, .26);
}

#login button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .28) 48%, transparent 70%);
  transform: translateX(-130%);
}

#login button[data-loading="true"]::after {
  animation: agLoginSweep 1.15s linear infinite;
}

#login button:disabled { cursor: wait; opacity: .86; }

.ag-earth-entry {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  color: #fff;
}

.ag-earth-stars,
.ag-earth-stars::before,
.ag-earth-stars::after {
  position: absolute;
  inset: 0;
  content: "";
  background: #000 url('/space-stars-sharp-v1.jpg?v=20260722-1') center / cover no-repeat;
  opacity: 1;
  animation: none;
  transform: scale(1);
  transition: opacity .34s ease, transform 1.15s var(--ag-earth-ease);
}

.ag-earth-stars::before,
.ag-earth-stars::after { display: none; }

.ag-earth-nebula {
  display: none;
}

.ag-earth-visual {
  position: absolute;
  inset-inline-start: 50%;
  top: 50%;
  width: min(82vw, 900px, 105vh);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  transition: transform 1.75s var(--ag-earth-ease), opacity 1.1s ease, filter 1.4s ease;
}

.ag-earth-halo {
  position: absolute;
  inset: 4.3%;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 62%, rgba(81, 157, 255, .10) 67%, rgba(91, 171, 255, .22) 69%, transparent 71%);
  box-shadow: 0 0 28px rgba(63, 145, 255, .18), 0 0 90px rgba(46, 117, 221, .09);
  filter: blur(.25px);
  transition: opacity .36s ease;
}

.ag-earth-orbit {
  position: absolute;
  inset: 15% -5%;
  border: 1px solid var(--ag-orbit);
  border-radius: 50%;
  transform: rotate(-17deg) scaleY(.32);
  box-shadow: 0 0 18px rgba(68, 145, 255, .13);
  opacity: .18;
  transition: opacity .36s ease;
}

.ag-earth-orbit::before,
.ag-earth-orbit::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a8d2ff;
  box-shadow: 0 0 16px #65a9ff, 0 0 34px rgba(82, 158, 255, .9);
}

.ag-earth-orbit::before { left: 12%; top: 24%; }
.ag-earth-orbit::after { right: 17%; bottom: 19%; animation: agSatellitePulse 1.8s ease-in-out infinite; }

.ag-earth-sphere {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  filter: none;
  animation: none;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
  backface-visibility: hidden;
  contain: paint;
  box-shadow: inset -24px -12px 42px rgba(0, 8, 25, .18), 0 0 1px rgba(154, 204, 255, .8);
}

.ag-earth-svg { width: 100%; height: 100%; overflow: visible; }
.ag-earth-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .32s ease;
}
.ag-earth-canvas.is-ready { opacity: 1; }
.ag-earth-photo {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  transform: none;
  filter: none;
  opacity: 1;
  transition: opacity .32s ease;
}
.ag-earth-photo.is-waiting { opacity: 0; }
.ag-earth-photo.is-replaced { opacity: 0; }
.ag-earth-photo + .ag-earth-svg { display: none; }
.ag-earth-land { animation: agLandDrift 24s ease-in-out infinite alternate; transform-origin: 320px 320px; }
.ag-earth-clouds { animation: agCloudDrift 31s linear infinite; transform-origin: 320px 320px; }

.ag-earth-scan {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  overflow: hidden;
  mix-blend-mode: screen;
  opacity: .12;
  transition: opacity .3s ease;
}

.ag-earth-scan::after {
  content: "";
  position: absolute;
  left: -20%; right: -20%; height: 2px;
  top: 18%;
  background: linear-gradient(90deg, transparent, rgba(116, 192, 255, .75), transparent);
  box-shadow: 0 0 18px rgba(74, 164, 255, .8);
  animation: agEarthScan 4.8s ease-in-out infinite;
}

.ag-earth-copy {
  position: absolute;
  inset-inline-start: clamp(28px, 7vw, 116px);
  bottom: clamp(28px, 7vh, 78px);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(46vw, 560px);
  transition: opacity .45s ease, transform .7s var(--ag-earth-ease);
}

.ag-earth-copy-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5bc9ff;
  box-shadow: 0 0 0 7px rgba(73, 171, 255, .11), 0 0 22px rgba(73, 171, 255, .92);
  animation: agSatellitePulse 1.6s ease-in-out infinite;
}

.ag-earth-copy strong {
  display: block;
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.ag-earth-copy span {
  display: block;
  margin-top: 5px;
  color: rgba(219, 233, 255, .7);
  font: 500 clamp(10px, .9vw, 12px)/1.4 "JetBrains Mono", monospace;
}

.ag-earth-entry[data-phase="auth"] .ag-earth-orbit,
.ag-earth-entry[data-phase="locating"] .ag-earth-orbit { animation: agOrbitLock 1.7s ease-in-out infinite; }
body.ag-earth-transitioning #shell {
  opacity: .08;
  transform: scale(1.025);
  filter: blur(5px);
  transition: opacity 1.2s ease, transform 1.7s var(--ag-earth-ease), filter 1.1s ease;
}

body.ag-earth-arriving #shell { opacity: 1; transform: scale(1); filter: blur(0); }
body.ag-earth-transitioning #login .card { opacity: 0; transform: translateY(18px) scale(.965); filter: none; pointer-events: none; }
body.ag-earth-transitioning .ag-earth-stars { opacity: 0; transform: scale(1.035); }
body.ag-earth-transitioning .ag-earth-visual { transform: translate(-50%, -50%) scale(1.38); }
body.ag-earth-transitioning .ag-earth-halo,
body.ag-earth-transitioning .ag-earth-orbit,
body.ag-earth-transitioning .ag-earth-scan,
body.ag-earth-transitioning .ag-earth-copy { opacity: 0; }

html[data-horizon="v1"] body.ag-earth-arriving #login {
  background: transparent !important;
}

.ag-earth-entry[data-phase="arriving"] .ag-earth-visual {
  transform: translate(-50%, -50%) scale(6.4);
  opacity: 0;
  filter: none;
  transition: transform 1.90s cubic-bezier(.45, 0, .55, 1), opacity .32s ease 1.55s;
}

.ag-earth-entry[data-phase="arriving"] .ag-earth-copy { opacity: 0; transform: translateY(-20px); }

@keyframes agLoginSweep { to { transform: translateX(130%); } }
@keyframes agStarDrift { to { transform: translate3d(-3%, 2%, 0); } }
@keyframes agEarthFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-9px) rotate(1deg); } }
@keyframes agLandDrift { from { transform: translateX(-5px) rotate(-1deg); } to { transform: translateX(15px) rotate(2deg); } }
@keyframes agCloudDrift { to { transform: rotate(360deg); } }
@keyframes agEarthScan { 0%,100% { top: 15%; opacity: 0; } 18% { opacity: .85; } 75% { opacity: .55; } 92% { top: 83%; opacity: 0; } }
@keyframes agSatellitePulse { 50% { opacity: .48; transform: scale(.72); } }
@keyframes agOrbitLock { 50% { border-color: rgba(152, 207, 255, .7); filter: brightness(1.35); } }

@media (max-width: 900px) {
  #login { align-items: flex-end; justify-content: center; padding: 24px 18px max(24px, env(safe-area-inset-bottom)); }
  #login .card { width: min(430px, 100%); padding: 27px 25px 23px; border-radius: 24px; }
  #login .card::before { margin-bottom: 12px; }
  #login .sub { margin-bottom: 16px; }
  #login input { margin-bottom: 12px; }
  .ag-earth-visual { width: min(140vw, 760px); inset-inline-start: 50%; top: 30%; transform: translate(-50%, -50%); }
  .ag-earth-copy { display: none; }
  .ag-earth-copy-dot { display: none; }
  .ag-earth-entry[data-phase="arriving"] .ag-earth-visual { transform: translate(-50%, -50%) scale(5.6); }
}

@media (max-height: 720px) and (max-width: 900px) {
  .ag-earth-visual { top: 18%; width: min(78vw, 440px); }
  #login .card { padding-block: 21px 18px; }
  #login .card::before, #login .sub { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-earth-stars, .ag-earth-stars::before, .ag-earth-stars::after,
  .ag-earth-sphere, .ag-earth-land, .ag-earth-clouds,
  .ag-earth-scan::after, .ag-earth-orbit, .ag-earth-orbit::after,
  .ag-earth-copy-dot, #login button::after { animation: none !important; }
  .ag-earth-visual, #login, #login .card, #shell { transition-duration: .18s !important; transition-delay: 0s !important; }
}
