/* ============ Login / Register ============ */
body[data-page="login"] { min-height: 100vh; }
.auth { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); min-height: 100vh; }

/* ---------- stage ---------- */
.stage {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(139, 92, 246, .22), transparent 70%),
    radial-gradient(40% 35% at 30% 30%, rgba(34, 211, 238, .12), transparent 70%),
    radial-gradient(45% 40% at 72% 38%, rgba(232, 121, 249, .1), transparent 70%),
    #04050a;
  border-right: 1px solid var(--border);
}
.stage #stage-stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.stage-top { position: absolute; top: 28px; left: 32px; right: 32px; z-index: 5; display: flex; align-items: center; justify-content: space-between; }
.stage-top .back { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.stage-top .back:hover { color: #fff; }

.halo {
  position: absolute; z-index: 1; left: 50%; top: 44%; width: min(62vh, 560px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 200deg, rgba(34, 211, 238, .0), rgba(34, 211, 238, .55), rgba(139, 92, 246, .55), rgba(232, 121, 249, .5), rgba(34, 211, 238, 0) 70%);
  filter: blur(48px); opacity: .55; animation: halo-spin 18s linear infinite;
}
.halo-ring {
  position: absolute; z-index: 1; left: 50%; top: 44%; width: min(56vh, 500px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid rgba(103, 232, 249, .22);
  box-shadow: 0 0 40px rgba(34, 211, 238, .15), inset 0 0 40px rgba(139, 92, 246, .15);
}
.halo-ring::after { content: ""; position: absolute; inset: -34px; border-radius: 50%; border: 1px dashed rgba(167, 139, 250, .14); animation: ring-spin 60s linear infinite reverse; }
@keyframes halo-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes ring-spin { to { transform: rotate(360deg); } }

.floor {
  position: absolute; z-index: 1; left: -50%; right: -50%; bottom: -8%; height: 46%;
  background-image:
    linear-gradient(rgba(34, 211, 238, .35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, .35) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(500px) rotateX(68deg); transform-origin: 50% 0%;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 60%, transparent 100%);
  opacity: .35; animation: floor-move 6s linear infinite;
}
@keyframes floor-move { to { background-position: 0 64px, 0 0; } }
.horizon { position: absolute; z-index: 1; left: 0; right: 0; bottom: 38%; height: 1px; background: linear-gradient(90deg, transparent, rgba(103, 232, 249, .7), rgba(232, 121, 249, .7), transparent); box-shadow: 0 0 24px 2px rgba(139, 92, 246, .55); }

.astro-wrap { position: absolute; z-index: 2; left: 50%; bottom: 0; transform: translateX(-50%); width: min(78vh, 92%); max-width: 700px; aspect-ratio: 6 / 7; }
.astro-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; opacity: 0; transition: opacity .8s;
  mask-image: radial-gradient(75% 80% at 50% 45%, #000 60%, transparent 100%);
  -webkit-mask-image: radial-gradient(75% 80% at 50% 45%, #000 60%, transparent 100%);
}
.stage.has-video .astro-video { opacity: 1; }
.stage.has-video .astro-svg { opacity: 0; }
.astro-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .6s; animation: astro-float 7s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(139, 92, 246, .25)); }
@keyframes astro-float { 50% { transform: translateY(-8px); } }

/* head-turn rig — 10s loop: center → left → center → right → center */
.astro-svg .rig { transform-box: view-box; animation-duration: 10s; animation-iteration-count: infinite; animation-timing-function: cubic-bezier(.55, 0, .3, 1); }
.astro-svg #head   { transform-origin: 300px 340px; animation-name: head-tilt; }
.astro-svg #visor  { transform-origin: 300px 318px; animation-name: visor-turn; }
.astro-svg #refl   { transform-origin: 300px 318px; animation-name: refl-turn; }
.astro-svg #ear-l  { transform-origin: 117px 320px; animation-name: ear-l; }
.astro-svg #ear-r  { transform-origin: 483px 320px; animation-name: ear-r; }
.astro-svg #lamp   { transform-origin: 300px 160px; animation-name: lamp-turn; }
.astro-svg #shine  { transform-origin: 300px 320px; animation-name: shine-turn; }
@keyframes head-tilt  { 0%,12% { transform: rotate(0) } 24%,38% { transform: rotate(-4deg) translateX(-4px) } 50%,58% { transform: rotate(0) } 70%,84% { transform: rotate(4deg) translateX(4px) } 96%,100% { transform: rotate(0) } }
@keyframes visor-turn { 0%,12% { transform: none } 24%,38% { transform: translateX(-54px) scaleX(.8) } 50%,58% { transform: none } 70%,84% { transform: translateX(54px) scaleX(.8) } 96%,100% { transform: none } }
@keyframes refl-turn  { 0%,12% { transform: none } 24%,38% { transform: translateX(-80px) } 50%,58% { transform: none } 70%,84% { transform: translateX(80px) } 96%,100% { transform: none } }
@keyframes ear-l      { 0%,12% { transform: none; opacity: 1 } 24%,38% { transform: translateX(6px) scaleX(.35); opacity: .35 } 50%,58% { transform: none; opacity: 1 } 70%,84% { transform: translateX(30px) scaleX(1.25); opacity: 1 } 96%,100% { transform: none; opacity: 1 } }
@keyframes ear-r      { 0%,12% { transform: none; opacity: 1 } 24%,38% { transform: translateX(-30px) scaleX(1.25); opacity: 1 } 50%,58% { transform: none; opacity: 1 } 70%,84% { transform: translateX(-6px) scaleX(.35); opacity: .35 } 96%,100% { transform: none; opacity: 1 } }
@keyframes lamp-turn  { 0%,12% { transform: none } 24%,38% { transform: translateX(-34px) scaleX(.85) } 50%,58% { transform: none } 70%,84% { transform: translateX(34px) scaleX(.85) } 96%,100% { transform: none } }
@keyframes shine-turn { 0%,12% { transform: none } 24%,38% { transform: translateX(26px) } 50%,58% { transform: none } 70%,84% { transform: translateX(-26px) } 96%,100% { transform: none } }
.astro-svg .rim { animation: neon 4.5s ease-in-out infinite; }
@keyframes neon { 0%, 100% { opacity: 1 } 47% { opacity: 1 } 48% { opacity: .55 } 49% { opacity: 1 } 50% { opacity: .8 } 51% { opacity: 1 } 70% { opacity: .88 } }
.astro-svg .led { animation: led 2.4s ease-in-out infinite; }
.astro-svg .led:nth-of-type(2) { animation-delay: .4s; }
.astro-svg .led:nth-of-type(3) { animation-delay: .8s; }
@keyframes led { 50% { opacity: .25 } }

.stage-copy { position: absolute; z-index: 4; left: 32px; right: 32px; bottom: 32px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.stage-copy h2 { font-size: clamp(22px, 2.2vw, 30px); max-width: 420px; text-shadow: 0 2px 24px rgba(0, 0, 0, .8); }
.stage-copy .ticker { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stage-copy .ticker > span { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border-2); background: rgba(5, 6, 11, .6); backdrop-filter: blur(8px); color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.stage::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; z-index: 3; background: linear-gradient(to top, rgba(4, 5, 10, .95), transparent); pointer-events: none; }

/* ---------- form panel ---------- */
.panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 72px); position: relative; background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.panel-inner { width: 100%; max-width: 400px; margin: 0 auto; }
.panel .logo { margin-bottom: 40px; }
.panel h1 { font-size: 30px; letter-spacing: -0.035em; margin-bottom: 8px; }
.panel .sub { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 24px; position: relative; }
.seg button { position: relative; z-index: 1; height: 36px; border: 0; background: none; border-radius: 9px; font-size: 14px; font-weight: 550; color: var(--muted); transition: color .2s; }
.seg button.active { color: #07080d; }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: #fff; transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 2px 12px rgba(0, 0, 0, .3); }
.seg[data-mode="register"] .thumb { transform: translateX(100%); }

.oauth { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oauth .btn { height: 44px; width: 100%; }
.oauth svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 12.5px; margin: 22px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.form { display: grid; gap: 16px; }
.form .field label { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 7px; display: flex; justify-content: space-between; }
.form .field label a { color: var(--muted); font-weight: 400; }
.form .field label a:hover { color: var(--cyan-2); }
.form .input { height: 46px; }
.pw { position: relative; }
.pw .input { padding-right: 46px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--dim); display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.pw button:hover { color: #fff; }
.pw button svg { width: 18px; height: 18px; }
.field.reg-only { display: none; }
.form[data-mode="register"] .field.reg-only { display: block; }
.form[data-mode="register"] .login-only { display: none; }
.strength[hidden] { display: none; }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength i { height: 3px; border-radius: 9px; background: var(--surface-3); transition: background .2s; }
.form .btn-submit { height: 48px; width: 100%; margin-top: 6px; font-size: 15px; }
.btn-submit .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(7, 8, 13, .25); border-top-color: #07080d; animation: spin .7s linear infinite; display: none; }
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .label { opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-error { display: none; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; color: #fecaca; background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .3); }
.form-error.show { display: block; }
.input.invalid { border-color: rgba(248, 113, 113, .6); }
.fine { color: var(--dim); font-size: 12.5px; text-align: center; margin-top: 4px; }
.fine a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.switch-line { text-align: center; margin-top: 26px; font-size: 14px; color: var(--muted); }
.switch-line button { border: 0; background: none; color: var(--cyan-2); font-weight: 550; padding: 0; }
.panel-foot { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 20px; font-size: 12.5px; color: var(--dim); }
.panel-foot a:hover { color: #fff; }

@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; }
  .stage { height: 46vh; min-height: 340px; border-right: 0; border-bottom: 1px solid var(--border); }
  .astro-wrap { width: auto; height: 94%; }
  .stage-copy { display: none; }
  .halo, .halo-ring { top: 52%; }
  .panel { padding-top: 36px; padding-bottom: 80px; }
  .panel .logo { display: none; }
}
@media (max-width: 480px) { .oauth { grid-template-columns: 1fr; } .stage { height: 40vh; min-height: 300px; } }
