:root {
  --classroom-login-popup-scale: 1;
}

/* Keep decorative layers on the viewport while the login content scrolls.
   Natural image height alone leaves blank areas on short landscape screens. */
#box {
  position: fixed;
  inset: 0;
  /* The document may scroll past its original height in landscape. Paint the
     existing gradient on this fixed layer rather than leave the canvas bare. */
  background: inherit;
}

#shell_wrap, #shell {
  min-width: 0;
  width: 100%;
  height: calc(100% + 40px);
  max-height: none;
}

#shell {
  /* Retire the VI stylesheet's fixed 2000px canvas centering offsets. */
  left: 0;
  margin-left: 0;
}

#shell img {
  left: -40px;
  margin-left: 0;
  width: calc(100% + 80px);
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

#con_wrap img {
  height: auto;
}

#cha img {
  max-width: 100%;
}

@media (max-width: 650px) {
  html, body {
    display: block;
    min-width: 0;
    min-height: 100%;
    height: auto;
  }

  #shell img {
    object-position: center;
  }

  #con_wrap {
    position: relative;
    padding-bottom: 16px;
  }

  #logo {
    padding-top: 90px;
  }

  .homeschool-login-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0 12px;
  }

  #popup_open1, #popup_open2 {
    display: block;
    padding: 0;
    width: 100%;
    max-width: 572px;
  }

  #popup_open1 a, #popup_open2 a {
    display: block;
  }

  #popup_open1 img, #popup_open2 img, #cha img {
    display: block;
    width: 100%;
    height: auto;
  }

  #cha {
    margin: 0 12px;
  }

  #cha img {
    padding-top: 0;
  }

  #link { top: 12px; right: 8px; }
  #link img { width: min(120px, 28vw); }
  #link_btn { top: 12px; left: 8px; }
  #link_btn img { width: min(180px, 43vw); }
}

.login-submit-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.login-submit-wrap input[type="image"]:disabled {
  cursor: wait;
  filter: grayscale(0.2) brightness(0.82);
}

.login-submit-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: none;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  box-sizing: border-box;
  border: 7px solid rgba(255, 255, 255, 0.92);
  border-top-color: #c940b8;
  border-radius: 50%;
  pointer-events: none;
  animation: classroom-login-spin 0.75s linear infinite;
}

form[aria-busy="true"] .login-submit-spinner {
  display: block;
}

@keyframes classroom-login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shooting_star,
  .shooting_star::before,
  .shooting_star::after,
  .image-box,
  #boxbeat {
    animation: none;
  }

  .login-submit-spinner {
    animation-duration: 1.5s;
  }
}

.homeschool-animation-paused .shooting_star,
.homeschool-animation-paused .shooting_star::before,
.homeschool-animation-paused .shooting_star::after,
.homeschool-animation-paused .image-box,
.homeschool-animation-paused #boxbeat {
  animation-play-state: paused;
}

#popup_wrap1,
#popup_wrap2,
.popup_wrap2 {
  top: 50%;
  left: 50%;
  margin-left: 0;
  transform: translate(-50%, -50%) scale(var(--classroom-login-popup-scale));
  transform-origin: center center;
}

@media (max-height: 880px), (max-width: 880px) {
  :root {
    --classroom-login-popup-scale: 0.82;
  }
}

@media (max-height: 720px), (max-width: 720px) {
  :root {
    --classroom-login-popup-scale: 0.68;
  }
}

@media (max-height: 600px), (max-width: 600px) {
  :root {
    --classroom-login-popup-scale: 0.55;
  }
}
