/* Portal login — glass panel over a twinkling starfield. */

* { box-sizing: border-box; }

body.portal-auth-body {
  margin: 0;
  min-height: 100vh;
  color: #f3efe8;
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
  background: #05060f;
  overflow-x: hidden;
}

.portal-cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 85% 65% at 50% 45%, #121833 0%, #080a18 48%, #02030a 100%);
}

/* Soft gas clouds — drift independently of the rotating starfield */
.portal-cosmos__gas {
  position: absolute;
  inset: -20%;
  filter: blur(48px);
  will-change: transform, opacity;
}

.portal-cosmos__gas--green {
  opacity: 0.55;
  background:
    radial-gradient(ellipse 46% 34% at 22% 68%, rgba(72, 170, 120, 0.38) 0%, transparent 62%),
    radial-gradient(ellipse 38% 30% at 72% 28%, rgba(42, 131, 95, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 32% 26% at 48% 82%, rgba(90, 190, 140, 0.18) 0%, transparent 60%);
  animation: portal-gas-drift-green 52s ease-in-out infinite alternate;
}

.portal-cosmos__gas--white {
  opacity: 0.42;
  background:
    radial-gradient(ellipse 42% 32% at 68% 58%, rgba(235, 242, 255, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 36% 28% at 28% 24%, rgba(255, 255, 255, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse 50% 36% at 54% 40%, rgba(210, 225, 245, 0.12) 0%, transparent 65%);
  animation: portal-gas-drift-white 68s ease-in-out infinite alternate;
}

/* Entire starfield rotates slowly counterclockwise */
.portal-cosmos__field {
  position: absolute;
  inset: -28%;
  animation: portal-field-spin 220s linear infinite;
  will-change: transform;
}

.portal-cosmos__stars {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

/* Steady glow — majority of the field */
.portal-cosmos__stars--a {
  background-size: 420px 420px;
  opacity: 0.88;
  background-image:
    radial-gradient(1px 1px at 18px 28px, rgba(255, 255, 255, 0.95), transparent),
    radial-gradient(1px 1px at 72px 110px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 148px 64px, rgba(210, 225, 255, 0.95), transparent),
    radial-gradient(1px 1px at 220px 190px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 300px 36px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.5px 1.5px at 372px 150px, rgba(190, 215, 255, 0.9), transparent),
    radial-gradient(1px 1px at 54px 250px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 186px 286px, rgba(255, 255, 255, 0.78), transparent),
    radial-gradient(1px 1px at 340px 268px, rgba(225, 235, 255, 0.72), transparent),
    radial-gradient(1px 1px at 96px 340px, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 268px 360px, rgba(200, 220, 255, 0.88), transparent),
    radial-gradient(1px 1px at 400px 320px, rgba(255, 255, 255, 0.65), transparent);
}

.portal-cosmos__stars--b {
  background-size: 680px 680px;
  opacity: 0.52;
  background-image:
    radial-gradient(1px 1px at 36px 76px, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 168px 38px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 290px 210px, rgba(205, 225, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 448px 118px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 510px 330px, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 120px 420px, rgba(220, 230, 255, 0.6), transparent),
    radial-gradient(1px 1px at 380px 480px, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 600px 260px, rgba(190, 210, 255, 0.8), transparent),
    radial-gradient(1px 1px at 240px 560px, rgba(255, 255, 255, 0.5), transparent);
}

/* Sparse warm field stars (yellow / soft red) — also steady */
.portal-cosmos__stars--warm {
  background-size: 920px 720px;
  opacity: 0.62;
  background-image:
    radial-gradient(1.5px 1.5px at 80px 120px, rgba(255, 214, 120, 0.9), transparent),
    radial-gradient(1px 1px at 260px 60px, rgba(255, 196, 90, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 520px 200px, rgba(255, 120, 110, 0.85), transparent),
    radial-gradient(1px 1px at 700px 90px, rgba(255, 210, 130, 0.7), transparent),
    radial-gradient(1px 1px at 180px 380px, rgba(240, 90, 90, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 640px 420px, rgba(255, 180, 70, 0.8), transparent),
    radial-gradient(1px 1px at 420px 520px, rgba(255, 130, 120, 0.65), transparent),
    radial-gradient(1px 1px at 860px 300px, rgba(255, 220, 140, 0.75), transparent);
}

/* Rare sparkles — mostly quiet, brief glint */
.portal-cosmos__glints {
  position: absolute;
  inset: 0;
}

.portal-star {
  --star-size: 2.5px;
  --star-color: #fff;
  --star-glow: rgba(255, 255, 255, 0.7);
  --star-delay: 0s;
  --star-duration: 11s;

  position: absolute;
  width: var(--star-size);
  height: var(--star-size);
  border-radius: 50%;
  background: var(--star-color);
  box-shadow:
    0 0 3px 1px var(--star-glow),
    0 0 10px 2px var(--star-glow);
  opacity: 0.55;
  animation: portal-star-glint var(--star-duration) ease-in-out var(--star-delay) infinite;
}

.portal-star--gold {
  --star-color: #ffd56a;
  --star-glow: rgba(255, 200, 80, 0.85);
}

.portal-star--ruby {
  --star-color: #ff6b6b;
  --star-glow: rgba(255, 90, 90, 0.8);
}

.portal-star--1 { left: 14%; top: 20%; --star-size: 2.5px; --star-delay: 1.2s;  --star-duration: 12s; }
.portal-star--2 { left: 82%; top: 38%; --star-size: 2px;   --star-delay: 5.5s;  --star-duration: 14s; }
.portal-star--3 { left: 58%; top: 76%; --star-size: 3px;   --star-delay: 9s;    --star-duration: 13s; }

@keyframes portal-field-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes portal-gas-drift-green {
  from { transform: translate3d(-3%, 2%, 0) scale(1); }
  to { transform: translate3d(4%, -3%, 0) scale(1.08); }
}

@keyframes portal-gas-drift-white {
  from { transform: translate3d(2%, -2%, 0) scale(1.04); }
  to { transform: translate3d(-4%, 3%, 0) scale(1); }
}

/* Quiet most of the cycle; short sparkle near the end */
@keyframes portal-star-glint {
  0%, 86%, 100% {
    opacity: 0.5;
    transform: scale(1);
    filter: brightness(1);
  }
  89% {
    opacity: 1;
    transform: scale(1.7);
    filter: brightness(1.55);
  }
  92% {
    opacity: 0.35;
    transform: scale(0.9);
    filter: brightness(0.95);
  }
  95% {
    opacity: 1;
    transform: scale(1.4);
    filter: brightness(1.35);
  }
  98% {
    opacity: 0.5;
    transform: scale(1);
    filter: brightness(1);
  }
}

.portal-cosmos__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 75% 65% at 50% 45%, transparent 35%, rgba(2, 3, 10, 0.62) 100%);
}

.portal-cosmos__warp-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.85) 0%, rgba(180, 220, 255, 0.35) 28%, transparent 70%);
  pointer-events: none;
}

/* Warp on login submit */
body.is-warping .portal-cosmos {
  animation: portal-warp-zoom 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

body.is-warping .portal-auth-shell {
  animation: portal-warp-shell 900ms cubic-bezier(0.25, 0.8, 0.2, 1) both;
}

body.is-warping .portal-cosmos__warp-flash {
  animation: portal-warp-flash 900ms ease-in both;
}

body.is-warping .portal-auth-submit {
  pointer-events: none;
  filter: brightness(1.15);
}

@keyframes portal-warp-zoom {
  0% { transform: scale(1); filter: brightness(1) saturate(1); }
  55% { transform: scale(1.25); filter: brightness(1.2) saturate(1.15); }
  100% { transform: scale(2.1); filter: brightness(1.7) saturate(1.3); }
}

@keyframes portal-warp-shell {
  0% { opacity: 1; transform: scale(1); filter: blur(0); }
  45% { opacity: 0.85; transform: scale(0.96); filter: blur(0); }
  100% { opacity: 0; transform: scale(0.72); filter: blur(8px); }
}

@keyframes portal-warp-flash {
  0% { opacity: 0; }
  55% { opacity: 0.15; }
  78% { opacity: 0.85; }
  100% { opacity: 1; }
}

.portal-auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem 4rem;
  gap: 1.25rem;
}

.portal-auth-header {
  text-align: center;
  max-width: 28rem;
  animation: portal-auth-rise 520ms ease both;
}

.portal-auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #f3efe8;
}

.portal-auth-logo .usher-logo-mark-img {
  width: 2.4rem;
  height: 2.4rem;
  display: block;
  filter: drop-shadow(0 0 10px rgba(139, 187, 146, 0.35));
}

.portal-auth-logo__title {
  font-family: "Unbounded", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.portal-auth-tagline {
  margin: 0.75rem 0 0;
  color: rgba(243, 239, 232, 0.72);
  font-size: 0.95rem;
  line-height: 1.55;
}

.portal-auth-panel {
  width: min(100%, 420px);
  padding: 1.75rem 1.6rem 1.4rem;
  border-radius: 16px;
  background: rgba(10, 14, 28, 0.78);
  border: 1px solid rgba(160, 190, 230, 0.22);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: portal-auth-rise 620ms ease both;
}

.portal-auth-panel__title {
  margin: 0 0 1.25rem;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.portal-auth-form {
  display: grid;
  gap: 1rem;
}

.portal-auth-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(243, 239, 232, 0.82);
}

.portal-auth-input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(160, 190, 230, 0.28);
  background: rgba(6, 10, 22, 0.72);
  color: #f3efe8;
  font: inherit;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.portal-auth-input::placeholder {
  color: rgba(243, 239, 232, 0.35);
}

.portal-auth-input:focus {
  border-color: #8bbb92;
  box-shadow: 0 0 0 3px rgba(139, 187, 146, 0.22);
}

.portal-auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(243, 239, 232, 0.78);
  cursor: pointer;
}

.portal-auth-submit {
  width: 100%;
  min-height: 3rem;
  margin-top: 0.25rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a835f 0%, #12544f 100%);
  color: #f4faf6;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.portal-auth-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.portal-auth-copyright {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.65rem;
  color: rgba(243, 239, 232, 0.45);
}

.portal-auth-copyright .usher-footer-brand,
.portal-auth-copyright strong.usher-footer-brand {
  font-family: "Unbounded", "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.portal-auth-flash {
  width: min(100%, 420px);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(160, 190, 230, 0.22);
  background: rgba(10, 14, 28, 0.78);
  animation: portal-auth-rise 420ms ease both;
}

.portal-auth-flash--notice {
  border-color: rgba(139, 187, 146, 0.45);
  color: #8bbb92;
}

.portal-auth-flash--alert {
  border-color: rgba(200, 90, 90, 0.5);
  color: #f0b4b4;
}

@keyframes portal-auth-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .portal-auth-panel {
    padding: 1.4rem 1.15rem 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-cosmos__field,
  .portal-cosmos__gas,
  .portal-star {
    animation: none !important;
  }

  .portal-star { opacity: 0.65; }

  body.is-warping .portal-cosmos,
  body.is-warping .portal-auth-shell,
  body.is-warping .portal-cosmos__warp-flash {
    animation: none !important;
  }
}
