body.raai-login-body {
  min-height: 100dvh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  color: #eef9ff;
  background: #02060d;
  -webkit-text-size-adjust: 100%;
}

.raai-login-fallback {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
  transition: opacity 400ms ease;
}

.raai-login-fallback::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 8%, rgba(0, 7, 18, 0.2) 58%, rgba(0, 5, 14, 0.72) 100%),
    linear-gradient(180deg, rgba(0, 4, 12, 0.04), rgba(0, 4, 12, 0.34));
}

#raai-webgl-canvas,
#raai-fx-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
}

#raai-webgl-canvas {
  z-index: 1;
}

#raai-fx-canvas {
  z-index: 2;
  mix-blend-mode: screen;
}

.raai-login-status {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 4;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 13px;
  border: 1px solid rgba(110, 191, 239, 0.24);
  border-radius: 12px;
  color: #a8d9f7;
  background: rgba(2, 10, 22, 0.72);
  font-size: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (max-width: 640px) {
  .raai-login-status {
    display: none;
  }
}

.raai-login-shell {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 100dvh;
  min-height: 100svh;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.raai-login-panel {
  position: relative;
  width: min(430px, 100%);
  padding: 34px;
  overflow: hidden;
  border: 1px solid rgba(98, 196, 255, 0.38);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(10, 33, 61, 0.72), rgba(2, 10, 24, 0.86)),
    rgba(3, 13, 29, 0.66);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(29, 160, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.raai-login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
  text-align: center;
}

.raai-login-brand img {
  width: min(200px, 72%);
  height: auto;
  display: block;
  margin: 0 auto;
}

.raai-login-brand-mark {
  display: block;
  margin-bottom: 14px;
  color: #7bd5ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

.raai-login-panel h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-align: center;
}

.raai-login-sub {
  margin: 10px 0 22px;
  color: #9ab8ca;
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

.raai-field {
  position: relative;
  margin-top: 12px;
}

.raai-field input {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 18px 16px 6px;
  color: white;
  font-size: 15px;
  outline: none;
  border: 1px solid rgba(107, 190, 239, 0.25);
  border-radius: 14px;
  background: rgba(3, 15, 31, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.raai-field label {
  position: absolute;
  left: 16px;
  top: 14px;
  color: #91aabc;
  font-size: 14px;
  pointer-events: none;
  transition: all 160ms ease;
}

.raai-field input:focus,
.raai-field input:not(:placeholder-shown) {
  border-color: rgba(93, 203, 255, 0.78);
  box-shadow: 0 0 0 4px rgba(48, 163, 255, 0.1), 0 0 26px rgba(27, 150, 255, 0.13);
}

.raai-field input:focus + label,
.raai-field input:not(:placeholder-shown) + label {
  top: 5px;
  color: #7bd5ff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.raai-login-button {
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin-top: 16px;
  border: 1px solid rgba(116, 216, 255, 0.5);
  border-radius: 14px;
  color: white;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(34, 155, 255, 0.96), rgba(25, 86, 214, 0.96));
  box-shadow: 0 16px 40px rgba(21, 109, 255, 0.28);
  cursor: pointer;
}

.raai-login-button:hover {
  filter: brightness(1.08);
}

.raai-login-footer {
  margin-top: 18px;
  color: rgba(198, 222, 237, 0.7);
  font-size: 12px;
  text-align: center;
}

.raai-login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(60, 10, 20, 0.55);
  color: #ffc9c9;
  font-size: 13px;
  text-align: center;
}

.raai-logout-dest {
  margin-top: 10px;
  color: rgba(198, 222, 237, 0.55);
  font-size: 11px;
  text-align: center;
  word-break: break-all;
}

@media (max-width: 640px) {
  .raai-login-shell {
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    min-height: 100svh;
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .raai-login-panel {
    width: 100%;
    max-width: 400px;
    margin: auto 0;
    padding: 22px 18px 16px;
    border-radius: 22px;
  }

  .raai-login-brand {
    margin-bottom: 12px;
  }

  .raai-login-brand img {
    width: min(168px, 58%);
  }

  .raai-login-brand-mark {
    margin-bottom: 10px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .raai-login-panel h1 {
    font-size: clamp(26px, 8vw, 32px);
  }

  .raai-login-sub {
    margin: 8px 0 16px;
    font-size: 13px;
    line-height: 1.45;
  }

  .raai-field {
    margin-top: 10px;
  }

  .raai-field input,
  .raai-login-button {
    height: 46px;
    min-height: 46px;
    border-radius: 12px;
  }

  .raai-field label {
    top: 13px;
  }

  .raai-login-button {
    margin-top: 14px;
  }

  .raai-login-footer {
    margin-top: 12px;
    font-size: 11px;
  }

  .raai-logout-dest {
    margin-top: 6px;
    font-size: 10px;
    max-height: 2.6em;
    overflow: hidden;
  }
}

/* Short phones (e.g. 375×667) — keep centered, tighten further */
@media (max-width: 640px) and (max-height: 720px) {
  .raai-login-panel {
    padding: 18px 16px 14px;
  }

  .raai-login-brand {
    margin-bottom: 8px;
  }

  .raai-login-brand img {
    width: min(150px, 52%);
  }

  .raai-login-brand-mark {
    margin-bottom: 8px;
  }

  .raai-login-sub {
    margin: 6px 0 12px;
  }

  .raai-field {
    margin-top: 8px;
  }

  .raai-login-button {
    margin-top: 12px;
  }

  .raai-logout-dest {
    display: none;
  }
}
