* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --text: #f7fbff;
  --muted: rgba(205, 229, 255, 0.74);
  --line: rgba(217, 236, 255, 0.6);
  --ring-a: rgba(190, 225, 255, 0.92);
  --ring-b: rgba(80, 160, 255, 0.72);
  --ring-c: rgba(255, 190, 120, 0.55);
  --ring-r: rgba(255, 68, 92, 0.42);
  --error: #ff9eb5;
  --field-h: clamp(40px, 4.2vh, 46px);
  --button-h: clamp(44px, 5vh, 54px);
  --login-mechanism-x: 36px;
  --login-form-x: -100px;
  --login-form-y: 62px;
  --portal-orbits-x: -126px;
  --portal-orbits-y: -117px;
  --portal-orbits-size: 1100px;
  --portal-orbits-opacity: 1;
  --portal-orbits-glow: 18px;
  --portal-orbits-border: 4.6px;
  --portal-orbits-hover-border: 7.6px;
  --portal-orbits-hover-opacity: 0.39;
  --portal-orbits-hover-glow: 10px;
  --portal-orbits-shimmer: 0.25;
  --portal-orbits-pulse: 0.66;
  --portal-orbits-speed: 2.5;
}

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

body {
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.28)),
    url("/static/login_aidesk.png?v=portalrings-cleanbg-001") center center / cover no-repeat,
    #111;
  color: var(--text);
  font-family: Quicksand, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(ellipse 36vh 28vh at 50% 50%, rgba(91, 164, 255, 0.13), rgba(255, 183, 105, 0.05) 45%, rgba(0, 0, 0, 0) 72%),
    radial-gradient(ellipse 52vh 18vh at 50% 82%, rgba(255, 190, 120, 0.08), rgba(0, 0, 0, 0) 70%);
  opacity: 0.88;
  animation: ambientPulse 8s ease-in-out infinite alternate;
}

body::after {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      rgba(255, 255, 255, 0) 4px,
      rgba(255, 255, 255, 0) 9px
    );
  mix-blend-mode: screen;
  opacity: 0.1;
}

.login-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.ring {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100vw - 32px), calc(100vh - 20px));
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.ring::before {
  content: "";
  position: absolute;
  inset: -17%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(235, 247, 255, 0.1), rgba(75, 147, 255, 0.08) 28%, rgba(255, 183, 105, 0.04) 50%, rgba(0, 0, 0, 0) 72%);
  filter: blur(1.5px);
  opacity: calc(0.66 + (var(--portal-orbits-pulse) * 0.36));
  pointer-events: none;
  translate: var(--login-mechanism-x) 0;
  animation: portalBreath calc(7s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
}

.portal-orbits {
  position: absolute;
  left: calc(50% + var(--portal-orbits-x));
  top: calc(50% + var(--portal-orbits-y));
  z-index: 1;
  width: var(--portal-orbits-size);
  height: var(--portal-orbits-size);
  transform: translate(-50%, -50%);
  opacity: var(--portal-orbits-opacity);
  filter: drop-shadow(0 0 var(--portal-orbits-glow) rgba(120, 190, 255, 0.38));
  pointer-events: none;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.portal-orbits::before,
.portal-orbits::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  pointer-events: none;
}

.portal-orbits::before {
  background:
    radial-gradient(circle, rgba(210, 235, 255, 0.12), rgba(55, 145, 255, 0.07) 36%, rgba(255, 55, 75, 0.04) 58%, rgba(0, 0, 0, 0) 72%);
  filter: blur(calc(1.25px + (var(--portal-orbits-pulse) * 4px)));
  opacity: calc(0.58 + (var(--portal-orbits-pulse) * 0.34));
  animation: portalBreath calc(8s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.portal-orbits::after {
  background:
    repeating-conic-gradient(from 20deg, rgba(255, 255, 255, 0.16) 0deg 1deg, rgba(255, 255, 255, 0) 1deg 9deg);
  -webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0) 56%, #000 57%, #000 59%, rgba(0, 0, 0, 0) 61%);
  mask: radial-gradient(circle, rgba(0, 0, 0, 0) 56%, #000 57%, #000 59%, rgba(0, 0, 0, 0) 61%);
  opacity: calc(0.08 + (var(--portal-orbits-shimmer) * 0.26));
  animation: portalOrbitClockwise calc(34s / var(--portal-orbits-speed)) linear infinite;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.portal-orbits i {
  position: absolute;
  inset: 0;
  border: var(--portal-orbits-border) solid rgba(210, 235, 255, 0.78);
  opacity: calc(0.46 + (var(--portal-orbits-shimmer) * 0.32));
  mix-blend-mode: screen;
  pointer-events: none;
  transition: border-color 0.45s ease, border-width 0.45s ease, filter 0.45s ease, opacity 0.45s ease;
  filter: drop-shadow(0 0 var(--portal-orbits-glow) rgba(90, 170, 255, 0.22));
}

.portal-orbits i:nth-child(1) {
  inset: 2.5%;
  border-color: rgba(210, 235, 255, 0.78);
  border-left-color: rgba(255, 255, 255, 0.22);
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation: portalOrbitClockwise calc(18s / var(--portal-orbits-speed)) linear infinite, ringLumen calc(6s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
}

.portal-orbits i:nth-child(2) {
  inset: 5.5%;
  border-color: rgba(55, 145, 255, 0.62);
  border-right-color: rgba(255, 55, 75, 0.5);
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: portalOrbitCounter calc(26s / var(--portal-orbits-speed)) linear infinite, ringLumen calc(7s / var(--portal-orbits-speed)) ease-in-out infinite alternate-reverse;
}

.portal-orbits i:nth-child(3) {
  inset: 8.5%;
  border-color: rgba(255, 55, 75, 0.5);
  border-top-color: rgba(245, 250, 255, 0.68);
  border-radius: 48% 52% 42% 58% / 47% 39% 61% 53%;
  animation: portalOrbitClockwise calc(12s / var(--portal-orbits-speed)) linear infinite, portalShimmer calc(5s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
}

.portal-orbits i:nth-child(4) {
  inset: 12%;
  border-color: rgba(255, 190, 105, 0.36);
  border-bottom-color: rgba(255, 255, 255, 0.22);
  border-radius: 56% 44% 61% 39% / 42% 58% 41% 59%;
  transform: scale(1.02);
  animation: portalOrbitCounter calc(34s / var(--portal-orbits-speed)) linear infinite, ringLumen calc(8s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
}

.portal-orbits i:nth-child(5) {
  inset: 15.5%;
  border-color: rgba(255, 255, 255, 0.22);
  border-left-color: rgba(55, 145, 255, 0.42);
  border-radius: 45% 55% 54% 46% / 58% 44% 56% 42%;
  transform: scale(0.98);
  animation: portalOrbitClockwise calc(45s / var(--portal-orbits-speed)) linear infinite, portalShimmer calc(9s / var(--portal-orbits-speed)) ease-in-out infinite alternate;
}

.portal-orbits i:nth-child(6) {
  inset: 19%;
  border-color: rgba(210, 235, 255, 0.44);
  border-right-color: rgba(255, 190, 105, 0.32);
  border-radius: 61% 39% 45% 55% / 46% 54% 43% 57%;
  animation: portalOrbitCounter calc(18s / var(--portal-orbits-speed)) linear infinite, ringLumen calc(5.5s / var(--portal-orbits-speed)) ease-in-out infinite alternate-reverse;
}

.portal-orbits i:nth-child(7) {
  inset: 23%;
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 55, 75, 0.38);
  border-bottom-color: rgba(55, 145, 255, 0.38);
  border-radius: 50% 50% 43% 57% / 39% 61% 50% 50%;
  animation: portalOrbitClockwise calc(26s / var(--portal-orbits-speed)) linear infinite, portalShimmer calc(6.5s / var(--portal-orbits-speed)) ease-in-out infinite alternate-reverse;
}

.ring:hover .portal-orbits,
.ring:focus-within .portal-orbits {
  opacity: var(--portal-orbits-hover-opacity);
  filter:
    drop-shadow(0 0 var(--portal-orbits-glow) rgba(120, 190, 255, 0.38))
    drop-shadow(0 0 calc(var(--portal-orbits-hover-glow) * 0.65) rgba(70, 150, 255, 0.28));
}

.ring:hover .portal-orbits::before,
.ring:focus-within .portal-orbits::before {
  opacity: calc(0.68 + (var(--portal-orbits-pulse) * 0.24));
}

.ring:hover .portal-orbits::after,
.ring:focus-within .portal-orbits::after {
  opacity: calc(0.2 + (var(--portal-orbits-shimmer) * 0.34));
  filter: drop-shadow(0 0 calc(var(--portal-orbits-hover-glow) * 0.32) rgba(230, 245, 255, 0.46));
}

.ring:hover .portal-orbits i,
.ring:focus-within .portal-orbits i {
  border-width: var(--portal-orbits-hover-border);
  opacity: var(--portal-orbits-hover-opacity);
  filter:
    drop-shadow(0 0 calc(var(--portal-orbits-hover-glow) * 0.45) rgba(230, 245, 255, 0.78))
    drop-shadow(0 0 var(--portal-orbits-hover-glow) rgba(70, 150, 255, 0.48))
    drop-shadow(0 0 calc(var(--portal-orbits-hover-glow) * 1.35) rgba(255, 60, 80, 0.24));
}

@keyframes portalOrbitClockwise {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes portalOrbitCounter {
  0% {
    transform: rotate(360deg) scale(1.02);
  }
  100% {
    transform: rotate(0deg) scale(1.02);
  }
}

@keyframes ringLumen {
  0% {
    opacity: 0.54;
  }
  100% {
    opacity: 0.78;
  }
}

@keyframes portalShimmer {
  0% {
    opacity: 0.32;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0.46;
  }
}

@keyframes ambientPulse {
  0% {
    opacity: 0.66;
  }
  100% {
    opacity: 0.96;
  }
}

@keyframes portalBreath {
  0% {
    transform: scale(0.985);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.02);
    opacity: 0.82;
  }
}

.login {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 50vh;
  width: clamp(284px, 37.1vh, 410px);
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  flex-direction: column;
  gap: clamp(12px, 1.65vh, 18px);
  transform: translate(calc(-50% + var(--login-form-x)), var(--login-form-y));
  pointer-events: auto;
}

.login-tune-panel {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 10000;
  width: min(360px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(217, 236, 255, 0.26);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.9);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  color: var(--text);
  font: 13px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  backdrop-filter: blur(10px);
}

.login-tune-panel[hidden] {
  display: none !important;
}

.login-tune-panel h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.login-tune-help {
  margin: -4px 0 10px;
  color: rgba(205, 229, 255, 0.78);
  font-size: 12px;
  line-height: 1.35;
}

.login-tune-control {
  display: grid;
  grid-template-columns: 110px 1fr 68px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.login-tune-control label {
  color: rgba(247, 251, 255, 0.84);
}

.login-tune-control input {
  width: 100%;
  accent-color: #79baff;
}

.login-tune-value {
  color: rgba(247, 251, 255, 0.96);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.login-tune-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.login-tune-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(217, 236, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.login-tune-actions button:hover,
.login-tune-actions button:focus-visible {
  border-color: rgba(217, 236, 255, 0.52);
  background: rgba(255, 255, 255, 0.13);
}

.login-tune-output {
  display: none;
  width: 100%;
  min-height: 120px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(217, 236, 255, 0.22);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.36);
  color: rgba(247, 251, 255, 0.92);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  resize: vertical;
}

.login-tune-output.is-visible {
  display: block;
}

.login-logo,
#login-title,
.login-copy {
  display: none !important;
}

.inputBx {
  position: relative;
  width: 100%;
}

.inputBx:last-child {
  margin-top: clamp(10px, 2.1vh, 24px);
}

.inputBx:last-child::before {
  content: "";
  position: absolute;
  left: -3%;
  right: -3%;
  top: -18px;
  bottom: -5px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(7, 9, 12, 0.9), rgba(9, 10, 12, 0.78) 58%, rgba(0, 0, 0, 0.16) 100%),
    radial-gradient(ellipse at 50% 58%, rgba(9, 10, 12, 0.84), rgba(10, 8, 8, 0.62) 55%, rgba(0, 0, 0, 0) 82%);
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.inputBx span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.inputBx input,
.inputBx button {
  position: relative;
  width: 100%;
  height: var(--field-h);
  min-height: 0;
  padding: 10px 24px;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--text);
  outline: none;
}

.inputBx input {
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 17%, rgba(158, 204, 255, 0.07) 26%, rgba(255, 255, 255, 0) 37%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0) 8px),
    linear-gradient(180deg, rgba(23, 34, 43, 0.95), rgba(7, 11, 16, 0.94));
  border: 1px solid rgba(152, 204, 243, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -12px 18px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 185, 108, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.32),
    0 0 22px rgba(79, 158, 255, 0.09);
  text-shadow: 0 0 10px rgba(143, 207, 255, 0.28);
  backdrop-filter: blur(2px) saturate(1.08);
}

.inputBx input:focus {
  border-color: rgba(232, 248, 255, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -12px 18px rgba(0, 0, 0, 0.42),
    0 0 0 2px rgba(82, 170, 255, 0.24),
    0 0 24px rgba(80, 160, 255, 0.25),
    0 0 34px rgba(255, 190, 120, 0.1);
}

.inputBx input::placeholder {
  color: rgba(194, 228, 255, 0.86);
}

.inputBx input:-webkit-autofill,
.inputBx input:-webkit-autofill:hover,
.inputBx input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow:
    inset 0 0 0 1000px rgba(10, 17, 24, 0.94),
    0 0 0 2px rgba(82, 170, 255, 0.22),
    0 0 24px rgba(80, 160, 255, 0.2);
  transition: background-color 9999s ease-out;
}

.inputBx button {
  z-index: 1;
  height: var(--button-h);
  overflow: hidden;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  color: #f9fcff;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.36);
  background:
    linear-gradient(180deg, rgba(42, 35, 30, 0.96), rgba(8, 10, 14, 0.96)) padding-box,
    linear-gradient(100deg, rgba(225, 48, 91, 0.9), rgba(255, 198, 118, 0.9) 48%, rgba(83, 170, 255, 0.92)) border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 220, 0.24),
    inset 0 -10px 18px rgba(0, 0, 0, 0.38),
    0 0 18px rgba(255, 150, 90, 0.18),
    0 0 28px rgba(80, 160, 255, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.32);
}

.inputBx button::before {
  content: "";
  position: absolute;
  inset: -60% -30%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 250, 225, 0.26), rgba(124, 194, 255, 0.18), rgba(255, 255, 255, 0));
  transform: translateX(-72%) rotate(8deg);
  transition: transform 0.65s ease;
  pointer-events: none;
}

.inputBx button:hover,
.inputBx button:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 230, 0.3),
    inset 0 -10px 18px rgba(0, 0, 0, 0.3),
    0 0 22px rgba(255, 185, 108, 0.28),
    0 0 34px rgba(80, 160, 255, 0.22),
    0 12px 26px rgba(0, 0, 0, 0.36);
}

.inputBx button:hover::before,
.inputBx button:focus-visible::before {
  transform: translateX(54%) rotate(8deg);
}

.inputBx button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.error {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  min-height: 0;
  color: var(--error);
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
}

.error:empty {
  display: none;
}

.error:not(:empty) {
  padding: 8px 12px;
  border: 1px solid rgba(255, 126, 157, 0.36);
  border-radius: 14px;
  background: rgba(22, 4, 10, 0.76);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
}

@media (max-width: 520px) {
  :root {
    --login-form-y: 3.8vh;
  }

  .ring {
    width: min(680px, calc(100vw - 20px), calc(100vh - 20px));
  }

  .portal-orbits {
    width: min(620px, 118vw);
    height: min(620px, 118vw);
  }

  .login {
    width: min(330px, calc(100vw - 72px));
    gap: 12px;
  }

  .inputBx input,
  .inputBx button {
    padding-inline: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .ring::before,
  .portal-orbits::before,
  .portal-orbits::after,
  .portal-orbits i,
  .inputBx button::before {
    animation: none;
    transition: none;
  }
}
