html.layout-mobile,
body.layout-mobile {
  width: 100%;
  height: auto;
  min-height: 100%;
}

html.layout-mobile {
  --login-mobile-edge-gap: clamp(10px, 3.4vw, 16px);
  --login-mobile-card-width: min(100%, 440px);
  --login-mobile-card-radius: clamp(14px, 3.6vw, 18px);
  --login-mobile-card-min-height: clamp(500px, calc(72 * var(--mobile-vh, 1vh)), 580px);
}

body.layout-mobile {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  justify-content: center;
  align-items: center;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-right: var(--login-mobile-edge-gap);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  padding-left: var(--login-mobile-edge-gap);
}

body.layout-mobile .login-container {
  width: var(--login-mobile-card-width);
  min-height: var(--login-mobile-card-min-height);
  height: auto;
  margin: 0 auto;
  border-radius: var(--login-mobile-card-radius);
}

body.layout-mobile .window-controls {
  top: calc(env(safe-area-inset-top) + 10px);
  right: clamp(12px, 3.8vw, 16px);
  gap: 0;
  z-index: 6;
}

body.layout-mobile .window-controls .control-btn {
  display: none;
}

body.layout-mobile .window-controls .oauth-switch-btn {
  min-width: 92px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body.layout-mobile .window-controls .oauth-switch-btn:active {
  transform: scale(0.98);
}

body.layout-mobile .header {
  margin-top: clamp(46px, 9vh, 62px);
  margin-top: clamp(46px, 9dvh, 62px);
  margin-bottom: clamp(22px, 4.8vh, 32px);
  margin-bottom: clamp(22px, 4.8dvh, 32px);
}

body.layout-mobile .header h1 {
  font-size: clamp(24px, 6.4vw, 30px);
  letter-spacing: 1px;
}

body.layout-mobile .login-form {
  width: calc(100% - clamp(34px, 9vw, 48px));
}

body.layout-mobile .form-group {
  margin-bottom: clamp(18px, 5vw, 24px);
}

body.layout-mobile .login-btn {
  margin-top: clamp(14px, 4vw, 22px);
}

@media (max-width: 360px) {
  html.layout-mobile {
    --login-mobile-edge-gap: 10px;
  }

  body.layout-mobile .header h1 {
    font-size: 23px;
  }
}

@media (max-height: 700px) {
  html.layout-mobile {
    --login-mobile-card-min-height: 0;
  }

  body.layout-mobile .login-container {
    min-height: 0;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  html.layout-mobile {
    --login-mobile-card-width: min(100%, 520px);
  }

  body.layout-mobile .login-container {
    margin-top: 0;
  }

  body.layout-mobile .window-controls {
    top: 10px;
  }

  body.layout-mobile .header {
    margin-top: clamp(26px, 7vh, 36px);
    margin-top: clamp(26px, 7dvh, 36px);
    margin-bottom: clamp(14px, 4vh, 22px);
    margin-bottom: clamp(14px, 4dvh, 22px);
  }
}
